From 821f20cecee6e2c70659e385607eb1fc3fd24e7e Mon Sep 17 00:00:00 2001
From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com>
Date: Tue, 3 Dec 2024 20:45:16 +0100
Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=92=A3=20[Frontend]=20Retire=20cluste?=
=?UTF-8?q?rs=20(#6883)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../source/class/osparc/auth/Manager.js | 9 -
.../class/osparc/cluster/ClusterMiniView.js | 202 -------
.../class/osparc/cluster/ClusterWorkers.js | 140 -----
.../class/osparc/cluster/ClustersDetails.js | 109 ----
.../source/class/osparc/cluster/Utils.js | 136 -----
.../source/class/osparc/data/Permissions.js | 1 -
.../source/class/osparc/data/Resources.js | 45 --
.../class/osparc/desktop/StartStopButtons.js | 72 ---
.../class/osparc/desktop/StudyEditor.js | 8 -
.../osparc/desktop/preferences/Preferences.js | 22 -
.../desktop/preferences/pages/ClustersPage.js | 563 ------------------
.../class/osparc/editor/ClusterEditor.js | 262 --------
.../class/osparc/navigation/UserMenu.js | 14 -
.../source/class/osparc/product/Utils.js | 7 -
.../client/source/class/osparc/store/Store.js | 5 -
.../class/osparc/ui/list/ClusterListItem.js | 150 -----
.../class/osparc/utils/DisabledPlugins.js | 5 -
17 files changed, 1750 deletions(-)
delete mode 100644 services/static-webserver/client/source/class/osparc/cluster/ClusterMiniView.js
delete mode 100644 services/static-webserver/client/source/class/osparc/cluster/ClusterWorkers.js
delete mode 100644 services/static-webserver/client/source/class/osparc/cluster/ClustersDetails.js
delete mode 100644 services/static-webserver/client/source/class/osparc/cluster/Utils.js
delete mode 100644 services/static-webserver/client/source/class/osparc/desktop/preferences/pages/ClustersPage.js
delete mode 100644 services/static-webserver/client/source/class/osparc/editor/ClusterEditor.js
delete mode 100644 services/static-webserver/client/source/class/osparc/ui/list/ClusterListItem.js
diff --git a/services/static-webserver/client/source/class/osparc/auth/Manager.js b/services/static-webserver/client/source/class/osparc/auth/Manager.js
index 8f325a0644a..5b5efeef7d0 100644
--- a/services/static-webserver/client/source/class/osparc/auth/Manager.js
+++ b/services/static-webserver/client/source/class/osparc/auth/Manager.js
@@ -257,15 +257,6 @@ qx.Class.define("osparc.auth.Manager", {
this.updateProfile(profile);
const role = profile.role.toLowerCase();
osparc.data.Permissions.getInstance().setRole(role);
-
- this.__fetchStartUpResources();
- },
-
- __fetchStartUpResources: function() {
- const isDisabled = osparc.utils.DisabledPlugins.isClustersDisabled();
- if (isDisabled === false) {
- osparc.data.Resources.get("clusters");
- }
},
__logoutUser: function() {
diff --git a/services/static-webserver/client/source/class/osparc/cluster/ClusterMiniView.js b/services/static-webserver/client/source/class/osparc/cluster/ClusterMiniView.js
deleted file mode 100644
index 271ce645725..00000000000
--- a/services/static-webserver/client/source/class/osparc/cluster/ClusterMiniView.js
+++ /dev/null
@@ -1,202 +0,0 @@
-/* ************************************************************************
-
- osparc - the simcore frontend
-
- https://osparc.io
-
- Copyright:
- 2022 IT'IS Foundation, https://itis.swiss
-
- License:
- MIT: https://opensource.org/licenses/MIT
-
- Authors:
- * Odei Maiz (odeimaiz)
-
-************************************************************************ */
-
-qx.Class.define("osparc.cluster.ClusterMiniView", {
- extend: qx.ui.core.Widget,
-
- construct: function() {
- this.base(arguments);
-
- const grid = new qx.ui.layout.Grid(2, 2);
- this._setLayout(grid);
-
- this.__listenToClusterDetails();
-
- this.set({
- allowGrowY: false,
- cursor: "pointer"
- });
- this.addListener("tap", () => osparc.cluster.Utils.popUpClustersDetails(this.__clusterId), this);
-
- const hint = this.__hint = new osparc.ui.hint.Hint(this).set({
- active: false
- });
- const showHint = () => hint.show();
- const hideHint = () => hint.exclude();
- this.addListener("mouseover", showHint);
- [
- "mouseout",
- "tap"
- ].forEach(e => this.addListener(e, hideHint));
- },
-
- statics: {
- GRID_POS: {
- CPU: 0,
- RAM: 1,
- GPU: 2
- }
- },
-
- members: {
- __clusterId: null,
- __hint: null,
-
- setClusterId: function(clusterId) {
- const clusters = osparc.cluster.Utils.getInstance();
- if (this.__clusterId !== null) {
- clusters.stopFetchingDetails(this.__clusterId);
- }
- this.__clusterId = clusterId;
- if (clusterId !== null) {
- clusters.startFetchingDetails(clusterId);
- }
- },
-
- __listenToClusterDetails: function() {
- const clusters = osparc.cluster.Utils.getInstance();
- clusters.addListener("clusterDetailsReceived", e => {
- const data = e.getData();
- if (this.__clusterId === data.clusterId) {
- if ("error" in data) {
- this.__detailsCallFailed();
- } else {
- const clusterDetails = data.clusterDetails;
- this.__updateWorkersDetails(clusterDetails);
- }
- }
- });
- },
-
- __showBulb: function(failed) {
- this._removeAll();
-
- const clusterStatusImage = new qx.ui.basic.Image().set({
- source: "@FontAwesome5Solid/lightbulb/16",
- alignY: "middle",
- alignX: "center",
- paddingLeft: 3,
- textColor: failed ? "failed-red" : "ready-green"
- });
- this._add(clusterStatusImage, {
- row: 0,
- column: 0
- });
- },
-
- __detailsCallFailed: function() {
- this.__showBulb(true);
- this.__hint.setText(this.tr("Connection failed"));
- },
-
- __updateWorkersDetails: function(clusterDetails) {
- this._removeAll();
-
- const workers = clusterDetails.scheduler.workers;
- if (Object.keys(workers).length === 0) {
- this.__showBulb(false);
- this.__hint.setText(this.tr("No workers running at the moment in this cluster"));
- return;
- }
-
- const resources = {
- cpu: {
- metric: "cpu",
- usedResource: "CPU",
- resource: "CPU",
- icon: "@FontAwesome5Solid/microchip/10",
- available: 0,
- used: 0
- },
- ram: {
- metric: "memory",
- usedResource: "RAM",
- resource: "RAM",
- icon: "@MaterialIcons/memory/10",
- available: 0,
- used: 0
- },
- gpu: {
- metric: "gpu",
- usedResource: "GPU",
- resource: "GPU",
- icon: "@FontAwesome5Solid/server/10",
- available: 0,
- used: 0
- }
- };
- Object.keys(resources).forEach(resourceKey => {
- const resource = resources[resourceKey];
- osparc.cluster.Utils.accumulateWorkersResources(workers, resource);
- });
- this.__updateMiniView(resources);
- this.__updateHint(resources);
- },
-
- __updateMiniView: function(resources) {
- Object.keys(resources).forEach((resourceKey, idx) => {
- const resourceInfo = resources[resourceKey];
- if (resourceInfo.available === 0) {
- return;
- }
- const relativeUsage = resourceInfo.used / resourceInfo.available;
- const icon = new qx.ui.basic.Image(resourceInfo.icon).set({
- textColor: relativeUsage > 0.8 ? "busy-orange" : "text"
- });
- this._add(icon, {
- row: idx,
- column: 0
- });
- const progressBar = new qx.ui.indicator.ProgressBar(resourceInfo.used, resourceInfo.available).set({
- height: 10,
- width: 60
- });
- osparc.utils.Utils.hideBorder(progressBar);
- // orange > 80%
- progressBar.getChildControl("progress").set({
- backgroundColor: relativeUsage > 0.8 ? "busy-orange" : "ready-green"
- });
- this._add(progressBar, {
- row: idx,
- column: 1
- });
- });
- },
-
- __updateHint: function(resources) {
- let text = "";
- Object.keys(resources).forEach(resourceKey => {
- const resourceInfo = resources[resourceKey];
- if (resourceInfo.available === 0) {
- return;
- }
- text += resourceInfo.resource + ": ";
- if (resourceKey === "ram") {
- text += osparc.utils.Utils.bytesToGB(resourceInfo.used) + "GB / " + osparc.utils.Utils.bytesToGB(resourceInfo.available) + "GB";
- } else {
- text += resourceInfo.used + " / " + resourceInfo.available;
- }
- text += "
";
- });
- this.__hint.setText(text);
- }
- },
-
- destruct: function() {
- osparc.cluster.Utils.getInstance().stopFetchingDetails(this.__clusterId);
- }
-});
diff --git a/services/static-webserver/client/source/class/osparc/cluster/ClusterWorkers.js b/services/static-webserver/client/source/class/osparc/cluster/ClusterWorkers.js
deleted file mode 100644
index bcb2638439d..00000000000
--- a/services/static-webserver/client/source/class/osparc/cluster/ClusterWorkers.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/* ************************************************************************
-
- osparc - the simcore frontend
-
- https://osparc.io
-
- Copyright:
- 2022 IT'IS Foundation, https://itis.swiss
-
- License:
- MIT: https://opensource.org/licenses/MIT
-
- Authors:
- * Odei Maiz (odeimaiz)
-
-************************************************************************ */
-
-qx.Class.define("osparc.cluster.ClusterWorkers", {
- extend: qx.ui.core.Widget,
-
- construct: function() {
- this.base(arguments);
-
- const grid = new qx.ui.layout.Grid(5, 8);
- for (let i=0; i {
- const worker = clusterDetails.scheduler.workers[workerUrl];
-
- const img = new qx.ui.basic.Image().set({
- source: "@FontAwesome5Solid/hdd/24",
- toolTipText: worker.name,
- textColor: "ready-green",
- paddingTop: 50
- });
- this._add(img, {
- row,
- column: this.self().GRID_POS.ICON
- });
-
- Object.keys(plots).forEach(plotKey => {
- const plotInfo = plots[plotKey];
- const gaugeDatas = osparc.wrapper.Plotly.getDefaultGaugeData();
- const gaugeData = gaugeDatas[0];
- gaugeData.title.text = plotInfo.label.toLocaleString();
- let used = osparc.cluster.Utils.getUsedResourcesAttribute(worker, plotInfo.usedResource);
- let available = osparc.cluster.Utils.getAvailableResourcesAttribute(worker, plotInfo.resource);
- if (plotKey === "ram") {
- used = osparc.utils.Utils.bytesToGB(used);
- available = osparc.utils.Utils.bytesToGB(available);
- }
- if (qx.lang.Type.isNumber(available)) {
- // orange > 80%
- gaugeData.gauge.steps = [{
- range: [0.8*available, available],
- color: qx.theme.manager.Color.getInstance().resolve("busy-orange"),
- thickness: 0.5
- }];
- }
- if (available === "-") {
- gaugeData.value = "-";
- } else {
- gaugeData.value = used;
- gaugeData.gauge.axis.range[1] = available;
- }
- const layout = osparc.wrapper.Plotly.getDefaultLayout();
- const plotId = "ClusterDetails_" + plotKey + "-" + row;
- const w = parseInt(gridW/Object.keys(plots).length);
- const h = parseInt(w*0.75);
- // hide plotly toolbar
- const config = {
- displayModeBar: false
- };
- const plot = new osparc.widget.PlotlyWidget(plotId, gaugeDatas, layout, config).set({
- width: w,
- height: h
- });
- this._add(plot, {
- row,
- column: plotInfo.column
- });
- });
- row++;
- });
- }
- }
-});
diff --git a/services/static-webserver/client/source/class/osparc/cluster/ClustersDetails.js b/services/static-webserver/client/source/class/osparc/cluster/ClustersDetails.js
deleted file mode 100644
index 033f8ab2466..00000000000
--- a/services/static-webserver/client/source/class/osparc/cluster/ClustersDetails.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/* ************************************************************************
-
- osparc - the simcore frontend
-
- https://osparc.io
-
- Copyright:
- 2022 IT'IS Foundation, https://itis.swiss
-
- License:
- MIT: https://opensource.org/licenses/MIT
-
- Authors:
- * Odei Maiz (odeimaiz)
-
-************************************************************************ */
-
-qx.Class.define("osparc.cluster.ClustersDetails", {
- extend: qx.ui.core.Widget,
-
- construct: function(selectClusterId) {
- this.base(arguments);
-
- this._setLayout(new qx.ui.layout.VBox(20));
-
- if (selectClusterId === undefined) {
- selectClusterId = 0;
- }
- this.__clusterId = selectClusterId;
- this.__populateClustersLayout();
- this.__addClusterWorkersLayout();
- this.__startFetchingDetails();
- },
-
- members: {
- __clustersSelectBox: null,
- __clusterId: null,
- __clusterWorkers: null,
-
- __populateClustersLayout: function() {
- const clustersLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({
- alignY: "middle"
- }));
-
- const clustersLabel = new qx.ui.basic.Label(this.tr("Connected clusters"));
- clustersLayout.add(clustersLabel);
-
- const selectBox = this.__clustersSelectBox = new qx.ui.form.SelectBox().set({
- allowGrowX: false
- });
- osparc.cluster.Utils.populateClustersSelectBox(selectBox);
- selectBox.addListener("changeSelection", e => {
- const selection = e.getData();
- if (selection.length) {
- const clusterId = selection[0].id;
- this.__selectedClusterChanged(clusterId);
- }
- }, this);
- clustersLayout.add(selectBox);
-
- clustersLayout.add(new qx.ui.core.Spacer(10, null));
-
- const clusterStatusLabel = new qx.ui.basic.Label(this.tr("Status:"));
- clustersLayout.add(clusterStatusLabel);
-
- const clusterStatus = this.__clusterStatus = new qx.ui.basic.Image().set({
- source: "@FontAwesome5Solid/lightbulb/16"
- });
- clustersLayout.add(clusterStatus);
-
- this._add(clustersLayout);
-
- selectBox.getSelectables().forEach(selectable => {
- if (selectable.id === this.__clusterId) {
- selectBox.setSelection([selectable]);
- }
- });
- },
-
- __addClusterWorkersLayout: function() {
- const clusterWorkers = this.__clusterWorkers = new osparc.cluster.ClusterWorkers();
- this._add(clusterWorkers, {
- flex: 1
- });
- },
-
- __selectedClusterChanged: function(clusterId) {
- osparc.cluster.Utils.getInstance().stopFetchingDetails(this.__clusterId);
- this.__clusterId = clusterId;
- this.__startFetchingDetails();
- },
-
- __startFetchingDetails: function() {
- const clusters = osparc.cluster.Utils.getInstance();
- clusters.addListener("clusterDetailsReceived", e => {
- const data = e.getData();
- if (this.__clusterId === data.clusterId) {
- this.__clusterStatus.setTextColor("error" in data ? "failed-red" : "ready-green");
- this.__clusterWorkers.populateWorkersDetails("error" in data ? null : data.clusterDetails);
- }
- });
- clusters.startFetchingDetails(this.__clusterId);
- }
- },
-
- destruct: function() {
- osparc.cluster.Utils.getInstance().stopFetchingDetails(this.__clusterId);
- }
-});
diff --git a/services/static-webserver/client/source/class/osparc/cluster/Utils.js b/services/static-webserver/client/source/class/osparc/cluster/Utils.js
deleted file mode 100644
index 7140bf5cbf1..00000000000
--- a/services/static-webserver/client/source/class/osparc/cluster/Utils.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/* ************************************************************************
-
- osparc - the simcore frontend
-
- https://osparc.io
-
- Copyright:
- 2022 IT'IS Foundation, https://itis.swiss
-
- License:
- MIT: https://opensource.org/licenses/MIT
-
- Authors:
- * Odei Maiz (odeimaiz)
-
-************************************************************************ */
-
-/**
- * Collection of methods for dealing with clusters.
- *
- * *Example*
- */
-
-qx.Class.define("osparc.cluster.Utils", {
- extend: qx.core.Object,
- type: "singleton",
-
- construct: function() {
- this.base(arguments);
-
- this.__clusterIds = [];
- },
-
- statics: {
- popUpClustersDetails: function(clusterId) {
- const clusters = new osparc.cluster.ClustersDetails(clusterId);
- osparc.ui.window.Window.popUpInWindow(clusters, qx.locale.Manager.tr("Clusters & Workers"), 650, 600);
- },
-
- getUsedResourcesAttribute: function(worker, attributeKey) {
- if (attributeKey in worker["used_resources"]) {
- return osparc.utils.Utils.toTwoDecimals(worker["used_resources"][attributeKey]);
- }
- return "-";
- },
-
- getAvailableResourcesAttribute: function(worker, attributeKey) {
- if (attributeKey in worker.resources) {
- return worker.resources[attributeKey];
- }
- return "-";
- },
-
- accumulateWorkersResources: function(workers, resource) {
- Object.keys(workers).forEach(workerUrl => {
- const worker = workers[workerUrl];
- const available = this.getAvailableResourcesAttribute(worker, resource.resource);
- if (available === "-") {
- return;
- }
- resource.available += available;
- const used = this.getUsedResourcesAttribute(worker, resource.usedResource);
- resource.used += used;
- });
- },
-
- populateClustersSelectBox: function(clustersSelectBox) {
- clustersSelectBox.removeAll();
-
- const store = osparc.store.Store.getInstance();
- const clusters = store.getClusters();
- if (clusters) {
- clusters.forEach(cluster => {
- const item = new qx.ui.form.ListItem().set({
- label: cluster["name"],
- toolTipText: cluster["type"] + "\n" + cluster["description"],
- allowGrowY: false
- });
- item.id = cluster["id"];
- clustersSelectBox.add(item);
- });
- }
- }
- },
-
- events: {
- "clusterDetailsReceived": "qx.event.type.Data"
- },
-
- members: {
- __clusterIds: null,
-
- __fetchDetails: function(cid) {
- const params = {
- url: {
- cid
- }
- };
- osparc.data.Resources.get("clusterDetails", params)
- .then(clusterDetails => {
- this.fireDataEvent("clusterDetailsReceived", {
- clusterId: cid,
- clusterDetails
- });
- })
- .catch(err => {
- console.error(err);
- this.fireDataEvent("clusterDetailsReceived", {
- clusterId: cid,
- error: err
- });
- })
- .finally(() => {
- if (this.__clusterIds.includes(cid)) {
- const interval = 10000;
- qx.event.Timer.once(() => this.__fetchDetails(cid), this, interval);
- }
- });
- },
-
- startFetchingDetails: function(clusterId) {
- const found = this.__clusterIds.includes(clusterId);
- this.__clusterIds.push(clusterId);
- if (!found) {
- this.__fetchDetails(clusterId);
- }
- },
-
- stopFetchingDetails: function(clusterId) {
- const idx = this.__clusterIds.indexOf(clusterId);
- if (idx > -1) {
- this.__clusterIds.splice(idx, 1);
- }
- }
- }
-});
diff --git a/services/static-webserver/client/source/class/osparc/data/Permissions.js b/services/static-webserver/client/source/class/osparc/data/Permissions.js
index 5c53b4da76d..0cc74fc9cc0 100644
--- a/services/static-webserver/client/source/class/osparc/data/Permissions.js
+++ b/services/static-webserver/client/source/class/osparc/data/Permissions.js
@@ -130,7 +130,6 @@ qx.Class.define("osparc.data.Permissions", {
"services.all.read",
"services.all.reupdate",
"services.filePicker.read.all",
- "user.clusters.create",
"user.wallets.create",
"study.everyone.share",
"study.snapshot.read",
diff --git a/services/static-webserver/client/source/class/osparc/data/Resources.js b/services/static-webserver/client/source/class/osparc/data/Resources.js
index f8b38797c58..4e54df325c3 100644
--- a/services/static-webserver/client/source/class/osparc/data/Resources.js
+++ b/services/static-webserver/client/source/class/osparc/data/Resources.js
@@ -1029,51 +1029,6 @@ qx.Class.define("osparc.data.Resources", {
}
}
},
- /*
- * CLUSTERS
- */
- "clusters": {
- useCache: true,
- endpoints: {
- get: {
- method: "GET",
- url: statics.API + "/clusters"
- },
- post: {
- method: "POST",
- url: statics.API + "/clusters"
- },
- pingWCredentials: {
- method: "POST",
- url: statics.API + "/clusters:ping"
- },
- getOne: {
- method: "GET",
- url: statics.API + "/clusters/{cid}"
- },
- delete: {
- method: "DELETE",
- url: statics.API + "/clusters/{cid}"
- },
- patch: {
- method: "PATCH",
- url: statics.API + "/clusters/{cid}"
- },
- ping: {
- method: "POST",
- url: statics.API + "/clusters/{cid}:ping"
- }
- }
- },
- "clusterDetails": {
- useCache: false,
- endpoints: {
- get: {
- method: "GET",
- url: statics.API + "/clusters/{cid}/details"
- }
- }
- },
/*
* CLASSIFIERS
* Gets the json object containing sample classifiers
diff --git a/services/static-webserver/client/source/class/osparc/desktop/StartStopButtons.js b/services/static-webserver/client/source/class/osparc/desktop/StartStopButtons.js
index 15cd77f5288..c1633ddda85 100644
--- a/services/static-webserver/client/source/class/osparc/desktop/StartStopButtons.js
+++ b/services/static-webserver/client/source/class/osparc/desktop/StartStopButtons.js
@@ -64,31 +64,6 @@ qx.Class.define("osparc.desktop.StartStopButtons", {
_createChildControlImpl: function(id) {
let control;
switch (id) {
- case "cluster-layout":
- control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({
- alignY: "middle"
- }));
- this._add(control);
- break;
- case "cluster-selector": {
- control = new qx.ui.form.SelectBox().set({
- maxHeight: 32
- });
- this.getChildControl("cluster-layout").add(control);
- const store = osparc.store.Store.getInstance();
- store.addListener("changeClusters", () => this.__populateClustersSelectBox(), this);
- break;
- }
- case "cluster-mini-view":
- control = new osparc.cluster.ClusterMiniView();
- this.getChildControl("cluster-layout").add(control);
- this.getChildControl("cluster-selector").addListener("changeSelection", e => {
- const selection = e.getData();
- if (selection.length) {
- control.setClusterId(selection[0].id);
- }
- }, this);
- break;
case "dynamics-layout":
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({
alignY: "middle"
@@ -140,9 +115,6 @@ qx.Class.define("osparc.desktop.StartStopButtons", {
},
__buildLayout: function() {
- this.getChildControl("cluster-selector");
- this.getChildControl("cluster-mini-view");
-
this.getChildControl("start-service-button");
this.getChildControl("stop-service-button");
@@ -209,24 +181,9 @@ qx.Class.define("osparc.desktop.StartStopButtons", {
];
},
- __populateClustersSelectBox: function() {
- osparc.cluster.Utils.populateClustersSelectBox(this.getChildControl("cluster-selector"));
- const clusters = osparc.store.Store.getInstance().getClusters();
- this.getChildControl("cluster-layout").setVisibility(Object.keys(clusters).length ? "visible" : "excluded");
- },
-
- getClusterId: function() {
- if (this.getChildControl("cluster-layout").isVisible()) {
- return this.getChildControl("cluster-selector").getSelection()[0].id;
- }
- return null;
- },
-
__applyStudy: async function(study) {
study.getWorkbench().addListener("pipelineChanged", this.__checkButtonsVisible, this);
study.addListener("changePipelineRunning", this.__updateRunButtonsStatus, this);
- this.__populateClustersSelectBox();
- this.__getComputations();
this.__checkButtonsVisible();
this.__updateRunButtonsStatus();
},
@@ -250,34 +207,5 @@ qx.Class.define("osparc.desktop.StartStopButtons", {
this.__setRunning(study.isPipelineRunning());
}
},
-
- __getComputations: function() {
- const studyId = this.getStudy().getUuid();
- const url = "/computations/" + encodeURIComponent(studyId);
- const req = new osparc.io.request.ApiRequest(url, "GET");
- req.addListener("success", e => {
- const res = e.getTarget().getResponse();
- if (res && res.data && "cluster_id" in res.data) {
- const clusterId = res.data["cluster_id"];
- if (clusterId) {
- const clustersBox = this.getChildControl("cluster-selector");
- if (clustersBox.isVisible()) {
- clustersBox.getSelectables().forEach(selectable => {
- if (selectable.id === clusterId) {
- clustersBox.setSelection([selectable]);
- }
- });
- }
- }
- }
- }, this);
- req.addListener("fail", e => {
- const res = e.getTarget().getResponse();
- if (res && res.error) {
- console.error(res.error);
- }
- });
- req.send();
- }
}
});
diff --git a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js
index 14474eabd7d..bfd02dc41eb 100644
--- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js
+++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js
@@ -619,10 +619,6 @@ qx.Class.define("osparc.desktop.StudyEditor", {
"subgraph": partialPipeline,
"force_restart": forceRestart
};
- const startStopButtonsWB = this.__workbenchView.getStartStopButtons();
- if (startStopButtonsWB.getClusterId() !== null) {
- requestData["cluster_id"] = startStopButtonsWB.getClusterId();
- }
req.setRequestData(requestData);
req.send();
if (partialPipeline.length) {
@@ -911,10 +907,6 @@ qx.Class.define("osparc.desktop.StudyEditor", {
this.getStudy().stopStudy();
this.__closeStudy();
}
- const clusterMiniView = this.__workbenchView.getStartStopButtons().getChildControl("cluster-mini-view");
- if (clusterMiniView) {
- clusterMiniView.setClusterId(null);
- }
osparc.utils.Utils.closeHangingWindows();
},
diff --git a/services/static-webserver/client/source/class/osparc/desktop/preferences/Preferences.js b/services/static-webserver/client/source/class/osparc/desktop/preferences/Preferences.js
index d04b96ceeea..90616bfd3e4 100644
--- a/services/static-webserver/client/source/class/osparc/desktop/preferences/Preferences.js
+++ b/services/static-webserver/client/source/class/osparc/desktop/preferences/Preferences.js
@@ -29,9 +29,6 @@ qx.Class.define("osparc.desktop.preferences.Preferences", {
if (osparc.data.Permissions.getInstance().canDo("user.tag")) {
this.__addTagsPage();
}
- if (osparc.product.Utils.showClusters()) {
- this.__addClustersPage();
- }
},
members: {
@@ -63,24 +60,5 @@ qx.Class.define("osparc.desktop.preferences.Preferences", {
const page = this.addTab(title, iconSrc, tagsPage);
osparc.utils.Utils.setIdToWidget(page.getChildControl("button"), "preferencesTagsTabBtn");
},
-
- __addClustersPage: function() {
- const title = this.tr("Clusters");
- const iconSrc = "@FontAwesome5Solid/server/24";
- const clustersPage = new osparc.desktop.preferences.pages.ClustersPage();
- const page = this.addTab(title, iconSrc, clustersPage);
- const clustersBtn = page.getChildControl("button");
- clustersBtn.exclude();
- const isDisabled = osparc.utils.DisabledPlugins.isClustersDisabled();
- if (isDisabled === false) {
- osparc.data.Resources.get("clusters")
- .then(clusters => {
- if (clusters.length || osparc.data.Permissions.getInstance().canDo("user.clusters.create")) {
- clustersBtn.show();
- }
- })
- .catch(err => console.error(err));
- }
- },
}
});
diff --git a/services/static-webserver/client/source/class/osparc/desktop/preferences/pages/ClustersPage.js b/services/static-webserver/client/source/class/osparc/desktop/preferences/pages/ClustersPage.js
deleted file mode 100644
index d5d7e6ba6dc..00000000000
--- a/services/static-webserver/client/source/class/osparc/desktop/preferences/pages/ClustersPage.js
+++ /dev/null
@@ -1,563 +0,0 @@
-/* ************************************************************************
-
- osparc - the simcore frontend
-
- https://osparc.io
-
- Copyright:
- 2021 IT'IS Foundation, https://itis.swiss
-
- License:
- MIT: https://opensource.org/licenses/MIT
-
- Authors:
- * Odei Maiz (odeimaiz)
-
-************************************************************************ */
-
-/**
- * Clusters and members in preferences dialog
- *
- */
-
-qx.Class.define("osparc.desktop.preferences.pages.ClustersPage", {
- extend: qx.ui.core.Widget,
-
- construct: function() {
- this.base(arguments);
-
- this._setLayout(new qx.ui.layout.VBox(15));
-
- const buttonsLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({
- alignX: "center"
- }));
- if (osparc.data.Permissions.getInstance().canDo("user.clusters.create")) {
- buttonsLayout.add(this.__getCreateClusterButton());
- }
- buttonsLayout.add(this.__getShowClustersDetailsButton());
- this._add(buttonsLayout);
- this._add(this.__getClustersSection());
- this._add(this.__getOrgsAndMembersSection(), {
- flex: 1
- });
-
- this.__reloadClusters();
- },
-
- members: {
- __currentCluster: null,
- __clustersModel: null,
- __clustersList: null,
- __selectOrgMemberLayout: null,
- __organizationsAndMembers: null,
- __membersArrayModel: null,
-
- __getCreateClusterButton: function() {
- const createClusterBtn = new qx.ui.form.Button().set({
- appearance: "strong-button",
- label: this.tr("New Cluster"),
- icon: "@FontAwesome5Solid/plus/14",
- allowGrowX: false
- });
- createClusterBtn.addListener("execute", function() {
- const newCluster = true;
- const clusterEditor = new osparc.editor.ClusterEditor(newCluster);
- const title = this.tr("Cluster Details Editor");
- const win = osparc.ui.window.Window.popUpInWindow(clusterEditor, title, 400, 260);
- clusterEditor.addListener("createCluster", () => {
- this.__createCluster(win, clusterEditor.getChildControl("create"), clusterEditor);
- });
- clusterEditor.addListener("cancel", () => win.close());
- }, this);
- return createClusterBtn;
- },
-
- __getShowClustersDetailsButton: function() {
- const createClusterBtn = new qx.ui.form.Button().set({
- label: this.tr("Show Resources"),
- icon: "@FontAwesome5Solid/info/14",
- allowGrowX: false
- });
- createClusterBtn.addListener("execute", () => osparc.cluster.Utils.popUpClustersDetails(), this);
- return createClusterBtn;
- },
-
- __getClustersSection: function() {
- const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Clusters"));
- box.add(this.__getClustersList());
- box.setContentPadding(0);
- return box;
- },
-
- __getClustersList: function() {
- const clustersList = this.__clustersList = new qx.ui.form.List().set({
- decorator: "no-border",
- spacing: 3,
- height: 150,
- width: 150
- });
- clustersList.addListener("changeSelection", e => {
- this.__clusterSelected(e.getData());
- }, this);
-
- const clustersModel = this.__clustersModel = new qx.data.Array();
- const clustersCtrl = new qx.data.controller.List(clustersModel, clustersList, "name");
- clustersCtrl.setDelegate({
- createItem: () => new osparc.ui.list.ClusterListItem(),
- bindItem: (ctrl, item, id) => {
- ctrl.bindProperty("id", "model", null, item, id);
- ctrl.bindProperty("id", "key", null, item, id);
- ctrl.bindProperty("thumbnail", "thumbnail", null, item, id);
- ctrl.bindProperty("name", "title", null, item, id);
- ctrl.bindProperty("endpoint", "endpoint", null, item, id);
- ctrl.bindProperty("description", "subtitle", null, item, id);
- ctrl.bindProperty("accessRights", "members", null, item, id);
- },
- configureItem: item => {
- item.addListener("openEditCluster", e => {
- const clusterId = e.getData();
- this.__openEditCluster(clusterId);
- });
-
- item.addListener("deleteCluster", e => {
- const clusterId = e.getData();
- this.__deleteCluster(clusterId);
- });
- }
- });
-
- return clustersList;
- },
-
- __getOrgsAndMembersSection: function() {
- const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Organization and Members"));
- box.add(this.__getOrgMembersFilter());
- box.add(this.__getMembersList(), {
- flex: 1
- });
- box.setContentPadding(0);
- return box;
- },
-
- __getOrgMembersFilter: function() {
- const vBox = this.__selectOrgMemberLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox());
- vBox.exclude();
-
- const label = new qx.ui.basic.Label(this.tr("Select from the following list")).set({
- paddingLeft: 5
- });
- vBox.add(label);
-
- const hBox = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({
- alignY: "middle"
- }));
- vBox.add(hBox);
-
- const organizationsAndMembers = this.__organizationsAndMembers = new osparc.filter.OrganizationsAndMembers("orgAndMembClusters");
- hBox.add(organizationsAndMembers, {
- flex: 1
- });
-
- const addCollaboratorBtn = new qx.ui.form.Button(this.tr("Add")).set({
- appearance: "strong-button",
- allowGrowY: false,
- enabled: false
- });
- addCollaboratorBtn.addListener("execute", () => {
- this.__addMembers(this.__organizationsAndMembers.getSelectedGIDs());
- }, this);
- qx.event.message.Bus.getInstance().subscribe("OrgAndMembClustersFilter", () => {
- const anySelected = Boolean(this.__organizationsAndMembers.getSelectedGIDs().length);
- addCollaboratorBtn.setEnabled(anySelected);
- }, this);
-
- hBox.add(addCollaboratorBtn);
-
- return vBox;
- },
-
- __getMembersList: function() {
- const membersUIList = new qx.ui.form.List().set({
- decorator: "no-border",
- spacing: 3,
- width: 150,
- backgroundColor: "background-main-2"
- });
-
- const membersArrayModel = this.__membersArrayModel = new qx.data.Array();
- const membersCtrl = new qx.data.controller.List(membersArrayModel, membersUIList, "name");
- membersCtrl.setDelegate({
- createItem: () => new osparc.ui.list.MemberListItem(),
- bindItem: (ctrl, item, id) => {
- ctrl.bindProperty("id", "model", null, item, id);
- ctrl.bindProperty("id", "key", null, item, id);
- ctrl.bindProperty("thumbnail", "thumbnail", null, item, id);
- ctrl.bindProperty("name", "title", null, item, id);
- ctrl.bindProperty("login", "subtitleMD", null, item, id);
- ctrl.bindProperty("accessRights", "accessRights", null, item, id);
- ctrl.bindProperty("showOptions", "showOptions", null, item, id);
- },
- configureItem: item => {
- item.getChildControl("thumbnail").getContentElement()
- .setStyles({
- "border-radius": "16px"
- });
- item.addListener("promoteToManager", e => {
- const clusterMember = e.getData();
- this.__promoteToManager(clusterMember);
- });
- item.addListener("removeMember", e => {
- const clusterMember = e.getData();
- this.__deleteMember(clusterMember);
- });
- }
- });
-
- return membersUIList;
- },
-
- __clusterSelected: function(data) {
- this.__selectOrgMemberLayout.exclude();
- if (data && data.length) {
- this.__currentCluster = data[0];
- } else {
- this.__currentCluster = null;
- }
- this.__reloadClusterMembers();
- },
-
- __reloadClusters: function(reloadMembers = false) {
- let reloadClusterKey = null;
- if (reloadMembers) {
- reloadClusterKey = this.__currentCluster.getKey();
- }
-
- const clustersModel = this.__clustersModel;
- clustersModel.removeAll();
-
- const isDisabled = osparc.utils.DisabledPlugins.isClustersDisabled();
- if (isDisabled === false) {
- osparc.data.Resources.get("clusters")
- .then(clusters => {
- clusters.forEach(cluster => clustersModel.append(qx.data.marshal.Json.createModel(cluster)));
- if (reloadClusterKey) {
- const selectables = this.__clustersList.getSelectables();
- selectables.forEach(selectable => {
- if (selectable.getKey() === reloadClusterKey) {
- this.__currentCluster = selectable;
- this.__reloadClusterMembers();
- }
- });
- }
- })
- .catch(err => console.error(err));
- }
- },
-
- __reloadClusterMembers: function() {
- const membersArrayModel = this.__membersArrayModel;
- membersArrayModel.removeAll();
-
- const clusterModel = this.__currentCluster;
- if (clusterModel === null) {
- return;
- }
-
- const clusterMembers = clusterModel.getMembersList();
-
- const groupsStore = osparc.store.Groups.getInstance();
- const myGid = groupsStore.getMyGroupId();
- const membersModel = clusterModel.getMembers();
- const getter = "get"+String(myGid);
- const canWrite = membersModel[getter] ? membersModel[getter]().getWrite() : false;
- if (canWrite) {
- this.__selectOrgMemberLayout.show();
- const memberKeys = [];
- clusterMembers.forEach(clusterMember => memberKeys.push(clusterMember["gid"]));
- this.__organizationsAndMembers.reloadVisibleCollaborators(memberKeys);
- }
-
- const potentialCollaborators = osparc.store.Groups.getInstance().getPotentialCollaborators();
- clusterMembers.forEach(clusterMember => {
- const gid = clusterMember.getGroupId();
- if (gid in potentialCollaborators) {
- const collaborator = potentialCollaborators[gid];
- const collabObj = {};
- if (collaborator["collabType"] === 1) {
- // group
- collabObj["thumbnail"] = collaborator.getThumbnail() || "@FontAwesome5Solid/users/24";
- collabObj["login"] = collaborator.getDescription();
- } else if (collaborator["collabType"] === 2) {
- // user
- collabObj["thumbnail"] = collaborator.getThumbnail() || "@FontAwesome5Solid/user/24";
- collabObj["login"] = collaborator.getLogin();
- }
- if (Object.keys(collabObj).length) {
- collabObj["id"] = collaborator.getGroupId();
- collabObj["name"] = collaborator.getLabel();
- collabObj["accessRights"] = clusterMember.getAccessRights();
- collabObj["showOptions"] = canWrite;
- membersArrayModel.append(qx.data.marshal.Json.createModel(collabObj));
- }
- }
- });
- },
-
- __openEditCluster: function(clusterId) {
- let cluster = null;
- this.__clustersModel.forEach(clusterModel => {
- if (clusterModel.getId() === parseInt(clusterId)) {
- cluster = clusterModel;
- }
- });
- if (cluster === null) {
- return;
- }
-
- const newCluster = false;
- const clusterEditor = new osparc.editor.ClusterEditor(newCluster);
- cluster.bind("id", clusterEditor, "cid");
- cluster.bind("name", clusterEditor, "label");
- cluster.bind("endpoint", clusterEditor, "endpoint");
- clusterEditor.setSimpleAuthenticationUsername(cluster.getAuthentication().getUsername());
- clusterEditor.setSimpleAuthenticationPassword(cluster.getAuthentication().getPassword());
- cluster.bind("description", clusterEditor, "description");
- const title = this.tr("Cluster Details Editor");
- const win = osparc.ui.window.Window.popUpInWindow(clusterEditor, title, 400, 260);
- clusterEditor.addListener("updateCluster", () => {
- this.__updateCluster(win, clusterEditor.getChildControl("save"), clusterEditor);
- });
- clusterEditor.addListener("cancel", () => win.close());
- },
-
- __deleteCluster: function(clusterId) {
- let cluster = null;
- this.__clustersModel.forEach(clusterModel => {
- if (clusterModel.getId() === parseInt(clusterId)) {
- cluster = clusterModel;
- }
- });
- if (cluster === null) {
- return;
- }
-
- const name = cluster.getName();
- const msg = this.tr("Are you sure you want to delete ") + name + "?";
- const win = new osparc.ui.window.Confirmation(msg).set({
- caption: this.tr("Delete Cluster"),
- confirmText: this.tr("Delete"),
- confirmAction: "delete"
- });
- win.center();
- win.open();
- win.addListener("close", () => {
- if (win.getConfirmed()) {
- const params = {
- url: {
- "cid": clusterId
- }
- };
- osparc.data.Resources.fetch("clusters", "delete", params)
- .then(() => {
- osparc.store.Store.getInstance().reset("clusters");
- this.__reloadClusters();
- })
- .catch(err => {
- osparc.FlashMessenger.getInstance().logAs(this.tr("Something went wrong deleting ") + name, "ERROR");
- console.error(err);
- })
- .finally(() => {
- win.close();
- });
- }
- }, this);
- },
-
- __createCluster: function(win, button, clusterEditor) {
- const clusterKey = clusterEditor.getCid();
- const name = clusterEditor.getLabel();
- const endpoint = clusterEditor.getEndpoint();
- const simpleAuthenticationUsername = clusterEditor.getSimpleAuthenticationUsername();
- const simpleAuthenticationPassword = clusterEditor.getSimpleAuthenticationPassword();
- const description = clusterEditor.getDescription();
- const params = {
- url: {
- "cid": clusterKey
- },
- data: {
- "name": name,
- "endpoint": endpoint,
- "authentication": {
- "type": "simple",
- "username": simpleAuthenticationUsername,
- "password": simpleAuthenticationPassword
- },
- "description": description,
- "type": "AWS"
- }
- };
- osparc.data.Resources.fetch("clusters", "post", params)
- .then(() => {
- osparc.FlashMessenger.getInstance().logAs(name + this.tr(" successfully created"));
- button.setFetching(false);
- osparc.store.Store.getInstance().reset("clusters");
- this.__reloadClusters();
- })
- .catch(err => {
- osparc.FlashMessenger.getInstance().logAs(this.tr("Something went wrong creating ") + name, "ERROR");
- button.setFetching(false);
- console.error(err);
- })
- .finally(() => {
- win.close();
- });
- },
-
- __updateCluster: function(win, button, clusterEditor) {
- const clusterId = clusterEditor.getCid();
- const name = clusterEditor.getLabel();
- const endpoint = clusterEditor.getEndpoint();
- const authenticationType = "simple";
- const simpleAuthenticationUsername = clusterEditor.getSimpleAuthenticationUsername();
- const simpleAuthenticationPassword = clusterEditor.getSimpleAuthenticationPassword();
- const description = clusterEditor.getDescription();
- const params = {
- url: {
- "cid": clusterId
- },
- data: {
- "name": name,
- "endpoint": endpoint,
- "authentication": {
- "type": authenticationType,
- "username": simpleAuthenticationUsername,
- "password": simpleAuthenticationPassword
- },
- "description": description,
- "type": "AWS"
- }
- };
- osparc.data.Resources.fetch("clusters", "patch", params)
- .then(() => {
- osparc.FlashMessenger.getInstance().logAs(name + this.tr(" successfully edited"));
- button.setFetching(false);
- win.close();
- osparc.store.Store.getInstance().reset("clusters");
- this.__reloadClusters();
- })
- .catch(err => {
- osparc.FlashMessenger.getInstance().logAs(this.tr("Something went wrong editing ") + name, "ERROR");
- button.setFetching(false);
- console.error(err);
- });
- },
-
- __addMembers: function(gids) {
- if (this.__currentCluster === null) {
- return;
- }
-
- const accessRights = JSON.parse(qx.util.Serializer.toJson(this.__currentCluster.getMembers()));
- gids.forEach(gid => {
- if (gid in accessRights) {
- return;
- }
-
- accessRights[gid] = {
- "read": true,
- "write": false,
- "delete": false
- };
- });
-
- const params = {
- url: {
- "cid": this.__currentCluster.getKey()
- },
- data: {
- "accessRights": accessRights
- }
- };
- osparc.data.Resources.fetch("clusters", "patch", params)
- .then(() => {
- osparc.FlashMessenger.getInstance().logAs(this.tr("Cluster successfully shared"));
- osparc.store.Store.getInstance().reset("clusters");
- this.__reloadClusters(true);
- })
- .catch(err => {
- osparc.FlashMessenger.getInstance().logAs(this.tr("Something went wrong sharing the Cluster"), "ERROR");
- console.error(err);
- });
- },
-
- __promoteToManager: function(clusterMember) {
- if (this.__currentCluster === null) {
- return;
- }
-
- const accessRights = JSON.parse(qx.util.Serializer.toJson(this.__currentCluster.getMembers()));
- if (!(clusterMember["key"] in accessRights)) {
- return;
- }
-
- accessRights[clusterMember["key"]] = {
- "read": true,
- "write": true,
- "delete": false
- };
- const params = {
- url: {
- "cid": this.__currentCluster.getKey()
- },
- data: {
- "accessRights": accessRights
- }
- };
- osparc.data.Resources.fetch("clusters", "patch", params)
- .then(() => {
- osparc.FlashMessenger.getInstance().logAs(clusterMember["name"] + this.tr(" successfully promoted"));
- osparc.store.Store.getInstance().reset("clusters");
- this.__reloadClusters(true);
- })
- .catch(err => {
- osparc.FlashMessenger.getInstance().logAs(this.tr("Something went wrong promoting ") + clusterMember["name"], "ERROR");
- console.error(err);
- });
- },
-
- __deleteMember: function(clusterMember) {
- if (this.__currentCluster === null) {
- return;
- }
-
- const accessRights = JSON.parse(qx.util.Serializer.toJson(this.__currentCluster.getMembers()));
- if (!(clusterMember["key"] in accessRights)) {
- return;
- }
-
- accessRights[clusterMember["key"]] = {
- "read": false,
- "write": false,
- "delete": false
- };
- const params = {
- url: {
- "cid": this.__currentCluster.getKey()
- },
- data: {
- "accessRights": accessRights
- }
- };
- osparc.data.Resources.fetch("clusters", "patch", params)
- .then(() => {
- osparc.FlashMessenger.getInstance().logAs(clusterMember["name"] + this.tr(" successfully removed"));
- osparc.store.Store.getInstance().reset("clusters");
- this.__reloadClusters(true);
- })
- .catch(err => {
- osparc.FlashMessenger.getInstance().logAs(this.tr("Something went wrong removing ") + clusterMember["name"], "ERROR");
- console.error(err);
- });
- }
- }
-});
diff --git a/services/static-webserver/client/source/class/osparc/editor/ClusterEditor.js b/services/static-webserver/client/source/class/osparc/editor/ClusterEditor.js
deleted file mode 100644
index 8418d2494d9..00000000000
--- a/services/static-webserver/client/source/class/osparc/editor/ClusterEditor.js
+++ /dev/null
@@ -1,262 +0,0 @@
-/* ************************************************************************
-
- osparc - the simcore frontend
-
- https://osparc.io
-
- Copyright:
- 2021 IT'IS Foundation, https://itis.swiss
-
- License:
- MIT: https://opensource.org/licenses/MIT
-
- Authors:
- * Odei Maiz (odeimaiz)
-
-************************************************************************ */
-
-qx.Class.define("osparc.editor.ClusterEditor", {
- extend: qx.ui.core.Widget,
-
- construct: function(newCluster = true) {
- this.base(arguments);
- this._setLayout(new qx.ui.layout.VBox(8));
-
- this.__newCluster = newCluster;
-
- const manager = this.__validator = new qx.ui.form.validation.Manager();
- const title = this.getChildControl("title");
- title.setRequired(true);
- manager.add(title);
- const endpoint = this.getChildControl("endpoint");
- endpoint.setRequired(true);
- manager.add(endpoint);
- const username = this.getChildControl("simpleAuthenticationUsername");
- username.setRequired(true);
- manager.add(username);
- const pass = this.getChildControl("simpleAuthenticationPassword");
- pass.setRequired(true);
- manager.add(pass);
- this._createChildControlImpl("description");
- this._createChildControlImpl("test-layout");
- newCluster ? this._createChildControlImpl("create") : this._createChildControlImpl("save");
- },
-
- properties: {
- cid: {
- check: "Number",
- init: 0,
- nullable: false,
- event: "changeCid"
- },
-
- label: {
- check: "String",
- init: "",
- nullable: false,
- event: "changeLabel"
- },
-
- endpoint: {
- check: "String",
- init: "",
- nullable: false,
- event: "changeEndpoint"
- },
-
- simpleAuthenticationUsername: {
- check: "String",
- init: "",
- nullable: false,
- event: "changeSimpleAuthenticationUsername"
- },
-
- simpleAuthenticationPassword: {
- check: "String",
- init: "",
- nullable: false,
- event: "changeSimpleAuthenticationPassword"
- },
-
- description: {
- check: "String",
- init: "",
- nullable: false,
- event: "changeDescription"
- }
- },
-
- events: {
- "createCluster": "qx.event.type.Event",
- "updateCluster": "qx.event.type.Event",
- "cancel": "qx.event.type.Event"
- },
-
- members: {
- __validator: null,
- __newCluster: null,
-
- _createChildControlImpl: function(id) {
- let control;
- switch (id) {
- case "title":
- control = new qx.ui.form.TextField().set({
- font: "text-14",
- backgroundColor: "background-main",
- placeholder: this.tr("Title")
- });
- this.bind("label", control, "value");
- control.bind("value", this, "label");
- this._add(control);
- break;
- case "endpointLayout":
- control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5));
- this._add(control);
- break;
- case "endpoint": {
- const endpointLayout = this.getChildControl("endpointLayout");
- control = new qx.ui.form.TextField().set({
- font: "text-14",
- backgroundColor: "background-main",
- placeholder: this.tr("Endpoint")
- });
- this.bind("endpoint", control, "value");
- control.bind("value", this, "endpoint");
- control.setRequired(true);
- endpointLayout.add(control, {
- flex: 1
- });
- break;
- }
- case "simpleAuthenticationUsername": {
- const endpointLayout = this.getChildControl("endpointLayout");
- control = new qx.ui.form.TextField().set({
- font: "text-14",
- backgroundColor: "background-main",
- placeholder: this.tr("Username")
- });
- control.getContentElement().setAttribute("autocomplete", "off");
- this.bind("simpleAuthenticationUsername", control, "value");
- control.bind("value", this, "simpleAuthenticationUsername");
- control.setRequired(true);
- endpointLayout.add(control);
- break;
- }
- case "simpleAuthenticationPassword": {
- const endpointLayout = this.getChildControl("endpointLayout");
- control = new osparc.ui.form.PasswordField().set({
- font: "text-14",
- backgroundColor: "background-main",
- placeholder: this.tr("Password")
- });
- control.getContentElement().setAttribute("autocomplete", "off");
- this.bind("simpleAuthenticationPassword", control, "value");
- control.bind("value", this, "simpleAuthenticationPassword");
- control.setRequired(true);
- endpointLayout.add(control);
- break;
- }
- case "description":
- control = new qx.ui.form.TextArea().set({
- font: "text-14",
- placeholder: this.tr("Description"),
- autoSize: true,
- minHeight: 70,
- maxHeight: 140
- });
- this.bind("description", control, "value");
- control.bind("value", this, "description");
- this._add(control);
- break;
- case "test-layout": {
- control = this.__getTestLayout();
- this._add(control);
- break;
- }
- case "buttonsLayout": {
- control = new qx.ui.container.Composite(new qx.ui.layout.HBox(8).set({
- alignX: "right"
- }));
- const cancelButton = new qx.ui.form.Button(this.tr("Cancel")).set({
- appearance: "form-button-text"
- });
- cancelButton.addListener("execute", () => this.fireEvent("cancel"), this);
- control.add(cancelButton);
- this._add(control);
- break;
- }
- case "create": {
- const buttons = this.getChildControl("buttonsLayout");
- control = new osparc.ui.form.FetchButton(this.tr("Create")).set({
- appearance: "form-button"
- });
- control.addListener("execute", () => {
- if (this.__validator.validate()) {
- control.setFetching(true);
- this.fireEvent("createCluster");
- }
- }, this);
- buttons.add(control);
- break;
- }
- case "save": {
- const buttons = this.getChildControl("buttonsLayout");
- control = new osparc.ui.form.FetchButton(this.tr("Save")).set({
- appearance: "form-button"
- });
- control.addListener("execute", () => {
- if (this.__validator.validate()) {
- control.setFetching(true);
- this.fireEvent("updateCluster");
- }
- }, this);
- buttons.add(control);
- break;
- }
- }
-
- return control || this.base(arguments, id);
- },
-
- __getTestLayout: function() {
- const testLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(8));
- const testButton = new osparc.ui.form.FetchButton(this.tr("Test"));
- testLayout.add(testButton);
-
- const testResult = new qx.ui.basic.Image("@FontAwesome5Solid/lightbulb/16");
- testLayout.add(testResult);
-
- testButton.addListener("execute", () => {
- if (this.__validator.validate()) {
- testButton.setFetching(true);
- const endpoint = this.__newCluster ? "pingWCredentials" : "ping";
- const params = {};
- if (this.__newCluster) {
- params["data"] = {
- "endpoint": this.getEndpoint(),
- "authentication": {
- "type": "simple",
- "username": this.getSimpleAuthenticationUsername(),
- "password": this.getSimpleAuthenticationPassword()
- }
- };
- } else {
- params["url"] = {
- cid: this.getCid()
- };
- }
- osparc.data.Resources.fetch("clusters", endpoint, params)
- .then(() => testResult.setTextColor("ready-green"))
- .catch(err => {
- testResult.setTextColor("failed-red");
- const msg = err.message || this.tr("Test failed");
- osparc.FlashMessenger.getInstance().logAs(msg, "Error");
- })
- .finally(() => testButton.setFetching(false));
- }
- }, this);
-
- return testLayout;
- }
- }
-});
diff --git a/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js b/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js
index be4a1c8f4a8..160ab65ae29 100644
--- a/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js
+++ b/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js
@@ -91,18 +91,6 @@ qx.Class.define("osparc.navigation.UserMenu", {
control.addListener("execute", () => osparc.desktop.organizations.OrganizationsWindow.openWindow(), this);
this.add(control);
break;
- case "clusters":
- control = new qx.ui.menu.Button(this.tr("Clusters"));
- control.exclude();
- if (osparc.product.Utils.showClusters()) {
- const isDisabled = osparc.utils.DisabledPlugins.isClustersDisabled();
- if (isDisabled === false) {
- control.show();
- }
- }
- control.addListener("execute", () => osparc.cluster.Utils.popUpClustersDetails(), this);
- this.add(control);
- break;
case "market":
control = new qx.ui.menu.Button(this.tr("Market"));
control.addListener("execute", () => osparc.vipMarket.MarketWindow.openWindow());
@@ -175,7 +163,6 @@ qx.Class.define("osparc.navigation.UserMenu", {
}
this.getChildControl("preferences");
this.getChildControl("organizations");
- this.getChildControl("clusters");
}
this.addSeparator();
@@ -231,7 +218,6 @@ qx.Class.define("osparc.navigation.UserMenu", {
}
this.getChildControl("preferences");
this.getChildControl("organizations");
- this.getChildControl("clusters");
}
this.addSeparator();
diff --git a/services/static-webserver/client/source/class/osparc/product/Utils.js b/services/static-webserver/client/source/class/osparc/product/Utils.js
index 4535f1ca8b6..31501afeb34 100644
--- a/services/static-webserver/client/source/class/osparc/product/Utils.js
+++ b/services/static-webserver/client/source/class/osparc/product/Utils.js
@@ -247,13 +247,6 @@ qx.Class.define("osparc.product.Utils", {
return true;
},
- showClusters: function() {
- if (this.isProduct("s4llite") || this.isProduct("tis") || this.isProduct("tiplite")) {
- return false;
- }
- return true;
- },
-
showDisableServiceAutoStart: function() {
if (this.isProduct("s4llite")) {
return false;
diff --git a/services/static-webserver/client/source/class/osparc/store/Store.js b/services/static-webserver/client/source/class/osparc/store/Store.js
index 7b94b336852..cd82975131d 100644
--- a/services/static-webserver/client/source/class/osparc/store/Store.js
+++ b/services/static-webserver/client/source/class/osparc/store/Store.js
@@ -174,11 +174,6 @@ qx.Class.define("osparc.store.Store", {
check: "Array",
init: []
},
- clusters: {
- check: "Array",
- init: [],
- event: "changeClusters"
- },
services: {
check: "Array",
init: []
diff --git a/services/static-webserver/client/source/class/osparc/ui/list/ClusterListItem.js b/services/static-webserver/client/source/class/osparc/ui/list/ClusterListItem.js
deleted file mode 100644
index ff24bb6f6b0..00000000000
--- a/services/static-webserver/client/source/class/osparc/ui/list/ClusterListItem.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/* ************************************************************************
-
- osparc - the simcore frontend
-
- https://osparc.io
-
- Copyright:
- 2021 IT'IS Foundation, https://itis.swiss
-
- License:
- MIT: https://opensource.org/licenses/MIT
-
- Authors:
- * Odei Maiz (odeimaiz)
-
-************************************************************************ */
-
-qx.Class.define("osparc.ui.list.ClusterListItem", {
- extend: osparc.ui.list.ListItem,
-
- construct: function() {
- this.base(arguments);
- },
-
- properties: {
- members: {
- check: "Object",
- nullable: false,
- apply: "__applyMembers",
- event: "changeMembers"
- },
-
- accessRights: {
- check: "Object",
- nullable: false,
- apply: "__applyAccessRights",
- event: "changeAccessRights"
- },
-
- endpoint: {
- check: "String",
- nullable: false,
- event: "changeEndpoint"
- },
-
- simpleAuthenticationUsername: {
- check: "String",
- init: "",
- nullable: false,
- event: "changeSimpleAuthenticationUsername"
- },
-
- simpleAuthenticationPassword: {
- check: "String",
- init: "",
- nullable: false,
- event: "changeSimpleAuthenticationPassword"
- }
- },
-
- events: {
- "openEditCluster": "qx.event.type.Data",
- "deleteCluster": "qx.event.type.Data"
- },
-
- members: {
- _createChildControlImpl: function(id) {
- let control;
- switch (id) {
- case "options": {
- const iconSize = 25;
- control = new qx.ui.form.MenuButton().set({
- maxWidth: iconSize,
- maxHeight: iconSize,
- alignX: "center",
- alignY: "middle",
- icon: "@FontAwesome5Solid/ellipsis-v/"+(iconSize-11),
- focusable: false
- });
- this._add(control, {
- row: 0,
- column: 3,
- rowSpan: 2
- });
- break;
- }
- }
-
- return control || this.base(arguments, id);
- },
-
- __applyMembers: function(members) {
- if (members === null) {
- return;
- }
-
- const nMembers = this.getMembersList().length + this.tr(" members");
- this.setContact(nMembers);
-
- const myGid = osparc.auth.Data.getInstance().getGroupId();
- if ("get"+myGid in members) {
- this.setAccessRights(members.get(myGid));
- }
- },
-
- getMembersList: function() {
- const membersList = [];
- const members = this.getMembers();
- const memberGids = members.basename.split("|");
- memberGids.forEach(memberGid => {
- const member = members.get(memberGid);
- member.gid = memberGid;
- membersList.push(member);
- });
- return membersList;
- },
-
- __applyAccessRights: function(accessRights) {
- if (accessRights === null) {
- return;
- }
-
- if (accessRights.getDelete()) {
- const optionsMenu = this.getChildControl("options");
- const menu = this.__getOptionsMenu();
- optionsMenu.setMenu(menu);
- }
- },
-
- __getOptionsMenu: function() {
- const menu = new qx.ui.menu.Menu().set({
- position: "bottom-right"
- });
-
- const editClusterButton = new qx.ui.menu.Button(this.tr("Edit details"));
- editClusterButton.addListener("execute", () => {
- this.fireDataEvent("openEditCluster", this.getKey());
- });
- menu.add(editClusterButton);
-
- const deleteClusterButton = new qx.ui.menu.Button(this.tr("Delete"));
- deleteClusterButton.addListener("execute", () => {
- this.fireDataEvent("deleteCluster", this.getKey());
- });
- menu.add(deleteClusterButton);
-
- return menu;
- }
- }
-});
diff --git a/services/static-webserver/client/source/class/osparc/utils/DisabledPlugins.js b/services/static-webserver/client/source/class/osparc/utils/DisabledPlugins.js
index e9e955b1ba9..2b5d9a65995 100644
--- a/services/static-webserver/client/source/class/osparc/utils/DisabledPlugins.js
+++ b/services/static-webserver/client/source/class/osparc/utils/DisabledPlugins.js
@@ -28,7 +28,6 @@ qx.Class.define("osparc.utils.DisabledPlugins", {
SCICRUNCH: "WEBSERVER_SCICRUNCH",
VERSION_CONTROL: "WEBSERVER_VERSION_CONTROL",
META_MODELING: "WEBSERVER_META_MODELING",
- CLUSTERS: "WEBSERVER_CLUSTERS",
FOLDERS: "WEBSERVER_FOLDERS",
isFoldersEnabled: function() {
@@ -53,10 +52,6 @@ qx.Class.define("osparc.utils.DisabledPlugins", {
return this.__isPluginDisabled(this.META_MODELING);
},
- isClustersDisabled: function() {
- return this.__isPluginDisabled(this.CLUSTERS);
- },
-
__isPluginDisabled: function(key) {
const statics = osparc.store.Store.getInstance().get("statics");
if (statics) {
From 7d1ac3e2020fc7423b9928cfb24553ca03396b9d Mon Sep 17 00:00:00 2001
From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com>
Date: Tue, 3 Dec 2024 20:45:28 +0100
Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=92=A3=20[Frontend]=20Retire=20cluste?=
=?UTF-8?q?rs=20(#6883)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From b1fe5989dbbaed62c26fc1d91bb985ae9b91cac4 Mon Sep 17 00:00:00 2001
From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com>
Date: Tue, 3 Dec 2024 20:45:44 +0100
Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=92=A3=20[Frontend]=20Retire=20cluste?=
=?UTF-8?q?rs=20(#6883)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit