Skip to content

Commit 8c7ee30

Browse files
committed
getOpenText
1 parent 3e3296f commit 8c7ee30

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,21 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
196196
osparc.utils.Utils.addBorderRightRadius(rButton);
197197
}
198198
return rButton;
199-
}
199+
},
200+
201+
getOpenText: function(resourceData) {
202+
const studyAlias = osparc.product.Utils.getStudyAlias({firstUpperCase: true});
203+
let openText = this.tr("New") + " " + studyAlias;
204+
if (resourceData["resourceType"] === "study") {
205+
// if it's in use call it join
206+
if (osparc.study.Utils.state.getCurrentGroupIds(resourceData["state"])) {
207+
openText = this.tr("Join");
208+
} else {
209+
openText = this.tr("Open");
210+
}
211+
}
212+
return openText;
213+
},
200214
},
201215

202216
members: {
@@ -899,8 +913,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
899913
},
900914

901915
_getOpenMenuButton: function(resourceData) {
902-
const studyAlias = osparc.product.Utils.getStudyAlias({firstUpperCase: true});
903-
const openText = (resourceData["resourceType"] === "study") ? this.tr("Open") : this.tr("New") + " " + studyAlias;
916+
const openText = osparc.dashboard.ResourceBrowserBase.getOpenText(resourceData);
904917
const openButton = new qx.ui.menu.Button(openText);
905918
openButton["openResourceButton"] = true;
906919
openButton.addListener("execute", () => {

services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
225225
toolbar.add(serviceVersionSelector);
226226
}
227227

228-
const studyAlias = osparc.product.Utils.getStudyAlias({firstUpperCase: true});
229-
const openText = (this.__resourceData["resourceType"] === "study") ? this.tr("Open") : this.tr("New") + " " + studyAlias;
228+
const openText = osparc.dashboard.ResourceBrowserBase.getOpenText(this.__resourceData);
230229
const openButton = new osparc.ui.form.FetchButton(openText).set({
231230
enabled: true
232231
});

services/static-webserver/client/source/class/osparc/study/Utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ qx.Class.define("osparc.study.Utils", {
446446
return "UNKNOWN_SERVICES";
447447
}
448448
}
449-
if (this.isProjectLocked(studyData)) {
449+
if (this.state.isProjectLocked(studyData["state"])) {
450450
return "IN_USE";
451451
}
452452
if (this.isInDebt(studyData)) {

0 commit comments

Comments
 (0)