From b024acbce95cd5beda577bb56e9219bc230d1252 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Mon, 4 Dec 2023 16:59:31 +0100 Subject: [PATCH] feat: Refactor Wallet Administration to move in Setup UI - MEED-2896 - Meeds-io/meeds#1271 This change will move Settings into centralized Recognition UI. --- .../FundsRequestNotificationPlugin.java | 19 ++- .../WalletReceiverNotificationPlugin.java | 35 ++++- .../WalletSenderNotificationPlugin.java | 13 ++ .../locale/addon/Wallet_en.properties | 16 ++ wallet-webapps/.eslintignore | 1 + wallet-webapps/package-lock.json | 4 +- .../main/webapp/WEB-INF/gatein-resources.xml | 38 +++++ .../src/main/webapp/WEB-INF/portlet.xml | 23 +++ .../src/main/webapp/html/rewardAdmin.html | 16 -- .../src/main/webapp/html/spaceWallet.html | 16 -- .../src/main/webapp/html/walletAPI.html | 16 -- .../src/main/webapp/html/walletAdmin.html | 16 -- .../src/main/webapp/html/walletLink.html | 16 -- .../main/webapp/html/walletSetupAdmin.html | 7 + .../components/{admin => }/WalletAdminApp.vue | 101 ++++-------- .../settings/WalletAdminInitialFundsTab.vue | 148 ------------------ .../{admin => }/wallets/AdminWallet.vue | 0 .../wallets/WalletAdminWalletsTab.vue | 0 .../modals/WalletAdminSendEtherModal.vue | 0 .../modals/WalletAdminSendTokenModal.vue | 0 .../vue-app/wallet-admin/initComponents.js | 31 +++- .../wallet-admin/{walletAdmin.js => main.js} | 21 +-- .../components/TransactionsList.vue | 2 +- .../components/WalletAdminSetup.vue | 52 ++++++ .../components/settings/AdminDrawer.vue | 99 ++++++++++++ .../components/settings/AdminForm.vue | 145 +++++++++++++++++ .../wallet-setup-admin/initComponents.js | 32 ++++ .../webapp/vue-app/wallet-setup-admin/main.js | 36 +++++ wallet-webapps/webpack.prod.js | 3 +- wallet-webapps/webpack.watch.js | 5 +- 30 files changed, 588 insertions(+), 323 deletions(-) create mode 100644 wallet-webapps/.eslintignore create mode 100644 wallet-webapps/src/main/webapp/html/walletSetupAdmin.html rename wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/{admin => }/WalletAdminApp.vue (69%) delete mode 100644 wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/settings/WalletAdminInitialFundsTab.vue rename wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/{admin => }/wallets/AdminWallet.vue (100%) rename wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/{admin => }/wallets/WalletAdminWalletsTab.vue (100%) rename wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/{admin => }/wallets/modals/WalletAdminSendEtherModal.vue (100%) rename wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/{admin => }/wallets/modals/WalletAdminSendTokenModal.vue (100%) rename wallet-webapps/src/main/webapp/vue-app/wallet-admin/{walletAdmin.js => main.js} (78%) create mode 100644 wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/WalletAdminSetup.vue create mode 100644 wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/settings/AdminDrawer.vue create mode 100644 wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/settings/AdminForm.vue create mode 100644 wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/initComponents.js create mode 100644 wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/main.js diff --git a/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/FundsRequestNotificationPlugin.java b/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/FundsRequestNotificationPlugin.java index ba98bd9161..abc120b020 100644 --- a/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/FundsRequestNotificationPlugin.java +++ b/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/FundsRequestNotificationPlugin.java @@ -20,11 +20,16 @@ import java.util.List; +import org.apache.commons.lang3.StringUtils; + import org.exoplatform.commons.api.notification.NotificationContext; import org.exoplatform.commons.api.notification.model.NotificationInfo; import org.exoplatform.commons.api.notification.plugin.BaseNotificationPlugin; import org.exoplatform.commons.utils.CommonsUtils; +import org.exoplatform.commons.utils.HTMLSanitizer; import org.exoplatform.container.xml.InitParams; +import org.exoplatform.services.log.ExoLogger; +import org.exoplatform.services.log.Log; import org.exoplatform.wallet.model.ContractDetail; import org.exoplatform.wallet.model.Wallet; import org.exoplatform.wallet.model.transaction.FundsRequest; @@ -32,6 +37,8 @@ public class FundsRequestNotificationPlugin extends BaseNotificationPlugin { + private static final Log LOG = ExoLogger.getLogger(FundsRequestNotificationPlugin.class); + public FundsRequestNotificationPlugin(InitParams initParams) { super(initParams); } @@ -66,6 +73,16 @@ protected NotificationInfo makeNotification(NotificationContext ctx) { ContractDetail contractDetail = WalletUtils.getContractDetail(); String symbol = contractDetail == null ? null : contractDetail.getSymbol(); + String message = fundsRequest.getMessage() == null ? "" : fundsRequest.getMessage(); + if (StringUtils.isNotBlank(message)) { + try { + message = HTMLSanitizer.sanitize(message); + } catch (Exception e) { + LOG.warn("error sanitizing wallet transaction message {}. Use empty message", message, e); + message = ""; + } + } + return NotificationInfo.instance() .to(toList) .with(AMOUNT, String.valueOf(fundsRequest.getAmount())) @@ -79,7 +96,7 @@ protected NotificationInfo makeNotification(NotificationContext ctx) { .with(SENDER, requestSenderAccountDetail.getName()) .with(RECEIVER, requestReceiverAccountDetail.getName()) .with(SYMBOL, symbol) - .with(MESSAGE, fundsRequest.getMessage() == null ? "" : fundsRequest.getMessage()) + .with(MESSAGE, message) .key(getKey()) .end(); } diff --git a/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/WalletReceiverNotificationPlugin.java b/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/WalletReceiverNotificationPlugin.java index 41fd1e598c..16dabda2c3 100644 --- a/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/WalletReceiverNotificationPlugin.java +++ b/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/WalletReceiverNotificationPlugin.java @@ -16,7 +16,27 @@ */ package org.exoplatform.wallet.notification.plugin; -import static org.exoplatform.wallet.utils.WalletUtils.*; +import static org.exoplatform.wallet.utils.WalletUtils.ACCOUNT_TYPE; +import static org.exoplatform.wallet.utils.WalletUtils.AMOUNT; +import static org.exoplatform.wallet.utils.WalletUtils.AMOUNT_PARAMETER; +import static org.exoplatform.wallet.utils.WalletUtils.AVATAR; +import static org.exoplatform.wallet.utils.WalletUtils.CONTRACT_ADDRESS; +import static org.exoplatform.wallet.utils.WalletUtils.CONTRACT_ADDRESS_PARAMETER; +import static org.exoplatform.wallet.utils.WalletUtils.HASH; +import static org.exoplatform.wallet.utils.WalletUtils.HASH_PARAMETER; +import static org.exoplatform.wallet.utils.WalletUtils.MESSAGE; +import static org.exoplatform.wallet.utils.WalletUtils.MESSAGE_PARAMETER; +import static org.exoplatform.wallet.utils.WalletUtils.RECEIVER; +import static org.exoplatform.wallet.utils.WalletUtils.RECEIVER_ACCOUNT_DETAIL_PARAMETER; +import static org.exoplatform.wallet.utils.WalletUtils.RECEIVER_TYPE; +import static org.exoplatform.wallet.utils.WalletUtils.RECEIVER_URL; +import static org.exoplatform.wallet.utils.WalletUtils.SENDER; +import static org.exoplatform.wallet.utils.WalletUtils.SENDER_ACCOUNT_DETAIL_PARAMETER; +import static org.exoplatform.wallet.utils.WalletUtils.SENDER_URL; +import static org.exoplatform.wallet.utils.WalletUtils.SYMBOL; +import static org.exoplatform.wallet.utils.WalletUtils.SYMBOL_PARAMETER; +import static org.exoplatform.wallet.utils.WalletUtils.getNotificationReceiversUsers; +import static org.exoplatform.wallet.utils.WalletUtils.getPermanentLink; import java.util.List; @@ -26,13 +46,18 @@ import org.exoplatform.commons.api.notification.model.NotificationInfo; import org.exoplatform.commons.api.notification.plugin.BaseNotificationPlugin; import org.exoplatform.commons.utils.CommonsUtils; +import org.exoplatform.commons.utils.HTMLSanitizer; import org.exoplatform.container.xml.InitParams; +import org.exoplatform.services.log.ExoLogger; +import org.exoplatform.services.log.Log; import org.exoplatform.social.core.service.LinkProvider; import org.exoplatform.wallet.model.Wallet; import org.exoplatform.wallet.model.transaction.TransactionNotificationType; public class WalletReceiverNotificationPlugin extends BaseNotificationPlugin { + private static final Log LOG = ExoLogger.getLogger(WalletReceiverNotificationPlugin.class); + public WalletReceiverNotificationPlugin(InitParams initParams) { super(initParams); } @@ -56,6 +81,14 @@ protected NotificationInfo makeNotification(NotificationContext ctx) { double amount = ctx.value(AMOUNT_PARAMETER); String message = ctx.value(MESSAGE_PARAMETER); String hash = ctx.value(HASH_PARAMETER); + if (StringUtils.isNotBlank(message)) { + try { + message = HTMLSanitizer.sanitize(message); + } catch (Exception e) { + LOG.warn("error sanitizing wallet transaction message {}. Use empty message", message, e); + message = ""; + } + } List toList = getNotificationReceiversUsers(receiverAccountDetail, senderAccountDetail.getId()); if (toList == null || toList.isEmpty()) { diff --git a/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/WalletSenderNotificationPlugin.java b/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/WalletSenderNotificationPlugin.java index 62f1759220..59fc52c046 100644 --- a/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/WalletSenderNotificationPlugin.java +++ b/wallet-services/src/main/java/org/exoplatform/wallet/notification/plugin/WalletSenderNotificationPlugin.java @@ -26,13 +26,18 @@ import org.exoplatform.commons.api.notification.model.NotificationInfo; import org.exoplatform.commons.api.notification.plugin.BaseNotificationPlugin; import org.exoplatform.commons.utils.CommonsUtils; +import org.exoplatform.commons.utils.HTMLSanitizer; import org.exoplatform.container.xml.InitParams; +import org.exoplatform.services.log.ExoLogger; +import org.exoplatform.services.log.Log; import org.exoplatform.social.core.service.LinkProvider; import org.exoplatform.wallet.model.Wallet; import org.exoplatform.wallet.model.transaction.TransactionNotificationType; public class WalletSenderNotificationPlugin extends BaseNotificationPlugin { + private static final Log LOG = ExoLogger.getLogger(WalletSenderNotificationPlugin.class); + public WalletSenderNotificationPlugin(InitParams initParams) { super(initParams); } @@ -56,6 +61,14 @@ protected NotificationInfo makeNotification(NotificationContext ctx) { double amount = ctx.value(AMOUNT_PARAMETER); String message = ctx.value(MESSAGE_PARAMETER); String hash = ctx.value(HASH_PARAMETER); + if (StringUtils.isNotBlank(message)) { + try { + message = HTMLSanitizer.sanitize(message); + } catch (Exception e) { + LOG.warn("error sanitizing wallet transaction message {}. Use empty message", message, e); + message = ""; + } + } // Don't send notifications about Admin wallet sending funds if (senderAccountDetail == null || StringUtils.equals(senderAccountDetail.getId(), WALLET_ADMIN_REMOTE_ID)) { diff --git a/wallet-services/src/main/resources/locale/addon/Wallet_en.properties b/wallet-services/src/main/resources/locale/addon/Wallet_en.properties index b1f14f8821..f4f56973f2 100644 --- a/wallet-services/src/main/resources/locale/addon/Wallet_en.properties +++ b/wallet-services/src/main/resources/locale/addon/Wallet_en.properties @@ -478,3 +478,19 @@ exoplatform.wallet.message.followTransaction=See transaction wallet.mainCurrency=Matic wallet.mainCurrencySymbol=Matic wallet.addressAlreadyInUse=Address already in use by another wallet + +wallet.administration.title=Wallet +wallet.administration.subtitle=Define the amount to send to new wallet +wallet.administration.drawer.title=Setup wallet +wallet.administration.introduction1=The following parameters define the amout to send to new wallet. +wallet.administration.introduction2=Initial Meeds Token quantity is a free grant you offer to new users in order to engage them in the exchange system. +wallet.administration.introduction3=We recommend 10 Meeds to start. +wallet.administration.introduction4=In addition to this token, {0} gas will be sent to your users to cover the transaction fees on the blockchain network. +wallet.administration.initialFundsFormLabel=Define initial funds +wallet.administration.gas=Gas +wallet.administration.meeds=Meeds +wallet.administration.initialFundsMessageLabel=Set a message to send with initial funds +wallet.administration.initialFundsMessagePlaceholder=Enter a default message to send with initial funds +wallet.administration.apply=Apply +wallet.administration.cancel=Cancel +wallet.administration.reset=Reset diff --git a/wallet-webapps/.eslintignore b/wallet-webapps/.eslintignore new file mode 100644 index 0000000000..94a2dd146a --- /dev/null +++ b/wallet-webapps/.eslintignore @@ -0,0 +1 @@ +*.json \ No newline at end of file diff --git a/wallet-webapps/package-lock.json b/wallet-webapps/package-lock.json index 1a4944b1e8..d954fe84f3 100644 --- a/wallet-webapps/package-lock.json +++ b/wallet-webapps/package-lock.json @@ -5879,9 +5879,7 @@ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", "dev": true, - "requires": { - "ajv": "^8.0.0" - } + "requires": {} }, "ajv-keywords": { "version": "5.1.0", diff --git a/wallet-webapps/src/main/webapp/WEB-INF/gatein-resources.xml b/wallet-webapps/src/main/webapp/WEB-INF/gatein-resources.xml index 17303b0ab6..e2a99e3251 100644 --- a/wallet-webapps/src/main/webapp/WEB-INF/gatein-resources.xml +++ b/wallet-webapps/src/main/webapp/WEB-INF/gatein-resources.xml @@ -196,6 +196,44 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + WalletSetupAdmin + + + + walletCommon + WalletCommon + + + vue + + + vuetify + + + eXoVueI18n + + + jquery + $ + + + Web3 + LocalWeb3 + + + ethQRCode + EthereumQRPlugin + + + commons-cometd3 + cCometd + + + WalletSettings diff --git a/wallet-webapps/src/main/webapp/WEB-INF/portlet.xml b/wallet-webapps/src/main/webapp/WEB-INF/portlet.xml index f861b63fbf..e91e657f67 100644 --- a/wallet-webapps/src/main/webapp/WEB-INF/portlet.xml +++ b/wallet-webapps/src/main/webapp/WEB-INF/portlet.xml @@ -141,6 +141,29 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. admin + + WalletSetupAdmin + Wallet Setup Administration + org.exoplatform.commons.api.portlet.GenericDispatchedViewPortlet + + portlet-view-dispatched-file-path + /html/walletSetupAdmin.html + + -1 + PUBLIC + + text/html + + en + + Wallet Setup Administration + Wallet Setup Administration + + + admin + admin + + WalletSettings org.exoplatform.commons.api.portlet.GenericDispatchedViewPortlet diff --git a/wallet-webapps/src/main/webapp/html/rewardAdmin.html b/wallet-webapps/src/main/webapp/html/rewardAdmin.html index 6b584b5297..6ef0a429d8 100644 --- a/wallet-webapps/src/main/webapp/html/rewardAdmin.html +++ b/wallet-webapps/src/main/webapp/html/rewardAdmin.html @@ -1,19 +1,3 @@ -
+
+
\ No newline at end of file diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/WalletAdminApp.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/WalletAdminApp.vue similarity index 69% rename from wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/WalletAdminApp.vue rename to wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/WalletAdminApp.vue index 208222d436..af71ea881d 100644 --- a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/WalletAdminApp.vue +++ b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/WalletAdminApp.vue @@ -20,76 +20,38 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. color="transaprent" class="VuetifyApp" flat> -
- - - - - {{ $t('exoplatform.wallet.title.walletAdministrationTab') }} - - - {{ $t('exoplatform.wallet.title.initialFundsTab') }} - - - - - -
- {{ error }} -
- - - - - {{ $t('exoplatform.wallet.label.loading') }} ... - - - - -
- -
- - - -
-
-
+ + +
+ {{ error }} +
+ + + + {{ $t('exoplatform.wallet.label.loading') }} ... + + + + + +
-
+ @@ -98,7 +60,6 @@ export default { data() { return { loading: false, - selectedTab: 'wallets', fiatSymbol: '$', settings: null, wallet: null, diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/settings/WalletAdminInitialFundsTab.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/settings/WalletAdminInitialFundsTab.vue deleted file mode 100644 index 032707f935..0000000000 --- a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/settings/WalletAdminInitialFundsTab.vue +++ /dev/null @@ -1,148 +0,0 @@ - - - diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/wallets/AdminWallet.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/wallets/AdminWallet.vue similarity index 100% rename from wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/wallets/AdminWallet.vue rename to wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/wallets/AdminWallet.vue diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/wallets/WalletAdminWalletsTab.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/wallets/WalletAdminWalletsTab.vue similarity index 100% rename from wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/wallets/WalletAdminWalletsTab.vue rename to wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/wallets/WalletAdminWalletsTab.vue diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/wallets/modals/WalletAdminSendEtherModal.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/wallets/modals/WalletAdminSendEtherModal.vue similarity index 100% rename from wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/wallets/modals/WalletAdminSendEtherModal.vue rename to wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/wallets/modals/WalletAdminSendEtherModal.vue diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/wallets/modals/WalletAdminSendTokenModal.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/wallets/modals/WalletAdminSendTokenModal.vue similarity index 100% rename from wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/admin/wallets/modals/WalletAdminSendTokenModal.vue rename to wallet-webapps/src/main/webapp/vue-app/wallet-admin/components/wallets/modals/WalletAdminSendTokenModal.vue diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/initComponents.js b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/initComponents.js index a6df9a3726..7e3e4fa6db 100644 --- a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/initComponents.js +++ b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/initComponents.js @@ -1,11 +1,30 @@ -import WalletAdminInitialFundsTab from './components/admin/settings/WalletAdminInitialFundsTab.vue'; -import WalletAdminSendEtherModal from './components/admin/wallets/modals/WalletAdminSendEtherModal.vue'; -import WalletAdminSendTokenModal from './components/admin/wallets/modals/WalletAdminSendTokenModal.vue'; -import AdminWallet from './components/admin/wallets/AdminWallet.vue'; -import WalletAdminWalletsTab from './components/admin/wallets/WalletAdminWalletsTab.vue'; +/* + * This file is part of the Meeds project (https://meeds.io/). + * + * Copyright (C) 2023 Meeds Association contact@meeds.io + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import WalletAdminApp from './components/WalletAdminApp.vue'; +import WalletAdminSendEtherModal from './components/wallets/modals/WalletAdminSendEtherModal.vue'; +import WalletAdminSendTokenModal from './components/wallets/modals/WalletAdminSendTokenModal.vue'; +import AdminWallet from './components/wallets/AdminWallet.vue'; +import WalletAdminWalletsTab from './components/wallets/WalletAdminWalletsTab.vue'; const components = { - 'wallet-initial-funds-tab': WalletAdminInitialFundsTab, + 'wallet-admin-app': WalletAdminApp, 'wallet-send-ether-modal': WalletAdminSendEtherModal, 'wallet-send-token-modal': WalletAdminSendTokenModal, 'wallet-admin-wallet': AdminWallet, diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/walletAdmin.js b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/main.js similarity index 78% rename from wallet-webapps/src/main/webapp/vue-app/wallet-admin/walletAdmin.js rename to wallet-webapps/src/main/webapp/vue-app/wallet-admin/main.js index 5543ddcffd..79c6275ec9 100644 --- a/wallet-webapps/src/main/webapp/vue-app/wallet-admin/walletAdmin.js +++ b/wallet-webapps/src/main/webapp/vue-app/wallet-admin/main.js @@ -1,35 +1,36 @@ /* * This file is part of the Meeds project (https://meeds.io/). - * Copyright (C) 2020 Meeds Association - * contact@meeds.io + * + * Copyright (C) 2023 Meeds Association contact@meeds.io + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import WalletAdminApp from './components/admin/WalletAdminApp.vue'; import './initComponents.js'; -Vue.use(Vuetify); -Vue.use(WalletCommon); - -const vuetify = new Vuetify(eXo.env.portal.vuetifyPreset); const lang = (eXo && eXo.env && eXo.env.portal && eXo.env.portal.language) || 'en'; const url = `${eXo.env.portal.context}/${eXo.env.portal.rest}/i18n/bundle/locale.addon.Wallet-${lang}.json`; +const appId = 'WalletAdminApp'; + +Vue.use(WalletCommon); export function init() { exoi18n.loadLanguageAsync(lang, url).then(i18n => { Vue.createApp({ - render: (h) => h(WalletAdminApp), + template: ``, + vuetify: Vue.prototype.vuetifyOptions, i18n, - vuetify, - }, '#WalletAdminApp', 'Wallet Administration'); + }, `#${appId}`, 'Wallet Administration'); }); } \ No newline at end of file diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-common/components/TransactionsList.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-common/components/TransactionsList.vue index 9290f1aab7..00ce457391 100644 --- a/wallet-webapps/src/main/webapp/vue-app/wallet-common/components/TransactionsList.vue +++ b/wallet-webapps/src/main/webapp/vue-app/wallet-common/components/TransactionsList.vue @@ -362,7 +362,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. {{ $t('exoplatform.wallet.label.transactionMessage') }} - {{ item.message }} + diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/WalletAdminSetup.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/WalletAdminSetup.vue new file mode 100644 index 0000000000..c9ce10e46f --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/WalletAdminSetup.vue @@ -0,0 +1,52 @@ + + + diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/settings/AdminDrawer.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/settings/AdminDrawer.vue new file mode 100644 index 0000000000..9f004404d4 --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/settings/AdminDrawer.vue @@ -0,0 +1,99 @@ + + + + diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/settings/AdminForm.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/settings/AdminForm.vue new file mode 100644 index 0000000000..719a69c089 --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/components/settings/AdminForm.vue @@ -0,0 +1,145 @@ + + + diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/initComponents.js b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/initComponents.js new file mode 100644 index 0000000000..5866db458a --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/initComponents.js @@ -0,0 +1,32 @@ +/* + * This file is part of the Meeds project (https://meeds.io/). + * + * Copyright (C) 2023 Meeds Association contact@meeds.io + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import WalletAdminSetup from './components/WalletAdminSetup.vue'; +import AdminDrawer from './components/settings/AdminDrawer.vue'; +import AdminForm from './components/settings/AdminForm.vue'; + +const components = { + 'wallet-admin-setup': WalletAdminSetup, + 'wallet-admin-drawer': AdminDrawer, + 'wallet-admin-form': AdminForm, +}; + +for (const key in components) { + Vue.component(key, components[key]); +} \ No newline at end of file diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/main.js b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/main.js new file mode 100644 index 0000000000..e34b6c12be --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/wallet-setup-admin/main.js @@ -0,0 +1,36 @@ +/* + * This file is part of the Meeds project (https://meeds.io/). + * + * Copyright (C) 2023 Meeds Association contact@meeds.io + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import './initComponents.js'; + +const lang = window.eXo?.env?.portal?.language || 'en'; +const url = `${eXo.env.portal.context}/${eXo.env.portal.rest}/i18n/bundle/locale.addon.Wallet-${lang}.json`; +const appId = 'WalletSetupAdmin'; + +Vue.use(WalletCommon); + +export function init() { + exoi18n.loadLanguageAsync(lang, url).then(i18n => { + Vue.createApp({ + template: ``, + vuetify: Vue.prototype.vuetifyOptions, + i18n, + }, `#${appId}`, 'Wallet Setup Administration'); + }); +} \ No newline at end of file diff --git a/wallet-webapps/webpack.prod.js b/wallet-webapps/webpack.prod.js index 1228112619..5850acb379 100644 --- a/wallet-webapps/webpack.prod.js +++ b/wallet-webapps/webpack.prod.js @@ -24,7 +24,8 @@ const config = merge(webpackCommonConfig, { wallet: './src/main/webapp/vue-app/wallet-app/wallet.js', walletAPI: './src/main/webapp/vue-app/wallet-app/walletAPI.js', spaceWallet: './src/main/webapp/vue-app/wallet-app/spaceWallet.js', - walletAdmin : './src/main/webapp/vue-app/wallet-admin/walletAdmin.js', + walletAdmin : './src/main/webapp/vue-app/wallet-admin/main.js', + walletSetupAdmin : './src/main/webapp/vue-app/wallet-setup-admin/main.js', walletCommon: './src/main/webapp/vue-app/wallet-common/walletCommon.js', walletSettings: './src/main/webapp/vue-app/wallet-common/wallet-settings/main.js', walletOverview: './src/main/webapp/vue-app/wallet-common/wallet-overview/main.js', diff --git a/wallet-webapps/webpack.watch.js b/wallet-webapps/webpack.watch.js index b30fa571d0..8650715dda 100644 --- a/wallet-webapps/webpack.watch.js +++ b/wallet-webapps/webpack.watch.js @@ -18,8 +18,9 @@ const { merge } = require('webpack-merge'); const webpackProductionConfig = require('./webpack.prod.js'); module.exports = merge(webpackProductionConfig, { - mode: 'development', output: { path: '/exo-server/webapps/wallet', - } + }, + mode: 'development', + devtool: 'eval-source-map', }); \ No newline at end of file