Skip to content

Commit 78d85df

Browse files
committed
refactor
1 parent 3fb8edd commit 78d85df

File tree

1 file changed

+37
-19
lines changed

1 file changed

+37
-19
lines changed

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

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,35 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
5757
__tagButtons: null,
5858
__appTypeButtons: null,
5959

60+
_createChildControlImpl: function(id) {
61+
let control;
62+
switch (id) {
63+
case "filters-spacer":
64+
control = new qx.ui.core.Spacer(10, 10);
65+
this._add(control);
66+
break;
67+
case "shared-with-layout":
68+
control = this.__createSharedWithFilterLayout();
69+
this._add(control);
70+
break;
71+
case "app-type-layout":
72+
control = this.__createAppTypeFilterLayout();
73+
this._add(control);
74+
break;
75+
case "tags-layout": {
76+
control = this.__createTagsFilterLayout();
77+
const scrollView = new qx.ui.container.Scroll();
78+
scrollView.add(control);
79+
this._add(scrollView, {
80+
flex: 1
81+
});
82+
break;
83+
}
84+
}
85+
return control || null;
86+
},
87+
6088
__buildLayout: function() {
61-
const filtersSpacer = new qx.ui.core.Spacer(10, 10);
6289
switch (this.__resourceType) {
6390
case "study": {
6491
this._add(this.__createWorkspacesAndFoldersTree());
@@ -72,28 +99,19 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
7299
this._add(this.__createFunctions());
73100
}
74101
this._add(this.__createTrashBin());
75-
this._add(filtersSpacer);
76-
const scrollView = new qx.ui.container.Scroll();
77-
scrollView.add(this.__createTagsFilterLayout());
78-
this._add(scrollView, {
79-
flex: 1
80-
});
102+
this.getChildControl("filters-spacer");
103+
this.getChildControl("tags-layout");
81104
break;
82105
}
83-
case "template": {
84-
this._add(filtersSpacer);
85-
this._add(this.__createSharedWithFilterLayout());
86-
const scrollView = new qx.ui.container.Scroll();
87-
scrollView.add(this.__createTagsFilterLayout());
88-
this._add(scrollView, {
89-
flex: 1
90-
});
106+
case "template":
107+
this.getChildControl("filters-spacer");
108+
this.getChildControl("shared-with-layout");
109+
this.getChildControl("tags-layout");
91110
break;
92-
}
93111
case "service":
94-
this._add(filtersSpacer);
95-
this._add(this.__createSharedWithFilterLayout());
96-
this._add(this.__createAppTypeFilterLayout());
112+
this.getChildControl("filters-spacer");
113+
this.getChildControl("shared-with-layout");
114+
this.getChildControl("app-type-layout");
97115
break;
98116
}
99117
},

0 commit comments

Comments
 (0)