Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,10 @@ qx.Class.define("osparc.Application", {
},

__updateTabName: function() {
const platformName = osparc.store.StaticInfo.getInstance().getPlatformName();
if (osparc.utils.Utils.isInZ43()) {
document.title += " Z43";
}
if (platformName) {
document.title += ` (${platformName})`;
}
const newName = osparc.utils.Utils.composeTabName();
osparc.utils.Utils.updateTabName(newName);
},



__setDeviceSpecificIcons: function() {
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
const isAndroid = /android/i.test(navigator.userAgent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
!osparc.auth.Manager.getInstance().isLoggedIn() ||
!osparc.utils.DisabledPlugins.isFoldersEnabled() ||
this.getCurrentContext() === "studiesAndFolders" ||
this.getCurrentContext() === "search" || // not yet implemented for workspaces
this.__loadingWorkspaces
) {
return;
Expand All @@ -179,7 +178,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
case "search": {
const filterData = this._searchBarFilter.getFilterData();
const text = filterData.text ? encodeURIComponent(filterData.text) : "";
request = osparc.store.Workspaces.getInstance().searchWorkspaces(text);
request = osparc.store.Workspaces.getInstance().searchWorkspaces(text, this.getOrderBy());
break;
}
case "workspaces": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ qx.Class.define("osparc.data.Resources", {
getPageSearch: {
useCache: false,
method: "GET",
url: statics.API + "/workspaces:search?offset={offset}&limit={limit}&text={text}&order_by={orderBy}"
url: statics.API + "/workspaces?offset={offset}&limit={limit}&filters={filters}&order_by={orderBy}"
},
getPageTrashed: {
useCache: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ qx.Class.define("osparc.store.Store", {
check: "osparc.data.model.Study",
init: null,
nullable: true,
event: "changeCurrentStudy"
event: "changeCurrentStudy",
apply: "__applyCurrentStudy",
},
currentStudyId: {
check: "String",
Expand Down Expand Up @@ -339,6 +340,21 @@ qx.Class.define("osparc.store.Store", {
}
},

__applyCurrentStudy: function(study) {
if (study) {
study.addListener("changeName", () => {
if (this.getCurrentStudy() === study) {
// the study might have been closed
osparc.utils.Utils.updateTabName(study.getName());
}
});
osparc.utils.Utils.updateTabName(study.getName());
} else {
const newName = osparc.utils.Utils.composeTabName();
osparc.utils.Utils.updateTabName(newName);
}
},

__applyWallets: function(wallets) {
const preferenceSettings = osparc.Preferences.getInstance();
const preferenceWalletId = preferenceSettings.getPreferredWalletId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,24 @@ qx.Class.define("osparc.store.Workspaces", {
});
},

searchWorkspaces: function(text) {
searchWorkspaces: function(
text,
orderBy = {
field: "modified_at",
direction: "desc"
},
) {
if (osparc.auth.Data.getInstance().isGuest()) {
return new Promise(resolve => {
resolve([]);
});
}

const curatedOrderBy = this.self().curateOrderBy(orderBy);
const params = {
url: {
text,
filters: JSON.stringify({text: text}),
orderBy: JSON.stringify(curatedOrderBy),
}
};
return osparc.data.Resources.getInstance().getAllPages("workspaces", params, "getPageSearch")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ qx.Class.define("osparc.utils.Utils", {

FLOATING_Z_INDEX: 110000,

updateTabName: function(name) {
document.title = name;
},

composeTabName: function() {
let newName = osparc.store.StaticInfo.getInstance().getDisplayName();
const platformName = osparc.store.StaticInfo.getInstance().getPlatformName();
if (osparc.utils.Utils.isInZ43()) {
newName += " Z43";
}
if (platformName) {
newName += ` (${platformName})`;
}
return newName;
},

replaceTokens: function(str, key, value) {
// `str` might be a a localized string, get the string first
str = str.toString ? str.toString() : str;
Expand Down
Loading