From 48a6a641b777d395bbc1ed2e82007bafe5de4ceb Mon Sep 17 00:00:00 2001 From: Aleksander <170264518+t-aleksander@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:28:32 +0200 Subject: [PATCH] feat: Display license status (#787) * display license status * orange -> red * inform about the status on tabs --- web/src/i18n/en/index.ts | 14 ++++- web/src/i18n/i18n-types.ts | 56 +++++++++++++++++-- web/src/i18n/pl/index.ts | 16 ++++-- .../EnterpriseSettings/EnterpriseSettings.tsx | 6 +- .../LicenseSettings/LicenseSettings.tsx | 37 ++++++++++-- .../components/LicenseSettings/styles.scss | 16 ++++-- .../OpenIdSettings/OpenIdSettings.tsx | 6 +- 7 files changed, 122 insertions(+), 29 deletions(-) diff --git a/web/src/i18n/en/index.ts b/web/src/i18n/en/index.ts index 1f11278fc..6217edfb7 100644 --- a/web/src/i18n/en/index.ts +++ b/web/src/i18n/en/index.ts @@ -913,6 +913,7 @@ const en: BaseTranslation = { }, enterpriseOnly: { title: 'This feature is available only in Defguard Enterprise.', + currentExpired: 'Your current license has expired.', subtitle: 'To learn more, visit our ', website: 'website', }, @@ -1099,6 +1100,13 @@ const en: BaseTranslation = { }, }, fields: { + status: { + label: 'Status', + active: 'Active', + expired: 'Expired', + subscriptionHelper: + 'A subscription license is considered valid for some time after the expiration date to account for possible automatic payment delays.', + }, type: { label: 'Type', }, @@ -1574,11 +1582,11 @@ const en: BaseTranslation = { noConnection: `No connection established, please run provided command.`, connected: `Gateway connected.`, statusError: 'Failed to get gateway status', - oneLineInstall: `If you are doing one line install: https://defguard.gitbook.io/defguard/admin-and-features/setting-up-your-instance/one-line-install + oneLineInstall: `If you are doing one line install: https://defguard.gitbook.io/defguard/admin-and-features/setting-up-your-instance/one-line-install you don't need to do anything.`, - fromPackage: `Install the package available at https://github.com/DefGuard/gateway/releases/latest and configure \`/etc/defguard/gateway.toml\` + fromPackage: `Install the package available at https://github.com/DefGuard/gateway/releases/latest and configure \`/etc/defguard/gateway.toml\` according to the [documentation]({setupGatewayDocs:string}).`, - authToken: `Token below is required to authenticate and configure the gateway node. Ensure you keep this token secure and follow the deployment instructions + authToken: `Token below is required to authenticate and configure the gateway node. Ensure you keep this token secure and follow the deployment instructions provided in the [documentation]({setupGatewayDocs:string}) to successfully set up the gateway server. For more details and exact steps, please refer to the [documentation]({setupGatewayDocs:string}).`, dockerBasedGatewaySetup: `Below is a Docker based example. For more details and exact steps, please refer to the [documentation]({setupGatewayDocs:string}).`, diff --git a/web/src/i18n/i18n-types.ts b/web/src/i18n/i18n-types.ts index 7966d2d78..1046d6e97 100644 --- a/web/src/i18n/i18n-types.ts +++ b/web/src/i18n/i18n-types.ts @@ -2253,6 +2253,10 @@ type RootTranslation = { * This feature is available only in Defguard Enterprise. */ title: string + /** + * Your current license has expired. + */ + currentExpired: string /** * To learn more, visit our */ @@ -2664,6 +2668,24 @@ type RootTranslation = { } } fields: { + status: { + /** + * Status + */ + label: string + /** + * Active + */ + active: string + /** + * Expired + */ + expired: string + /** + * A subscription license is considered valid for some time after the expiration date to account for possible automatic payment delays. + */ + subscriptionHelper: string + } type: { /** * Type @@ -3745,18 +3767,18 @@ type RootTranslation = { */ statusError: string /** - * If you are doing one line install: https://defguard.gitbook.io/defguard/admin-and-features/setting-up-your-instance/one-line-install + * If you are doing one line install: https://defguard.gitbook.io/defguard/admin-and-features/setting-up-your-instance/one-line-install you don't need to do anything. */ oneLineInstall: string /** - * Install the package available at https://github.com/DefGuard/gateway/releases/latest and configure `/etc/defguard/gateway.toml` + * Install the package available at https://github.com/DefGuard/gateway/releases/latest and configure `/etc/defguard/gateway.toml` according to the [documentation]({setupGatewayDocs}). * @param {string} setupGatewayDocs */ fromPackage: RequiredParams<'setupGatewayDocs'> /** - * Token below is required to authenticate and configure the gateway node. Ensure you keep this token secure and follow the deployment instructions + * Token below is required to authenticate and configure the gateway node. Ensure you keep this token secure and follow the deployment instructions provided in the [documentation]({setupGatewayDocs}) to successfully set up the gateway server. For more details and exact steps, please refer to the [documentation]({setupGatewayDocs}). * @param {string} setupGatewayDocs @@ -6474,6 +6496,10 @@ export type TranslationFunctions = { * This feature is available only in Defguard Enterprise. */ title: () => LocalizedString + /** + * Your current license has expired. + */ + currentExpired: () => LocalizedString /** * To learn more, visit our */ @@ -6882,6 +6908,24 @@ export type TranslationFunctions = { } } fields: { + status: { + /** + * Status + */ + label: () => LocalizedString + /** + * Active + */ + active: () => LocalizedString + /** + * Expired + */ + expired: () => LocalizedString + /** + * A subscription license is considered valid for some time after the expiration date to account for possible automatic payment delays. + */ + subscriptionHelper: () => LocalizedString + } type: { /** * Type @@ -7955,17 +7999,17 @@ export type TranslationFunctions = { */ statusError: () => LocalizedString /** - * If you are doing one line install: https://defguard.gitbook.io/defguard/admin-and-features/setting-up-your-instance/one-line-install + * If you are doing one line install: https://defguard.gitbook.io/defguard/admin-and-features/setting-up-your-instance/one-line-install you don't need to do anything. */ oneLineInstall: () => LocalizedString /** - * Install the package available at https://github.com/DefGuard/gateway/releases/latest and configure `/etc/defguard/gateway.toml` + * Install the package available at https://github.com/DefGuard/gateway/releases/latest and configure `/etc/defguard/gateway.toml` according to the [documentation]({setupGatewayDocs}). */ fromPackage: (arg: { setupGatewayDocs: string }) => LocalizedString /** - * Token below is required to authenticate and configure the gateway node. Ensure you keep this token secure and follow the deployment instructions + * Token below is required to authenticate and configure the gateway node. Ensure you keep this token secure and follow the deployment instructions provided in the [documentation]({setupGatewayDocs}) to successfully set up the gateway server. For more details and exact steps, please refer to the [documentation]({setupGatewayDocs}). */ diff --git a/web/src/i18n/pl/index.ts b/web/src/i18n/pl/index.ts index 201f23fc1..723d73afa 100644 --- a/web/src/i18n/pl/index.ts +++ b/web/src/i18n/pl/index.ts @@ -901,6 +901,7 @@ Uwaga, podane tutaj konfiguracje nie posiadają klucza prywatnego. Musisz uzupe }, enterpriseOnly: { title: 'Ta funkcja jest dostępna tylko w wersji Defguard Enterprise', + currentExpired: 'Twoja obecna licencja wygasła.', subtitle: 'Aby uzyskać więcej informacji, odwiedź naszą ', website: 'stronę internetową', }, @@ -1087,6 +1088,13 @@ Uwaga, podane tutaj konfiguracje nie posiadają klucza prywatnego. Musisz uzupe }, }, fields: { + status: { + label: 'Status', + active: 'Aktywna', + expired: 'Wygasła', + subscriptionHelper: + 'Licencja w formie subskrypcji jest ważna przez pewien czas po dacie wygaśnięcia, by uwzględnić możliwe opóźnienia w automatycznej płatności.', + }, type: { label: 'Typ', }, @@ -1562,14 +1570,14 @@ Uwaga, podane tutaj konfiguracje nie posiadają klucza prywatnego. Musisz uzupe noConnection: `Brak połączenia proszę uruchom poniższą komendę.`, connected: `Gateway połączony.`, statusError: 'Nie udało się uzyskać statusu', - oneLineInstall: `Jeśli wykonujesz instalację w jednej linii: https://defguard.gitbook.io/defguard/admin-and-features/setting-up-your-instance/one-line-install + oneLineInstall: `Jeśli wykonujesz instalację w jednej linii: https://defguard.gitbook.io/defguard/admin-and-features/setting-up-your-instance/one-line-install nie ma potrzeby wykonywania dalszych kroków.`, - fromPackage: `Zainstaluj pakiet dostępny na https://github.com/DefGuard/gateway/releases/latest i skonfiguruj \`/etc/defguard/gateway.toml\` + fromPackage: `Zainstaluj pakiet dostępny na https://github.com/DefGuard/gateway/releases/latest i skonfiguruj \`/etc/defguard/gateway.toml\` na podstawie [dokumentacji]({setupGatewayDocs}).`, - authToken: `Poniższy token jest wymwagany do autoryzacji i konfiguracji węzła gateway. Upewnij się, że zachowasz ten token w bezpiecznym miejscu, + authToken: `Poniższy token jest wymwagany do autoryzacji i konfiguracji węzła gateway. Upewnij się, że zachowasz ten token w bezpiecznym miejscu, a następnie podążaj za instrukcją wdrażania usługi znajdującej się w [dokumentacji]({setupGatewayDocs}), aby pomyślnie skonfigurwoać serwer gateway. Po więcej szczegółów i dokładnych kroków, proszę zapoznaj się z [dokumentacją](setupGatewayDocs).`, - dockerBasedGatewaySetup: `Poniżej znajduje się przykład oparty na Dockerze. + dockerBasedGatewaySetup: `Poniżej znajduje się przykład oparty na Dockerze. Więcej szczegółów i dokładnych kroków można znaleźć w [dokumentacji]({setupGatewayDocs}).`, }, }, diff --git a/web/src/pages/settings/components/EnterpriseSettings/EnterpriseSettings.tsx b/web/src/pages/settings/components/EnterpriseSettings/EnterpriseSettings.tsx index 3f658609e..af50d0056 100644 --- a/web/src/pages/settings/components/EnterpriseSettings/EnterpriseSettings.tsx +++ b/web/src/pages/settings/components/EnterpriseSettings/EnterpriseSettings.tsx @@ -3,16 +3,18 @@ import { useAppStore } from '../../../../shared/hooks/store/useAppStore'; import { EnterpriseForm } from './components/EnterpriseForm'; export const EnterpriseSettings = () => { - const enterpriseEnabled = useAppStore((state) => state.enterprise_status?.enabled); + const enterpriseStatus = useAppStore((state) => state.enterprise_status); const { LL } = useI18nContext(); const localLL = LL.settingsPage.enterpriseOnly; return ( <> - {!enterpriseEnabled && ( + {!enterpriseStatus?.enabled && (
{localLL.currentExpired()}
}