Merge branch 'cloud' of github.com:appwrite/console into feat-org-limit-banner-alert

This commit is contained in:
Arman
2024-04-09 16:25:52 +02:00
7 changed files with 34 additions and 125 deletions
@@ -95,9 +95,8 @@
{/if}
{#if $organization?.billingPlanDowngrade}
<Alert type="info" class="common-section">
Your organization will change to a Starter plan once your current billing cycle ends on {toLocaleDate(
$organization.billingNextInvoiceDate
)}.
Your organization will change to a Starter plan once your current billing cycle ends and
your invoice is paid on {toLocaleDate($organization.billingNextInvoiceDate)}.
</Alert>
{/if}
<div class="common-section">
@@ -58,11 +58,10 @@
headerDivider={false}
title="Unable to delete payment method">
<p data-private>
The {isBackup ? 'backup' : 'default'} payment method cannot be deleted as
The {isBackup ? 'backup' : 'default'} payment method cannot be removed as
<b>{$organization?.name}</b>
has an upcoming invoice. To proceed with deletion, set a {isBackup
? 'default'
: 'backup'} or add a new {isBackup ? 'backup' : 'default'} payment method.
has an upcoming invoice. To proceed, set a {isBackup ? 'default' : 'backup'} or add a new
{isBackup ? 'backup' : 'default'} payment method.
</p>
<svelte:fragment slot="footer">
<Button text on:click={() => (showDelete = false)}>Cancel</Button>
@@ -76,13 +75,13 @@
icon="exclamation"
state="warning"
headerDivider={false}
title="Delete payment method">
title="Remove payment method">
<p data-private>
Are you sure you want to delete the payment method from <b>{$organization?.name}</b>?
Are you sure you want to remove the payment method from <b>{$organization?.name}</b>?
</p>
<svelte:fragment slot="footer">
<Button text on:click={() => (showDelete = false)}>Cancel</Button>
<Button secondary submit>Delete</Button>
<Button secondary submit>Remove</Button>
</svelte:fragment>
</Modal>
{/if}
@@ -137,7 +137,7 @@
showDelete = true;
showDropdown = false;
}}>
Delete
Remove
</DropListItem>
</svelte:fragment>
</DropList>
@@ -3,8 +3,8 @@ import { derived } from 'svelte/store';
import type { Models } from '@appwrite.io/console';
export const runtimesList = derived(page, async ($page) => {
const { runtimes } = (await $page.data.runtimes) as Models.RuntimeList;
const filtered = runtimes.filter((runtime) => !runtime.name.startsWith('python-ml'));
const { runtimes } = (await $page.data.runtimesList) as Models.RuntimeList;
const filtered = runtimes.filter((runtime) => !runtime.$id.startsWith('python-ml'));
return { runtimes: filtered, total: filtered.length };
});
@@ -29,7 +29,7 @@
async function create() {
try {
await uploader.uploadFile(
uploader.uploadFile(
bucketId,
$createFile.id ?? ID.unique(),
$createFile.files[0],
@@ -42,7 +42,7 @@
addNotification({
type: 'success',
message: `File has been uploaded`
message: `File upload in progress`
});
trackEvent(Submit.FileCreate, {
customId: !!$createFile.id
@@ -1,105 +0,0 @@
<script lang="ts">
import { Button, FormList, InputFile } from '$lib/elements/forms';
import { Pill } from '$lib/elements';
import { Modal, CustomId, Heading, Alert } from '$lib/components';
import { createEventDispatcher } from 'svelte';
import { page } from '$app/stores';
import { uploader } from '$lib/stores/uploader';
import { bucket } from './store';
import { Permissions } from '$lib/components/permissions';
import { addNotification } from '$lib/stores/notifications';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { ID } from '@appwrite.io/console';
export let showCreate = false;
const bucketId = $page.params.bucket;
const dispatch = createEventDispatcher();
let files: FileList;
let permissions: string[] = [];
let id: string = null;
let error: string;
let showCustomId = false;
async function create() {
try {
showCreate = false;
await uploader.uploadFile(bucketId, id ?? ID.unique(), files[0], permissions);
files = null;
showCustomId = false;
dispatch('created');
addNotification({
type: 'success',
message: `File has been uploaded`
});
trackEvent(Submit.FileCreate, {
customId: !!id
});
} catch (e) {
error = e.message;
trackError(e, Submit.FileCreate);
}
}
$: if (!showCreate) {
id = files = error = null;
permissions = [];
}
</script>
<Modal title="Create file" size="big" {error} bind:show={showCreate} onSubmit={create}>
<FormList>
<div>
<InputFile
bind:files
allowedFileExtensions={$bucket.allowedFileExtensions}
maxSize={$bucket.maximumFileSize} />
</div>
{#if !showCustomId}
<div>
<Pill button on:click={() => (showCustomId = !showCustomId)}>
<span class="icon-pencil" aria-hidden="true" /><span class="text">
File ID
</span>
</Pill>
</div>
{:else}
<CustomId bind:show={showCustomId} name="File" bind:id />
{/if}
<Heading tag="h6" size="7">Permissions</Heading>
<p class="text">
Choose who can access your buckets and files. For more information, visit our
<a
href="https://appwrite.io/docs/advanced/platform/permissions"
target="_blank"
rel="noopener noreferrer"
class="link">
Permissions guide
</a>.
</p>
{#if $bucket.fileSecurity}
<div class="common-section">
<Alert type="info">
<svelte:fragment slot="title">File security enabled</svelte:fragment>
Users will be able to access this file if they have been granted
<b>either File or Bucket permissions</b>.
</Alert>
</div>
<div class="common-section">
<Permissions bind:permissions />
</div>
{:else}
<Alert type="info">
<svelte:fragment slot="title">File security disabled</svelte:fragment>
If you want to assign file permissions, navigate to Bucket settings and enable file security.
Otherwise, only Bucket permissions will be used.
</Alert>
{/if}
</FormList>
<svelte:fragment slot="footer">
<Button secondary on:click={() => (showCreate = false)}>Cancel</Button>
<Button submit>Create</Button>
</svelte:fragment>
</Modal>
@@ -1,5 +1,5 @@
<script lang="ts">
import { Box, CreditCardBrandImage } from '$lib/components';
import { Alert, Box, CreditCardBrandImage } from '$lib/components';
import { CouponInput } from '$lib/components/billing';
import { BillingPlan } from '$lib/constants';
import { FormList, InputSelect, InputTextarea } from '$lib/elements/forms';
@@ -7,7 +7,7 @@
import { formatCurrency } from '$lib/helpers/numbers';
import { WizardStep } from '$lib/layout';
import type { Coupon } from '$lib/sdk/billing';
import { plansInfo } from '$lib/stores/billing';
import { plansInfo, tierToPlan } from '$lib/stores/billing';
import { organization } from '$lib/stores/organization';
import { sdk } from '$lib/stores/sdk';
import {
@@ -58,17 +58,33 @@
Your feedback is important to us and helps us improve the services Appwrite offers.
Please let us know if there is a specific reason for changing your plan.
</svelte:fragment>
<FormList>
<Alert>
<svelte:fragment slot="title"
>Your {tierToPlan($organization.billingPlan).name} plan subscription will end on {toLocaleDate(
$organization.billingNextInvoiceDate
)}</svelte:fragment>
<p class="text">
Following the payment of your final invoice on {toLocaleDate(
$organization.billingNextInvoiceDate
)}, your organization will switch to the {tierToPlan(
$changeOrganizationTier.billingPlan
).name} plan. Until then, you can continue to use the resources available to the {tierToPlan(
$organization.billingPlan
).name} plan.
</p>
</Alert>
<FormList class="u-margin-block-start-24">
<InputSelect
id="reason"
label="What made you decide to change your plan?*"
label="Reason for plan change"
placeholder="Select one"
required
options={feedbackDowngradeOptions}
bind:value={$changeOrganizationTier.feedbackDowngradeReason} />
<InputTextarea
id="comment"
label="Your feedback here"
label="If you would like to elaborate, please do so here"
placeholder="Enter feedback"
bind:value={$changeOrganizationTier.feedbackMessage} />
</FormList>