Skip to content

🎨 Frontend: Credits indicator only visible in warning zone by default (🚨) #5897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ qx.Class.define("osparc.Preferences", {
walletIndicatorVisibility: {
check: ["always", "warning"],
nullable: false,
init: "always",
init: "warning",
event: "changeWalletIndicatorVisibility",
apply: "__patchPreference"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", {
const lItem = new qx.ui.form.ListItem(options.label, null, options.id);
walletIndicatorVisibilitySB.add(lItem);
});
const value2 = preferencesSettings.getWalletIndicatorVisibility();
const value = preferencesSettings.getWalletIndicatorVisibility();
walletIndicatorVisibilitySB.getSelectables().forEach(selectable => {
if (selectable.getModel() === value2) {
if (selectable.getModel() === value) {
walletIndicatorVisibilitySB.setSelection([selectable]);
}
});
Expand All @@ -68,7 +68,7 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", {
form.add(walletIndicatorVisibilitySB, this.tr("Show indicator"));

const creditsWarningThresholdField = new qx.ui.form.Spinner().set({
minimum: 100,
minimum: 50,
maximum: 10000,
singleStep: 10,
allowGrowX: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ qx.Class.define("osparc.info.StudyLarge", {
},

events: {
"updateStudy": "qx.event.type.Data",
"updateService": "qx.event.type.Data"
"updateStudy": "qx.event.type.Data"
},

properties: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ qx.Class.define("osparc.metadata.ClassifiersEditor", {
},

__createClassifiersTree: function() {
const studyData = this.__resourceData;
const classifiers = studyData.classifiers && studyData.classifiers ? studyData.classifiers : [];
const resourceData = this.__resourceData;
const classifiers = resourceData.classifiers && resourceData.classifiers ? resourceData.classifiers : [];
const classifiersTree = this.__classifiersTree = new osparc.filter.ClassifiersFilter("classifiersEditor", "searchBarFilter", classifiers);
osparc.store.Store.getInstance().addListener("changeClassifiers", e => {
classifiersTree.recreateTree();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ qx.Class.define("osparc.metadata.QualityEditor", {
"tsr_target": this.__copyQualityData["tsr_target"]
};
const patchData = {
"quality" : newQuality
"quality": newQuality
};
if (this.__validate(this.__schema, patchData["quality"])) {
btn.setFetching(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@ qx.Class.define("osparc.navigation.CreditsMenuButton", {
this.getContentElement().setStyle("line-height", 1.2);

const preferencesSettings = osparc.Preferences.getInstance();
this.__computeVisibility();
preferencesSettings.addListener("changeWalletIndicatorVisibility", () => this.__computeVisibility());
preferencesSettings.addListener("changeCreditsWarningThreshold", () => {
this.__computeVisibility();
this.__updateCredits();
});
preferencesSettings.addListener("changeCreditsWarningThreshold", () => this.__updateCredits());

const store = osparc.store.Store.getInstance();
this.__contextWalletChanged(store.getContextWallet());
Expand Down Expand Up @@ -100,6 +96,7 @@ qx.Class.define("osparc.navigation.CreditsMenuButton", {
textColor: osparc.desktop.credits.Utils.creditsToColor(creditsLeft, "text")
});
}
this.__computeVisibility();
},

__computeVisibility: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CreditsWarningThresholdFrontendUserPreference(FrontendUserPreference):

class WalletIndicatorVisibilityFrontendUserPreference(FrontendUserPreference):
preference_identifier: PreferenceIdentifier = "walletIndicatorVisibility"
value: str | None = "always"
value: str | None = "warning"


class UserInactivityThresholdFrontendUserPreference(FrontendUserPreference):
Expand Down
Loading