Skip to content

Commit 5070ea7

Browse files
committed
refactor
1 parent 4a86b9a commit 5070ea7

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,7 @@ qx.Class.define("osparc.dashboard.GroupedCardContainer", {
126126
},
127127

128128
__modeChanged: function(container) {
129-
const spacing = this.getMode() === "grid" ? osparc.dashboard.GridButtonBase.SPACING : osparc.dashboard.ListButtonBase.SPACING;
130-
container.getLayout().set({
131-
spacingX: spacing,
132-
spacingY: spacing
133-
});
129+
osparc.dashboard.ResourceContainerManager.updateSpacing(this.getMode(), container);
134130
if (this.getMode() === "list") {
135131
this.set({
136132
expanded: true,

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,15 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
110110
}
111111
}
112112
return false;
113-
}
113+
},
114+
115+
updateSpacing: function(mode, container) {
116+
const spacing = mode === "grid" ? osparc.dashboard.GridButtonBase.SPACING : osparc.dashboard.ListButtonBase.SPACING;
117+
container.getLayout().set({
118+
spacingX: spacing,
119+
spacingY: spacing
120+
});
121+
},
114122
},
115123

116124
members: {
@@ -311,18 +319,10 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
311319
}
312320
},
313321

314-
__modeChanged: function(container) {
315-
const spacing = this.getMode() === "grid" ? osparc.dashboard.GridButtonBase.SPACING : osparc.dashboard.ListButtonBase.SPACING;
316-
container.getLayout().set({
317-
spacingX: spacing,
318-
spacingY: spacing
319-
});
320-
},
321-
322322
__createFlatList: function() {
323323
const flatList = new osparc.dashboard.CardContainer();
324-
this.__modeChanged(flatList);
325-
this.addListener("changeMode", () => this.__modeChanged(flatList));
324+
osparc.dashboard.ResourceContainerManager.updateSpacing(this.getMode(), flatList);
325+
this.addListener("changeMode", () => osparc.dashboard.ResourceContainerManager.updateSpacing(this.getMode(), flatList));
326326
[
327327
"changeSelection",
328328
"changeVisibility"

0 commit comments

Comments
 (0)