Skip to content

Commit 0963820

Browse files
authored
🐛🎨 [Frontend] Reduce number of (unnecessary) PATCH calls at Study open (ITISFoundation#7019)
1 parent 7e31592 commit 0963820

File tree

8 files changed

+36
-27
lines changed

8 files changed

+36
-27
lines changed

services/static-webserver/client/source/class/osparc/data/Resources.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ qx.Class.define("osparc.data.Resources", {
12591259
method: "POST",
12601260
url: statics.API + "/tags"
12611261
},
1262-
put: {
1262+
patch: {
12631263
method: "PATCH",
12641264
url: statics.API + "/tags/{tagId}"
12651265
},

services/static-webserver/client/source/class/osparc/data/model/Node.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ qx.Class.define("osparc.data.model.Node", {
115115
event: "changeServiceUrl"
116116
},
117117

118-
thumbnail: {
119-
check: "String",
120-
nullable: true,
121-
init: ""
122-
},
123-
124118
portsConnected: {
125119
check: "Array",
126120
init: [],
@@ -421,9 +415,12 @@ qx.Class.define("osparc.data.model.Node", {
421415

422416
__getInputUnits: function() {
423417
if (this.isPropertyInitialized("propsForm") && this.getPropsForm()) {
424-
return this.getPropsForm().getChangedXUnits();
418+
const changedUnits = this.getPropsForm().getChangedXUnits();
419+
if (Object.keys(changedUnits).length) {
420+
return changedUnits;
421+
}
425422
}
426-
return {};
423+
return null;
427424
},
428425

429426
getInput: function(inputId) {
@@ -478,9 +475,6 @@ qx.Class.define("osparc.data.model.Node", {
478475
}
479476
this.populateInputOutputData(nodeData);
480477
this.populateStates(nodeData);
481-
if (nodeData.thumbnail) {
482-
this.setThumbnail(nodeData.thumbnail);
483-
}
484478
if (nodeData.bootOptions) {
485479
this.setBootOptions(nodeData.bootOptions);
486480
}
@@ -1254,7 +1248,6 @@ qx.Class.define("osparc.data.model.Node", {
12541248
inputAccess: this.getInputAccess(),
12551249
inputNodes: this.getInputNodes(),
12561250
inputsRequired: this.getInputsRequired(),
1257-
thumbnail: this.getThumbnail(),
12581251
bootOptions: this.getBootOptions()
12591252
};
12601253
if (!clean) {

services/static-webserver/client/source/class/osparc/desktop/WorkbenchView.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -790,24 +790,33 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
790790
this.__studyOptionsPage.getChildControl("button").show();
791791
this.getChildControl("side-panel-right-tabs").setSelection([this.__studyOptionsPage]);
792792

793-
this.__studyOptionsPage.add(new osparc.info.StudyMedium(study), {
793+
const scrollView = new qx.ui.container.Scroll();
794+
const secondaryColumnStudyContent = new qx.ui.container.Composite(new qx.ui.layout.VBox(15)).set({
795+
backgroundColor: "transparent"
796+
});
797+
scrollView.add(secondaryColumnStudyContent);
798+
this.__studyOptionsPage.add(scrollView, {
799+
flex: 1
800+
});
801+
802+
secondaryColumnStudyContent.add(new osparc.info.StudyMedium(study), {
794803
flex: 1
795804
});
796805

797-
this.__studyOptionsPage.add(this.__getSlideshowSection());
806+
secondaryColumnStudyContent.add(this.__getSlideshowSection());
798807

799-
this.__studyOptionsPage.add(this.__getAnnotationsSection());
808+
secondaryColumnStudyContent.add(this.__getAnnotationsSection());
800809

801810
const snaps = this.__getSnapshotsSection();
802811
snaps.exclude();
803812
const isVCDisabled = osparc.utils.DisabledPlugins.isVersionControlDisabled();
804813
snaps.setVisibility(isVCDisabled ? "excluded" : "visible");
805-
this.__studyOptionsPage.add(snaps);
814+
secondaryColumnStudyContent.add(snaps);
806815

807816
const iters = this.__getIterationsSection();
808817
const isMMDisabled = osparc.utils.DisabledPlugins.isMetaModelingDisabled();
809818
snaps.setVisibility(isMMDisabled ? "excluded" : "visible");
810-
this.__studyOptionsPage.add(iters);
819+
secondaryColumnStudyContent.add(iters);
811820
},
812821

813822
__getSlideshowSection: function() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ qx.Class.define("osparc.form.tag.TagItem", {
275275
saveButton.setFetching(true);
276276
const tagsStore = osparc.store.Tags.getInstance();
277277
if (this.isPropertyInitialized("id")) {
278-
tagsStore.putTag(this.getId(), data)
278+
tagsStore.patchTag(this.getId(), data)
279279
.then(tag => this.setTag(tag))
280280
.catch(console.error)
281281
.finally(() => {
@@ -336,7 +336,7 @@ qx.Class.define("osparc.form.tag.TagItem", {
336336
return {
337337
name: name.trim(),
338338
description: description ? description.trim() : "",
339-
color: color
339+
color: color,
340340
};
341341
},
342342
__applyMode: function() {

services/static-webserver/client/source/class/osparc/share/Collaborators.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ qx.Class.define("osparc.share.Collaborators", {
194194
switch (this._resourceType) {
195195
case "study":
196196
case "template":
197-
canIShare = osparc.study.Utils.canIWrite(this._serializedDataCopy["accessRights"]);
197+
canIShare = osparc.data.model.Study.canIWrite(this._serializedDataCopy["accessRights"]);
198198
break;
199199
case "service":
200200
canIShare = osparc.service.Utils.canIWrite(this._serializedDataCopy["accessRights"]);

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,19 @@ qx.Class.define("osparc.store.Tags", {
8888
.catch(console.error);
8989
},
9090

91-
putTag: function(tagId, updateData) {
91+
patchTag: function(tagId, updateData) {
9292
const params = {
9393
url: {
9494
tagId
9595
},
9696
data: updateData
9797
};
98-
return osparc.data.Resources.getInstance().fetch("tags", "put", params)
98+
return osparc.data.Resources.getInstance().fetch("tags", "patch", params)
9999
.then(tagData => {
100+
if ("accessRights" in tagData) {
101+
// accessRights are not patched in this endpoint
102+
delete tagData["accessRights"];
103+
}
100104
return this.__addToCache(tagData);
101105
})
102106
.catch(console.error);

services/static-webserver/client/source/class/osparc/workbench/NodeUI.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ qx.Class.define("osparc.workbench.NodeUI", {
203203

204204
__createWindowLayout: function() {
205205
const node = this.getNode();
206-
if (node.getThumbnail()) {
207-
this.setThumbnail(node.getThumbnail());
208-
}
209206

210207
this.getChildControl("chips").show();
211208

services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,6 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
11401140
// create nodes
11411141
const nodes = model.getNodes();
11421142
this.__renderNodes(nodes);
1143-
qx.ui.core.queue.Layout.flush();
11441143
this.__renderAnnotations(model.getStudy().getUi());
11451144
}
11461145
},
@@ -1154,7 +1153,14 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
11541153
nodeUI.addListenerOnce("appear", () => {
11551154
nNodesToRender--;
11561155
if (nNodesToRender === 0) {
1156+
// all nodes rendered
11571157
this.__renderEdges(nodes);
1158+
1159+
setTimeout(() => {
1160+
// move to position (0, 0)
1161+
this._workbenchLayoutScroll.scrollToX(0);
1162+
this._workbenchLayoutScroll.scrollToY(0);
1163+
}, 10);
11581164
}
11591165
}, this);
11601166
this._addNodeUIToWorkbench(nodeUI, node.getPosition());

0 commit comments

Comments
 (0)