Skip to content

Commit e36f4e9

Browse files
committed
separator in Organizations
1 parent 1049023 commit e36f4e9

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

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

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsList", {
8989
getOrgModel: function(orgId) {
9090
let org = null;
9191
this.__orgsModel.forEach(orgModel => {
92-
if (orgModel.getGroupId() === parseInt(orgId)) {
92+
if ("getGroupId" in orgModel && orgModel.getGroupId() === parseInt(orgId)) {
9393
org = orgModel;
9494
}
9595
});
@@ -146,6 +146,10 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsList", {
146146
ctrl.bindProperty("description", "subtitle", null, item, id);
147147
ctrl.bindProperty("groupMembers", "groupMembers", null, item, id);
148148
ctrl.bindProperty("accessRights", "accessRights", null, item, id);
149+
// handle separator
150+
ctrl.bindProperty("isSeparator", "enabled", {
151+
converter: val => !val // disable clicks on separator
152+
}, item, id);
149153
},
150154
configureItem: item => {
151155
item.subscribeToFilterGroup("organizationsList");
@@ -165,6 +169,15 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsList", {
165169
const orgKey = e.getData();
166170
this.__deleteOrganization(orgKey);
167171
});
172+
item.addListener("changeEnabled", e => {
173+
if (!e.getData()) {
174+
item.set({
175+
minHeight: 1,
176+
maxHeight: 1,
177+
decorator: "separator-strong",
178+
});
179+
}
180+
});
168181
}
169182
});
170183

@@ -189,7 +202,28 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsList", {
189202
const groupsStore = osparc.store.Groups.getInstance();
190203
const orgs = Object.values(groupsStore.getOrganizations());
191204
orgs.sort(this.self().sortOrganizations);
192-
orgs.forEach(org => orgsModel.append(org));
205+
206+
// insert a separator between product and non-product groups
207+
const productGroup = [
208+
osparc.store.Groups.COLLAB_TYPE.EVERYONE,
209+
osparc.store.Groups.COLLAB_TYPE.SUPPORT,
210+
];
211+
const hasProductGroup = orgs.some(org => productGroup.includes(org.getGroupType()));
212+
const hasNonProductGroup = orgs.some(org => !productGroup.includes(org.getGroupType()));
213+
let separatorInserted = false;
214+
orgs.forEach(org => {
215+
const isProductGroup = productGroup.includes(org.getGroupType());
216+
// Only insert separator if both sides exist
217+
if (!isProductGroup && hasProductGroup && hasNonProductGroup && !separatorInserted) {
218+
const separator = {
219+
isSeparator: true
220+
};
221+
orgsModel.append(qx.data.marshal.Json.createModel(separator));
222+
separatorInserted = true;
223+
}
224+
orgsModel.append(org);
225+
});
226+
193227
this.setOrganizationsLoaded(true);
194228
if (orgId) {
195229
this.fireDataEvent("organizationSelected", orgId);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ qx.Class.define("osparc.share.Collaborators", {
507507
}
508508
collaboratorsList.sort(this.self().sortStudyOrServiceCollabs);
509509

510-
// add a separator right after the product groups
510+
// insert a separator between product and non-product groups
511511
const productGroup = [
512512
osparc.store.Groups.COLLAB_TYPE.EVERYONE,
513513
osparc.store.Groups.COLLAB_TYPE.SUPPORT,

0 commit comments

Comments
 (0)