From 046f61e0159de3b1830188321262e29e065675e8 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 1 Aug 2022 11:56:01 +0100 Subject: [PATCH] Fix stale data showing when creating user groups and reduce height of group rows --- .../builder/portal/manage/groups/index.svelte | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) 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 131906529d..01bd8e889d 100644 --- a/packages/builder/src/pages/builder/portal/manage/groups/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/groups/index.svelte @@ -14,13 +14,9 @@ import { Constants } from "@budibase/frontend-core" import CreateEditGroupModal from "./_components/CreateEditGroupModal.svelte" import UserGroupsRow from "./_components/UserGroupsRow.svelte" + import { cloneDeep } from "lodash/fp" - $: hasGroupsLicense = $auth.user?.license.features.includes( - Constants.Features.USER_GROUPS - ) - - let modal - let group = { + const DefaultGroup = { name: "", icon: "UserGroup", color: "var(--spectrum-global-color-blue-600)", @@ -28,6 +24,12 @@ apps: [], roles: {}, } + let modal + let group = cloneDeep(DefaultGroup) + + $: hasGroupsLicense = $auth.user?.license.features.includes( + Constants.Features.USER_GROUPS + ) async function deleteGroup(group) { try { @@ -45,6 +47,11 @@ } } + const showCreateGroupModal = () => { + group = cloneDeep(DefaultGroup) + modal?.show() + } + onMount(async () => { try { if (hasGroupsLicense) { @@ -78,10 +85,11 @@ icon={hasGroupsLicense ? "UserGroup" : ""} cta={hasGroupsLicense} on:click={hasGroupsLicense - ? () => modal.show() + ? showCreateGroupModal : window.open("https://budibase.com/pricing/", "_blank")} - >{hasGroupsLicense ? "Create user group" : "Upgrade Account"} + {hasGroupsLicense ? "Create user group" : "Upgrade Account"} + {#if !hasGroupsLicense}