diff --git a/packages/builder/src/components/portal/licensing/DeleteLicenseKeyModal.svelte b/packages/builder/src/components/portal/licensing/DeleteLicenseKeyModal.svelte new file mode 100644 index 0000000000..e482d1c776 --- /dev/null +++ b/packages/builder/src/components/portal/licensing/DeleteLicenseKeyModal.svelte @@ -0,0 +1,31 @@ + + + + + Are you sure you want to delete this license key? + This license key cannot be re-activated. + + + + diff --git a/packages/builder/src/pages/builder/portal/manage/groups/index.svelte b/packages/builder/src/pages/builder/portal/manage/groups/index.svelte index f3b5cbee00..c9fdeb6cff 100644 --- a/packages/builder/src/pages/builder/portal/manage/groups/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/groups/index.svelte @@ -9,7 +9,7 @@ Tags, notifications, } from "@budibase/bbui" - import { groups, auth, licensing } from "stores/portal" + import { groups, auth, licensing, admin } from "stores/portal" import { onMount } from "svelte" import CreateEditGroupModal from "./_components/CreateEditGroupModal.svelte" import UserGroupsRow from "./_components/UserGroupsRow.svelte" @@ -53,6 +53,8 @@ onMount(async () => { try { + // always load latest + await licensing.init() if ($licensing.groupsEnabled) { await groups.actions.init() } @@ -77,7 +79,7 @@ {/if} Easily assign and manage your users access with User Groups - {#if !$auth.accountPortalAccess} + {#if !$auth.accountPortalAccess && $admin.cloud} Contact your account holder to upgrade {/if} @@ -90,7 +92,7 @@ {:else} +
+
+ +
+
+ {#if licenseInfo?.licenseKey} + + {/if} +
@@ -152,4 +181,10 @@ grid-gap: var(--spacing-l); align-items: center; } + .action-button { + margin-right: 10px; + } + .button-container { + display: flex; + } diff --git a/packages/frontend-core/src/api/licensing.js b/packages/frontend-core/src/api/licensing.js index 16d65a20d7..c27d79d740 100644 --- a/packages/frontend-core/src/api/licensing.js +++ b/packages/frontend-core/src/api/licensing.js @@ -9,6 +9,15 @@ export const buildLicensingEndpoints = API => ({ }) }, + /** + * Delete a self hosted license key + */ + deleteLicenseKey: async () => { + return API.delete({ + url: `/api/global/license/info`, + }) + }, + /** * Get the license info - metadata about the license including the * obfuscated license key. diff --git a/packages/worker/src/api/controllers/global/license.ts b/packages/worker/src/api/controllers/global/license.ts index 1e5ca9beac..2bd173010f 100644 --- a/packages/worker/src/api/controllers/global/license.ts +++ b/packages/worker/src/api/controllers/global/license.ts @@ -24,6 +24,11 @@ export const getInfo = async (ctx: any) => { ctx.status = 200 } +export const deleteInfo = async (ctx: any) => { + await licensing.deleteLicenseInfo() + ctx.status = 200 +} + export const getQuotaUsage = async (ctx: any) => { ctx.body = await quotas.getQuotaUsage() } diff --git a/packages/worker/src/api/routes/global/license.ts b/packages/worker/src/api/routes/global/license.ts index b9f5aa3218..03908e052b 100644 --- a/packages/worker/src/api/routes/global/license.ts +++ b/packages/worker/src/api/routes/global/license.ts @@ -7,6 +7,7 @@ router .post("/api/global/license/activate", controller.activate) .post("/api/global/license/refresh", controller.refresh) .get("/api/global/license/info", controller.getInfo) + .delete("/api/global/license/info", controller.deleteInfo) .get("/api/global/license/usage", controller.getQuotaUsage) export = router