Skip to content

Commit 8c43212

Browse files
odeimaizsanderegg
authored andcommitted
Auto retrieve, round 2 (#969)
Shows spinner when files are being retrieved Check or Cross when finished retrieving Got rid of retrieve all button
1 parent 3e80ce4 commit 8c43212

File tree

9 files changed

+293
-107
lines changed

9 files changed

+293
-107
lines changed

services/docker-compose.devel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ services:
1616
build:
1717
target: development
1818
environment:
19-
REGISTRY_CACHING=False
19+
- REGISTRY_CACHING=False
2020
volumes:
2121
- ./director:/devel/services/director
2222
- ../packages/service-library:/devel/packages/service-library

services/web/client/source/class/qxapp/component/filter/TagsFilter.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,40 +64,22 @@ qx.Class.define("qxapp.component.filter.TagsFilter", {
6464
__buildMenu: function() {
6565
const menu = new qx.ui.menu.Menu();
6666

67-
this.__getServiceTypes().forEach(serviceType => {
67+
qxapp.utils.Services.getTypes().forEach(serviceType => {
6868
const button = new qx.ui.menu.Button(qxapp.utils.Utils.capitalize(serviceType));
6969
button.addListener("execute", e => this.__addTag(serviceType, e.getTarget()));
7070
menu.add(button);
7171
});
7272

7373
menu.addSeparator();
7474

75-
this.__getServiceCategories().forEach(serviceCategory => {
75+
qxapp.utils.Services.getCategories().forEach(serviceCategory => {
7676
const button = new qx.ui.menu.Button(qxapp.utils.Utils.capitalize(serviceCategory));
7777
button.addListener("execute", e => this.__addTag(serviceCategory, e.getTarget()));
7878
menu.add(button);
7979
});
8080
return menu;
8181
},
8282

83-
__getServiceTypes: function() {
84-
return [
85-
"computational",
86-
"dynamic"
87-
];
88-
},
89-
90-
__getServiceCategories: function() {
91-
return [
92-
"data",
93-
"modeling",
94-
"simulator",
95-
"solver",
96-
"postpro",
97-
"notebook"
98-
];
99-
},
100-
10183
__addTag: function(tagName, menuButton) {
10284
// Check if added
10385
this.__activeTags = this.__activeTags || [];

services/web/client/source/class/qxapp/component/form/renderer/PropForm.js

Lines changed: 173 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,28 @@ qx.Class.define("qxapp.component.form.renderer.PropForm", {
6262
}
6363
},
6464

65+
statics: {
66+
getRetrievingAtom: function() {
67+
return new qx.ui.basic.Atom("", "qxapp/loading.gif");
68+
},
69+
70+
getRetrievedAtom: function(success) {
71+
const icon = success ? "@FontAwesome5Solid/check/12" : "@FontAwesome5Solid/times/12";
72+
return new qx.ui.basic.Atom("", icon);
73+
}
74+
},
75+
6576
// eslint-disable-next-line qx-rules/no-refs-in-members
6677
members: {
6778
_gridPos: {
6879
label: 0,
69-
entryField: 1
80+
entryField: 1,
81+
retrieveStatus: 2
82+
},
83+
_retrieveStatus: {
84+
failed: 0,
85+
retrieving: 1,
86+
succeed: 2
7087
},
7188
addItems: function(items, names, title, itemOptions, headerOptions) {
7289
// add the header
@@ -90,7 +107,10 @@ qx.Class.define("qxapp.component.form.renderer.PropForm", {
90107
column: this._gridPos.label
91108
});
92109
label.setBuddy(item);
93-
this._add(new qxapp.component.form.FieldWHint(null, item.description, item), {
110+
111+
const field = new qxapp.component.form.FieldWHint(null, item.description, item);
112+
field.key = item.key;
113+
this._add(field, {
94114
row: this._row,
95115
column: this._gridPos.entryField
96116
});
@@ -149,51 +169,176 @@ qx.Class.define("qxapp.component.form.renderer.PropForm", {
149169
return filteredData;
150170
},
151171

152-
linkAdded: function(portId) {
153-
let children = this._getChildren();
172+
__getLayoutChild(portId, column) {
173+
let row = null;
174+
const children = this._getChildren();
154175
for (let i=0; i<children.length; i++) {
155-
let child = children[i];
156-
if (child.getField && child.getField().key === portId) {
176+
const child = children[i];
177+
const layoutProps = child.getLayoutProperties();
178+
if (layoutProps.column === this._gridPos.label &&
179+
child.getBuddy().key === portId) {
180+
row = layoutProps.row;
181+
break;
182+
}
183+
}
184+
if (row !== null) {
185+
for (let i=0; i<children.length; i++) {
186+
const child = children[i];
157187
const layoutProps = child.getLayoutProperties();
158-
this._remove(child);
188+
if (layoutProps.column === column &&
189+
layoutProps.row === row) {
190+
return {
191+
child,
192+
idx: i
193+
};
194+
}
195+
}
196+
}
197+
return null;
198+
},
159199

160-
const hBox = new qx.ui.container.Composite(new qx.ui.layout.HBox(5));
161-
hBox.add(this._form.getControlLink(portId), {
162-
flex: 1
163-
});
200+
__getEntryFieldChild(portId) {
201+
return this.__getLayoutChild(portId, this._gridPos.entryField);
202+
},
203+
204+
__getRetrieveStatusChild(portId) {
205+
return this.__getLayoutChild(portId, this._gridPos.retrieveStatus);
206+
},
207+
208+
linkAdded: function(portId) {
209+
let data = this.__getEntryFieldChild(portId);
210+
if (data) {
211+
let child = data.child;
212+
let idx = data.idx;
213+
const layoutProps = child.getLayoutProperties();
214+
this._remove(child);
215+
216+
const hBox = new qx.ui.container.Composite(new qx.ui.layout.HBox(5));
217+
hBox.add(this._form.getControlLink(portId), {
218+
flex: 1
219+
});
164220

165-
const unlinkBtn = new qx.ui.form.Button(this.tr("Unlink"), "@FontAwesome5Solid/unlink/14");
166-
unlinkBtn.addListener("execute", function() {
167-
this.fireDataEvent("removeLink", portId);
168-
}, this);
169-
hBox.add(unlinkBtn);
221+
const unlinkBtn = new qx.ui.form.Button(this.tr("Unlink"), "@FontAwesome5Solid/unlink/14");
222+
unlinkBtn.addListener("execute", function() {
223+
this.fireDataEvent("removeLink", portId);
224+
}, this);
225+
hBox.add(unlinkBtn);
226+
227+
hBox.key = portId;
228+
this._addAt(hBox, idx, {
229+
row: layoutProps.row,
230+
column: this._gridPos.entryField
231+
});
170232

171-
hBox.key = portId;
172-
this._addAt(hBox, i, {
233+
this.fireDataEvent("dataFieldModified", portId);
234+
}
235+
},
236+
237+
linkRemoved: function(portId) {
238+
let data = this.__getEntryFieldChild(portId);
239+
if (data) {
240+
let child = data.child;
241+
let idx = data.idx;
242+
const layoutProps = child.getLayoutProperties();
243+
if (layoutProps.column === this._gridPos.entryField) {
244+
this._remove(child);
245+
const field = new qxapp.component.form.FieldWHint(null, this._form.getControl(portId).description, this._form.getControl(portId));
246+
this._addAt(field, idx, {
173247
row: layoutProps.row,
174-
column: this._gridPos.entryField
248+
column: layoutProps.column
175249
});
176250

177251
this.fireDataEvent("dataFieldModified", portId);
178252
}
179253
}
180254
},
181255

182-
linkRemoved: function(portId) {
256+
retrievingPortData: function(portId) {
257+
const status = this._retrieveStatus.retrieving;
258+
if (portId) {
259+
let data = this.__getEntryFieldChild(portId);
260+
if (data) {
261+
let child = data.child;
262+
let idx = data.idx;
263+
const layoutProps = child.getLayoutProperties();
264+
this.__setRetrievingStatus(status, portId, idx+1, layoutProps.row);
265+
}
266+
} else {
267+
for (let i = this._getChildren().length; i--;) {
268+
let child = this._getChildren()[i];
269+
const layoutProps = child.getLayoutProperties();
270+
if (layoutProps.column === this._gridPos.entryField) {
271+
const ctrl = this._form.getControl(child.key);
272+
if (ctrl && ctrl.link) {
273+
this.__setRetrievingStatus(status, child.key, i, layoutProps.row);
274+
}
275+
}
276+
}
277+
}
278+
},
279+
280+
retrievedPortData: function(portId, succeed) {
281+
const status = succeed ? this._retrieveStatus.succeed : this._retrieveStatus.failed;
282+
if (portId) {
283+
let data = this.__getEntryFieldChild(portId);
284+
if (data) {
285+
let child = data.child;
286+
let idx = data.idx;
287+
const layoutProps = child.getLayoutProperties();
288+
// this._remove(child);
289+
this.__setRetrievingStatus(status, portId, idx+1, layoutProps.row);
290+
}
291+
} else {
292+
let children = this._getChildren();
293+
for (let i=0; i<children.length; i++) {
294+
let child = children[i];
295+
const layoutProps = child.getLayoutProperties();
296+
if (layoutProps.column === this._gridPos.retrieveStatus) {
297+
// this._remove(child);
298+
this.__setRetrievingStatus(status, portId, i, layoutProps.row);
299+
}
300+
}
301+
}
302+
},
303+
304+
__setRetrievingStatus: function(status, portId, idx, row) {
305+
let icon;
306+
switch (status) {
307+
case this._retrieveStatus.failed:
308+
icon = qxapp.component.form.renderer.PropForm.getRetrievedAtom(false);
309+
break;
310+
case this._retrieveStatus.retrieving:
311+
icon = qxapp.component.form.renderer.PropForm.getRetrievingAtom();
312+
break;
313+
case this._retrieveStatus.succeed:
314+
icon = qxapp.component.form.renderer.PropForm.getRetrievedAtom(true);
315+
break;
316+
}
317+
icon.key = portId;
318+
319+
// remove first if any
183320
let children = this._getChildren();
184321
for (let i=0; i<children.length; i++) {
185322
let child = children[i];
186-
if ("key" in child && child.key === portId) {
187-
const layoutProps = child.getLayoutProperties();
323+
const layoutProps = child.getLayoutProperties();
324+
if (layoutProps.row === row &&
325+
layoutProps.column === this._gridPos.retrieveStatus) {
188326
this._remove(child);
189-
this._addAt(new qxapp.component.form.FieldWHint(null, this._form.getControl(portId).description, this._form.getControl(portId)), i, {
190-
row: layoutProps.row,
191-
column: this._gridPos.entryField
192-
});
193-
194-
this.fireDataEvent("dataFieldModified", portId);
195327
}
196328
}
329+
330+
this._addAt(icon, idx, {
331+
row: row,
332+
column: this._gridPos.retrieveStatus
333+
});
334+
},
335+
336+
__isInputData: function(portId) {
337+
const port = this.getNode().getInput(portId);
338+
if (port) {
339+
return port.type.includes("data");
340+
}
341+
return false;
197342
},
198343

199344
__arePortsCompatible: function(node1Id, port1Id, node2Id, port2Id) {

services/web/client/source/class/qxapp/data/Converters.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ qx.Class.define("qxapp.data.Converters", {
123123
},
124124

125125
createDirEntry: function(label, location, path, children = []) {
126+
if (label === null || label === undefined || label === "") {
127+
label = "Unknown label";
128+
}
126129
return {
127130
label,
128131
location,
@@ -145,7 +148,7 @@ qx.Class.define("qxapp.data.Converters", {
145148
lastModified = (Math.floor(Math.random()*1000000)+1).toString();
146149
}
147150
if (size === undefined) {
148-
size = (Math.floor(Math.random()*1000000)+1).toString();
151+
size = 0;
149152
}
150153
return {
151154
label,

0 commit comments

Comments
 (0)