Revert "chore: remove grace period global variable"

This reverts commit f61154fd49.
This commit is contained in:
Arman
2024-02-01 14:51:21 +01:00
parent f61154fd49
commit b6edffe278
9 changed files with 42 additions and 21 deletions
+4 -2
View File
@@ -11,7 +11,7 @@
import { Alert, DropList, Heading } from '$lib/components';
import { Pill } from '$lib/elements';
import { organization } from '$lib/stores/organization';
import { isCloud } from '$lib/system';
import { GRACE_PERIOD_OVERRIDE, isCloud } from '$lib/system';
import { createEventDispatcher, onMount } from 'svelte';
import { wizard } from '$lib/stores/wizard';
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
@@ -61,7 +61,9 @@
$: isLimited = limit !== 0 && limit < Infinity;
$: overflowingServices = limitedServices.filter((service) => service.value >= 0);
$: isButtonDisabled =
buttonDisabled || $readOnly || (isLimited && total >= limit && !hasUsageFees);
buttonDisabled ||
($readOnly && !GRACE_PERIOD_OVERRIDE) ||
(isLimited && total >= limit && !hasUsageFees);
onMount(() => {
dispatch('data', { isButtonDisabled, limit, tier });
+1
View File
@@ -23,3 +23,4 @@ export const MODE = VARS.CONSOLE_MODE === Mode.CLOUD ? Mode.CLOUD : Mode.SELF_HO
export const isCloud = MODE === Mode.CLOUD;
export const isSelfHosted = MODE !== Mode.CLOUD;
export const hasStripePublicKey = !!VARS.STRIPE_PUBLIC_KEY;
export const GRACE_PERIOD_OVERRIDE = false;
@@ -7,7 +7,7 @@
import CreateProject from './createProject.svelte';
import CreateOrganization from '../createOrganization.svelte';
import { wizard } from '$lib/stores/wizard';
import { isCloud } from '$lib/system';
import { GRACE_PERIOD_OVERRIDE, isCloud } from '$lib/system';
import { page } from '$app/stores';
import { registerCommands } from '$lib/commandCenter';
import {
@@ -90,7 +90,7 @@
showCreate = true;
},
keys: ['c'],
disabled: $readOnly,
disabled: $readOnly && !GRACE_PERIOD_OVERRIDE,
group: 'projects',
icon: 'plus'
}
@@ -143,7 +143,10 @@
<Heading tag="h2" size="5">Projects</Heading>
<DropList bind:show={showDropdown} placement="bottom-end">
<Button on:click={handleCreateProject} event="create_project" disabled={$readOnly}>
<Button
on:click={handleCreateProject}
event="create_project"
disabled={$readOnly && !GRACE_PERIOD_OVERRIDE}>
<span class="icon-plus" aria-hidden="true" />
<span class="text">Create project</span>
</Button>
@@ -18,14 +18,16 @@
organizationList
} from '$lib/stores/organization';
import { wizard } from '$lib/stores/wizard';
import { isCloud } from '$lib/system';
import { GRACE_PERIOD_OVERRIDE, isCloud } from '$lib/system';
import CreateOrganizationCloud from '../createOrganizationCloud.svelte';
let areMembersLimited: boolean;
$: organization.subscribe(() => {
const limit = getServiceLimit('members') || Infinity;
const isLimited = limit !== 0 && limit < Infinity;
areMembersLimited = isCloud && ($readOnly || (isLimited && $members?.total >= limit));
areMembersLimited =
isCloud &&
(($readOnly && !GRACE_PERIOD_OVERRIDE) || (isLimited && $members?.total >= limit));
});
let showDropdown = false;
@@ -3,6 +3,7 @@
import { page } from '$app/stores';
import { registerCommands, updateCommandGroupRanks } from '$lib/commandCenter';
import { readOnly } from '$lib/stores/billing';
import { GRACE_PERIOD_OVERRIDE } from '$lib/system';
import { project } from '../store';
import { showCreateUser } from './+page.svelte';
import { showCreateTeam } from './teams/+page.svelte';
@@ -20,7 +21,7 @@
group: 'users',
icon: 'plus',
rank: $page.url.pathname.endsWith('auth') ? 10 : 0,
disabled: $readOnly
disabled: $readOnly && !GRACE_PERIOD_OVERRIDE
},
{
label: 'Create team',
@@ -35,7 +36,7 @@
group: 'teams',
icon: 'plus',
rank: $page.url.pathname.endsWith('teams') ? 10 : 0,
disabled: $readOnly
disabled: $readOnly && !GRACE_PERIOD_OVERRIDE
},
{
label: 'Go to teams',
@@ -39,7 +39,7 @@
import DeploymentSource from './deploymentSource.svelte';
import DeploymentCreatedBy from './deploymentCreatedBy.svelte';
import DeploymentDomains from './deploymentDomains.svelte';
import { isCloud } from '$lib/system';
import { GRACE_PERIOD_OVERRIDE, isCloud } from '$lib/system';
import { readOnly } from '$lib/stores/billing';
export let data;
@@ -152,7 +152,7 @@
<Button
secondary
on:click={() => ($execute = $func)}
disabled={isCloud && $readOnly}>
disabled={isCloud && $readOnly && !GRACE_PERIOD_OVERRIDE}>
Execute now
</Button>
</div>
@@ -15,7 +15,7 @@
import { isSameDay, toLocaleDate } from '$lib/helpers/date';
import { Container } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import { isSelfHosted } from '$lib/system';
import { GRACE_PERIOD_OVERRIDE, isSelfHosted } from '$lib/system';
import { onMount } from 'svelte';
import { project } from '../../store';
import { openImportWizard } from './(import)';
@@ -227,7 +227,7 @@
class="u-margin-block-start-20"
secondary
on:click={openImportWizard}
disabled={$readOnly}>
disabled={$readOnly && !GRACE_PERIOD_OVERRIDE}>
Import data
</Button>
</div>
@@ -81,6 +81,7 @@
import { bucket } from '../store';
import UpdateMaxFileSize from './updateMaxFileSize.svelte';
import { readOnly } from '$lib/stores/billing';
import { GRACE_PERIOD_OVERRIDE } from '$lib/system';
let showDelete = false;
@@ -232,7 +233,10 @@
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={enabled === $bucket.enabled || $readOnly} submit>
<Button
disabled={enabled === $bucket.enabled ||
($readOnly && !GRACE_PERIOD_OVERRIDE)}
submit>
Update
</Button>
</svelte:fragment>
@@ -248,14 +252,16 @@
id="name"
label="Name"
placeholder="Enter name"
readonly={$readOnly}
readonly={$readOnly && !GRACE_PERIOD_OVERRIDE}
bind:value={bucketName} />
</FormList>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button
disabled={bucketName === $bucket.name || !bucketName || $readOnly}
disabled={bucketName === $bucket.name ||
!bucketName ||
($readOnly && !GRACE_PERIOD_OVERRIDE)}
submit>
Update
</Button>
@@ -308,7 +314,8 @@
</svelte:fragment>
<svelte:fragment slot="actions">
<Button
disabled={bucketFileSecurity === $bucket.fileSecurity || $readOnly}
disabled={bucketFileSecurity === $bucket.fileSecurity ||
($readOnly && !GRACE_PERIOD_OVERRIDE)}
submit>
Update
</Button>
@@ -422,7 +429,9 @@
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={isExtensionsDisabled || $readOnly} submit>Update</Button>
<Button
disabled={isExtensionsDisabled || ($readOnly && !GRACE_PERIOD_OVERRIDE)}
submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -8,7 +8,7 @@
import { getServiceLimit, readOnly, tierToPlan } from '$lib/stores/billing';
import { organization } from '$lib/stores/organization';
import { wizard } from '$lib/stores/wizard';
import { isCloud } from '$lib/system';
import { GRACE_PERIOD_OVERRIDE, isCloud } from '$lib/system';
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
import { bucket } from '../store';
import { updateBucket } from './+page.svelte';
@@ -66,7 +66,7 @@
fullWidth
id="size"
label="Size"
disabled={$readOnly}
disabled={$readOnly && !GRACE_PERIOD_OVERRIDE}
placeholder={$bucket.maximumFileSize.toString()}
min={0}
max={isCloud ? service : Infinity}
@@ -82,7 +82,10 @@
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={$baseValue === $bucket.maximumFileSize || $readOnly} submit>
<Button
disabled={$baseValue === $bucket.maximumFileSize ||
($readOnly && !GRACE_PERIOD_OVERRIDE)}
submit>
Update
</Button>
</svelte:fragment>