diff --git a/services/static-webserver/client/source/class/osparc/desktop/credits/CheckoutsTable.js b/services/static-webserver/client/source/class/osparc/desktop/credits/CheckoutsTable.js index 8c590bc779c..82f38559161 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/credits/CheckoutsTable.js +++ b/services/static-webserver/client/source/class/osparc/desktop/credits/CheckoutsTable.js @@ -32,7 +32,7 @@ qx.Class.define("osparc.desktop.credits.CheckoutsTable", { }); const columnModel = this.getTableColumnModel(); - columnModel.setColumnVisible(this.self().COLS.PURCHASE_ID.column, false); + columnModel.setColumnVisible(this.self().COLS.CHECKOUT_ID.column, false); columnModel.setColumnVisible(this.self().COLS.ITEM_ID.column, false); columnModel.setDataCellRenderer(this.self().COLS.COST.column, new qx.ui.table.cellrenderer.Number()); @@ -41,10 +41,10 @@ qx.Class.define("osparc.desktop.credits.CheckoutsTable", { statics: { COLS: { - PURCHASE_ID: { - id: "purchaseId", + CHECKOUT_ID: { + id: "checkoutId", column: 0, - label: qx.locale.Manager.tr("PurchaseId"), + label: qx.locale.Manager.tr("CheckoutId"), width: 150 }, ITEM_ID: { @@ -65,10 +65,10 @@ qx.Class.define("osparc.desktop.credits.CheckoutsTable", { label: qx.locale.Manager.tr("Start"), width: 150 }, - END: { - id: "end", + DURATION: { + id: "duration", column: 4, - label: qx.locale.Manager.tr("End"), + label: qx.locale.Manager.tr("Duration"), width: 150 }, SEATS: { @@ -77,15 +77,9 @@ qx.Class.define("osparc.desktop.credits.CheckoutsTable", { label: qx.locale.Manager.tr("Seats"), width: 50 }, - COST: { - id: "cost", - column: 6, - label: qx.locale.Manager.tr("Credits"), - width: 60 - }, USER: { id: "user", - column: 7, + column: 6, label: qx.locale.Manager.tr("User"), width: 100 }, diff --git a/services/static-webserver/client/source/class/osparc/desktop/credits/CheckoutsTableModel.js b/services/static-webserver/client/source/class/osparc/desktop/credits/CheckoutsTableModel.js index 8297259c9ec..54785a2f932 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/credits/CheckoutsTableModel.js +++ b/services/static-webserver/client/source/class/osparc/desktop/credits/CheckoutsTableModel.js @@ -33,6 +33,7 @@ qx.Class.define("osparc.desktop.credits.CheckoutsTableModel", { } this.setSortColumnIndexWithoutSortingData(checkoutsCols.START.column); this.setSortAscendingWithoutSortingData(false); + this.setColumnSortable(checkoutsCols.DURATION.column, false); }, properties: { @@ -135,14 +136,21 @@ qx.Class.define("osparc.desktop.credits.CheckoutsTableModel", { const licensedItemId = checkoutsItem["licensedItemId"]; const licensedItem = licensedItems.find(licItem => licItem["licensedItemId"] === licensedItemId); const vipModel = vipModels.find(vipMdl => licensedItem && (vipMdl["modelId"] == licensedItem["name"])); + let start = ""; + let duration = ""; + if (checkoutsItem["startedAt"]) { + start = osparc.utils.Utils.formatDateAndTime(new Date(checkoutsItem["startedAt"])); + if (checkoutsItem["stoppedAt"]) { + duration = osparc.utils.Utils.formatMsToHHMMSS(new Date(checkoutsItem["stoppedAt"]) - new Date(checkoutsItem["startedAt"])); + } + } data.push({ - [checkoutsCols.PURCHASE_ID.id]: checkoutsItem["licensedItemPurchaseId"], + [checkoutsCols.CHECKOUT_ID.id]: checkoutsItem["licensed_item_checkout_id"], [checkoutsCols.ITEM_ID.id]: licensedItemId, [checkoutsCols.ITEM_LABEL.id]: vipModel ? vipModel["name"] : "unknown model", - [checkoutsCols.START.id]: osparc.utils.Utils.formatDateAndTime(new Date(checkoutsItem["startAt"])), - [checkoutsCols.END.id]: osparc.utils.Utils.formatDateAndTime(new Date(checkoutsItem["expireAt"])), + [checkoutsCols.START.id]: start, + [checkoutsCols.DURATION.id]: duration, [checkoutsCols.SEATS.id]: checkoutsItem["numOfSeats"], - [checkoutsCols.COST.id]: checkoutsItem["pricingUnitCost"] ? ("-" + parseFloat(checkoutsItem["pricingUnitCost"]).toFixed(2)) : "", // show it negative [checkoutsCols.USER.id]: checkoutsItem["purchasedByUser"], }); });