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:
parent
d3cd76214c
commit
528a21643c
|
@ -1,10 +1,12 @@
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
|
AbsTooltip,
|
||||||
Layout,
|
Layout,
|
||||||
Heading,
|
Heading,
|
||||||
Body,
|
Body,
|
||||||
Button,
|
Button,
|
||||||
Divider,
|
Divider,
|
||||||
|
Icon,
|
||||||
Tags,
|
Tags,
|
||||||
Tag,
|
Tag,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
|
@ -15,6 +17,8 @@
|
||||||
export let description
|
export let description
|
||||||
export let enabled
|
export let enabled
|
||||||
export let upgradeButtonClick
|
export let upgradeButtonClick
|
||||||
|
|
||||||
|
$: upgradeDisabled = !$auth.accountPortalAccess && $admin.cloud
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
|
@ -36,8 +40,9 @@
|
||||||
{:else}
|
{:else}
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<Button
|
<Button
|
||||||
primary
|
primary={!upgradeDisabled}
|
||||||
disabled={!$auth.accountPortalAccess && $admin.cloud}
|
secondary={upgradeDisabled}
|
||||||
|
disabled={upgradeDisabled}
|
||||||
on:click={async () => upgradeButtonClick()}
|
on:click={async () => upgradeButtonClick()}
|
||||||
>
|
>
|
||||||
Upgrade
|
Upgrade
|
||||||
|
@ -51,6 +56,16 @@
|
||||||
>
|
>
|
||||||
View Plans
|
View Plans
|
||||||
</Button>
|
</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>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -67,7 +82,11 @@
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
gap: var(--spacing-m);
|
gap: var(--spacing-m);
|
||||||
}
|
}
|
||||||
|
.icon {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
.buttons {
|
.buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
|
@ -127,7 +127,10 @@
|
||||||
name: user.firstName ? user.firstName + " " + user.lastName : "",
|
name: user.firstName ? user.firstName + " " + user.lastName : "",
|
||||||
userGroups,
|
userGroups,
|
||||||
__selectable:
|
__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))],
|
apps: [...new Set(Object.keys(user.roles))],
|
||||||
access: role.sortOrder,
|
access: role.sortOrder,
|
||||||
}
|
}
|
||||||
|
@ -392,7 +395,7 @@
|
||||||
allowSelectRows={!readonly}
|
allowSelectRows={!readonly}
|
||||||
{customRenderers}
|
{customRenderers}
|
||||||
loading={!$fetch.loaded || !groupsLoaded}
|
loading={!$fetch.loaded || !groupsLoaded}
|
||||||
defaultSortColumn={"access"}
|
defaultSortColumn={"__selectable"}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
|
|
Loading…
Reference in New Issue