Skip to content

Commit 282d397

Browse files
committed
simplify
1 parent 45882b7 commit 282d397

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
100100
__billingSettings: null,
101101
__classifiersPage: null,
102102
__qualityPage: null,
103-
__openButton: null,
104-
__payDebtButton: null,
105103

106104
__addOpenButton: function(page) {
107105
const resourceData = this.__resourceData;
@@ -110,13 +108,13 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
110108
page.addToHeader(toolbar);
111109

112110
if (this.__resourceData["resourceType"] === "study") {
113-
const payDebtButton = this.__payDebtButton = new qx.ui.form.Button(this.tr("Credits required"));
111+
const payDebtButton = new qx.ui.form.Button(this.tr("Credits required"));
114112
page.payDebtButton = payDebtButton;
115113
osparc.dashboard.resources.pages.BasePage.decorateHeaderButton(payDebtButton);
116114
payDebtButton.addListener("execute", () => this.openBillingSettings());
117115
if (this.__resourceData["resourceType"] === "study") {
118116
const studyData = this.__resourceData;
119-
this.__payDebtButton.set({
117+
payDebtButton.set({
120118
visibility: osparc.study.Utils.isInDebt(studyData) ? "visible" : "excluded"
121119
});
122120
}
@@ -128,7 +126,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
128126
toolbar.add(serviceVersionSelector);
129127
}
130128

131-
const openButton = this.__openButton = new osparc.ui.form.FetchButton(this.tr("Open")).set({
129+
const openButton = new osparc.ui.form.FetchButton(this.tr("Open")).set({
132130
enabled: true
133131
});
134132
page.openButton = openButton;
@@ -141,7 +139,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
141139
this.bind("showOpenButton", openButton, "visibility", {
142140
converter: show => (store.getCurrentStudy() === null && show) ? "visible" : "excluded"
143141
});
144-
openButton.addListener("execute", () => this.__openTapped());
142+
openButton.addListener("execute", () => this.__openTapped(openButton));
145143

146144
if (this.__resourceData["resourceType"] === "study") {
147145
const studyData = this.__resourceData;
@@ -152,21 +150,21 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
152150
toolbar.add(openButton);
153151
},
154152

155-
__openTapped: function() {
153+
__openTapped: function(openButton) {
156154
if (this.__resourceData["resourceType"] !== "study") {
157155
// Template or Service, nothing to pre-check
158156
this.__openResource();
159157
return;
160158
}
161-
this.__openButton.setFetching(true);
159+
openButton.setFetching(true);
162160
const params = {
163161
url: {
164162
"studyId": this.__resourceData["uuid"]
165163
}
166164
};
167165
osparc.data.Resources.getOne("studies", params)
168166
.then(updatedStudyData => {
169-
this.__openButton.setFetching(false);
167+
openButton.setFetching(false);
170168
const updatableServices = osparc.metadata.ServicesInStudyUpdate.updatableNodeIds(updatedStudyData.workbench);
171169
if (updatableServices.length && osparc.data.model.Study.canIWrite(updatedStudyData["accessRights"])) {
172170
this.__confirmUpdate();
@@ -177,7 +175,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
177175
.catch(err => {
178176
console.error(err);
179177
osparc.FlashMessenger.logAs(err.message, "ERROR");
180-
this.__openButton.setFetching(false);
178+
openButton.setFetching(false);
181179
});
182180
},
183181

0 commit comments

Comments
 (0)