diff --git a/services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js b/services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js index e4cc5b1a25a..397f6ad7a88 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js @@ -18,7 +18,7 @@ /** * Widget containing a TabView including: * - StudyBrowser - * - TemplateBrowser + * - TutorialBrowser * - AppBrowser * - DataBrowser * @@ -82,7 +82,7 @@ qx.Class.define("osparc.dashboard.Dashboard", { members: { __studyBrowser: null, - __templateBrowser: null, + __tutorialBrowser: null, __appBrowser: null, __dataBrowser: null, @@ -90,8 +90,8 @@ qx.Class.define("osparc.dashboard.Dashboard", { return this.__studyBrowser; }, - getTemplateBrowser: function() { - return this.__templateBrowser; + getTutorialBrowser: function() { + return this.__tutorialBrowser; }, getAppBrowser: function() { @@ -104,10 +104,7 @@ qx.Class.define("osparc.dashboard.Dashboard", { const tabs = [{ id: "studiesTab", buttonId: "studiesTabBtn", - label: osparc.product.Utils.getStudyAlias({ - plural: true, - allUpperCase: true - }), + label: this.tr("PROJECTS"), icon: "@FontAwesome5Solid/file/"+tabIconSize, buildLayout: this.__createStudyBrowser }]; @@ -115,12 +112,9 @@ qx.Class.define("osparc.dashboard.Dashboard", { tabs.push({ id: "templatesTab", buttonId: "templatesTabBtn", - label: osparc.product.Utils.getTemplateAlias({ - plural: true, - allUpperCase: true - }), + label: this.tr("TUTORIALS"), icon: "@FontAwesome5Solid/copy/"+tabIconSize, - buildLayout: this.__createTemplateBrowser + buildLayout: this.__createTutorialBrowser }); } if (permissions.canDo("dashboard.services.read")) { @@ -228,8 +222,8 @@ qx.Class.define("osparc.dashboard.Dashboard", { return studiesView; }, - __createTemplateBrowser: function() { - const templatesView = this.__templateBrowser = new osparc.dashboard.TemplateBrowser(); + __createTutorialBrowser: function() { + const templatesView = this.__tutorialBrowser = new osparc.dashboard.TutorialBrowser(); return templatesView; }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/NewPlusMenu.js b/services/static-webserver/client/source/class/osparc/dashboard/NewPlusMenu.js index f75eb12cedf..92f4e9b0ca0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/NewPlusMenu.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/NewPlusMenu.js @@ -232,7 +232,7 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", { } if (permissions.canDo("dashboard.services.read")) { - const servicesButton = this.self().createMenuButton("@FontAwesome5Solid/cog/16", this.tr("Services...")); + const servicesButton = this.self().createMenuButton("@FontAwesome5Solid/cog/16", this.tr("Apps...")); servicesButton.addListener("execute", () => this.fireDataEvent("changeTab", "appsTab"), this); moreMenu.add(servicesButton); } diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js index 29a98376cf7..675986427ac 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js @@ -29,11 +29,13 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { this.__tagButtons = []; this.__appTypeButtons = []; - this._setLayout(new qx.ui.layout.VBox(15)); + this._setLayout(new qx.ui.layout.VBox(10)); this.__buildLayout(); }, events: { + "templatesContext": "qx.event.type.Event", + "publicContext": "qx.event.type.Event", "trashContext": "qx.event.type.Event", "changeTab": "qx.event.type.Data", "trashStudyRequested": "qx.event.type.Data", @@ -46,6 +48,8 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { members: { __resourceType: null, __workspacesAndFoldersTree: null, + __templatesButton: null, + __publicProjectsButton: null, __trashButton: null, __sharedWithButtons: null, __tagButtons: null, @@ -56,6 +60,8 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { switch (this.__resourceType) { case "study": { this._add(this.__createWorkspacesAndFoldersTree()); + this._add(this.__createTemplates()); + this._add(this.__createPublicProjects()); this._add(this.__createTrashBin()); this._add(filtersSpacer); const scrollView = new qx.ui.container.Scroll(); @@ -90,6 +96,8 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { }); this.__workspacesAndFoldersTree.contextChanged(context); + this.__templatesButton.setValue(context === "templates"); + this.__publicProjectsButton.setValue(context === "public"); this.__trashButton.setValue(context === "trash"); }, @@ -116,6 +124,40 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { }, /* /WORKSPACES AND FOLDERS */ + __createTemplates: function() { + const templatesButton = this.__templatesButton = new qx.ui.toolbar.RadioButton().set({ + value: false, + appearance: "filter-toggle-button", + label: this.tr("Templates"), + icon: "@FontAwesome5Solid/copy/16", + paddingLeft: 10, // align it with the context + }); + templatesButton.addListener("changeValue", e => { + const templatesEnabled = e.getData(); + if (templatesEnabled) { + this.fireEvent("templatesContext"); + } + }); + return templatesButton; + }, + + __createPublicProjects: function() { + const publicProjectsButton = this.__publicProjectsButton = new qx.ui.toolbar.RadioButton().set({ + value: false, + appearance: "filter-toggle-button", + label: this.tr("Public Projects"), + icon: "@FontAwesome5Solid/globe/16", + paddingLeft: 10, // align it with the context + }); + publicProjectsButton.addListener("changeValue", e => { + const templatesEnabled = e.getData(); + if (templatesEnabled) { + this.fireEvent("publicContext"); + } + }); + return publicProjectsButton; + }, + /* TRASH BIN */ __createTrashBin: function() { const trashButton = this.__trashButton = new qx.ui.toolbar.RadioButton().set({ diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index 6ca49e333c8..10dec655675 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -34,9 +34,11 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { if (resourceType === "study") { const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.CardContainer(); + this.__workspacesContainer.exclude(); this._add(workspacesContainer); const foldersContainer = this.__foldersContainer = new osparc.dashboard.CardContainer(); + this.__foldersContainer.exclude(); this._add(foldersContainer); } @@ -294,26 +296,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.__groupedContainersList = []; }, - __addFoldersContainer: function() { - // add foldersContainer dynamically - [ - "addChildWidget", - "removeChildWidget" - ].forEach(ev => { - this.__foldersContainer.addListener(ev, () => { - const children = this.__foldersContainer.getChildren(); - if (children.length && !children.includes(this.__foldersContainer)) { - this._addAt(this.__foldersContainer, 0); - return; - } - if (children.length === 0 && children.includes(this.__foldersContainer)) { - this._remove(this.__foldersContainer); - return; - } - }) - }); - }, - __rebuildLayout: function(resourceType) { this.__cleanAll(); if (this.getGroupBy()) { @@ -386,6 +368,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { reloadWorkspaces: function() { if (this.__workspacesContainer) { this.__workspacesContainer.removeAll(); + this.__workspacesContainer.exclude(); } let workspacesCards = []; this.__workspacesList.forEach(workspaceData => workspacesCards.push(this.__workspaceToCard(workspaceData))); @@ -394,11 +377,13 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { addNewWorkspaceCard: function(newWorkspaceCard) { this.__workspacesContainer.addAt(newWorkspaceCard, 0); + this.__workspacesContainer.show(); }, __workspaceToCard: function(workspaceData) { const card = this.__createWorkspaceCard(workspaceData); this.__workspacesContainer.add(card); + this.__workspacesContainer.show(); return card; }, @@ -423,6 +408,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { reloadFolders: function() { if (this.__foldersContainer) { this.__foldersContainer.removeAll(); + this.__foldersContainer.exclude(); } let folderCards = []; this.__foldersList.forEach(folderData => folderCards.push(this.__folderToCard(folderData))); @@ -431,11 +417,13 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { addNewFolderCard: function(newFolderCard) { this.__foldersContainer.addAt(newFolderCard, 0); + this.__foldersContainer.show(); }, __folderToCard: function(folderData) { const card = this.__createFolderCard(folderData); this.__foldersContainer.add(card); + this.__foldersContainer.show(); return card; }, 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 e08c0358406..7dfce9110fd 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -49,7 +49,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { properties: { currentContext: { - check: ["studiesAndFolders", "workspaces", "search", "trash"], + check: [ + "studiesAndFolders", + "workspaces", + "search", + "templates", + "public", + "trash", + ], nullable: false, init: "studiesAndFolders", event: "changeCurrentContext" @@ -157,7 +164,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __reloadWorkspaces: function() { if ( !osparc.auth.Manager.getInstance().isLoggedIn() || - this.getCurrentContext() === "studiesAndFolders" || + ["studiesAndFolders", "templates", "public"].includes(this.getCurrentContext()) || this.__loadingWorkspaces ) { return; @@ -201,7 +208,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __reloadFolders: function() { if ( !osparc.auth.Manager.getInstance().isLoggedIn() || - this.getCurrentContext() === "workspaces" || + ["workspaces", "templates", "public"].includes(this.getCurrentContext()) || this.__loadingFolders ) { return; @@ -269,8 +276,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { return; } - const studies = resp["data"]; - this.__addStudiesToList(studies); + if (["templates", "public"].includes(this.getCurrentContext())) { + const templates = resp["data"]; + templates.forEach(template => template["resourceType"] = "template"); + this.__addResourcesToList(templates); + } else { + const studies = resp["data"]; + studies.forEach(study => study["resourceType"] = "study"); + this.__addResourcesToList(studies); + } if (this._resourcesContainer.getFlatList()) { this._resourcesContainer.getFlatList().nextRequest = resp["_links"]["next"]; } @@ -326,9 +340,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this._reloadCards(); }, - __addStudiesToList: function(studiesList) { - studiesList.forEach(study => study["resourceType"] = "study"); - studiesList.forEach(study => { + __addResourcesToList: function(resourcesList) { + resourcesList.forEach(study => { const idx = this._resourcesList.findIndex(std => std["uuid"] === study["uuid"]); if (idx === -1) { this._resourcesList.push(study); @@ -336,7 +349,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }); this.__reloadNewCards(); - studiesList.forEach(study => { + resourcesList.forEach(study => { const state = study["state"]; if (state && "locked" in state && state["locked"]["value"] && state["locked"]["status"] === "CLOSING") { // websocket might have already notified that the state was closed. @@ -617,7 +630,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { card.addListener("tap", e => this.__studyCardClicked(card, e.getNativeEvent().shiftKey), this); this._populateCardMenu(card); - if (this.getCurrentContext() !== "trash") { + if (["studiesAndFolders", "search"].includes(this.getCurrentContext())) { this.__attachDragHandlers(card); } }); @@ -711,7 +724,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __didContextChange: function(reqParams) { // not needed for the comparison - delete reqParams["type"]; + // delete reqParams["type"]; delete reqParams["limit"]; delete reqParams["offset"]; delete reqParams["filters"]; @@ -772,6 +785,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { case "studiesAndFolders": requestParams.workspaceId = this.getCurrentWorkspaceId(); requestParams.folderId = this.getCurrentFolderId(); + requestParams.type = "user"; + break; + case "templates": + requestParams.type = "template"; + break; + case "public": + requestParams.type = "template"; break; case "search": { // Use the ``search`` functionality only if the user types some text @@ -811,14 +831,20 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { let request = null; switch (this.getCurrentContext()) { - case "trash": - request = osparc.data.Resources.fetch("studies", "getPageTrashed", params, options); + case "studiesAndFolders": + request = osparc.data.Resources.fetch("studies", "getPage", params, options); break; case "search": request = osparc.data.Resources.fetch("studies", "getPageSearch", params, options); break; - case "studiesAndFolders": - request = osparc.data.Resources.fetch("studies", "getPage", params, options); + case "templates": + request = osparc.store.Templates.fetchTemplatesPaginated(params, options); + break; + case "public": + request = osparc.store.Templates.fetchTemplatesPublicPaginated(params, options); + break; + case "trash": + request = osparc.data.Resources.fetch("studies", "getPageTrashed", params, options); break; } return request; @@ -1040,9 +1066,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { } }, this); - this._resourceFilter.addListener("trashContext", () => { - this._changeContext("trash"); - }); + this._resourceFilter.addListener("templatesContext", () => this._changeContext("templates")); + this._resourceFilter.addListener("publicContext", () => this._changeContext("public")); + this._resourceFilter.addListener("trashContext", () => this._changeContext("trash")); this._searchBarFilter.addListener("filterChanged", e => { const filterData = e.getData(); @@ -1083,29 +1109,45 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this._resourcesContainer.setResourcesToList(this._resourcesList); this._resourcesContainer.reloadCards("studies"); - this._toolbar.show(); switch (this.getCurrentContext()) { case "studiesAndFolders": this._searchBarFilter.resetFilters(); + this._toolbar.show(); this.__reloadFolders(); this._loadingResourcesBtn.setFetching(false); this.invalidateStudies(); this.__reloadStudies(); break; case "workspaces": - this._toolbar.exclude(); this._searchBarFilter.resetFilters(); + this._toolbar.exclude(); this.__reloadWorkspaces(); break; case "search": + this._toolbar.show(); this.__reloadWorkspaces(); this.__reloadFolders(); this._loadingResourcesBtn.setFetching(false); this.invalidateStudies(); this.__reloadStudies(); break; + case "templates": + this._searchBarFilter.resetFilters(); + this._toolbar.show(); + this._loadingResourcesBtn.setFetching(false); + this.invalidateStudies(); + this.__reloadStudies(); + break; + case "public": + this._searchBarFilter.resetFilters(); + this._toolbar.show(); + this._loadingResourcesBtn.setFetching(false); + this.invalidateStudies(); + this.__reloadStudies(); + break; case "trash": this._searchBarFilter.resetFilters(); + this._toolbar.show(); this.__reloadWorkspaces(); this.__reloadFolders(); this._loadingResourcesBtn.setFetching(false); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index ec9ef69314e..d4c99138587 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -82,7 +82,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { }, statics: { - HEIGHT: 36, + HEIGHT: 32, POS: { ICON: 0, TITLE: 1, @@ -288,7 +288,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { workspace.bind("accessRights", this, "accessRights"); workspace.bind("myAccessRights", this, "myAccessRights"); } else { - this.__setIcon("@FontAwesome5Solid/home/30"); + this.__setIcon("@FontAwesome5Solid/home/24"); title.setValue(this.tr("My Workspace")); } break; @@ -301,8 +301,18 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { this.__setIcon("@FontAwesome5Solid/search/24"); title.setValue(this.tr("Search results")); break; + case "templates": { + this.__setIcon("@FontAwesome5Solid/copy/24"); + title.setValue(this.tr("Templates")); + break; + } + case "public": { + this.__setIcon("@FontAwesome5Solid/globe/24"); + title.setValue(this.tr("Public Projects")); + break; + } case "trash": { - this.__setIcon("@FontAwesome5Solid/trash/20"); + this.__setIcon("@FontAwesome5Solid/trash/24"); title.setValue(this.tr("Recently Deleted")); const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays(); description.set({ diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js similarity index 99% rename from services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js rename to services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js index 483fa3fa4cc..a5c39445154 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js @@ -15,7 +15,7 @@ ************************************************************************ */ -qx.Class.define("osparc.dashboard.TemplateBrowser", { +qx.Class.define("osparc.dashboard.TutorialBrowser", { extend: osparc.dashboard.ResourceBrowserBase, construct: function(templateType = null) { diff --git a/services/static-webserver/client/source/class/osparc/data/Job.js b/services/static-webserver/client/source/class/osparc/data/Job.js index 34b7d1ec190..8b0733da7ca 100644 --- a/services/static-webserver/client/source/class/osparc/data/Job.js +++ b/services/static-webserver/client/source/class/osparc/data/Job.js @@ -91,15 +91,16 @@ qx.Class.define("osparc.data.Job", { statics: { STATUS_LABELS: { "UNKNOWN": "Unknown", - "NOT_STARTED": "Not Started", - "PUBLISHED": "Published", - "PENDING": "Pending", + "NOT_STARTED": "Unknown", + "PUBLISHED": "Queued", + "PENDING": "Queued", "RUNNING": "Running", - "SUCCESS": "Success", + "STARTED": "Running", + "SUCCESS": "Finished", "FAILED": "Failed", "ABORTED": "Aborted", - "WAITING_FOR_RESOURCES": "Waiting for Resources", - "WAITING_FOR_CLUSTER": "Waiting for Cluster", + "WAITING_FOR_RESOURCES": "Hardware is ready, installing solvers", + "WAITING_FOR_CLUSTER": "Creating your personal computing hardware", }, }, diff --git a/services/static-webserver/client/source/class/osparc/data/Resources.js b/services/static-webserver/client/source/class/osparc/data/Resources.js index dcffb873828..eeba96b1c00 100644 --- a/services/static-webserver/client/source/class/osparc/data/Resources.js +++ b/services/static-webserver/client/source/class/osparc/data/Resources.js @@ -595,7 +595,11 @@ qx.Class.define("osparc.data.Resources", { getPage: { method: "GET", url: statics.API + "/projects?type=template&offset={offset}&limit={limit}" - } + }, + getPageSorted: { + method: "GET", + url: statics.API + "/projects?type=template&offset={offset}&limit={limit}&order_by={orderBy}" + }, } }, /* diff --git a/services/static-webserver/client/source/class/osparc/desktop/MainPage.js b/services/static-webserver/client/source/class/osparc/desktop/MainPage.js index 2cf130e9871..31b44357d31 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/MainPage.js +++ b/services/static-webserver/client/source/class/osparc/desktop/MainPage.js @@ -26,7 +26,7 @@ * - Main Stack * - Dashboard Stack * - StudyBrowser - * - TemplateBrowser + * - TutorialBrowser * - AppBrowser * - DataManager * - StudyEditor @@ -248,10 +248,10 @@ qx.Class.define("osparc.desktop.MainPage", { const pollTasks = osparc.store.PollTasks.getInstance(); pollTasks.createPollingTask(fetchPromise) .then(task => { - const templateBrowser = this.__dashboard.getTemplateBrowser(); + const tutorialBrowser = this.__dashboard.getTutorialBrowser(); const appBrowser = this.__dashboard.getAppBrowser(); - if (templateBrowser) { - templateBrowser.taskToTemplateReceived(task, studyName); + if (tutorialBrowser) { + tutorialBrowser.taskToTemplateReceived(task, studyName); } task.addListener("resultReceived", e => { const templateData = e.getData(); @@ -262,8 +262,8 @@ qx.Class.define("osparc.desktop.MainPage", { studyUI["templateType"] = templateType; osparc.store.Study.patchStudyData(templateData, "ui", studyUI) .then(() => { - if (templateBrowser) { - templateBrowser.reloadResources(); + if (tutorialBrowser) { + tutorialBrowser.reloadResources(); } if (appBrowser) { // OM: reload hypertools only diff --git a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js index 9110b9ca814..55a98858f60 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js @@ -597,7 +597,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { } }; osparc.data.Resources.fetch("runPipeline", "startPipeline", params) - .then(() => this.__onPipelineSubmitted()) + .then(resp => this.__onPipelineSubmitted(resp)) .catch(err => { let msg = err.message; const errStatus = err.status; @@ -630,10 +630,9 @@ qx.Class.define("osparc.desktop.StudyEditor", { return true; }, - __onPipelineSubmitted: function(e) { - const resp = e.getTarget().getResponse(); - const pipelineId = resp.data["pipeline_id"]; - const iterationRefIds = resp.data["ref_ids"]; + __onPipelineSubmitted: function(response) { + const pipelineId = response["pipeline_id"]; + const iterationRefIds = response["ref_ids"]; this.getStudyLogger().debug(null, "Pipeline ID " + pipelineId); const notGood = [null, undefined, -1]; if (notGood.includes(pipelineId)) { diff --git a/services/static-webserver/client/source/class/osparc/info/ServiceLarge.js b/services/static-webserver/client/source/class/osparc/info/ServiceLarge.js index 39d85b590d9..07f5f509965 100644 --- a/services/static-webserver/client/source/class/osparc/info/ServiceLarge.js +++ b/services/static-webserver/client/source/class/osparc/info/ServiceLarge.js @@ -391,6 +391,12 @@ qx.Class.define("osparc.info.ServiceLarge", { }, __createThumbnail: function(maxWidth, maxHeight = 160) { + // make sure maxs are not larger than the mins + const minWidth = Math.max(120, maxWidth); + const minHeight = Math.max(139, maxHeight); + maxWidth = Math.max(minWidth, maxWidth); + maxHeight = Math.max(minHeight, maxHeight); + const serviceData = this.getService(); const thumbnail = osparc.info.Utils.createThumbnail(maxWidth, maxHeight); if (serviceData["thumbnail"]) { @@ -403,8 +409,8 @@ qx.Class.define("osparc.info.ServiceLarge", { source: noThumbnail }); thumbnail.getChildControl("image").set({ - minWidth: Math.max(120, maxWidth), - minHeight: Math.max(139, maxHeight) + minWidth, + minHeight, }); } return thumbnail; diff --git a/services/static-webserver/client/source/class/osparc/jobs/RunsTable.js b/services/static-webserver/client/source/class/osparc/jobs/RunsTable.js index 9d16c322537..81244349a29 100644 --- a/services/static-webserver/client/source/class/osparc/jobs/RunsTable.js +++ b/services/static-webserver/client/source/class/osparc/jobs/RunsTable.js @@ -150,22 +150,38 @@ qx.Class.define("osparc.jobs.RunsTable", { break; } case "cancel": { + this.__cancelRun(rowData); + break; + } + default: + console.warn(`Unknown action: ${action}`); + } + }, + + __cancelRun: function(rowData) { + const msg = this.tr("Are you sure you want to cancel") + " " + rowData["projectName"] + "?"; + const confirmationWin = new osparc.ui.window.Confirmation(msg).set({ + caption: this.tr("Cancel Run"), + confirmText: this.tr("Cancel"), + confirmAction: "delete", + }); + confirmationWin.getChildControl("cancel-button").set({ + label: this.tr("Close"), + }); + confirmationWin.center(); + confirmationWin.open(); + confirmationWin.addListener("close", () => { + if (confirmationWin.getConfirmed()) { const params = { url: { "studyId": rowData["projectUuid"], }, }; osparc.data.Resources.fetch("runPipeline", "stopPipeline", params) - .then(() => { - const msg = this.tr("Stopping pipeline"); - osparc.FlashMessenger.logAs(msg, "INFO"); - }) + .then(() => osparc.FlashMessenger.logAs(this.tr("Stopping pipeline"), "INFO")) .catch(err => osparc.FlashMessenger.logError(err)); - break; } - default: - console.warn(`Unknown action: ${action}`); - } + }, this); }, } }); diff --git a/services/static-webserver/client/source/class/osparc/product/Utils.js b/services/static-webserver/client/source/class/osparc/product/Utils.js index 3e8994f66a9..605a9db61dd 100644 --- a/services/static-webserver/client/source/class/osparc/product/Utils.js +++ b/services/static-webserver/client/source/class/osparc/product/Utils.js @@ -43,16 +43,10 @@ qx.Class.define("osparc.product.Utils", { getStudyAlias: function(options = {}) { let alias = null; - if (this.getProductName().includes("s4l")) { - if (options.plural) { - alias = qx.locale.Manager.tr("projects"); - } else { - alias = qx.locale.Manager.tr("project"); - } - } else if (options.plural) { - alias = qx.locale.Manager.tr("studies"); + if (options.plural) { + alias = qx.locale.Manager.tr("projects"); } else { - alias = qx.locale.Manager.tr("study"); + alias = qx.locale.Manager.tr("project"); } if (options.firstUpperCase) { diff --git a/services/static-webserver/client/source/class/osparc/store/Store.js b/services/static-webserver/client/source/class/osparc/store/Store.js index 8231404bac9..cbca9f8a00b 100644 --- a/services/static-webserver/client/source/class/osparc/store/Store.js +++ b/services/static-webserver/client/source/class/osparc/store/Store.js @@ -76,7 +76,14 @@ qx.Class.define("osparc.store.Store", { nullable: true }, studyBrowserContext: { - check: ["studiesAndFolders", "workspaces", "search", "trash"], + check: [ + "studiesAndFolders", + "workspaces", + "search", + "templates", + "public", + "trash", + ], init: "studiesAndFolders", nullable: false, event: "changeStudyBrowserContext", diff --git a/services/static-webserver/client/source/class/osparc/store/Templates.js b/services/static-webserver/client/source/class/osparc/store/Templates.js index 8b6deb99688..a207f589103 100644 --- a/services/static-webserver/client/source/class/osparc/store/Templates.js +++ b/services/static-webserver/client/source/class/osparc/store/Templates.js @@ -22,6 +22,30 @@ qx.Class.define("osparc.store.Templates", { __templates: null, __templatesPromisesCached: null, + fetchTemplatesPaginated: function(params, options) { + return osparc.data.Resources.fetch("templates", "getPageSorted", params, options) + .then(resp => { + const templates = resp.data; + // add them to the list + if (this.__templates) { + templates.forEach(template => { + const index = this.__templates.findIndex(t => t.uuid === template.uuid); + if (index === -1) { + this.__templates.push(template); + } else { + this.__templates[index] = template; + } + }); + } + return resp; + }) + .catch(err => osparc.FlashMessenger.logError(err)); + }, + + fetchTemplatesPublicPaginated: function(params, options) { + return this.fetchTemplatesPaginated(params, options); + }, + __fetchAllTemplates: function() { return this.__templatesPromisesCached = osparc.data.Resources.getInstance().getAllPages("templates") .then(templates => { diff --git a/services/static-webserver/client/source/translation/en.po b/services/static-webserver/client/source/translation/en.po index 76c5ed443d3..e0252f85eb7 100644 --- a/services/static-webserver/client/source/translation/en.po +++ b/services/static-webserver/client/source/translation/en.po @@ -1618,7 +1618,7 @@ msgstr "" msgid "Update all" msgstr "" -#: osparc/dashboard/TemplateBrowser.js +#: osparc/dashboard/TutorialBrowser.js msgid "Are you sure you want to update all " msgstr "" @@ -1630,15 +1630,15 @@ msgstr "" msgid "Are you sure you want to delete " msgstr "" -#: osparc/dashboard/TemplateBrowser.js +#: osparc/dashboard/TutorialBrowser.js msgid "Study to Template cancelled" msgstr "" -#: osparc/dashboard/TemplateBrowser.js +#: osparc/dashboard/TutorialBrowser.js msgid "Something went wrong while publishing the study
" msgstr "" -#: osparc/dashboard/TemplateBrowser.js +#: osparc/dashboard/TutorialBrowser.js msgid "Publishing " msgstr ""