Skip to content

Commit 1a1ae8e

Browse files
committed
getUniqueName
1 parent d24af3e commit 1a1ae8e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
11691169
__newStudyBtnClicked: function(button) {
11701170
button.setValue(false);
11711171
const minStudyData = osparc.data.model.Study.createMinStudyObject();
1172-
const title = osparc.utils.Utils.getUniqueStudyName(minStudyData.name, this._resourcesList);
1172+
const title = osparc.utils.Utils.getUniqueName(minStudyData.name, this._resourcesList);
11731173
minStudyData["name"] = title;
11741174
minStudyData["workspaceId"] = this.getCurrentWorkspaceId();
11751175
minStudyData["folderId"] = this.getCurrentFolderId();
@@ -1189,7 +1189,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
11891189
__newPlanBtnClicked: function(templateData, newStudyName) {
11901190
// do not override cached template data
11911191
const templateCopyData = osparc.utils.Utils.deepCloneObject(templateData);
1192-
const title = osparc.utils.Utils.getUniqueStudyName(newStudyName, this._resourcesList);
1192+
const title = osparc.utils.Utils.getUniqueName(newStudyName, this._resourcesList);
11931193
templateCopyData.name = title;
11941194
this._showLoadingPage(this.tr("Creating ") + (newStudyName || osparc.product.Utils.getStudyAlias()));
11951195
const contextProps = {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ qx.Class.define("osparc.study.Utils", {
116116
newStudyLabel = metadata["name"];
117117
}
118118
if (existingStudies) {
119-
const title = osparc.utils.Utils.getUniqueStudyName(newStudyLabel, existingStudies);
119+
const title = osparc.utils.Utils.getUniqueName(newStudyLabel, existingStudies);
120120
minStudyData["name"] = title;
121121
} else {
122122
minStudyData["name"] = newStudyLabel;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ qx.Class.define("osparc.utils.Utils", {
277277
return reloadButton;
278278
},
279279

280-
getUniqueStudyName: function(preferredName, list) {
280+
getUniqueName: function(preferredName, list, key = "name") {
281281
let title = preferredName;
282-
const existingTitles = list.map(study => study.name);
282+
const existingTitles = list.map(study => study[key]);
283283
if (existingTitles.includes(title)) {
284284
let cont = 1;
285285
while (existingTitles.includes(`${title} (${cont})`)) {

0 commit comments

Comments
 (0)