Skip to content

Commit f0f4e0f

Browse files
committed
enable button
1 parent d63516b commit f0f4e0f

File tree

1 file changed

+13
-10
lines changed
  • services/static-webserver/client/source/class/osparc/desktop/account

1 file changed

+13
-10
lines changed

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
9494
};
9595
this.__userProfileRenderer.setIcons(icons);
9696
}
97+
this.__updatePrivacyBtn.setEnabled(false);
9798
},
9899

99100
__createProfileUser: function() {
@@ -272,19 +273,15 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
272273
privacyModelCtrl.addTarget(hideFullname, "value", "hideFullname", true);
273274
privacyModelCtrl.addTarget(hideEmail, "value", "hideEmail", true);
274275

275-
privacyModelCtrl.addListener("changeTarget", () => {
276-
console.log("form changeModel");
277-
});
278-
279-
const privacyBtn = new qx.ui.form.Button().set({
276+
const updatePrivacyBtn = this.__updatePrivacyBtn = new qx.ui.form.Button().set({
280277
label: this.tr("Update Privacy"),
281278
appearance: "form-button",
282279
alignX: "right",
283280
allowGrowX: false,
284281
enabled: false,
285282
});
286-
box.add(privacyBtn);
287-
privacyBtn.addListener("execute", () => {
283+
box.add(updatePrivacyBtn);
284+
updatePrivacyBtn.addListener("execute", () => {
288285
if (!osparc.data.Permissions.getInstance().canDo("user.user.update", true)) {
289286
this.__resetPrivacyData();
290287
return;
@@ -345,15 +342,21 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
345342
hideFullname,
346343
hideEmail,
347344
]
348-
const valuesChanged = () => {
345+
const valueChanged = () => {
346+
const anyChanged =
347+
hideUsername.getValue() !== this.__userPrivacyData["hideUsername"] ||
348+
hideFullname.getValue() !== this.__userPrivacyData["hideFullname"] ||
349+
hideEmail.getValue() !== this.__userPrivacyData["hideEmail"];
350+
updatePrivacyBtn.setEnabled(anyChanged);
351+
349352
if (privacyFields.every(privacyField => privacyField.getValue())) {
350353
optOutMessage.show();
351354
} else {
352355
optOutMessage.exclude();
353356
}
354357
};
355-
valuesChanged();
356-
privacyFields.forEach(privacyField => privacyField.addListener("changeValue", () => valuesChanged()));
358+
valueChanged();
359+
privacyFields.forEach(privacyField => privacyField.addListener("changeValue", () => valueChanged()));
357360

358361
return box;
359362
},

0 commit comments

Comments
 (0)