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 b33d5015231..679c2b45cf1 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -35,11 +35,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { if (resourceType === "study") { const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.ToggleButtonContainer(); this._add(workspacesContainer); - workspacesContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded"); const foldersContainer = this.__foldersContainer = new osparc.dashboard.ToggleButtonContainer(); this._add(foldersContainer); - foldersContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded"); } const nonGroupedContainer = this.__nonGroupedContainer = this.__createFlatList(); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js index dcda538841c..097247cc847 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -49,7 +49,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { __serviceTypeButtons: null, __buildLayout: function() { - if (this.__resourceType === "study" && osparc.utils.DisabledPlugins.isFoldersEnabled()) { + if (this.__resourceType === "study") { this._add(this.__createWorkspacesAndFoldersTree()); this._add(this.__createTrashBin()); } else { @@ -104,7 +104,8 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { value: false, appearance: "filter-toggle-button", label: this.tr("Trash"), - icon: "@FontAwesome5Solid/trash/18", + icon: "@FontAwesome5Solid/trash/16", + paddingLeft: 10, // align it with the context }); trashButton.addListener("changeValue", e => { const trashEnabled = e.getData(); @@ -221,11 +222,11 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { /* TAGS */ __createTagsFilterLayout: function() { - const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); + const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(2)); osparc.utils.Utils.setIdToWidget(layout, this.__resourceType + "-tagsFilter"); this.__populateTags(layout, []); - osparc.store.Store.getInstance().addListener("changeTags", () => { + osparc.store.Tags.getInstance().addListener("tagsChanged", () => { this.__populateTags(layout, this.__getSelectedTagIds()); }, this); @@ -242,7 +243,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { this.__tagButtons = []; layout.removeAll(); osparc.store.Tags.getInstance().getTags().forEach((tag, idx) => { - const button = new qx.ui.form.ToggleButton(null, "@FontAwesome5Solid/tag/18"); + const button = new qx.ui.form.ToggleButton(null, "@FontAwesome5Solid/tag/16"); button.id = tag.getTagId(); tag.bind("name", button, "label"); tag.bind("color", button.getChildControl("icon"), "textColor"); @@ -266,7 +267,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { if (this.__tagButtons.length > maxTags) { - const showAllButton = new qx.ui.form.Button(this.tr("All Tags..."), "@FontAwesome5Solid/tags/20"); + const showAllButton = new qx.ui.form.Button(this.tr("All Tags..."), "@FontAwesome5Solid/tags/16"); showAllButton.set({ appearance: "filter-toggle-button" }); @@ -284,6 +285,20 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { }); layout.add(showAllButton); } + + const editTagsButton = new qx.ui.form.Button(this.tr("Edit Tags..."), "@FontAwesome5Solid/pencil-alt/14"); + editTagsButton.set({ + appearance: "filter-toggle-button" + }); + editTagsButton.addListener("execute", () => { + const preferencesWindow = osparc.desktop.preferences.PreferencesWindow.openWindow(); + preferencesWindow.openTags(); + }); + layout.add(editTagsButton); + + if (this.__resourceType === "study") { + layout.getChildren().forEach(item => item.setPaddingLeft(10)); // align them with the context + } }, /* /TAGS */ diff --git a/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js index 5b376a6b404..2e1abb5be41 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js @@ -242,8 +242,8 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", { __addClassifiers: function(menuButton) { const classifiers = osparc.store.Store.getInstance().getClassifiers(); - menuButton.setVisibility(classifiers.length ? "visible" : "excluded"); - if (classifiers.length) { + menuButton.setVisibility(classifiers && classifiers.length ? "visible" : "excluded"); + if (classifiers && classifiers.length) { const classifiersMenu = new qx.ui.menu.Menu(); classifiers.forEach(classifier => { const classifierButton = new qx.ui.menu.Button(classifier.display_name); 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 2eecb230400..a3cfc5b9d88 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -166,7 +166,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __reloadWorkspaces: function() { if ( !osparc.auth.Manager.getInstance().isLoggedIn() || - !osparc.utils.DisabledPlugins.isFoldersEnabled() || this.getCurrentContext() === "studiesAndFolders" || this.getCurrentContext() === "search" || // not yet implemented for workspaces this.__loadingWorkspaces @@ -212,7 +211,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __reloadFolders: function() { if ( !osparc.auth.Manager.getInstance().isLoggedIn() || - !osparc.utils.DisabledPlugins.isFoldersEnabled() || this.getCurrentContext() === "workspaces" || this.__loadingFolders ) { @@ -991,11 +989,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { _createLayout: function() { this._createSearchBar(); - if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - const header = this.__header = new osparc.dashboard.StudyBrowserHeader(); - this.__header.addListener("emptyTrashRequested", () => this.__emptyTrash(), this); - this._addToLayout(header); - } + const header = this.__header = new osparc.dashboard.StudyBrowserHeader(); + this.__header.addListener("emptyTrashRequested", () => this.__emptyTrash(), this); + this._addToLayout(header); this._createResourcesLayout("studiesList"); @@ -1069,112 +1065,108 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __connectContexts: function() { - if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - const header = this.__header; - header.addListener("locationChanged", () => { - const workspaceId = header.getCurrentWorkspaceId(); - const folderId = header.getCurrentFolderId(); - this._changeContext("studiesAndFolders", workspaceId, folderId); - }, this); + const header = this.__header; + header.addListener("locationChanged", () => { + const workspaceId = header.getCurrentWorkspaceId(); + const folderId = header.getCurrentFolderId(); + this._changeContext("studiesAndFolders", workspaceId, folderId); + }, this); - const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree(); - workspacesAndFoldersTree.addListener("locationChanged", e => { - const context = e.getData(); - const workspaceId = context["workspaceId"]; - if (workspaceId === -1) { - this._changeContext("workspaces"); - } else { - const folderId = context["folderId"]; - this._changeContext("studiesAndFolders", workspaceId, folderId); - } - }, this); + const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree(); + workspacesAndFoldersTree.addListener("locationChanged", e => { + const context = e.getData(); + const workspaceId = context["workspaceId"]; + if (workspaceId === -1) { + this._changeContext("workspaces"); + } else { + const folderId = context["folderId"]; + this._changeContext("studiesAndFolders", workspaceId, folderId); + } + }, this); - this._resourceFilter.addListener("trashContext", () => { - this._changeContext("trash"); - }); + this._resourceFilter.addListener("trashContext", () => { + this._changeContext("trash"); + }); - this._searchBarFilter.addListener("filterChanged", e => { - const filterData = e.getData(); - if (filterData.text) { - this._changeContext("search"); - } else { - const workspaceId = this.getCurrentWorkspaceId(); - const folderId = this.getCurrentFolderId(); - this._changeContext("studiesAndFolders", workspaceId, folderId); - } - }); - } + this._searchBarFilter.addListener("filterChanged", e => { + const filterData = e.getData(); + if (filterData.text) { + this._changeContext("search"); + } else { + const workspaceId = this.getCurrentWorkspaceId(); + const folderId = this.getCurrentFolderId(); + this._changeContext("studiesAndFolders", workspaceId, folderId); + } + }); }, _changeContext: function(context, workspaceId = null, folderId = null) { - if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - if ( - context !== "search" && // reload studies for a new search - context === this.getCurrentContext() && - workspaceId === this.getCurrentWorkspaceId() && - folderId === this.getCurrentFolderId() - ) { - // didn't really change - return; - } - - osparc.store.Store.getInstance().setStudyBrowserContext(context); - this.set({ - currentContext: context, - currentWorkspaceId: workspaceId, - currentFolderId: folderId, - }); - this.resetSelection(); - this.setMultiSelection(false); + if ( + context !== "search" && // reload studies for a new search + context === this.getCurrentContext() && + workspaceId === this.getCurrentWorkspaceId() && + folderId === this.getCurrentFolderId() + ) { + // didn't really change + return; + } - // reset lists - this.__setWorkspacesToList([]); - this.__setFoldersToList([]); - this._resourcesList = []; - this._resourcesContainer.setResourcesToList(this._resourcesList); - this._resourcesContainer.reloadCards("studies"); - - this._toolbar.show(); - switch (this.getCurrentContext()) { - case "studiesAndFolders": - this._searchBarFilter.resetFilters(); - this.__reloadFolders(); - this._loadingResourcesBtn.setFetching(false); - this.invalidateStudies(); - this.__reloadStudies(); - break; - case "workspaces": - this._toolbar.exclude(); - this._searchBarFilter.resetFilters(); - this.__reloadWorkspaces(); - break; - case "search": - this.__reloadWorkspaces(); - this.__reloadFolders(); - this._loadingResourcesBtn.setFetching(false); - this.invalidateStudies(); - this.__reloadStudies(); - break; - case "trash": - this._searchBarFilter.resetFilters(); - this.__reloadWorkspaces(); - this.__reloadFolders(); - this._loadingResourcesBtn.setFetching(false); - this.invalidateStudies(); - this.__reloadStudies(); - break; - } + osparc.store.Store.getInstance().setStudyBrowserContext(context); + this.set({ + currentContext: context, + currentWorkspaceId: workspaceId, + currentFolderId: folderId, + }); + this.resetSelection(); + this.setMultiSelection(false); - // notify header - const header = this.__header; - header.set({ - currentWorkspaceId: workspaceId, - currentFolderId: folderId, - }); + // reset lists + this.__setWorkspacesToList([]); + this.__setFoldersToList([]); + this._resourcesList = []; + this._resourcesContainer.setResourcesToList(this._resourcesList); + this._resourcesContainer.reloadCards("studies"); - // notify Filters on the left - this._resourceFilter.contextChanged(context, workspaceId, folderId); + this._toolbar.show(); + switch (this.getCurrentContext()) { + case "studiesAndFolders": + this._searchBarFilter.resetFilters(); + this.__reloadFolders(); + this._loadingResourcesBtn.setFetching(false); + this.invalidateStudies(); + this.__reloadStudies(); + break; + case "workspaces": + this._toolbar.exclude(); + this._searchBarFilter.resetFilters(); + this.__reloadWorkspaces(); + break; + case "search": + this.__reloadWorkspaces(); + this.__reloadFolders(); + this._loadingResourcesBtn.setFetching(false); + this.invalidateStudies(); + this.__reloadStudies(); + break; + case "trash": + this._searchBarFilter.resetFilters(); + this.__reloadWorkspaces(); + this.__reloadFolders(); + this._loadingResourcesBtn.setFetching(false); + this.invalidateStudies(); + this.__reloadStudies(); + break; } + + // notify header + const header = this.__header; + header.set({ + currentWorkspaceId: workspaceId, + currentFolderId: folderId, + }); + + // notify Filters on the left + this._resourceFilter.contextChanged(context, workspaceId, folderId); }, __addSortByButton: function() { @@ -1560,13 +1552,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { menu.add(billingsSettingsButton); } - if (writeAccess && osparc.utils.DisabledPlugins.isFoldersEnabled()) { - menu.addSeparator(); + menu.addSeparator(); - const moveToButton = this.__getMoveStudyToMenuButton(studyData); - if (moveToButton) { - menu.add(moveToButton); - } + const moveToButton = this.__getMoveStudyToMenuButton(studyData); + if (moveToButton) { + menu.add(moveToButton); } if (deleteAccess) { 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 4e54df325c3..45aede41aaa 100644 --- a/services/static-webserver/client/source/class/osparc/data/Resources.js +++ b/services/static-webserver/client/source/class/osparc/data/Resources.js @@ -343,7 +343,7 @@ qx.Class.define("osparc.data.Resources", { }, moveToWorkspace: { method: "POST", - url: statics.API + "/folders/{folderId}/folders/{workspaceId}:move" + url: statics.API + "/folders/{folderId}/workspaces/{workspaceId}:move" }, trash: { method: "POST", diff --git a/services/static-webserver/client/source/class/osparc/desktop/preferences/Preferences.js b/services/static-webserver/client/source/class/osparc/desktop/preferences/Preferences.js index 90616bfd3e4..31f8de5590b 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/preferences/Preferences.js +++ b/services/static-webserver/client/source/class/osparc/desktop/preferences/Preferences.js @@ -32,33 +32,42 @@ qx.Class.define("osparc.desktop.preferences.Preferences", { }, members: { + __tagsPage: null, + __addGeneralSettings: function() { const title = this.tr("General Settings"); - const iconSrc = "@FontAwesome5Solid/cogs/24"; + const iconSrc = "@FontAwesome5Solid/cogs/22"; const generalPage = new osparc.desktop.preferences.pages.GeneralPage(); this.addTab(title, iconSrc, generalPage); }, __addConfirmationSettings: function() { const title = this.tr("Confirmation Settings"); - const iconSrc = "@FontAwesome5Solid/question-circle/24"; + const iconSrc = "@FontAwesome5Solid/question-circle/22"; const confirmPage = new osparc.desktop.preferences.pages.ConfirmationsPage(); this.addTab(title, iconSrc, confirmPage); }, __addTokensPage: function() { const title = this.tr("API Keys/Tokens"); - const iconSrc = "@FontAwesome5Solid/exchange-alt/24"; + const iconSrc = "@FontAwesome5Solid/exchange-alt/22"; const tokensPage = new osparc.desktop.preferences.pages.TokensPage(); this.addTab(title, iconSrc, tokensPage); }, __addTagsPage: function() { const title = this.tr("Create/Edit Tags"); - const iconSrc = "@FontAwesome5Solid/tags/24"; + const iconSrc = "@FontAwesome5Solid/tags/22"; const tagsPage = new osparc.desktop.preferences.pages.TagsPage(); - const page = this.addTab(title, iconSrc, tagsPage); + const page = this.__tagsPage = this.addTab(title, iconSrc, tagsPage); osparc.utils.Utils.setIdToWidget(page.getChildControl("button"), "preferencesTagsTabBtn"); }, + + openTags: function() { + if (this.__tagsPage) { + this._openPage(this.__tagsPage); + return true; + } + }, } }); diff --git a/services/static-webserver/client/source/class/osparc/desktop/preferences/PreferencesWindow.js b/services/static-webserver/client/source/class/osparc/desktop/preferences/PreferencesWindow.js index 9952ab54a47..889a1e54c2e 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/preferences/PreferencesWindow.js +++ b/services/static-webserver/client/source/class/osparc/desktop/preferences/PreferencesWindow.js @@ -31,7 +31,7 @@ qx.Class.define("osparc.desktop.preferences.PreferencesWindow", { height }); - const preferences = new osparc.desktop.preferences.Preferences(); + const preferences = this.__preferences = new osparc.desktop.preferences.Preferences(); this._setTabbedView(preferences); }, @@ -42,5 +42,13 @@ qx.Class.define("osparc.desktop.preferences.PreferencesWindow", { preferencesWindow.open(); return preferencesWindow; } + }, + + members: { + __preferences: null, + + openTags: function() { + return this.__preferences.openTags(); + } } }); diff --git a/services/static-webserver/client/source/class/osparc/desktop/preferences/pages/GeneralPage.js b/services/static-webserver/client/source/class/osparc/desktop/preferences/pages/GeneralPage.js index 21b09014e9c..dffafeabc72 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/preferences/pages/GeneralPage.js +++ b/services/static-webserver/client/source/class/osparc/desktop/preferences/pages/GeneralPage.js @@ -24,91 +24,97 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", { this._setLayout(new qx.ui.layout.VBox(15)); - this.__addCreditsIndicatorSettings(); - this.__addLowDiskSpaceSetting(); - this.__addInactivitySetting(); + if (osparc.desktop.credits.Utils.areWalletsEnabled()) { + this.__addCreditsIndicatorSettings(); + } + + const preferences = osparc.Preferences.getInstance(); + if (preferences.getLowDiskSpaceThreshold()) { + this.__addLowDiskSpaceSetting(); + } + + if (osparc.desktop.credits.Utils.areWalletsEnabled()) { + this.__addInactivitySetting(); + } + // this.__addJobConcurrencySetting(); - this.__addS4LUserPrivacySettings(); + + if (osparc.product.Utils.isS4LProduct() || osparc.product.Utils.isProduct("s4llite")) { + this.__addS4LUserPrivacySettings(); + } }, members: { __addCreditsIndicatorSettings: function() { - const walletsEnabled = osparc.desktop.credits.Utils.areWalletsEnabled(); - if (walletsEnabled) { - // layout - const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Credits Indicator")); - - const form = new qx.ui.form.Form(); - - const preferencesSettings = osparc.Preferences.getInstance(); - - const walletIndicatorVisibilitySB = new qx.ui.form.SelectBox().set({ - allowGrowX: false - }); - [{ - id: "always", - label: "Always" - }, { - id: "warning", - label: "Warning" - }].forEach(options => { - const lItem = new qx.ui.form.ListItem(options.label, null, options.id); - walletIndicatorVisibilitySB.add(lItem); - }); - const value = preferencesSettings.getWalletIndicatorVisibility(); - walletIndicatorVisibilitySB.getSelectables().forEach(selectable => { - if (selectable.getModel() === value) { - walletIndicatorVisibilitySB.setSelection([selectable]); - } - }); - walletIndicatorVisibilitySB.addListener("changeValue", e => { - const selectable = e.getData(); - osparc.Preferences.patchPreferenceField("walletIndicatorVisibility", walletIndicatorVisibilitySB, selectable.getModel()); - }); - form.add(walletIndicatorVisibilitySB, this.tr("Show indicator")); - - const creditsWarningThresholdField = new qx.ui.form.Spinner().set({ - minimum: 50, - maximum: 10000, - singleStep: 10, - allowGrowX: false - }); - preferencesSettings.bind("creditsWarningThreshold", creditsWarningThresholdField, "value"); - creditsWarningThresholdField.addListener("changeValue", e => osparc.Preferences.patchPreferenceField("creditsWarningThreshold", creditsWarningThresholdField, e.getData())); - form.add(creditsWarningThresholdField, this.tr("Show warning when credits below")); - - box.add(new qx.ui.form.renderer.Single(form)); - - this._add(box); - } + const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Credits Indicator")); + + const form = new qx.ui.form.Form(); + + const preferencesSettings = osparc.Preferences.getInstance(); + + const walletIndicatorVisibilitySB = new qx.ui.form.SelectBox().set({ + allowGrowX: false + }); + [{ + id: "always", + label: "Always" + }, { + id: "warning", + label: "Warning" + }].forEach(options => { + const lItem = new qx.ui.form.ListItem(options.label, null, options.id); + walletIndicatorVisibilitySB.add(lItem); + }); + const value = preferencesSettings.getWalletIndicatorVisibility(); + walletIndicatorVisibilitySB.getSelectables().forEach(selectable => { + if (selectable.getModel() === value) { + walletIndicatorVisibilitySB.setSelection([selectable]); + } + }); + walletIndicatorVisibilitySB.addListener("changeValue", e => { + const selectable = e.getData(); + osparc.Preferences.patchPreferenceField("walletIndicatorVisibility", walletIndicatorVisibilitySB, selectable.getModel()); + }); + form.add(walletIndicatorVisibilitySB, this.tr("Show indicator")); + + const creditsWarningThresholdField = new qx.ui.form.Spinner().set({ + minimum: 50, + maximum: 10000, + singleStep: 10, + allowGrowX: false + }); + preferencesSettings.bind("creditsWarningThreshold", creditsWarningThresholdField, "value"); + creditsWarningThresholdField.addListener("changeValue", e => osparc.Preferences.patchPreferenceField("creditsWarningThreshold", creditsWarningThresholdField, e.getData())); + form.add(creditsWarningThresholdField, this.tr("Show warning when credits below")); + + box.add(new qx.ui.form.renderer.Single(form)); + + this._add(box); }, __addInactivitySetting: function() { - const walletsEnabled = osparc.desktop.credits.Utils.areWalletsEnabled(); - if (walletsEnabled) { - const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Automatic Shutdown of Idle Instances")); - - const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Enter 0 to disable this function"), "text-13-italic"); - box.add(label); - - const form = new qx.ui.form.Form(); - const inactivitySpinner = new qx.ui.form.Spinner().set({ - minimum: 0, - maximum: Number.MAX_SAFE_INTEGER, - singleStep: 1, - allowGrowX: false - }); - const preferences = osparc.Preferences.getInstance(); - preferences.bind("userInactivityThreshold", inactivitySpinner, "value", { - converter: value => Math.round(value / 60) // Stored in seconds, displayed in minutes - }); - inactivitySpinner.addListener("changeValue", e => osparc.Preferences.patchPreferenceField("userInactivityThreshold", inactivitySpinner, e.getData() * 60)); - form.add(inactivitySpinner, this.tr("Idle time before closing (in minutes)")); - - box.add(new qx.ui.form.renderer.Single(form)); - - this._add(box); - } + const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Automatic Shutdown of Idle Instances")); + + const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Enter 0 to disable this function"), "text-13-italic"); + box.add(label); + + const form = new qx.ui.form.Form(); + const inactivitySpinner = new qx.ui.form.Spinner().set({ + minimum: 0, + maximum: Number.MAX_SAFE_INTEGER, + singleStep: 1, + allowGrowX: false + }); + const preferences = osparc.Preferences.getInstance(); + preferences.bind("userInactivityThreshold", inactivitySpinner, "value", { + converter: value => Math.round(value / 60) // Stored in seconds, displayed in minutes + }); + inactivitySpinner.addListener("changeValue", e => osparc.Preferences.patchPreferenceField("userInactivityThreshold", inactivitySpinner, e.getData() * 60)); + form.add(inactivitySpinner, this.tr("Idle time before closing (in minutes)")); + + box.add(new qx.ui.form.renderer.Single(form)); + + this._add(box); }, __addJobConcurrencySetting: function() { @@ -130,44 +136,39 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", { }, __addLowDiskSpaceSetting: function() { - const preferences = osparc.Preferences.getInstance(); - if (preferences.getLowDiskSpaceThreshold()) { - const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Low Disk Space Threshold")); - const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Set the warning Threshold for low Disk Space availability."), "text-13-italic"); - box.add(label); - const form = new qx.ui.form.Form(); - const diskUsageSpinner = new qx.ui.form.Spinner().set({ - minimum: 1, - maximum: 10000, - singleStep: 1, - allowGrowX: false, - enabled: true - }); - preferences.bind("lowDiskSpaceThreshold", diskUsageSpinner, "value"); - - diskUsageSpinner.addListener("changeValue", e => osparc.Preferences.patchPreferenceField("lowDiskSpaceThreshold", diskUsageSpinner, e.getData())); - form.add(diskUsageSpinner, this.tr("Threshold (in GB)")); - box.add(new qx.ui.form.renderer.Single(form)); - this._add(box); - } + const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Low Disk Space Threshold")); + const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Set the warning Threshold for low Disk Space availability."), "text-13-italic"); + box.add(label); + const form = new qx.ui.form.Form(); + const diskUsageSpinner = new qx.ui.form.Spinner().set({ + minimum: 1, + maximum: 10000, + singleStep: 1, + allowGrowX: false, + enabled: true + }); + preferences.bind("lowDiskSpaceThreshold", diskUsageSpinner, "value"); + + diskUsageSpinner.addListener("changeValue", e => osparc.Preferences.patchPreferenceField("lowDiskSpaceThreshold", diskUsageSpinner, e.getData())); + form.add(diskUsageSpinner, this.tr("Threshold (in GB)")); + box.add(new qx.ui.form.renderer.Single(form)); + this._add(box); }, __addS4LUserPrivacySettings: function() { - if (osparc.product.Utils.isS4LProduct() || osparc.product.Utils.isProduct("s4llite")) { - const box = osparc.ui.window.TabbedView.createSectionBox("Privacy Settings"); + const box = osparc.ui.window.TabbedView.createSectionBox("Privacy Settings"); - const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Help us improve Sim4Life user experience"), "text-13-italic"); - box.add(label); + const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Help us improve Sim4Life user experience"), "text-13-italic"); + box.add(label); - const preferencesSettings = osparc.Preferences.getInstance(); + const preferencesSettings = osparc.Preferences.getInstance(); - const cbAllowMetricsCollection = new qx.ui.form.CheckBox(this.tr("Share usage data")); - preferencesSettings.bind("allowMetricsCollection", cbAllowMetricsCollection, "value"); - cbAllowMetricsCollection.addListener("changeValue", e => osparc.Preferences.patchPreferenceField("allowMetricsCollection", cbAllowMetricsCollection, e.getData())); - box.add(cbAllowMetricsCollection); + const cbAllowMetricsCollection = new qx.ui.form.CheckBox(this.tr("Share usage data")); + preferencesSettings.bind("allowMetricsCollection", cbAllowMetricsCollection, "value"); + cbAllowMetricsCollection.addListener("changeValue", e => osparc.Preferences.patchPreferenceField("allowMetricsCollection", cbAllowMetricsCollection, e.getData())); + box.add(cbAllowMetricsCollection); - this._add(box); - } + this._add(box); } } }); diff --git a/services/static-webserver/client/source/class/osparc/form/tag/TagManager.js b/services/static-webserver/client/source/class/osparc/form/tag/TagManager.js index 6f704c1f222..111c020fda6 100644 --- a/services/static-webserver/client/source/class/osparc/form/tag/TagManager.js +++ b/services/static-webserver/client/source/class/osparc/form/tag/TagManager.js @@ -82,6 +82,7 @@ qx.Class.define("osparc.form.tag.TagManager", { allowGrowX: false }); addTagButton.addListener("execute", () => { + this.__repopulateTags(); const newItem = new osparc.form.tag.TagItem().set({ mode: osparc.form.tag.TagItem.modes.EDIT }); @@ -89,7 +90,6 @@ qx.Class.define("osparc.form.tag.TagManager", { newItem.addListener("cancelNewTag", e => tagsContainer.remove(e.getTarget()), this); newItem.addListener("deleteTag", e => tagsContainer.remove(e.getTarget()), this); tagsContainer.add(newItem); - this.__repopulateTags(); }); this._add(addTagButton); diff --git a/services/static-webserver/client/source/class/osparc/info/StudyLarge.js b/services/static-webserver/client/source/class/osparc/info/StudyLarge.js index 5709bfd70a2..6512e4a459d 100644 --- a/services/static-webserver/client/source/class/osparc/info/StudyLarge.js +++ b/services/static-webserver/client/source/class/osparc/info/StudyLarge.js @@ -189,7 +189,7 @@ qx.Class.define("osparc.info.StudyLarge", { }; } - if (osparc.utils.DisabledPlugins.isFoldersEnabled() && !this.__isTemplate) { + if (!this.__isTemplate) { const pathLabel = new qx.ui.basic.Label(); pathLabel.setValue(this.getStudy().getLocationString()); extraInfo["LOCATION"] = { diff --git a/services/static-webserver/client/source/class/osparc/info/StudyUtils.js b/services/static-webserver/client/source/class/osparc/info/StudyUtils.js index f1d2c3449e5..1604be1805c 100644 --- a/services/static-webserver/client/source/class/osparc/info/StudyUtils.js +++ b/services/static-webserver/client/source/class/osparc/info/StudyUtils.js @@ -220,6 +220,7 @@ qx.Class.define("osparc.info.StudyUtils", { }); }; study.addListener("changeTags", () => addTags(study), this); + osparc.store.Tags.getInstance().addListener("tagsChanged", () => addTags(study), this); addTags(study); return tagsContainer; diff --git a/services/static-webserver/client/source/class/osparc/share/Collaborators.js b/services/static-webserver/client/source/class/osparc/share/Collaborators.js index 283cf695ef3..4fa94acfb78 100644 --- a/services/static-webserver/client/source/class/osparc/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/Collaborators.js @@ -22,7 +22,7 @@ qx.Class.define("osparc.share.Collaborators", { /** * @param serializedDataCopy {Object} Object containing the Serialized Data */ - construct: function(serializedDataCopy, initCollabs = []) { + construct: function(serializedDataCopy) { this.base(arguments); this._serializedDataCopy = serializedDataCopy; @@ -365,7 +365,11 @@ qx.Class.define("osparc.share.Collaborators", { win.open(); win.addListener("close", () => { if (win.getConfirmed()) { - this._deleteMember({gid: myGid}) + const collaborator = { + gid: myGid, + name: osparc.store.Groups.getInstance().getGroupMe().getLabel(), + } + this._deleteMember(collaborator) .then(() => { qx.event.message.Bus.dispatchByName("reloadStudies"); }); diff --git a/services/static-webserver/client/source/class/osparc/snapshots/SnapshotsView.js b/services/static-webserver/client/source/class/osparc/snapshots/SnapshotsView.js index 11a11fe1f88..6cbef9261a0 100644 --- a/services/static-webserver/client/source/class/osparc/snapshots/SnapshotsView.js +++ b/services/static-webserver/client/source/class/osparc/snapshots/SnapshotsView.js @@ -220,10 +220,17 @@ qx.Class.define("osparc.snapshots.SnapshotsView", { studyData["ui"] = data["ui"]; const study = new osparc.data.model.Study(studyData); study.setReadOnly(true); - this.__snapshotPreview.set({ - study: study - }); - this.__snapshotPreview.loadModel(study.getWorkbench()); + this.__snapshotPreview.setStudy(study); + // this.__snapshotPreview.loadModel(study.getWorkbench()); + if (study.getWorkbench().isDeserialized()) { + this.__snapshotPreview.loadModel(study.getWorkbench()) + } else { + study.getWorkbench().addListener("changeDeserialized", e => { + if (e.getData()) { + this.__snapshotPreview.loadModel(study.getWorkbench()) + } + }, this); + } }); } } diff --git a/services/static-webserver/client/source/class/osparc/store/Tags.js b/services/static-webserver/client/source/class/osparc/store/Tags.js index 4ffd9f5cd4f..c07e9d8d8ae 100644 --- a/services/static-webserver/client/source/class/osparc/store/Tags.js +++ b/services/static-webserver/client/source/class/osparc/store/Tags.js @@ -26,8 +26,7 @@ qx.Class.define("osparc.store.Tags", { }, events: { - "tagAdded": "qx.event.type.Data", - "tagRemoved": "qx.event.type.Data", + "tagsChanged": "qx.event.type.Data", }, members: { @@ -62,7 +61,7 @@ qx.Class.define("osparc.store.Tags", { return osparc.data.Resources.getInstance().fetch("tags", "post", params) .then(tagData => { const tag = this.__addToCache(tagData); - this.fireDataEvent("tagAdded", tag); + this.fireDataEvent("tagsChanged", tag); return tag; }); }, @@ -78,7 +77,7 @@ qx.Class.define("osparc.store.Tags", { const tag = this.getTag(tagId); if (tag) { this.__deleteFromCache(tagId); - this.fireDataEvent("tagRemoved", tag); + this.fireDataEvent("tagsChanged", tag); } }) .catch(console.error); diff --git a/services/static-webserver/client/source/class/osparc/utils/DisabledPlugins.js b/services/static-webserver/client/source/class/osparc/utils/DisabledPlugins.js index 2b5d9a65995..dcad527fff9 100644 --- a/services/static-webserver/client/source/class/osparc/utils/DisabledPlugins.js +++ b/services/static-webserver/client/source/class/osparc/utils/DisabledPlugins.js @@ -28,11 +28,6 @@ qx.Class.define("osparc.utils.DisabledPlugins", { SCICRUNCH: "WEBSERVER_SCICRUNCH", VERSION_CONTROL: "WEBSERVER_VERSION_CONTROL", META_MODELING: "WEBSERVER_META_MODELING", - FOLDERS: "WEBSERVER_FOLDERS", - - isFoldersEnabled: function() { - return !this.__isPluginDisabled(this.FOLDERS); - }, isExportDisabled: function() { return this.__isPluginDisabled(this.EXPORT); diff --git a/services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelListItem.js b/services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelListItem.js index 4beac36d736..30a95396774 100644 --- a/services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelListItem.js +++ b/services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelListItem.js @@ -132,6 +132,9 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelListItem", { }); break; } + control.set({ + anonymous: true, // pass the tap action over + }); return control || this.base(arguments, id); },