mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: types, GRACE_PERIOD_OVERRIDE
This commit is contained in:
1 parent
f5055aa8eb
commit
2e66eb7b69
15 files changed
+52
-51
No files matched your search
@@ -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';
|
||||
@@ -59,7 +59,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 });
|
||||
|
||||
@@ -185,7 +185,8 @@ export type AllowedRegions =
|
||||
| 'eu-nl'
|
||||
| 'ap-sg'
|
||||
| 'ap-ca'
|
||||
| 'ap-au';
|
||||
| 'ap-au'
|
||||
| 'default'; //TODO: remove after migration
|
||||
|
||||
export type Region = {
|
||||
$id: AllowedRegions;
|
||||
|
||||
@@ -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 = true;
|
||||
@@ -265,14 +265,7 @@
|
||||
}, INTERVAL);
|
||||
|
||||
if (isCloud && hasStripePublicKey) {
|
||||
console.log('Environment is Cloud and Stripe public key deteted');
|
||||
$stripe = await loadStripe(VARS.STRIPE_PUBLIC_KEY);
|
||||
console.log('Stripe loaded', $stripe);
|
||||
} else {
|
||||
console.log('Environment is not Cloud or Stripe public key not deteted');
|
||||
console.log('isCloud:', isCloud);
|
||||
console.log('hasStripePublicKey:', hasStripePublicKey);
|
||||
console.log('Stripe key:', VARS.STRIPE_PUBLIC_KEY);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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 {
|
||||
@@ -89,7 +89,7 @@
|
||||
showCreate = true;
|
||||
},
|
||||
keys: ['c'],
|
||||
disabled: $readOnly,
|
||||
disabled: $readOnly && !GRACE_PERIOD_OVERRIDE,
|
||||
group: 'projects',
|
||||
icon: 'plus'
|
||||
}
|
||||
@@ -141,7 +141,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>
|
||||
|
||||
@@ -17,14 +17,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;
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import type { PageData } from './$types';
|
||||
import Delete from '../deleteMember.svelte';
|
||||
import { readOnly } from '$lib/stores/billing';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -63,7 +62,6 @@
|
||||
total={data.organizationMembers.total}
|
||||
buttonText="Invite"
|
||||
buttonMethod={() => newMemberModal.set(true)}
|
||||
buttonDisabled={$readOnly}
|
||||
showAlert={false} />
|
||||
|
||||
<TableScroll>
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import type { PageData } from './$types';
|
||||
import Create from './createUser.svelte';
|
||||
import { readOnly } from '$lib/stores/billing';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -44,12 +42,7 @@
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<ContainerHeader
|
||||
title="Users"
|
||||
isFlex={false}
|
||||
total={data.users.total}
|
||||
buttonDisabled={isCloud && $readOnly}
|
||||
let:isButtonDisabled>
|
||||
<ContainerHeader title="Users" isFlex={false} total={data.users.total} let:isButtonDisabled>
|
||||
<SearchQuery search={data.search} placeholder="Search by name, email, phone, or ID">
|
||||
<div
|
||||
use:tooltip={{
|
||||
@@ -59,7 +52,7 @@
|
||||
<Button
|
||||
on:click={() => ($showCreateUser = true)}
|
||||
event="create_user"
|
||||
disabled={isCloud && $readOnly}>
|
||||
disabled={isButtonDisabled}>
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Create user</span>
|
||||
</Button>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
import DeploymentCreatedBy from './deploymentCreatedBy.svelte';
|
||||
import DeploymentDomains from './deploymentDomains.svelte';
|
||||
import { hoursToDays } from '$lib/helpers/date';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { GRACE_PERIOD_OVERRIDE, isCloud } from '$lib/system';
|
||||
import { readOnly } from '$lib/stores/billing';
|
||||
|
||||
export let data;
|
||||
@@ -160,7 +160,9 @@
|
||||
<Button
|
||||
secondary
|
||||
on:click={() => ($execute = $func)}
|
||||
disabled={isCloud && $readOnly}>Execute now</Button>
|
||||
disabled={isCloud && $readOnly && !GRACE_PERIOD_OVERRIDE}>
|
||||
Execute now
|
||||
</Button>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
|
||||
+2
-4
@@ -22,8 +22,7 @@
|
||||
import { func } from '../store';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { getServiceLimit, readOnly, showUsageRatesModal } from '$lib/stores/billing';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { getServiceLimit, showUsageRatesModal } from '$lib/stores/billing';
|
||||
import { project } from '$routes/console/project-[project]/store';
|
||||
import Create from '../create.svelte';
|
||||
import Execute from '../execute.svelte';
|
||||
@@ -55,8 +54,7 @@
|
||||
title="Executions"
|
||||
buttonText="Execute now"
|
||||
buttonEvent="execute_function"
|
||||
buttonMethod={() => (selectedFunction = $func)}
|
||||
buttonDisabled={isCloud && $readOnly}>
|
||||
buttonMethod={() => (selectedFunction = $func)}>
|
||||
<svelte:fragment slot="tooltip" let:tier let:limit let:upgradeMethod>
|
||||
<p class="u-bold">The {tier} plan has limits</p>
|
||||
<ul>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
import { uploader } from '$lib/stores/uploader';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { readOnly, showUsageRatesModal } from '$lib/stores/billing';
|
||||
import { showUsageRatesModal } from '$lib/stores/billing';
|
||||
import { sdk } from '$lib/stores/sdk.js';
|
||||
import Create from './create-file/create.svelte';
|
||||
import DeleteFile from './deleteFile.svelte';
|
||||
@@ -80,12 +80,7 @@
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<ContainerHeader
|
||||
title="Files"
|
||||
serviceId="storage"
|
||||
isFlex={false}
|
||||
total={usedStorage}
|
||||
buttonDisabled={$readOnly}>
|
||||
<ContainerHeader title="Files" serviceId="storage" isFlex={false} total={usedStorage}>
|
||||
<svelte:fragment let:isButtonDisabled>
|
||||
<SearchQuery search={data.search} placeholder="Search by filename">
|
||||
<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>
|
||||
|
||||
+6
-3
@@ -7,7 +7,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';
|
||||
@@ -65,7 +65,7 @@
|
||||
fullWidth
|
||||
id="size"
|
||||
label="Size"
|
||||
disabled={$readOnly}
|
||||
disabled={$readOnly && !GRACE_PERIOD_OVERRIDE}
|
||||
placeholder={$bucket.maximumFileSize.toString()}
|
||||
min={0}
|
||||
max={isCloud ? service : Infinity}
|
||||
@@ -81,7 +81,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>
|
||||
|
||||
Reference in new issue
Block a user