Skip to content

Commit 0f1ba36

Browse files
committed
fix postTag
1 parent 1844cbe commit 0f1ba36

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

services/static-webserver/client/source/class/osparc/form/tag/TagItem.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -272,20 +272,31 @@ qx.Class.define("osparc.form.tag.TagItem", {
272272
if (this.__validationManager.validate()) {
273273
const data = this.__serializeData();
274274
saveButton.setFetching(true);
275-
let fetch;
275+
const tagsStore = osparc.store.Tags.getInstance();
276276
if (this.isPropertyInitialized("id")) {
277-
fetch = osparc.store.Tags.getInstance().putTag(this.getId(), data);
277+
tagsStore.putTag(this.getId(), data)
278+
.then(tag => this.setTag(tag))
279+
.catch(console.error)
280+
.finally(() => {
281+
this.fireEvent("tagSaved");
282+
this.setMode(this.self().modes.DISPLAY);
283+
saveButton.setFetching(false);
284+
});
278285
} else {
279-
fetch = osparc.store.Tags.getInstance().postTag(data);
286+
let newTag = null;
287+
tagsStore.postTag(data)
288+
.then(tag => {
289+
newTag = tag;
290+
return tagsStore.fetchAccessRights(tag);
291+
})
292+
.then(() => this.setTag(newTag))
293+
.catch(console.error)
294+
.finally(() => {
295+
this.fireEvent("tagSaved");
296+
this.setMode(this.self().modes.DISPLAY);
297+
saveButton.setFetching(false);
298+
});
280299
}
281-
fetch
282-
.then(tag => this.setTag(tag))
283-
.catch(console.error)
284-
.finally(() => {
285-
this.fireEvent("tagSaved");
286-
this.setMode(this.self().modes.DISPLAY);
287-
saveButton.setFetching(false);
288-
});
289300
}
290301
}, this);
291302
cancelButton.addListener("execute", () => {

services/static-webserver/client/source/class/osparc/store/Tags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ qx.Class.define("osparc.store.Tags", {
108108
"tagId": tag.getTagId()
109109
}
110110
};
111-
osparc.data.Resources.fetch("tags", "getAccessRights", params)
111+
return osparc.data.Resources.fetch("tags", "getAccessRights", params)
112112
.then(accessRightsArray => {
113113
const accessRights = {};
114114
accessRightsArray.forEach(ar => accessRights[ar.gid] = ar);

0 commit comments

Comments
 (0)