From 4633a3be833b2f8305ad8a39a89b6eaca8fbfd19 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 17 May 2023 16:09:22 +0200 Subject: [PATCH 01/17] refactoring --- .../osparc/component/share/Collaborators.js | 152 +++++++++--------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/component/share/Collaborators.js b/services/static-webserver/client/source/class/osparc/component/share/Collaborators.js index b6e79f06936..8217c2dbe95 100644 --- a/services/static-webserver/client/source/class/osparc/component/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/component/share/Collaborators.js @@ -70,6 +70,80 @@ qx.Class.define("osparc.component.share.Collaborators", { } } return sorted; + }, + + createStudyLinkSection: function(serializedData) { + const vBox = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); + + const label = new qx.ui.basic.Label().set({ + value: qx.locale.Manager.tr("Any logged-in user with access to the ") + osparc.product.Utils.getStudyAlias() + qx.locale.Manager.tr(" can open it"), + rich: true + }); + vBox.add(label); + + const hBox = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({ + alignY: "middle" + })); + vBox.add(hBox, { + flex: 1 + }); + + const link = window.location.href + "#/study/" + serializedData["uuid"]; + const linkField = new qx.ui.form.TextField(link); + hBox.add(linkField, { + flex: 1 + }); + + const copyLinkBtn = new qx.ui.form.Button(qx.locale.Manager.tr("Copy link")); + copyLinkBtn.addListener("execute", () => { + if (osparc.utils.Utils.copyTextToClipboard(link)) { + copyLinkBtn.setIcon("@FontAwesome5Solid/check/12"); + } + }); + hBox.add(copyLinkBtn); + + return vBox; + }, + + createTemplateLinkSection: function(serializedData) { + const vBox = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); + + if ("permalink" in serializedData) { + const permalink = serializedData["permalink"]; + + const label = new qx.ui.basic.Label().set({ + rich: true + }); + if (permalink["is_public"]) { + label.setValue(qx.locale.Manager.tr("Anyone on the internet with the link can open this ") + osparc.product.Utils.getTemplateAlias()); + } else { + label.setValue(qx.locale.Manager.tr("Any logged-in user with the link can copy and open this ") + osparc.product.Utils.getTemplateAlias()); + } + vBox.add(label); + + const hBox = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({ + alignY: "middle" + })); + vBox.add(hBox, { + flex: 1 + }); + + const link = permalink["url"]; + const linkField = new qx.ui.form.TextField(link); + hBox.add(linkField, { + flex: 1 + }); + + const copyLinkBtn = new qx.ui.form.Button(qx.locale.Manager.tr("Copy link")); + copyLinkBtn.addListener("execute", () => { + if (osparc.utils.Utils.copyTextToClipboard(link)) { + copyLinkBtn.setIcon("@FontAwesome5Solid/check/12"); + } + }); + hBox.add(copyLinkBtn); + } + + return vBox; } }, @@ -105,13 +179,13 @@ qx.Class.define("osparc.component.share.Collaborators", { }); break; case "study-link": - control = this.__createStudyLinkSection(); + control = this.self().createStudyLinkSection(this._serializedData); this._add(control); // excluded by default control.exclude(); break; case "template-link": - control = this.__createTemplateLinkSection(); + control = this.self().createTemplateLinkSection(this._serializedData); this._add(control); // excluded by default control.exclude(); @@ -218,80 +292,6 @@ qx.Class.define("osparc.component.share.Collaborators", { return vBox; }, - __createStudyLinkSection: function() { - const vBox = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); - - const label = new qx.ui.basic.Label().set({ - value: this.tr("Any logged-in user with access to the ") + osparc.product.Utils.getStudyAlias() + this.tr(" can open it"), - rich: true - }); - vBox.add(label); - - const hBox = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({ - alignY: "middle" - })); - vBox.add(hBox, { - flex: 1 - }); - - const link = window.location.href + "#/study/" + this._serializedData["uuid"]; - const linkField = new qx.ui.form.TextField(link); - hBox.add(linkField, { - flex: 1 - }); - - const copyLinkBtn = new qx.ui.form.Button(this.tr("Copy link")); - copyLinkBtn.addListener("execute", () => { - if (osparc.utils.Utils.copyTextToClipboard(link)) { - copyLinkBtn.setIcon("@FontAwesome5Solid/check/12"); - } - }, this); - hBox.add(copyLinkBtn); - - return vBox; - }, - - __createTemplateLinkSection: function() { - const vBox = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); - - if ("permalink" in this._serializedData) { - const permalink = this._serializedData["permalink"]; - - const label = new qx.ui.basic.Label().set({ - rich: true - }); - if (permalink["is_public"]) { - label.setValue(this.tr("Anyone on the internet with the link can open this ") + osparc.product.Utils.getTemplateAlias()); - } else { - label.setValue(this.tr("Any logged-in user with the link can copy and open this ") + osparc.product.Utils.getTemplateAlias()); - } - vBox.add(label); - - const hBox = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({ - alignY: "middle" - })); - vBox.add(hBox, { - flex: 1 - }); - - const link = permalink["url"]; - const linkField = new qx.ui.form.TextField(link); - hBox.add(linkField, { - flex: 1 - }); - - const copyLinkBtn = new qx.ui.form.Button(this.tr("Copy link")); - copyLinkBtn.addListener("execute", () => { - if (osparc.utils.Utils.copyTextToClipboard(link)) { - copyLinkBtn.setIcon("@FontAwesome5Solid/check/12"); - } - }, this); - hBox.add(copyLinkBtn); - } - - return vBox; - }, - __getCollaborators: function() { osparc.store.Store.getInstance().getPotentialCollaborators() .then(potentialCollaborators => { From a2f4db714f4d540b6e88484703ed305b0b0a7fc0 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 13 Jun 2023 16:33:07 +0200 Subject: [PATCH 02/17] refactoring --- .../class/osparc/component/notification/NotificationUI.js | 8 +------- .../class/osparc/component/share/ShareePermissions.js | 8 +------- .../client/source/class/osparc/dashboard/CardBase.js | 8 +------- .../source/class/osparc/dashboard/ResourceBrowserBase.js | 8 +------- .../source/class/osparc/dashboard/ResourceMoreOptions.js | 7 ++++++- .../class/osparc/desktop/organizations/ServicesList.js | 8 +------- .../class/osparc/desktop/organizations/TemplatesList.js | 8 +------- 7 files changed, 12 insertions(+), 43 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/component/notification/NotificationUI.js b/services/static-webserver/client/source/class/osparc/component/notification/NotificationUI.js index 26907a428fa..b8756dd5d8d 100644 --- a/services/static-webserver/client/source/class/osparc/component/notification/NotificationUI.js +++ b/services/static-webserver/client/source/class/osparc/component/notification/NotificationUI.js @@ -202,13 +202,7 @@ qx.Class.define("osparc.component.notification.NotificationUI", { const studyDataCopy = osparc.data.model.Study.deepCloneStudyObject(studyData); studyDataCopy["resourceType"] = notification.getCategory() === "STUDY_SHARED" ? "study" : "template"; const moreOpts = new osparc.dashboard.ResourceMoreOptions(studyData); - const title = this.tr("Options"); - osparc.ui.window.Window.popUpInWindow( - moreOpts, - title, - osparc.dashboard.ResourceMoreOptions.WIDTH, - osparc.dashboard.ResourceMoreOptions.HEIGHT - ); + osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); } }); break; diff --git a/services/static-webserver/client/source/class/osparc/component/share/ShareePermissions.js b/services/static-webserver/client/source/class/osparc/component/share/ShareePermissions.js index 0336371008b..4706ed5cd1c 100644 --- a/services/static-webserver/client/source/class/osparc/component/share/ShareePermissions.js +++ b/services/static-webserver/client/source/class/osparc/component/share/ShareePermissions.js @@ -51,13 +51,7 @@ qx.Class.define("osparc.component.share.ShareePermissions", { infoButton.setAppearance("strong-button"); infoButton.addListener("execute", () => { const moreOpts = new osparc.dashboard.ResourceMoreOptions(metaData); - const title = this.tr("Service Info"); - osparc.ui.window.Window.popUpInWindow( - moreOpts, - title, - osparc.dashboard.ResourceMoreOptions.WIDTH, - osparc.dashboard.ResourceMoreOptions.HEIGHT - ); + osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); }, this); hBox.add(infoButton); hBox.add(new qx.ui.basic.Label(metaData.name + " : " + metaData.version)); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index 36a90b41337..04445aaaf9e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -602,13 +602,7 @@ qx.Class.define("osparc.dashboard.CardBase", { __openMoreOptions: function() { const resourceData = this.getResourceData(); const moreOpts = new osparc.dashboard.ResourceMoreOptions(resourceData); - const title = this.tr("Options"); - const win = osparc.ui.window.Window.popUpInWindow( - moreOpts, - title, - osparc.dashboard.ResourceMoreOptions.WIDTH, - osparc.dashboard.ResourceMoreOptions.HEIGHT - ); + const win = osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); [ "updateStudy", "updateTemplate", diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index 24b5ef2d258..8bc6c03a5f0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -315,13 +315,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { osparc.utils.Utils.setIdToWidget(moreOptsButton, "moreInfoBtn"); moreOptsButton.addListener("execute", () => { const moreOpts = new osparc.dashboard.ResourceMoreOptions(resourceData); - const title = this.tr("Options"); - const win = osparc.ui.window.Window.popUpInWindow( - moreOpts, - title, - osparc.dashboard.ResourceMoreOptions.WIDTH, - osparc.dashboard.ResourceMoreOptions.HEIGHT - ); + const win = osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); moreOpts.addListener("updateStudy", e => this._updateStudyData(e.getData())); moreOpts.addListener("updateTemplate", e => this._updateTemplateData(e.getData())); moreOpts.addListener("updateService", e => this._updateServiceData(e.getData())); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js index 90ab1dde35f..2cbecd20bcb 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js @@ -45,7 +45,12 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { statics: { WIDTH: 700, - HEIGHT: 660 + HEIGHT: 660, + + popUpInWindow: function(moreOpts) { + const title = qx.locale.Manager.tr("Details"); + return osparc.ui.window.Window.popUpInWindow(moreOpts, title, this.WIDTH, this.HEIGHT); + } }, properties: { diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/ServicesList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/ServicesList.js index 5c1ac95f12d..012e27fa432 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/ServicesList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/ServicesList.js @@ -96,13 +96,7 @@ qx.Class.define("osparc.desktop.organizations.ServicesList", { const moreOpts = new osparc.dashboard.ResourceMoreOptions(serviceData).set({ showOpenButton: false }); - const title = this.tr("Options"); - osparc.ui.window.Window.popUpInWindow( - moreOpts, - title, - osparc.dashboard.ResourceMoreOptions.WIDTH, - osparc.dashboard.ResourceMoreOptions.HEIGHT - ); + osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); } }); }); diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/TemplatesList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/TemplatesList.js index adb0e839abe..8a6c2bb3b13 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/TemplatesList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/TemplatesList.js @@ -93,13 +93,7 @@ qx.Class.define("osparc.desktop.organizations.TemplatesList", { if (templateData) { templateData["resourceType"] = "template"; const moreOpts = new osparc.dashboard.ResourceMoreOptions(templateData); - const title = this.tr("Options"); - osparc.ui.window.Window.popUpInWindow( - moreOpts, - title, - osparc.dashboard.ResourceMoreOptions.WIDTH, - osparc.dashboard.ResourceMoreOptions.HEIGHT - ); + osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); } }); }); From 41e7ab65af5cbd292cb45e5fc53a3d4e7731160e Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 13 Jun 2023 17:20:15 +0200 Subject: [PATCH 03/17] Open button on the top right --- .../osparc/dashboard/ResourceMoreOptions.js | 185 ++++++++++-------- 1 file changed, 100 insertions(+), 85 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js index 2cbecd20bcb..6d8a1c0ca90 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js @@ -16,23 +16,17 @@ ************************************************************************ */ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { - extend: qx.ui.tabview.TabView, + extend: qx.ui.core.Widget, construct: function(resourceData) { this.base(arguments); this.__resourceData = resourceData; - this.set({ - barPosition: "left", - contentPadding: 0 - }); + this._setLayout(new qx.ui.layout.VBox(10)); - if (osparc.utils.Resources.isService(resourceData)) { - this.__createServiceVersionSelector(); - } - - this.__addPages(); + this.__addToolbar(); + this.__addDetailsView(); }, events: { @@ -50,6 +44,34 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { popUpInWindow: function(moreOpts) { const title = qx.locale.Manager.tr("Details"); return osparc.ui.window.Window.popUpInWindow(moreOpts, title, this.WIDTH, this.HEIGHT); + }, + + createPage: function(title, widget, icon, id) { + const tabPage = new qx.ui.tabview.Page().set({ + backgroundColor: "background-main-2", + paddingLeft: 20, + layout: new qx.ui.layout.VBox(10), + icon: icon + "/24" + }); + tabPage.tabId = id; + + tabPage.getButton().set({ + minWidth: 35, + toolTipText: title + }); + osparc.utils.Utils.centerTabIcon(tabPage); + + // Page title + tabPage.add(new qx.ui.basic.Label(title).set({ + font: "text-15" + })); + + // Page content + tabPage.add(widget, { + flex: 1 + }); + + return tabPage; } }, @@ -64,14 +86,61 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { members: { __resourceData: null, - __serviceVersionLayout: null, - __serviceVersionSelector: null, + __toolbar: null, + __detailsView: null, __permissionsPage: null, __tagsPage: null, __classifiersPage: null, __qualityPage: null, __servicesUpdatePage: null, + __addToolbar: function() { + const toolbar = this.__toolbar = new qx.ui.container.Composite(new qx.ui.layout.HBox(10)); + + const resourceData = this.__resourceData; + if (osparc.utils.Resources.isService(resourceData)) { + const serviceVersionSelector = this.__createServiceVersionSelector(); + toolbar.add(serviceVersionSelector); + } + + toolbar.add(new qx.ui.core.Spacer(), { + flex: 1 + }); + + if (osparc.utils.Resources.isService(resourceData)) { + const openButton = new qx.ui.form.Button(this.tr("Open")).set({ + appearance: "strong-button", + allowGrowX: false, + alignX: "right", + height: 23 + }); + this.bind("showOpenButton", openButton, "visibility", { + converter: show => show ? "visible" : "excluded" + }); + openButton.addListener("execute", () => { + this.fireDataEvent("openService", { + key: this.__resourceData["key"], + version: this.__resourceData["version"] + }); + }); + toolbar.add(openButton); + } + + this._add(toolbar); + }, + + __addDetailsView: function() { + const detailsView = this.__detailsView = new qx.ui.tabview.TabView().set({ + barPosition: "left", + contentPadding: 0 + }); + this._add(detailsView, { + flex: 1 + }); + + this.__addPages(); + }, + __openPage: function(page) { if (page) { this.setSelection([page]); @@ -105,7 +174,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { const versionLabel = new qx.ui.basic.Label(this.tr("Service Version")); hBox.add(versionLabel); - const versionsBox = this.__serviceVersionSelector = new osparc.ui.toolbar.SelectBox(); + const versionsBox = new osparc.ui.toolbar.SelectBox(); hBox.add(versionsBox); // populate it with owned versions @@ -113,13 +182,12 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { store.getAllServices() .then(services => { const versions = osparc.utils.Services.getVersions(services, this.__resourceData["key"]); - const selectBox = this.__serviceVersionSelector; let selectedItem = null; versions.reverse().forEach(version => { selectedItem = new qx.ui.form.ListItem(version); - selectBox.add(selectedItem); + versionsBox.add(selectedItem); if (this.__resourceData["version"] === version) { - selectBox.setSelection([selectedItem]); + versionsBox.setSelection([selectedItem]); } }); }); @@ -144,14 +212,16 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { }, __addPages: function() { + const detailsView = this.__detailsView; + // keep selected page - const selection = this.getSelection(); + const selection = detailsView.getSelection(); const selectedTabId = selection.length ? selection[0]["tabId"] : null; // removeAll - const pages = this.getChildren().length; + const pages = detailsView.getChildren().length; for (let i=pages-1; i>=0; i--) { - this.remove(this.getChildren()[i]); + detailsView.remove(detailsView.getChildren()[i]); } // add Open service button @@ -168,56 +238,19 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { if (pageCallee) { const page = pageCallee.call(this); if (page) { - this.add(page); + detailsView.add(page); } } }); if (selectedTabId) { - const pageFound = this.getChildren().find(page => page.tabId === selectedTabId); + const pageFound = detailsView.getChildren().find(page => page.tabId === selectedTabId); if (pageFound) { - this.setSelection([pageFound]); + detailsView.setSelection([pageFound]); } } }, - __createPage: function(title, widget, icon, id) { - const tabPage = new qx.ui.tabview.Page().set({ - backgroundColor: "background-main-2", - paddingLeft: 20, - layout: new qx.ui.layout.VBox(10), - icon: icon + "/24" - }); - tabPage.tabId = id; - - tabPage.getButton().set({ - minWidth: 35, - toolTipText: title - }); - osparc.utils.Utils.centerTabIcon(tabPage); - - // Page title - tabPage.add(new qx.ui.basic.Label(title).set({ - font: "text-15" - })); - - // Page content - tabPage.add(widget, { - flex: 1 - }); - - if (osparc.utils.Resources.isService(this.__resourceData)) { - this.addListener("changeSelection", e => { - const currentSelection = e.getData()[0]; - if (currentSelection === tabPage) { - tabPage.addAt(this.__serviceVersionLayout, 1); - } - }, this); - } - - return tabPage; - }, - __getInfoPage: function() { const id = "Information"; const title = this.tr("Information"); @@ -250,25 +283,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { this.fireDataEvent("updateTemplate", updatedData); } }); - const page = this.__createPage(title, infoCard, icon, id); - - if (osparc.utils.Resources.isService(resourceData)) { - const openServiceButton = new qx.ui.form.Button(this.tr("Open")).set({ - appearance: "strong-button", - allowGrowX: false, - alignX: "right" - }); - this.bind("showOpenButton", openServiceButton, "visibility", { - converter: show => show ? "visible" : "excluded" - }); - openServiceButton.addListener("execute", () => { - this.fireDataEvent("openService", { - key: resourceData["key"], - version: resourceData["version"] - }); - }); - page.add(openServiceButton); - } + const page = this.self().createPage(title, infoCard, icon, id); return page; }, @@ -318,7 +333,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { } }, this); } - const page = this.__permissionsPage = this.__createPage(title, permissionsView, icon, id); + const page = this.__permissionsPage = this.self().createPage(title, permissionsView, icon, id); return page; }, @@ -353,7 +368,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { } else { classifiers = new osparc.component.metadata.ClassifiersViewer(resourceData); } - const page = this.__classifiersPage = this.__createPage(title, classifiers, icon, id); + const page = this.__classifiersPage = this.self().createPage(title, classifiers, icon, id); return page; }, @@ -378,7 +393,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { this.fireDataEvent("updateTemplate", updatedData); } }); - const page = this.__qualityPage = this.__createPage(title, qualityEditor, icon, id); + const page = this.__qualityPage = this.self().createPage(title, qualityEditor, icon, id); return page; } return null; @@ -402,7 +417,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { tagManager.setStudydata(updatedData); this.fireDataEvent("updateStudy", updatedData); }, this); - const page = this.__tagsPage = this.__createPage(title, tagManager, icon, id); + const page = this.__tagsPage = this.self().createPage(title, tagManager, icon, id); return page; }, @@ -424,7 +439,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { this.fireDataEvent("updateTemplate", updatedData); } }); - const page = this.__servicesUpdatePage = this.__createPage(title, servicesUpdate, icon, id); + const page = this.__servicesUpdatePage = this.self().createPage(title, servicesUpdate, icon, id); return page; }, @@ -441,7 +456,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { const title = this.tr("Boot Options"); const icon = "@FontAwesome5Solid/play-circle"; const servicesBootOpts = new osparc.component.metadata.ServicesInStudyBootOpts(resourceData); - const page = this.__createPage(title, servicesBootOpts, icon, id); + const page = this.self().createPage(title, servicesBootOpts, icon, id); return page; }, @@ -458,7 +473,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { const icon = "@FontAwesome5Solid/copy"; const saveAsTemplate = new osparc.component.study.SaveAsTemplate(this.__resourceData); saveAsTemplate.addListener("publishTemplate", e => this.fireDataEvent("publishTemplate", e.getData())); - const page = this.__createPage(title, saveAsTemplate, icon, id); + const page = this.self().createPage(title, saveAsTemplate, icon, id); return page; } return null; From 3c8e8371785703966b0f71aadfe78d0dd91c89a7 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 13 Jun 2023 17:24:50 +0200 Subject: [PATCH 04/17] aesthetics --- .../source/class/osparc/dashboard/ResourceMoreOptions.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js index 6d8a1c0ca90..58d390f60ec 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js @@ -39,7 +39,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { statics: { WIDTH: 700, - HEIGHT: 660, + HEIGHT: 700, popUpInWindow: function(moreOpts) { const title = qx.locale.Manager.tr("Details"); @@ -110,9 +110,9 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { if (osparc.utils.Resources.isService(resourceData)) { const openButton = new qx.ui.form.Button(this.tr("Open")).set({ appearance: "strong-button", - allowGrowX: false, + font: "text-14", alignX: "right", - height: 23 + height: 24 }); this.bind("showOpenButton", openButton, "visibility", { converter: show => show ? "visible" : "excluded" From 727a238135ce1544a8106b661cfd6dd4d070549d Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 13 Jun 2023 17:41:27 +0200 Subject: [PATCH 05/17] open from home page --- .../osparc/dashboard/ResourceBrowserBase.js | 18 +++++++ .../osparc/dashboard/ResourceMoreOptions.js | 50 +++++++++++-------- .../class/osparc/dashboard/StudyBrowser.js | 12 ++--- .../class/osparc/dashboard/TemplateBrowser.js | 4 +- 4 files changed, 56 insertions(+), 28 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index 8bc6c03a5f0..ceeec7ce0b5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -302,6 +302,14 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { throw new Error("Abstract method called!"); }, + _startStudyById: function() { + throw new Error("Abstract method called!"); + }, + + _createStudyFromTemplate: function() { + throw new Error("Abstract method called!"); + }, + _createStudyFromService: function() { throw new Error("Abstract method called!"); }, @@ -323,6 +331,16 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { win.close(); this.fireDataEvent("publishTemplate", e.getData()); }); + moreOpts.addListener("openStudy", e => { + win.close(); + const openStudyData = e.getData(); + this._startStudyById(openStudyData["uuid"]); + }); + moreOpts.addListener("openTemplate", e => { + win.close(); + const templateData = e.getData(); + this._createStudyFromTemplate(templateData); + }); moreOpts.addListener("openService", e => { win.close(); const openServiceData = e.getData(); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js index 58d390f60ec..344533bde32 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js @@ -30,11 +30,13 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { }, events: { + "openStudy": "qx.event.type.Data", + "openTemplate": "qx.event.type.Data", + "openService": "qx.event.type.Data", "updateStudy": "qx.event.type.Data", "updateTemplate": "qx.event.type.Data", "updateService": "qx.event.type.Data", - "publishTemplate": "qx.event.type.Data", - "openService": "qx.event.type.Data" + "publishTemplate": "qx.event.type.Data" }, statics: { @@ -107,24 +109,32 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { flex: 1 }); - if (osparc.utils.Resources.isService(resourceData)) { - const openButton = new qx.ui.form.Button(this.tr("Open")).set({ - appearance: "strong-button", - font: "text-14", - alignX: "right", - height: 24 - }); - this.bind("showOpenButton", openButton, "visibility", { - converter: show => show ? "visible" : "excluded" - }); - openButton.addListener("execute", () => { - this.fireDataEvent("openService", { - key: this.__resourceData["key"], - version: this.__resourceData["version"] - }); - }); - toolbar.add(openButton); - } + const openButton = new qx.ui.form.Button(this.tr("Open")).set({ + appearance: "strong-button", + font: "text-14", + alignX: "right", + height: 35, + width: 70, + center: true + }); + osparc.utils.Utils.setIdToWidget(openButton, "openResource"); + this.bind("showOpenButton", openButton, "visibility", { + converter: show => show ? "visible" : "excluded" + }); + openButton.addListener("execute", () => { + switch (this.__resourceData["resourceType"]) { + case "study": + this.fireDataEvent("openStudy", this.__resourceData); + break; + case "template": + this.fireDataEvent("openTemplate", this.__resourceData); + break; + case "service": + this.fireDataEvent("openService", this.__resourceData); + break; + } + }); + toolbar.add(openButton); this._add(toolbar); }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 1fb861576ee..cee81b0e9bd 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -114,7 +114,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { // set by the url or active study const loadStudyId = osparc.store.Store.getInstance().getCurrentStudyId(); if (loadStudyId) { - this.__startStudyById(loadStudyId); + this._startStudyById(loadStudyId); } else { this.reloadResources(); } @@ -328,11 +328,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { if (!item.isMultiSelectionMode()) { const studyData = this.__getStudyData(item.getUuid(), false); - this.__startStudyById(studyData["uuid"]); + this._startStudyById(studyData["uuid"]); } }, - __startStudyById: function(studyId) { + _startStudyById: function(studyId) { if (!this._checkLoggedIn()) { return; } @@ -733,7 +733,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { osparc.utils.Study.createStudyFromTemplate(templateCopyData, this._loadingPage) .then(studyId => { this._hideLoadingPage(); - this.__startStudyById(studyId); + this._startStudyById(studyId); }) .catch(err => { this._hideLoadingPage(); @@ -748,7 +748,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { osparc.utils.Study.createStudyFromService(key, version, this._resourcesList, newStudyLabel) .then(studyId => { this._hideLoadingPage(); - this.__startStudyById(studyId); + this._startStudyById(studyId); }) .catch(err => { this._hideLoadingPage(); @@ -766,7 +766,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { osparc.utils.Study.createStudyAndPoll(params) .then(studyData => { this._hideLoadingPage(); - this.__startStudyById(studyData["uuid"]); + this._startStudyById(studyData["uuid"]); }) .catch(err => { this._hideLoadingPage(); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js index cc3dbafd852..898bbafeaf9 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js @@ -125,12 +125,12 @@ qx.Class.define("osparc.dashboard.TemplateBrowser", { if (!card.isLocked()) { card.setValue(false); const templateData = this.__getTemplateData(card.getUuid()); - this.__createStudyFromTemplate(templateData); + this._createStudyFromTemplate(templateData); } this.resetSelection(); }, - __createStudyFromTemplate: function(templateData) { + _createStudyFromTemplate: function(templateData) { if (!this._checkLoggedIn()) { return; } From 0abec66e68da10ba33128332bc89827a9ecd6454 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 11:14:40 +0200 Subject: [PATCH 06/17] unused --- tests/e2e/tutorials/tutorialBase.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tests/e2e/tutorials/tutorialBase.js b/tests/e2e/tutorials/tutorialBase.js index 34d23cdfb01..21e47861690 100644 --- a/tests/e2e/tutorials/tutorialBase.js +++ b/tests/e2e/tutorials/tutorialBase.js @@ -212,17 +212,6 @@ class TutorialBase { return this.__services; } - async checkFirstStudyId(studyId) { - await this.__page.waitForSelector('[osparc-test-id="studiesList"]'); - await this.waitFor(5000, "Wait for studies to be loaded"); - const studies = await utils.getVisibleChildrenIDs(this.__page, '[osparc-test-id="studiesList"]'); - console.log("checkFirstStudyId", studyId); - console.log(studies); - if (studyId !== studies[0]) { - throw (studyId + " not found"); - } - } - async waitForOpen() { this.__responsesQueue.addResponseListener(":open"); let resp = null; From 48f0341bbc13f5a4dccb35441d82862abc6d2c5c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 11:30:57 +0200 Subject: [PATCH 07/17] item click open detils view --- .../osparc/dashboard/ResourceBrowserBase.js | 61 ++++++++++--------- .../class/osparc/dashboard/ServiceBrowser.js | 10 +-- .../class/osparc/dashboard/StudyBrowser.js | 4 +- .../class/osparc/dashboard/TemplateBrowser.js | 3 +- tests/e2e/utils/auto.js | 2 + 5 files changed, 45 insertions(+), 35 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index ceeec7ce0b5..c8629991922 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -44,6 +44,8 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { }, statics: { + PAGINATED_STUDIES: 10, + sortStudyList: function(studyList) { const sortByProperty = function(prop) { return function(a, b) { @@ -91,9 +93,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { osparc.utils.Utils.addBorderRightRadius(rButton); } return rButton; - }, - - PAGINATED_STUDIES: 10 + } }, members: { @@ -321,35 +321,38 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { _getMoreOptionsMenuButton: function(resourceData) { const moreOptsButton = new qx.ui.menu.Button(this.tr("More options...")); osparc.utils.Utils.setIdToWidget(moreOptsButton, "moreInfoBtn"); - moreOptsButton.addListener("execute", () => { - const moreOpts = new osparc.dashboard.ResourceMoreOptions(resourceData); - const win = osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); - moreOpts.addListener("updateStudy", e => this._updateStudyData(e.getData())); - moreOpts.addListener("updateTemplate", e => this._updateTemplateData(e.getData())); - moreOpts.addListener("updateService", e => this._updateServiceData(e.getData())); - moreOpts.addListener("publishTemplate", e => { - win.close(); - this.fireDataEvent("publishTemplate", e.getData()); - }); - moreOpts.addListener("openStudy", e => { - win.close(); - const openStudyData = e.getData(); - this._startStudyById(openStudyData["uuid"]); - }); - moreOpts.addListener("openTemplate", e => { - win.close(); - const templateData = e.getData(); - this._createStudyFromTemplate(templateData); - }); - moreOpts.addListener("openService", e => { - win.close(); - const openServiceData = e.getData(); - this._createStudyFromService(openServiceData["key"], openServiceData["version"]); - }); - }, this); + moreOptsButton.addListener("execute", () => this._openDetailsView(resourceData), this); return moreOptsButton; }, + _openDetailsView: function(resourceData) { + const moreOpts = new osparc.dashboard.ResourceMoreOptions(resourceData); + const win = osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); + moreOpts.addListener("updateStudy", e => this._updateStudyData(e.getData())); + moreOpts.addListener("updateTemplate", e => this._updateTemplateData(e.getData())); + moreOpts.addListener("updateService", e => this._updateServiceData(e.getData())); + moreOpts.addListener("publishTemplate", e => { + win.close(); + this.fireDataEvent("publishTemplate", e.getData()); + }); + moreOpts.addListener("openStudy", e => { + win.close(); + const openStudyData = e.getData(); + this._startStudyById(openStudyData["uuid"]); + }); + moreOpts.addListener("openTemplate", e => { + win.close(); + const templateData = e.getData(); + this._createStudyFromTemplate(templateData); + }); + moreOpts.addListener("openService", e => { + win.close(); + const openServiceData = e.getData(); + this._createStudyFromService(openServiceData["key"], openServiceData["version"]); + }); + return moreOpts; + }, + _getShareMenuButton: function(card) { const resourceData = card.getResourceData(); const isCurrentUserOwner = osparc.data.model.Study.canIWrite(resourceData["accessRights"]); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js index 48c0507c8ac..ab4ccde0513 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js @@ -112,8 +112,10 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", { }, __itemClicked: function(card) { - const key = card.getUuid(); - this._createStudyFromService(key, null); + // const key = card.getUuid(); + // this._createStudyFromService(key, null); + const serviceData = card.getResourceData(); + this._openDetailsView(serviceData); this.resetSelection(); }, @@ -195,9 +197,9 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", { // MENU // _populateCardMenu: function(card) { const menu = card.getMenu(); - const studyData = card.getResourceData(); + const serviceData = card.getResourceData(); - const moreInfoButton = this._getMoreOptionsMenuButton(studyData); + const moreInfoButton = this._getMoreOptionsMenuButton(serviceData); if (moreInfoButton) { menu.add(moreInfoButton); } diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index cee81b0e9bd..b518383e6c6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -328,7 +328,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { if (!item.isMultiSelectionMode()) { const studyData = this.__getStudyData(item.getUuid(), false); - this._startStudyById(studyData["uuid"]); + // this._startStudyById(studyData["uuid"]); + this._openDetailsView(studyData); + this.resetSelection(); } }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js index 898bbafeaf9..007e3af8685 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js @@ -125,7 +125,8 @@ qx.Class.define("osparc.dashboard.TemplateBrowser", { if (!card.isLocked()) { card.setValue(false); const templateData = this.__getTemplateData(card.getUuid()); - this._createStudyFromTemplate(templateData); + // this._createStudyFromTemplate(templateData); + this._openDetailsView(templateData); } this.resetSelection(); }, diff --git a/tests/e2e/utils/auto.js b/tests/e2e/utils/auto.js index 43038aef978..3f0f97736a9 100644 --- a/tests/e2e/utils/auto.js +++ b/tests/e2e/utils/auto.js @@ -159,6 +159,7 @@ async function dashboardOpenFirstTemplate(page, templateName) { if (children.length) { const firstChildId = '[osparc-test-id="' + children[0] + '"]'; await utils.waitAndClick(page, firstChildId); + await utils.waitAndClick(page, '[osparc-test-id="openResource"]'); return true; } console.log("Creating New Study from template: no template found"); @@ -191,6 +192,7 @@ async function dashboardOpenService(page, serviceName) { } const firstChildId = '[osparc-test-id="' + children[idx] + '"]'; await utils.waitAndClick(page, firstChildId); + await utils.waitAndClick(page, '[osparc-test-id="openResource"]'); return true; } console.log("Creating New Study from service: no service found"); From c6a81ace4972c5a7e07208a7ffb200d2248bb49c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 11:41:05 +0200 Subject: [PATCH 08/17] label on toolbar --- .../osparc/dashboard/ResourceMoreOptions.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js index 344533bde32..694b9b926c1 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js @@ -97,9 +97,19 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { __servicesUpdatePage: null, __addToolbar: function() { - const toolbar = this.__toolbar = new qx.ui.container.Composite(new qx.ui.layout.HBox(10)); + const toolbar = this.__toolbar = new qx.ui.container.Composite(new qx.ui.layout.HBox(20)); const resourceData = this.__resourceData; + + const title = new qx.ui.basic.Label(resourceData.name).set({ + font: "text-16", + alignY: "middle", + maxWidth: 300, + rich: true, + wrap: true + }); + toolbar.add(title); + if (osparc.utils.Resources.isService(resourceData)) { const serviceVersionSelector = this.__createServiceVersionSelector(); toolbar.add(serviceVersionSelector); @@ -178,11 +188,13 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { }, __createServiceVersionSelector: function() { - const hBox = this.__serviceVersionLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({ + const hBox = this.__serviceVersionLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({ alignY: "middle" })); - const versionLabel = new qx.ui.basic.Label(this.tr("Service Version")); + const versionLabel = new qx.ui.basic.Label(this.tr("Service Version")).set({ + font: "text-14" + }); hBox.add(versionLabel); const versionsBox = new osparc.ui.toolbar.SelectBox(); hBox.add(versionsBox); From bc2e6af7022933d626d55e9c8237676594c3be9e Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 11:45:32 +0200 Subject: [PATCH 09/17] minor --- .../source/class/osparc/dashboard/ResourceMoreOptions.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js index 694b9b926c1..8458e9b13fd 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js @@ -97,7 +97,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { __servicesUpdatePage: null, __addToolbar: function() { - const toolbar = this.__toolbar = new qx.ui.container.Composite(new qx.ui.layout.HBox(20)); + const toolbar = this.__toolbar = new qx.ui.container.Composite(new qx.ui.layout.HBox(40)); const resourceData = this.__resourceData; @@ -188,11 +188,11 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { }, __createServiceVersionSelector: function() { - const hBox = this.__serviceVersionLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({ + const hBox = this.__serviceVersionLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox().set({ alignY: "middle" })); - const versionLabel = new qx.ui.basic.Label(this.tr("Service Version")).set({ + const versionLabel = new qx.ui.basic.Label(this.tr("Version")).set({ font: "text-14" }); hBox.add(versionLabel); From f0f9c9a78cc0615f8e47dcf244957f1aa3655d8f Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 11:49:01 +0200 Subject: [PATCH 10/17] minor fix --- .../client/source/class/osparc/dashboard/ResourceMoreOptions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js index 8458e9b13fd..acad465a025 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js @@ -163,7 +163,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", { __openPage: function(page) { if (page) { - this.setSelection([page]); + this.__detailsView.setSelection([page]); } }, From a7a88817b70caaef31a6cc73795fe9c1ffb8c943 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 11:49:55 +0200 Subject: [PATCH 11/17] "Export" -> "Export cMIS" --- .../client/source/class/osparc/dashboard/StudyBrowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index b518383e6c6..fd07920f09a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -894,7 +894,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __getExportMenuButton: function(studyData) { - const exportButton = new qx.ui.menu.Button(this.tr("Export")); + const exportButton = new qx.ui.menu.Button(this.tr("Export cMIS")); exportButton.exclude(); osparc.utils.DisabledPlugins.isExportDisabled() .then(isDisabled => { From d328e9f041ecd649c5d4953fd4a96708be704438 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 11:50:30 +0200 Subject: [PATCH 12/17] passwordLengthValidator 12 --- .../client/source/class/osparc/auth/core/Utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/auth/core/Utils.js b/services/static-webserver/client/source/class/osparc/auth/core/Utils.js index b0f6d58adbf..57cf8545163 100644 --- a/services/static-webserver/client/source/class/osparc/auth/core/Utils.js +++ b/services/static-webserver/client/source/class/osparc/auth/core/Utils.js @@ -20,9 +20,9 @@ qx.Class.define("osparc.auth.core.Utils", { statics: { passwordLengthValidator: function(value, item) { - const valid = value != null && value.length > 3; + const valid = value != null && value.length > 11; if (!valid) { - item.setInvalidMessage("Please enter a password at with least 4 characters."); + item.setInvalidMessage("Please enter a password at with least 12 characters."); } return valid; }, From 3bcbb89d42255d3c88d02853daefd9774106d55b Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 13:08:21 +0200 Subject: [PATCH 13/17] getOpenMenuButton --- .../osparc/dashboard/ResourceBrowserBase.js | 21 ++++++++++++++----- .../class/osparc/dashboard/ServiceBrowser.js | 6 +++--- .../class/osparc/dashboard/StudyBrowser.js | 8 ++++--- .../class/osparc/dashboard/TemplateBrowser.js | 16 +++++++------- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index c8629991922..b3c04318b00 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -318,11 +318,22 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { throw new Error("Abstract method called!"); }, - _getMoreOptionsMenuButton: function(resourceData) { - const moreOptsButton = new qx.ui.menu.Button(this.tr("More options...")); - osparc.utils.Utils.setIdToWidget(moreOptsButton, "moreInfoBtn"); - moreOptsButton.addListener("execute", () => this._openDetailsView(resourceData), this); - return moreOptsButton; + _getOpenMenuButton: function(resourceData) { + const openButton = new qx.ui.menu.Button(this.tr("Open")); + openButton.addListener("execute", () => { + switch (resourceData["resourceType"]) { + case "study": + this._startStudyById(resourceData["uuid"]); + break; + case "template": + this._createStudyFromTemplate(resourceData); + break; + case "service": + this._createStudyFromService(resourceData["key"], resourceData["version"]); + break; + } + }, this); + return openButton; }, _openDetailsView: function(resourceData) { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js index ab4ccde0513..3dc50a686a5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js @@ -199,9 +199,9 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", { const menu = card.getMenu(); const serviceData = card.getResourceData(); - const moreInfoButton = this._getMoreOptionsMenuButton(serviceData); - if (moreInfoButton) { - menu.add(moreInfoButton); + const openButton = this._getOpenMenuButton(serviceData); + if (openButton) { + menu.add(openButton); } }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index fd07920f09a..e9b2fa4f6d0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -804,6 +804,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const writeAccess = osparc.data.model.Study.canIWrite(studyData["accessRights"]); const deleteAccess = osparc.data.model.Study.canIDelete(studyData["accessRights"]); + const openButton = this._getOpenMenuButton(studyData); + if (openButton) { + menu.add(openButton); + } + if (writeAccess) { const renameStudyButton = this.__getRenameStudyMenuButton(studyData); menu.add(renameStudyButton); @@ -830,9 +835,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const exportButton = this.__getExportMenuButton(studyData); menu.add(exportButton); - const moreOptionsButton = this._getMoreOptionsMenuButton(studyData); - menu.add(moreOptionsButton); - if (deleteAccess) { const deleteButton = this.__getDeleteStudyMenuButton(studyData, false); if (deleteButton) { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js index 007e3af8685..45d289d6bb6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js @@ -260,14 +260,19 @@ qx.Class.define("osparc.dashboard.TemplateBrowser", { // MENU // _populateCardMenu: function(card) { const menu = card.getMenu(); - const studyData = card.getResourceData(); + const templateData = card.getResourceData(); - const editButton = this.__getEditTemplateMenuButton(studyData); + const editButton = this.__getEditTemplateMenuButton(templateData); if (editButton) { menu.add(editButton); menu.addSeparator(); } + const openButton = this._getOpenMenuButton(templateData); + if (openButton) { + menu.add(openButton); + } + const shareButton = this._getShareMenuButton(card); if (shareButton) { menu.add(shareButton); @@ -278,12 +283,7 @@ qx.Class.define("osparc.dashboard.TemplateBrowser", { menu.add(tagsButton); } - const moreInfoButton = this._getMoreOptionsMenuButton(studyData); - if (moreInfoButton) { - menu.add(moreInfoButton); - } - - const deleteButton = this.__getDeleteTemplateMenuButton(studyData); + const deleteButton = this.__getDeleteTemplateMenuButton(templateData); if (deleteButton && editButton) { menu.addSeparator(); menu.add(deleteButton); From 87d153037131839a22ddfd87f0918e41dc7b871e Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 13:29:41 +0200 Subject: [PATCH 14/17] minor --- .../class/osparc/desktop/organizations/TemplatesList.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/TemplatesList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/TemplatesList.js index 8a6c2bb3b13..88c927f43e0 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/TemplatesList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/TemplatesList.js @@ -92,7 +92,9 @@ qx.Class.define("osparc.desktop.organizations.TemplatesList", { const templateData = templates.find(t => t.uuid === templateId); if (templateData) { templateData["resourceType"] = "template"; - const moreOpts = new osparc.dashboard.ResourceMoreOptions(templateData); + const moreOpts = new osparc.dashboard.ResourceMoreOptions(templateData).set({ + showOpenButton: false + }); osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); } }); From f0daad7808486ca0ed48e3fffa44f169aba58817 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 14:03:10 +0200 Subject: [PATCH 15/17] minors --- .../class/osparc/navigation/NavigationBar.js | 10 ++++---- .../class/osparc/navigation/UserMenuButton.js | 24 +++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js b/services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js index f69f6c6e077..c07539db6df 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js +++ b/services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js @@ -138,7 +138,7 @@ qx.Class.define("osparc.navigation.NavigationBar", { this.getChildControl("manual"); this.getChildControl("feedback"); this.getChildControl("theme-switch"); - this.getChildControl("register-button"); + this.getChildControl("log-in-button"); this.getChildControl("user-menu"); }, @@ -313,8 +313,8 @@ qx.Class.define("osparc.navigation.NavigationBar", { control.set(this.self().BUTTON_OPTIONS); this.getChildControl("right-items").add(control); break; - case "register-button": { - control = this.__createRegisterBtn().set({ + case "log-in-button": { + control = this.__createLoginBtn().set({ visibility: "excluded" }); control.set(this.self().BUTTON_OPTIONS); @@ -398,8 +398,8 @@ qx.Class.define("osparc.navigation.NavigationBar", { return menuButton; }, - __createRegisterBtn: function() { - const registerButton = new qx.ui.form.Button(this.tr("Register"), "@FontAwesome5Solid/edit/14"); + __createLoginBtn: function() { + const registerButton = new qx.ui.form.Button(this.tr("Log in"), "@FontAwesome5Solid/edit/14"); registerButton.addListener("execute", () => window.open(window.location.href, "_blank")); return registerButton; }, diff --git a/services/static-webserver/client/source/class/osparc/navigation/UserMenuButton.js b/services/static-webserver/client/source/class/osparc/navigation/UserMenuButton.js index 1e55291dfdd..ee73fa5dbe4 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/UserMenuButton.js +++ b/services/static-webserver/client/source/class/osparc/navigation/UserMenuButton.js @@ -82,8 +82,8 @@ qx.Class.define("osparc.navigation.UserMenuButton", { control = new osparc.ui.switch.ThemeSwitcherMenuBtn(); this.getMenu().add(control); break; - case "register": - control = new qx.ui.menu.Button(this.tr("Register")); + case "log-in": + control = new qx.ui.menu.Button(this.tr("Log in")); control.addListener("execute", () => window.open(window.location.href, "_blank")); this.getMenu().add(control); break; @@ -135,8 +135,8 @@ qx.Class.define("osparc.navigation.UserMenuButton", { control.addListener("execute", () => osparc.product.AboutProduct.getInstance().open()); this.getMenu().add(control); break; - case "logout": - control = new qx.ui.menu.Button(this.tr("Logout")); + case "log-out": + control = new qx.ui.menu.Button(this.tr("Log out")); control.addListener("execute", () => qx.core.Init.getApplication().logout()); osparc.utils.Utils.setIdToWidget(control, "userMenuLogoutBtn"); this.getMenu().add(control); @@ -150,7 +150,7 @@ qx.Class.define("osparc.navigation.UserMenuButton", { const authData = osparc.auth.Data.getInstance(); if (["anonymous", "guest"].includes(authData.getRole())) { - this.getChildControl("register"); + this.getChildControl("log-in"); } else { this.getChildControl("preferences"); this.getChildControl("organizations"); @@ -167,8 +167,10 @@ qx.Class.define("osparc.navigation.UserMenuButton", { this.getChildControl("about-product"); } this.getChildControl("license"); - this.getMenu().addSeparator(); - this.getChildControl("logout"); + if (!["anonymous", "guest"].includes(authData.getRole())) { + this.getMenu().addSeparator(); + this.getChildControl("log-out"); + } }, populateMenuCompact: function() { @@ -177,7 +179,7 @@ qx.Class.define("osparc.navigation.UserMenuButton", { .then(async () => { const authData = osparc.auth.Data.getInstance(); if (["anonymous", "guest"].includes(authData.getRole())) { - this.getChildControl("register"); + this.getChildControl("log-in"); } else { this.getChildControl("preferences"); this.getChildControl("organizations"); @@ -199,8 +201,10 @@ qx.Class.define("osparc.navigation.UserMenuButton", { this.getChildControl("about-product"); } this.getChildControl("license"); - this.getMenu().addSeparator(); - this.getChildControl("logout"); + if (!["anonymous", "guest"].includes(authData.getRole())) { + this.getMenu().addSeparator(); + this.getChildControl("log-out"); + } }); }, From 5e4246cbe3b2aa77e8a2ef90f22597f35515493d Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 14 Jun 2023 16:51:55 +0200 Subject: [PATCH 16/17] minor --- .../client/source/class/osparc/auth/core/Utils.js | 2 +- tests/e2e/utils/utils.js | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/auth/core/Utils.js b/services/static-webserver/client/source/class/osparc/auth/core/Utils.js index 57cf8545163..9c01ea8dc37 100644 --- a/services/static-webserver/client/source/class/osparc/auth/core/Utils.js +++ b/services/static-webserver/client/source/class/osparc/auth/core/Utils.js @@ -20,7 +20,7 @@ qx.Class.define("osparc.auth.core.Utils", { statics: { passwordLengthValidator: function(value, item) { - const valid = value != null && value.length > 11; + const valid = (value != null) && (value.length > 11); if (!valid) { item.setInvalidMessage("Please enter a password at with least 12 characters."); } diff --git a/tests/e2e/utils/utils.js b/tests/e2e/utils/utils.js index f61a6e62902..1cbc2e0df92 100644 --- a/tests/e2e/utils/utils.js +++ b/tests/e2e/utils/utils.js @@ -180,10 +180,21 @@ function getUserAndPass(args) { return userPass; } + +function generateString(length) { + const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let result = ""; + const charactersLength = characters.length; + for (let i=0; i Date: Thu, 15 Jun 2023 10:04:17 +0200 Subject: [PATCH 17/17] fix e2e --- tests/e2e/utils/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/utils/utils.js b/tests/e2e/utils/utils.js index 1cbc2e0df92..a2b4d8db671 100644 --- a/tests/e2e/utils/utils.js +++ b/tests/e2e/utils/utils.js @@ -182,7 +182,7 @@ function getUserAndPass(args) { function generateString(length) { - const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + const characters = "abcdefghijklmnopqrstuvwxyz0123456789"; let result = ""; const charactersLength = characters.length; for (let i=0; i