Skip to content

Commit e7af162

Browse files
authored
πŸ› [Frontend] pydanticV2: Decimals are now Strings (#6853)
1 parent 4160ba3 commit e7af162

File tree

9 files changed

+16
-12
lines changed

9 files changed

+16
-12
lines changed

β€Žservices/static-webserver/client/source/class/osparc/data/model/Wallet.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ qx.Class.define("osparc.data.model.Wallet", {
2929
thumbnail: walletData["thumbnail"] ? walletData["thumbnail"] : null,
3030
owner: walletData["owner"] ? walletData["owner"] : null,
3131
status: walletData["status"] ? walletData["status"] : "INACTIVE",
32-
creditsAvailable: walletData["availableCredits"] ? walletData["availableCredits"] : 0,
32+
creditsAvailable: walletData["availableCredits"] ? parseFloat(walletData["availableCredits"]) : 0,
3333
accessRights: walletData["accessRights"] ? walletData["accessRights"] : [],
3434
autoRecharge: walletData["autoRecharge"] ? walletData["autoRecharge"] : null,
3535
preferredWallet: osparc.Preferences.getInstance().getPreferredWalletId() === walletData["walletId"]

β€Žservices/static-webserver/client/source/class/osparc/desktop/credits/BuyCreditsStepper.jsβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ qx.Class.define("osparc.desktop.credits.BuyCreditsStepper", {
3131
this.removeAll();
3232
this.__form = new osparc.desktop.credits.BuyCreditsForm(this.__paymentMethods);
3333
this.__form.addListener("submit", e => {
34-
const { amountDollars: priceDollars, osparcCredits, paymentMethodId } = e.getData();
34+
const {
35+
amountDollars: priceDollars,
36+
osparcCredits, paymentMethodId
37+
} = e.getData();
3538
const params = {
3639
url: {
3740
walletId: this.__personalWallet.getWalletId()

β€Žservices/static-webserver/client/source/class/osparc/desktop/credits/CreditsPerService.jsβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ qx.Class.define("osparc.desktop.credits.CreditsPerService", {
6464
let totalHours = 0;
6565
entries.forEach(entry => {
6666
totalHours += entry["running_time_in_hours"]
67-
totalCredits+= entry["osparc_credits"]
67+
totalCredits+= parseFloat(entry["osparc_credits"])
6868
});
6969
let datas = [];
7070
entries.forEach(entry => {
7171
datas.push({
7272
service: entry["service_key"],
73-
credits: -1*entry["osparc_credits"],
73+
credits: -1*parseFloat(entry["osparc_credits"]),
7474
hours: entry["running_time_in_hours"],
7575
percentageHours: totalHours ? 100*entry["running_time_in_hours"]/totalHours : 0,
76-
percentageCredits: totalCredits ? 100*entry["osparc_credits"]/totalCredits : 0,
76+
percentageCredits: totalCredits ? 100*parseFloat(entry["osparc_credits"])/totalCredits : 0,
7777
});
7878
});
7979
datas.sort((a, b) => {

β€Žservices/static-webserver/client/source/class/osparc/desktop/credits/CurrentUsage.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ qx.Class.define("osparc.desktop.credits.CurrentUsage", {
7272
let cost = 0;
7373
currentTasks.forEach(currentTask => {
7474
if (currentTask["credit_cost"]) {
75-
cost += currentTask["credit_cost"];
75+
cost += parseFloat(currentTask["credit_cost"]);
7676
}
7777
});
7878
this.setUsedCredits(cost);

β€Žservices/static-webserver/client/source/class/osparc/desktop/credits/TransactionsTableModel.jsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ qx.Class.define("osparc.desktop.credits.TransactionsTableModel", {
8787
rawData.forEach(rawRow => {
8888
data.push({
8989
date: osparc.utils.Utils.formatDateAndTime(new Date(rawRow.createdAt)),
90-
price: rawRow.priceDollars ? rawRow.priceDollars.toFixed(2) : 0,
91-
credits: rawRow.osparcCredits ? rawRow.osparcCredits.toFixed(2) * 1 : 0,
90+
price: rawRow.priceDollars ? parseFloat(rawRow.priceDollars).toFixed(2) : 0,
91+
credits: rawRow.osparcCredits ? parseFloat(rawRow.osparcCredits).toFixed(2) * 1 : 0,
9292
status: this.__addColorTag(rawRow.completedStatus),
9393
comment: rawRow.comment,
9494
invoice: rawRow.invoiceUrl ? this.__createPdfIconWithLink(rawRow.walletId, rawRow.paymentId) : ""

β€Žservices/static-webserver/client/source/class/osparc/desktop/credits/UsageTableModel.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ qx.Class.define("osparc.desktop.credits.UsageTableModel", {
148148
[usageCols.START.id]: start,
149149
[usageCols.DURATION.id]: duration,
150150
[usageCols.STATUS.id]: qx.lang.String.firstUp(rawRow["service_run_status"].toLowerCase()),
151-
[usageCols.COST.id]: rawRow["credit_cost"] ? rawRow["credit_cost"].toFixed(2) : "",
151+
[usageCols.COST.id]: rawRow["credit_cost"] ? parseFloat(rawRow["credit_cost"]).toFixed(2) : "",
152152
[usageCols.USER.id]: rawRow["user_email"]
153153
})
154154
})

β€Žservices/static-webserver/client/source/class/osparc/pricing/UnitData.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ qx.Class.define("osparc.pricing.UnitData", {
2929
this.set({
3030
pricingUnitId: unitData.pricingUnitId ? unitData.pricingUnitId : null,
3131
unitName: unitData.unitName,
32-
currentCostPerUnit: unitData.currentCostPerUnit,
32+
currentCostPerUnit: parseFloat(unitData.currentCostPerUnit),
3333
comment: unitData.comment ? unitData.comment : "",
3434
awsSpecificInfo: unitData.specificInfo && unitData.specificInfo["aws_ec2_instances"] ? unitData.specificInfo["aws_ec2_instances"].toString() : "",
3535
unitExtraInfo: unitData.unitExtraInfo,

β€Žservices/static-webserver/client/source/class/osparc/pricing/UnitEditor.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ qx.Class.define("osparc.pricing.UnitEditor", {
5050
this.set({
5151
pricingUnitId: pricingUnitData.pricingUnitId,
5252
unitName: pricingUnitData.unitName,
53-
costPerUnit: pricingUnitData.currentCostPerUnit,
53+
costPerUnit: parseFloat(pricingUnitData.currentCostPerUnit),
5454
comment: pricingUnitData.comment ? pricingUnitData.comment : "",
5555
specificInfo: pricingUnitData.specificInfo && pricingUnitData.specificInfo["aws_ec2_instances"] ? pricingUnitData.specificInfo["aws_ec2_instances"].toString() : "",
5656
default: pricingUnitData.default

β€Žservices/static-webserver/client/source/class/osparc/widget/PersistentIframe.jsβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ qx.Class.define("osparc.widget.PersistentIframe", {
128128
top: this.self().HIDDEN_TOP
129129
});
130130
const iframeEl = this._getIframeElement();
131-
iframeEl.setAttribute("allow", "clipboard-write");
131+
const host = window.location.host;
132+
iframeEl.setAttribute("allow", `clipboard-read; clipboard-write; from *.services.${host}`);
132133

133134
const buttonContainer = this.__buttonContainer = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({
134135
alignX: "right",

0 commit comments

Comments
Β (0)