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 de570f08278..e07813a5138 100644
--- a/services/static-webserver/client/source/class/osparc/data/Resources.js
+++ b/services/static-webserver/client/source/class/osparc/data/Resources.js
@@ -779,6 +779,10 @@ qx.Class.define("osparc.data.Resources", {
payWithPaymentMethod: {
method: "POST",
url: statics.API + "/wallets/{walletId}/payments-methods/{paymentMethodId}:pay"
+ },
+ invoiceLink: {
+ method: "GET",
+ url: statics.API + "/wallets/{walletId}/payments/{paymentId}/invoice-link"
}
}
},
@@ -1077,6 +1081,20 @@ qx.Class.define("osparc.data.Resources", {
},
members: {
+ /**
+ * @param {String} resource Name of the resource as defined in the static property 'resources'.
+ * @param {String} endpoint Name of the endpoint. Several endpoints can be defined for each resource.
+ * @param {Object} urlParams Object containing only the parameters for the url of the request.
+ */
+ replaceUrlParams: function(resource, endpoint, urlParams) {
+ const resourceDefinition = this.self().resources[resource];
+ const res = new osparc.io.rest.Resource(resourceDefinition.endpoints);
+ // Use qooxdoo's Get request configuration
+ // eslint-disable-next-line no-underscore-dangle
+ const getReqConfig = res._resource._getRequestConfig(endpoint, urlParams);
+ return getReqConfig;
+ },
+
/**
* Method to fetch resources from the server. If configured properly, the resources in the response will be cached in {osparc.store.Store}.
* @param {String} resource Name of the resource as defined in the static property 'resources'.
diff --git a/services/static-webserver/client/source/class/osparc/desktop/credits/TransactionsTableModel.js b/services/static-webserver/client/source/class/osparc/desktop/credits/TransactionsTableModel.js
index a6a40fb3972..203187d1d0a 100644
--- a/services/static-webserver/client/source/class/osparc/desktop/credits/TransactionsTableModel.js
+++ b/services/static-webserver/client/source/class/osparc/desktop/credits/TransactionsTableModel.js
@@ -89,7 +89,7 @@ qx.Class.define("osparc.desktop.credits.TransactionsTableModel", {
credits: rawRow.osparcCredits ? rawRow.osparcCredits.toFixed(2) * 1 : 0,
status: this.__addColorTag(rawRow.completedStatus),
comment: rawRow.comment,
- invoice: rawRow.invoiceUrl ? this.__createPdfIconWithLink(rawRow.invoiceUrl) : ""
+ invoice: rawRow.invoiceUrl ? this.__createPdfIconWithLink(rawRow.walletId, rawRow.paymentId) : ""
})
})
return data
@@ -147,8 +147,14 @@ qx.Class.define("osparc.desktop.credits.TransactionsTableModel", {
__addColorTag: function(status) {
return `${osparc.utils.Utils.onlyFirstsUp(status)}`;
},
- __createPdfIconWithLink: function(link) {
- return `
`;
+
+ __createPdfIconWithLink: function(walletId, paymentId) {
+ const urlParams = {
+ walletId,
+ paymentId
+ };
+ const req = osparc.data.Resources.getInstance().replaceUrlParams("payments", "invoiceLink", urlParams);
+ return `
`;
}
}
})
diff --git a/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js b/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js
index 08a459c185b..2c747b2f2d3 100644
--- a/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js
+++ b/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js
@@ -113,7 +113,10 @@ qx.Class.define("osparc.navigation.UserMenu", {
case "log-out": {
const authData = osparc.auth.Data.getInstance();
control = new qx.ui.menu.Button(authData.isGuest() ? this.tr("Exit") : this.tr("Log out"));
- control.addListener("execute", () => qx.core.Init.getApplication().logout());
+ control.addListener("execute", () => {
+ this.exclude();
+ qx.core.Init.getApplication().logout();
+ });
osparc.utils.Utils.setIdToWidget(control, "userMenuLogoutBtn");
this.add(control);
break;