From af5d4b889cab6f613f352b823b480b4b7f90862e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 11:36:36 +0100 Subject: [PATCH 1/3] [skip ci ]renaming --- .../client/source/class/osparc/data/Resources.js | 6 +++--- .../source/class/osparc/desktop/credits/CurrentUsage.js | 2 +- .../source/class/osparc/desktop/credits/UsageTableModel.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/Resources.js b/services/static-webserver/client/source/class/osparc/data/Resources.js index 534e9bd723a..16dbadc0b37 100644 --- a/services/static-webserver/client/source/class/osparc/data/Resources.js +++ b/services/static-webserver/client/source/class/osparc/data/Resources.js @@ -418,11 +418,11 @@ qx.Class.define("osparc.data.Resources", { }, getWithWallet: { method: "GET", - url: statics.API + "/services/-/resource-usages?wallet_id={walletId}&offset={offset}&limit={limit}&filters={filters}&order_by={orderBy}" + url: statics.API + "/services/-/resource-usages?wallet_id={walletId}&offset={offset}&limit={limit}" }, - getWithWallet2: { + getWithWalletFiltered: { method: "GET", - url: statics.API + "/services/-/resource-usages?wallet_id={walletId}&offset={offset}&limit={limit}" + url: statics.API + "/services/-/resource-usages?wallet_id={walletId}&offset={offset}&limit={limit}&filters={filters}&order_by={orderBy}" }, getUsagePerService: { method: "GET", diff --git a/services/static-webserver/client/source/class/osparc/desktop/credits/CurrentUsage.js b/services/static-webserver/client/source/class/osparc/desktop/credits/CurrentUsage.js index 9f03b4314bc..48597eb99ef 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/credits/CurrentUsage.js +++ b/services/static-webserver/client/source/class/osparc/desktop/credits/CurrentUsage.js @@ -66,7 +66,7 @@ qx.Class.define("osparc.desktop.credits.CurrentUsage", { limit: 10 } }; - osparc.data.Resources.fetch("resourceUsage", "getWithWallet2", params) + osparc.data.Resources.fetch("resourceUsage", "getWithWallet", params) .then(data => { const currentTasks = data.filter(d => (d.project_id === currentStudy.getUuid()) && d.service_run_status === "RUNNING"); let cost = 0; diff --git a/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTableModel.js b/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTableModel.js index 95b6128c086..61e115a1862 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTableModel.js +++ b/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTableModel.js @@ -76,7 +76,7 @@ qx.Class.define("osparc.desktop.credits.UsageTableModel", { // overridden _loadRowCount() { - const endpoint = this.getWalletId() == null ? "get" : "getWithWallet" + const endpoint = this.getWalletId() == null ? "get" : "getWithWalletFiltered" const params = { url: { walletId: this.getWalletId(), @@ -109,7 +109,7 @@ qx.Class.define("osparc.desktop.credits.UsageTableModel", { const lastRow = Math.min(qxLastRow, this._rowCount - 1) // Returns a request promise with given offset and limit const getFetchPromise = (offset, limit=this.self().SERVER_MAX_LIMIT) => { - const endpoint = this.getWalletId() == null ? "get" : "getWithWallet" + const endpoint = this.getWalletId() == null ? "get" : "getWithWalletFiltered" return osparc.data.Resources.fetch("resourceUsage", endpoint, { url: { walletId: this.getWalletId(), From bc4d187beffb44420a4f1fb2eb02e3be101f914f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 11:49:58 +0100 Subject: [PATCH 2/3] minor fix --- .../client/source/class/osparc/dashboard/CardBase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index 0d058644bce..b03ad9cfa0d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -83,7 +83,7 @@ qx.Class.define("osparc.dashboard.CardBase", { filterText: function(checks, text) { if (text) { - const includesSome = checks.some(check => check.toLowerCase().trim().includes(text.toLowerCase())); + const includesSome = checks.some(check => check && check.toLowerCase().trim().includes(text.toLowerCase())); return !includesSome; } return false; From 37d30e7b039ad90a5d562107d2d2534047e5a740 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 13 Dec 2024 11:51:50 +0100 Subject: [PATCH 3/3] expose project_tags --- .../source/class/osparc/desktop/credits/UsageTable.js | 8 +++++++- .../class/osparc/desktop/credits/UsageTableModel.js | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTable.js b/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTable.js index 9e81f2c8541..324f4dcb419 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTable.js +++ b/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTable.js @@ -114,7 +114,13 @@ qx.Class.define("osparc.desktop.credits.UsageTable", { column: 7, label: qx.locale.Manager.tr("User"), width: 140 - } + }, + TAGS: { + id: "tags", + column: 7, + label: qx.locale.Manager.tr("Tags"), + width: 140 + }, } } }); diff --git a/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTableModel.js b/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTableModel.js index 61e115a1862..c7811a984d9 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTableModel.js +++ b/services/static-webserver/client/source/class/osparc/desktop/credits/UsageTableModel.js @@ -60,7 +60,8 @@ qx.Class.define("osparc.desktop.credits.UsageTableModel", { // 4: (not used) SORTING BY DURATION 5: "service_run_status", 6: "credit_cost", - 7: "user_email" + 7: "user_email", + 8: "projects_tags", } }, @@ -149,7 +150,8 @@ qx.Class.define("osparc.desktop.credits.UsageTableModel", { [usageCols.DURATION.id]: duration, [usageCols.STATUS.id]: qx.lang.String.firstUp(rawRow["service_run_status"].toLowerCase()), [usageCols.COST.id]: rawRow["credit_cost"] ? parseFloat(rawRow["credit_cost"]).toFixed(2) : "", - [usageCols.USER.id]: rawRow["user_email"] + [usageCols.USER.id]: rawRow["user_email"], + [usageCols.TAGS.id]: rawRow["project_tags"], }) }) return data