Fix: unable to upgrade plan (#14527)

* Don't allow admin users to select themselves

* Disable upgrade button for non account holders
This commit is contained in:
melohagan 2024-09-06 09:01:05 +01:00 committed by GitHub
parent d3cd76214c
commit 528a21643c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 5 deletions

View File

@ -1,10 +1,12 @@
<script>
import {
AbsTooltip,
Layout,
Heading,
Body,
Button,
Divider,
Icon,
Tags,
Tag,
} from "@budibase/bbui"
@ -15,6 +17,8 @@
export let description
export let enabled
export let upgradeButtonClick
$: upgradeDisabled = !$auth.accountPortalAccess && $admin.cloud
</script>
<Layout noPadding>
@ -36,8 +40,9 @@
{:else}
<div class="buttons">
<Button
primary
disabled={!$auth.accountPortalAccess && $admin.cloud}
primary={!upgradeDisabled}
secondary={upgradeDisabled}
disabled={upgradeDisabled}
on:click={async () => upgradeButtonClick()}
>
Upgrade
@ -51,6 +56,16 @@
>
View Plans
</Button>
{#if upgradeDisabled}
<AbsTooltip
text={"Please contact the account holder to upgrade"}
position={"right"}
>
<div class="icon" on:focus>
<Icon name="InfoOutline" size="L" disabled hoverable />
</div>
</AbsTooltip>
{/if}
</div>
{/if}
</Layout>
@ -67,7 +82,11 @@
justify-content: flex-start;
gap: var(--spacing-m);
}
.icon {
position: relative;
display: flex;
justify-content: center;
}
.buttons {
display: flex;
flex-direction: row;

View File

@ -127,7 +127,10 @@
name: user.firstName ? user.firstName + " " + user.lastName : "",
userGroups,
__selectable:
role.value === Constants.BudibaseRoles.Owner ? false : undefined,
role.value === Constants.BudibaseRoles.Owner ||
$auth.user?.email === user.email
? false
: true,
apps: [...new Set(Object.keys(user.roles))],
access: role.sortOrder,
}
@ -392,7 +395,7 @@
allowSelectRows={!readonly}
{customRenderers}
loading={!$fetch.loaded || !groupsLoaded}
defaultSortColumn={"access"}
defaultSortColumn={"__selectable"}
/>
<div class="pagination">