Fix stale data showing when creating user groups and reduce height of group rows

This commit is contained in:
Andrew Kingston 2022-08-01 11:56:01 +01:00
parent f13f8eec3b
commit 046f61e015
1 changed files with 17 additions and 9 deletions

View File

@ -14,13 +14,9 @@
import { Constants } from "@budibase/frontend-core" import { Constants } from "@budibase/frontend-core"
import CreateEditGroupModal from "./_components/CreateEditGroupModal.svelte" import CreateEditGroupModal from "./_components/CreateEditGroupModal.svelte"
import UserGroupsRow from "./_components/UserGroupsRow.svelte" import UserGroupsRow from "./_components/UserGroupsRow.svelte"
import { cloneDeep } from "lodash/fp"
$: hasGroupsLicense = $auth.user?.license.features.includes( const DefaultGroup = {
Constants.Features.USER_GROUPS
)
let modal
let group = {
name: "", name: "",
icon: "UserGroup", icon: "UserGroup",
color: "var(--spectrum-global-color-blue-600)", color: "var(--spectrum-global-color-blue-600)",
@ -28,6 +24,12 @@
apps: [], apps: [],
roles: {}, roles: {},
} }
let modal
let group = cloneDeep(DefaultGroup)
$: hasGroupsLicense = $auth.user?.license.features.includes(
Constants.Features.USER_GROUPS
)
async function deleteGroup(group) { async function deleteGroup(group) {
try { try {
@ -45,6 +47,11 @@
} }
} }
const showCreateGroupModal = () => {
group = cloneDeep(DefaultGroup)
modal?.show()
}
onMount(async () => { onMount(async () => {
try { try {
if (hasGroupsLicense) { if (hasGroupsLicense) {
@ -78,10 +85,11 @@
icon={hasGroupsLicense ? "UserGroup" : ""} icon={hasGroupsLicense ? "UserGroup" : ""}
cta={hasGroupsLicense} cta={hasGroupsLicense}
on:click={hasGroupsLicense on:click={hasGroupsLicense
? () => modal.show() ? showCreateGroupModal
: window.open("https://budibase.com/pricing/", "_blank")} : window.open("https://budibase.com/pricing/", "_blank")}
>{hasGroupsLicense ? "Create user group" : "Upgrade Account"}</Button
> >
{hasGroupsLicense ? "Create user group" : "Upgrade Account"}
</Button>
{#if !hasGroupsLicense} {#if !hasGroupsLicense}
<Button <Button
newStyles newStyles
@ -130,7 +138,7 @@
.groupTable :global(> div) { .groupTable :global(> div) {
background: var(--bg-color); background: var(--bg-color);
height: 70px; height: 55px;
display: grid; display: grid;
align-items: center; align-items: center;
grid-gap: var(--spacing-xl); grid-gap: var(--spacing-xl);