From b6edffe278ee61852cd61be0ad69db07f8c9c394 Mon Sep 17 00:00:00 2001 From: Arman Date: Thu, 1 Feb 2024 14:51:21 +0100 Subject: [PATCH] Revert "chore: remove grace period global variable" This reverts commit f61154fd49304ae63a6dfc4103eb506a2056bedb. --- src/lib/layout/containerHeader.svelte | 6 ++++-- src/lib/system.ts | 1 + .../organization-[organization]/+page.svelte | 9 ++++++--- .../organization-[organization]/header.svelte | 6 ++++-- .../project-[project]/auth/+layout.svelte | 5 +++-- .../function-[function]/+page.svelte | 4 ++-- .../settings/migrations/+page.svelte | 4 ++-- .../bucket-[bucket]/settings/+page.svelte | 19 ++++++++++++++----- .../settings/updateMaxFileSize.svelte | 9 ++++++--- 9 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/lib/layout/containerHeader.svelte b/src/lib/layout/containerHeader.svelte index eca768d5a..80585507e 100644 --- a/src/lib/layout/containerHeader.svelte +++ b/src/lib/layout/containerHeader.svelte @@ -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 }); diff --git a/src/lib/system.ts b/src/lib/system.ts index 3586468ef..5cb998dca 100644 --- a/src/lib/system.ts +++ b/src/lib/system.ts @@ -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; diff --git a/src/routes/console/organization-[organization]/+page.svelte b/src/routes/console/organization-[organization]/+page.svelte index bb3b1fd38..0cc3ff1af 100644 --- a/src/routes/console/organization-[organization]/+page.svelte +++ b/src/routes/console/organization-[organization]/+page.svelte @@ -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 @@ Projects - diff --git a/src/routes/console/organization-[organization]/header.svelte b/src/routes/console/organization-[organization]/header.svelte index d93749cd1..23c2d23d8 100644 --- a/src/routes/console/organization-[organization]/header.svelte +++ b/src/routes/console/organization-[organization]/header.svelte @@ -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; diff --git a/src/routes/console/project-[project]/auth/+layout.svelte b/src/routes/console/project-[project]/auth/+layout.svelte index 7da5cc22e..cfb6a198b 100644 --- a/src/routes/console/project-[project]/auth/+layout.svelte +++ b/src/routes/console/project-[project]/auth/+layout.svelte @@ -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', diff --git a/src/routes/console/project-[project]/functions/function-[function]/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/+page.svelte index 2be30c035..1462e407d 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/+page.svelte @@ -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 @@ diff --git a/src/routes/console/project-[project]/settings/migrations/+page.svelte b/src/routes/console/project-[project]/settings/migrations/+page.svelte index 1375c9c17..2a7877a02 100644 --- a/src/routes/console/project-[project]/settings/migrations/+page.svelte +++ b/src/routes/console/project-[project]/settings/migrations/+page.svelte @@ -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 diff --git a/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/+page.svelte b/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/+page.svelte index 001823e70..e229e256c 100644 --- a/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/+page.svelte +++ b/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/+page.svelte @@ -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 @@ - @@ -248,14 +252,16 @@ id="name" label="Name" placeholder="Enter name" - readonly={$readOnly} + readonly={$readOnly && !GRACE_PERIOD_OVERRIDE} bind:value={bucketName} /> @@ -308,7 +314,8 @@ @@ -422,7 +429,9 @@ - + diff --git a/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/updateMaxFileSize.svelte b/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/updateMaxFileSize.svelte index f031a0645..3499e9c34 100644 --- a/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/updateMaxFileSize.svelte +++ b/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/updateMaxFileSize.svelte @@ -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 @@ -