forked from ITISFoundation/osparc-simcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into team-black-feedback
- Loading branch information
Showing
8 changed files
with
157 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
services/static-webserver/client/source/class/osparc/service/PricingUnitsList.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* ************************************************************************ | ||
osparc - the simcore frontend | ||
https://osparc.io | ||
Copyright: | ||
2024 IT'IS Foundation, https://itis.swiss | ||
License: | ||
MIT: https://opensource.org/licenses/MIT | ||
Authors: | ||
* Odei Maiz (odeimaiz) | ||
************************************************************************ */ | ||
|
||
qx.Class.define("osparc.service.PricingUnitsList", { | ||
extend: qx.ui.core.Widget, | ||
|
||
construct: function(serviceMetadata) { | ||
this.base(arguments); | ||
|
||
this.__serviceMetadata = serviceMetadata; | ||
|
||
this._setLayout(new qx.ui.layout.VBox(5)); | ||
|
||
this.getChildControl("pricing-units-container"); | ||
|
||
this.__fetchUnits(); | ||
}, | ||
|
||
members: { | ||
__serviceMetadata: null, | ||
|
||
_createChildControlImpl: function(id) { | ||
let control; | ||
switch (id) { | ||
case "pricing-units-container": | ||
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5)); | ||
this._addAt(control, 0, { | ||
flex: 1 | ||
}); | ||
break; | ||
} | ||
return control || this.base(arguments, id); | ||
}, | ||
|
||
__fetchUnits: function() { | ||
const plansParams = { | ||
url: osparc.data.Resources.getServiceUrl( | ||
this.__serviceMetadata["key"], | ||
this.__serviceMetadata["version"] | ||
) | ||
}; | ||
osparc.data.Resources.fetch("services", "pricingPlans", plansParams) | ||
.then(data => this.__populateList(data["pricingUnits"])) | ||
.catch(err => { | ||
console.error(err); | ||
this.__populateList([]); | ||
}); | ||
}, | ||
|
||
__populateList: function(pricingUnits) { | ||
this.getChildControl("pricing-units-container").removeAll(); | ||
|
||
if (pricingUnits.length === 0) { | ||
const notFound = new qx.ui.basic.Label().set({ | ||
value: this.tr("No Tiers found"), | ||
font: "text-14" | ||
}); | ||
this.getChildControl("pricing-units-container").add(notFound); | ||
return; | ||
} | ||
|
||
pricingUnits.forEach(pricingUnit => { | ||
const pUnit = new osparc.study.PricingUnit(pricingUnit).set({ | ||
advanced: true, | ||
allowGrowY: false | ||
}); | ||
this.getChildControl("pricing-units-container").add(pUnit); | ||
}); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters