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..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,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; }, 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..b3c04318b00 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: { @@ -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!"); }, @@ -310,32 +318,50 @@ 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", () => { - 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 - ); - 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("openService", e => { - win.close(); - const openServiceData = e.getData(); - this._createStudyFromService(openServiceData["key"], openServiceData["version"]); - }); + _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 moreOptsButton; + return openButton; + }, + + _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) { 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..acad465a025 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceMoreOptions.js @@ -16,36 +16,65 @@ ************************************************************************ */ 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: { + "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: { WIDTH: 700, - HEIGHT: 660 + HEIGHT: 700, + + 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; + } }, properties: { @@ -59,17 +88,82 @@ 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(40)); + + 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); + } + + toolbar.add(new qx.ui.core.Spacer(), { + flex: 1 + }); + + 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); + }, + + __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]); + this.__detailsView.setSelection([page]); } }, @@ -94,13 +188,15 @@ 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().set({ alignY: "middle" })); - const versionLabel = new qx.ui.basic.Label(this.tr("Service Version")); + const versionLabel = new qx.ui.basic.Label(this.tr("Version")).set({ + font: "text-14" + }); 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 @@ -108,13 +204,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]); } }); }); @@ -139,14 +234,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 @@ -163,56 +260,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"); @@ -245,25 +305,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; }, @@ -313,7 +355,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; }, @@ -348,7 +390,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; }, @@ -373,7 +415,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; @@ -397,7 +439,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; }, @@ -419,7 +461,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; }, @@ -436,7 +478,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; }, @@ -453,7 +495,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; 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..3dc50a686a5 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,11 +197,11 @@ 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); - 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 f0994d6e057..15c7fc25d8e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -121,7 +121,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(); } @@ -335,11 +335,13 @@ 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(); } }, - __startStudyById: function(studyId) { + _startStudyById: function(studyId) { if (!this._checkLoggedIn()) { return; } @@ -740,7 +742,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(); @@ -755,7 +757,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(); @@ -773,7 +775,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(); @@ -809,6 +811,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); @@ -835,9 +842,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) { @@ -899,7 +903,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 => { 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..45d289d6bb6 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,13 @@ 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(); }, - __createStudyFromTemplate: function(templateData) { + _createStudyFromTemplate: function(templateData) { if (!this._checkLoggedIn()) { return; } @@ -259,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); @@ -277,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); 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..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,14 +92,10 @@ 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 title = this.tr("Options"); - osparc.ui.window.Window.popUpInWindow( - moreOpts, - title, - osparc.dashboard.ResourceMoreOptions.WIDTH, - osparc.dashboard.ResourceMoreOptions.HEIGHT - ); + const moreOpts = new osparc.dashboard.ResourceMoreOptions(templateData).set({ + showOpenButton: false + }); + osparc.dashboard.ResourceMoreOptions.popUpInWindow(moreOpts); } }); }); 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"); + } }); }, 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; 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"); diff --git a/tests/e2e/utils/utils.js b/tests/e2e/utils/utils.js index f61a6e62902..a2b4d8db671 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 = "abcdefghijklmnopqrstuvwxyz0123456789"; + let result = ""; + const charactersLength = characters.length; + for (let i=0; i