Merge branch 'main' into notification-modals.

This commit is contained in:
ItzNotABug committed 2024-09-24 21:18:38 +05:30
commit d8fe3acf07
41 files changed
+835 -634

No files matched your search

+3 -1
View File
@@ -153,4 +153,6 @@ dist
# Sentry Config File # Sentry Config File
.sentryclirc .sentryclirc
.idea
# IDE specifics
.idea
+5 -4
View File
@@ -6,7 +6,7 @@
"": { "": {
"name": "@appwrite/console", "name": "@appwrite/console",
"dependencies": { "dependencies": {
"@appwrite.io/console": "1.1.0", "@appwrite.io/console": "^1.2.0",
"@appwrite.io/pink": "0.25.0", "@appwrite.io/pink": "0.25.0",
"@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons": "0.25.0",
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.8",
@@ -149,9 +149,10 @@
"integrity": "sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==" "integrity": "sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg=="
}, },
"node_modules/@appwrite.io/console": { "node_modules/@appwrite.io/console": {
"version": "1.1.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@appwrite.io/console/-/console-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@appwrite.io/console/-/console-1.2.0.tgz",
"integrity": "sha512-jWg+NW9RJxh2pnE/14xwpXBcChiSLYBnG3Jkr5RnMJ1mH7BYmbAuLTyxFn3UFy5llB7jVq8pHNYGqA93ZoEMsQ==" "integrity": "sha512-VglATKgjuhr9jYihz500VbqghOY/695aDwhXtx3beLMzvjjFK+eN+5BOgcNMTj01COl3kBu4wrvbXpDmVemStA==",
"license": "BSD-3-Clause"
}, },
"node_modules/@appwrite.io/pink": { "node_modules/@appwrite.io/pink": {
"version": "0.25.0", "version": "0.25.0",
+16 -21
View File
@@ -19,16 +19,16 @@
"e2e:ui": "playwright test tests/e2e --ui" "e2e:ui": "playwright test tests/e2e --ui"
}, },
"dependencies": { "dependencies": {
"@appwrite.io/console": "1.1.0", "@appwrite.io/console": "^1.2.0",
"@appwrite.io/pink": "0.25.0", "@appwrite.io/pink": "0.25.0",
"@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons": "0.25.0",
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.8",
"@sentry/sveltekit": "^8.26.0", "@sentry/sveltekit": "^8.31.0",
"@stripe/stripe-js": "^3.5.0", "@stripe/stripe-js": "^3.5.0",
"ai": "^2.2.37", "ai": "^2.2.37",
"analytics": "^0.8.14", "analytics": "^0.8.14",
"cron-parser": "^4.9.0", "cron-parser": "^4.9.0",
"dayjs": "^1.11.12", "dayjs": "^1.11.13",
"deep-equal": "^2.2.3", "deep-equal": "^2.2.3",
"echarts": "^5.5.1", "echarts": "^5.5.1",
"envfile": "^7.1.0", "envfile": "^7.1.0",
@@ -42,12 +42,12 @@
"devDependencies": { "devDependencies": {
"@melt-ui/pp": "^0.3.2", "@melt-ui/pp": "^0.3.2",
"@melt-ui/svelte": "^0.83.0", "@melt-ui/svelte": "^0.83.0",
"@playwright/test": "^1.46.0", "@playwright/test": "^1.47.2",
"@sveltejs/adapter-static": "^3.0.4", "@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.5.22", "@sveltejs/kit": "^2.5.28",
"@sveltejs/vite-plugin-svelte": "^3.1.1", "@sveltejs/vite-plugin-svelte": "^3.1.2",
"@testing-library/dom": "^10.4.0", "@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.4.8", "@testing-library/jest-dom": "^6.5.0",
"@testing-library/svelte": "^5.2.1", "@testing-library/svelte": "^5.2.1",
"@testing-library/user-event": "^14.5.2", "@testing-library/user-event": "^14.5.2",
"@types/deep-equal": "^1.0.4", "@types/deep-equal": "^1.0.4",
@@ -55,29 +55,24 @@
"@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0", "@typescript-eslint/parser": "^7.18.0",
"@vitest/ui": "^1.6.0", "@vitest/ui": "^1.6.0",
"eslint": "^8.57.0", "eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.43.0", "eslint-plugin-svelte": "^2.44.0",
"jsdom": "^22.1.0", "jsdom": "^22.1.0",
"kleur": "^4.1.5", "kleur": "^4.1.5",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.6", "prettier-plugin-svelte": "^3.2.6",
"sass": "^1.77.8", "sass": "^1.79.3",
"svelte": "^4.2.18", "svelte": "^4.2.19",
"svelte-check": "^3.8.5", "svelte-check": "^3.8.6",
"svelte-jester": "^2.3.2", "svelte-jester": "^2.3.2",
"svelte-preprocess": "^6.0.2", "svelte-preprocess": "^6.0.2",
"svelte-sequential-preprocessor": "^2.0.1", "svelte-sequential-preprocessor": "^2.0.1",
"tslib": "^2.6.3", "tslib": "^2.7.0",
"typescript": "^5.5.4", "typescript": "^5.6.2",
"vite": "^5.4.0", "vite": "^5.4.7",
"vitest": "^1.6.0" "vitest": "^1.6.0"
}, },
"pnpm": {
"overrides": {
"rollup": "^4.22.4"
}
},
"type": "module", "type": "module",
"packageManager": "pnpm@9.7.0+sha512.dc09430156b427f5ecfc79888899e1c39d2d690f004be70e05230b72cb173d96839587545d09429b55ac3c429c801b4dc3c0e002f653830a420fa2dd4e3cf9cf" "packageManager": "pnpm@9.7.0+sha512.dc09430156b427f5ecfc79888899e1c39d2d690f004be70e05230b72cb173d96839587545d09429b55ac3c429c801b4dc3c0e002f653830a420fa2dd4e3cf9cf"
} }
+508 -503
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -5,6 +5,7 @@
export let tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; export let tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
export let size: Size; export let size: Size;
export let trimmed = true; export let trimmed = true;
export let trimmedSecondLine = false;
export let id: string = null; export let id: string = null;
let classes = ''; let classes = '';
export { classes as class }; export { classes as class };
@@ -15,6 +16,7 @@
this={tag} this={tag}
class={`heading-level-${size} u-min-width-0 ${classes}`} class={`heading-level-${size} u-min-width-0 ${classes}`}
class:u-trim-1={trimmed} class:u-trim-1={trimmed}
class:u-trim-2={trimmedSecondLine}
{style} {style}
{id}> {id}>
<slot /> <slot />
+1 -1
View File
@@ -56,7 +56,7 @@ export { default as PaginationWithLimit } from './paginationWithLimit.svelte';
export { default as ClickableList } from './clickableList.svelte'; export { default as ClickableList } from './clickableList.svelte';
export { default as ClickableListItem } from './clickableListItem.svelte'; export { default as ClickableListItem } from './clickableListItem.svelte';
export { default as Id } from './id.svelte'; export { default as Id } from './id.svelte';
export { default as ProgressBar } from './progressBar.svelte'; export * from './progressbar';
export { default as ProgressBarBig } from './progressBarBig.svelte'; export { default as ProgressBarBig } from './progressBarBig.svelte';
export { default as CreditCardInfo } from './creditCardInfo.svelte'; export { default as CreditCardInfo } from './creditCardInfo.svelte';
export { default as CreditCardBrandImage } from './creditCardBrandImage.svelte'; export { default as CreditCardBrandImage } from './creditCardBrandImage.svelte';
@@ -1,4 +1,6 @@
<script context="module" lang="ts"> <script context="module" lang="ts">
let inputDigitFields: InputDigits;
export async function verify(challenge: Models.MfaChallenge, code: string) { export async function verify(challenge: Models.MfaChallenge, code: string) {
try { try {
if (challenge == null) { if (challenge == null) {
@@ -10,6 +12,7 @@
await invalidate(Dependencies.ACCOUNT); await invalidate(Dependencies.ACCOUNT);
trackEvent(Submit.AccountCreate); trackEvent(Submit.AccountCreate);
} catch (error) { } catch (error) {
inputDigitFields?.clearInputsAndRefocus();
trackError(error, Submit.AccountCreate); trackError(error, Submit.AccountCreate);
throw error; throw error;
} }
@@ -81,7 +84,12 @@
{:else if challengeType == AuthenticationFactor.Phone} {:else if challengeType == AuthenticationFactor.Phone}
<p>A 6-digit verification code was sent to your phone, enter it below.</p> <p>A 6-digit verification code was sent to your phone, enter it below.</p>
{/if} {/if}
<InputDigits bind:value={code} required autofocus {autoSubmit} /> <InputDigits
bind:value={code}
required
autofocus
{autoSubmit}
bind:this={inputDigitFields} />
{/if} {/if}
{#if showVerifyButton} {#if showVerifyButton}
<FormItem> <FormItem>
+23 -23
View File
@@ -1,36 +1,36 @@
<script lang="ts"> <script lang="ts">
export let currentValue: string; import { ProgressBar, type ProgressbarData } from '$lib/components/progressbar';
export let currentUnit: string;
export let maxValue: string; export let currentValue: string | undefined = undefined;
export let maxUnit: string; export let currentUnit: string | undefined = undefined;
export let maxValue: string | undefined = undefined;
export let maxUnit: string | undefined = undefined;
export let progressValue: number; export let progressValue: number;
export let progressMax: number; export let progressMax: number;
export let showBar = true; export let showBar = true;
export let minimum = 0; export let progressBarData: Array<ProgressbarData> = [];
export let maximum = 100;
$: progress = Math.round((progressValue / progressMax) * 100); $: progress = Math.round((progressValue / progressMax) * 100);
</script> </script>
<section class="progress-bar"> <section class="progress-bar">
<div class="u-flex u-flex-vertical"> {#if currentValue !== undefined && currentUnit !== undefined && progress !== undefined && maxValue !== undefined && maxUnit !== undefined}
<div class="u-flex u-main-space-between"> <div class="u-flex u-flex-vertical">
<p> <div class="u-flex u-main-space-between">
<span class="heading-level-4">{currentValue}</span> <p>
<span class="body-text-1 u-bold">{currentUnit}</span> <span class="heading-level-4">{currentValue}</span>
<span class="body-text-1 u-bold">{currentUnit}</span>
</p>
<p class="heading-level-4">{progress}%</p>
</div>
<p class="body-text-2">
{maxValue}
{maxUnit}
</p> </p>
<p class="heading-level-4">{progress}%</p>
</div> </div>
<p class="body-text-2"> {/if}
{maxValue} {#if showBar && progressBarData.length > 0}
{maxUnit} <ProgressBar maxSize={progressMax} data={progressBarData} />
</p>
</div>
{#if showBar}
<div
class="progress-bar-container u-margin-block-start-16"
class:is-warning={progress >= 75 && progress < 100}
class:is-danger={progress >= 100}
style:--graph-size={Math.max(Math.min(progress, maximum), minimum) + '%'} />
{/if} {/if}
</section> </section>
@@ -0,0 +1,92 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip';
import type { ProgressbarData, ProgressbarProps } from '$lib/components';
type $$Props = ProgressbarProps;
/**
* The max value of the progressbar
*/
export let maxSize: $$Props['maxSize'];
/**
* The data for the progressbar
*/
export let data: $$Props['data'];
/**
* The remaining value of the progressbar
*/
$: remainder = data.reduce((sum: number, item: ProgressbarData) => sum - item.size, maxSize);
</script>
<section class="progressbar__container">
{#each $$props.data as item}
<div
class="progressbar__content"
style:background-color={item.color}
style:width={`${(item.size / maxSize) * 100}%`}
use:tooltip={{
disabled: !item.tooltip,
allowHTML: true,
content: `<span class="u-bold">${item.tooltip.title}</span> ${item.tooltip.label}`
}}>
</div>
{/each}
{#if remainder > 0}
<div class="progressbar__content" style:width={`${(remainder / maxSize) * 100}%`} />
{/if}
</section>
<style lang="scss">
:root {
--progressbar-border-radius: 0.25rem;
--progressbar-tooltip-label-color: #818186;
--progressbar-tooltip-link-color: #6c6c71;
}
:global(.theme-dark) {
--progressbar-background-color: var(--neutral-800, #2d2d31);
--progressbar-tooltip-background-color: var(--neutral-800, #2d2d31);
--progressbar-tooltip-border-color: var(--neutral-80, #424248);
}
:global(.theme-light) {
--progressbar-background-color: var(--neutral-40, #f4f4f7);
--progressbar-tooltip-background-color: #ffffff;
--progressbar-tooltip-border-color: #ededf0;
}
.progressbar {
&__container {
height: 0.5rem;
background-color: var(--progressbar-background-color);
border-radius: var(--progressbar-border-radius);
display: flex;
flex-direction: row;
gap: 2px;
}
&__content {
height: 100%;
min-width: 4px;
display: flex;
justify-content: center;
&::before {
content: '';
height: 2.5rem;
margin-top: -1.25rem;
width: 100%;
}
&:first-child {
border-top-left-radius: var(--progressbar-border-radius);
border-bottom-left-radius: var(--progressbar-border-radius);
}
&:last-child {
border-top-right-radius: var(--progressbar-border-radius);
border-bottom-right-radius: var(--progressbar-border-radius);
}
}
}
</style>
+17
View File
@@ -0,0 +1,17 @@
export type ProgressbarData = {
size: number;
color: string;
tooltip?: {
title: string;
label: string;
// linkTitle?: string;
// linkPath?: string;
};
};
export type ProgressbarProps = {
maxSize: number;
data: Array<ProgressbarData>;
};
export { default as ProgressBar } from './ProgressBar.svelte';
+15
View File
@@ -38,6 +38,21 @@
} }
}); });
/**
* Clears the input fields and moves the focus to the first input.
* Usually used when resetting fields on auth fails, etc.
*/
export function clearInputsAndRefocus() {
value = '';
autoSubmitted = false;
if (element) {
const inputs = element.querySelectorAll('input');
inputs.forEach((input) => (input.value = ''));
if (autofocus) inputs[0].focus();
}
}
onMount(() => { onMount(() => {
const interval = setInterval(() => { const interval = setInterval(() => {
const input = element.querySelector('input'); const input = element.querySelector('input');
-2
View File
@@ -1,6 +1,4 @@
<script> <script>
import { settings } from '$lib/components/consent.svelte';
import { clickOnEnter } from '$lib/helpers/a11y';
import { isCloud } from '$lib/system'; import { isCloud } from '$lib/system';
import { version } from '$routes/(console)/store'; import { version } from '$routes/(console)/store';
+3
View File
@@ -178,6 +178,9 @@ export type OrganizationUsage = {
bandwidth: Array<Models.Metric>; bandwidth: Array<Models.Metric>;
executions: Array<Models.Metric>; executions: Array<Models.Metric>;
executionsTotal: number; executionsTotal: number;
filesStorageTotal: number;
buildsStorageTotal: number;
deploymentsStorageTotal: number;
storageTotal: number; storageTotal: number;
users: Array<Models.Metric>; users: Array<Models.Metric>;
usersTotal: number; usersTotal: number;
+18
View File
@@ -138,6 +138,24 @@ campaigns
description: description:
'Get $50 in Cloud credits when you upgrade or create an organization with a Pro plan' 'Get $50 in Cloud credits when you upgrade or create an organization with a Pro plan'
}) })
.set('NetNinja', {
template: 'card',
title: 'Claim your $50 Net Ninja credits.',
description:
'Get $50 in Cloud credits when you upgrade or create an organization with a Pro plan'
})
.set('CodeWithAntonio', {
template: 'card',
title: 'Claim your $50 Code With Antonio credits.',
description:
'Get $50 in Cloud credits when you upgrade or create an organization with a Pro plan'
})
.set('Hacktoberfest2024', {
template: 'card',
title: 'Claim your $60 Hacktobefest credits.',
description:
'Get $60 in Cloud credits when you upgrade or create an organization with a Pro plan'
})
.set('VueJS', { .set('VueJS', {
template: 'card', template: 'card',
title: 'Claim your $50 VueJS credits.', title: 'Claim your $50 VueJS credits.',
@@ -44,7 +44,7 @@
}} /> }} />
</p> </p>
<p class="text u-margin-block-start-4"> <p class="text u-margin-block-start-4">
This could include unauthorized users and search engines. This could include unauthorized users and bots.
</p> </p>
</div> </div>
@@ -78,7 +78,7 @@
content: content:
'You are limited to 1 free organization per account' 'You are limited to 1 free organization per account'
}}> }}>
<Pill>FREE</Pill> <Pill class="eyebrow-heading-3">FREE</Pill>
</div> </div>
{/if} {/if}
{#if organization?.billingTrialStartDate && $daysLeftInTrial > 0 && organization.billingPlan !== BillingPlan.FREE && $plansInfo.get(organization.billingPlan)?.trialDays} {#if organization?.billingTrialStartDate && $daysLeftInTrial > 0 && organization.billingPlan !== BillingPlan.FREE && $plansInfo.get(organization.billingPlan)?.trialDays}
@@ -89,7 +89,7 @@
organization.billingStartDate organization.billingStartDate
)}. ${$daysLeftInTrial} days remaining.` )}. ${$daysLeftInTrial} days remaining.`
}}> }}>
<Pill>TRIAL</Pill> <Pill class="eyebrow-heading-3">TRIAL</Pill>
</div> </div>
{/if} {/if}
{/if} {/if}
@@ -108,7 +108,7 @@
{$organization.name} {$organization.name}
</span> </span>
{#if isCloud && $organization?.billingPlan === BillingPlan.FREE} {#if isCloud && $organization?.billingPlan === BillingPlan.FREE}
<Pill>FREE</Pill> <Pill class="eyebrow-heading-3">FREE</Pill>
{/if} {/if}
{#if isCloud && $organization?.billingTrialStartDate && $daysLeftInTrial > 0 && $organization.billingPlan !== BillingPlan.FREE && $plansInfo.get($organization.billingPlan)?.trialDays} {#if isCloud && $organization?.billingTrialStartDate && $daysLeftInTrial > 0 && $organization.billingPlan !== BillingPlan.FREE && $plansInfo.get($organization.billingPlan)?.trialDays}
<div <div
@@ -118,7 +118,7 @@
$organization.billingStartDate $organization.billingStartDate
)}. ${$daysLeftInTrial} days remaining.` )}. ${$daysLeftInTrial} days remaining.`
}}> }}>
<Pill>TRIAL</Pill> <Pill class="eyebrow-heading-3">TRIAL</Pill>
</div> </div>
{/if} {/if}
</span> </span>
@@ -282,6 +282,32 @@
{@const current = data.organizationUsage.storageTotal} {@const current = data.organizationUsage.storageTotal}
{@const currentHumanized = humanFileSize(current)} {@const currentHumanized = humanFileSize(current)}
{@const max = getServiceLimit('storage', tier)} {@const max = getServiceLimit('storage', tier)}
{@const progressBarStorageDate = [
{
size: bytesToSize(data.organizationUsage.filesStorageTotal, 'GB'),
color: '#85DBD8',
tooltip: {
title: 'File storage',
label: `${Math.round(bytesToSize(data.organizationUsage.filesStorageTotal, 'GB') * 100) / 100}GB`
}
},
{
size: bytesToSize(data.organizationUsage.deploymentsStorageTotal, 'GB'),
color: '#7C67FE',
tooltip: {
title: 'Deployments storage',
label: `${Math.round(bytesToSize(data.organizationUsage.deploymentsStorageTotal, 'GB') * 100) / 100}GB`
}
},
{
size: bytesToSize(data.organizationUsage.buildsStorageTotal, 'GB'),
color: '#FE9567',
tooltip: {
title: 'Builds storage',
label: `${Math.round(bytesToSize(data.organizationUsage.buildsStorageTotal, 'GB') * 100) / 100}GB`
}
}
]}
<ProgressBarBig <ProgressBarBig
currentUnit={currentHumanized.unit} currentUnit={currentHumanized.unit}
currentValue={currentHumanized.value} currentValue={currentHumanized.value}
@@ -289,7 +315,7 @@
maxValue={max.toString()} maxValue={max.toString()}
progressValue={bytesToSize(current, 'GB')} progressValue={bytesToSize(current, 'GB')}
progressMax={max} progressMax={max}
minimum={1} /> progressBarData={progressBarStorageDate} />
{#if project?.length > 0} {#if project?.length > 0}
<ProjectBreakdown projects={project} metric="storage" {data} /> <ProjectBreakdown projects={project} metric="storage" {data} />
{/if} {/if}
@@ -19,6 +19,9 @@ export const load: PageLoad = async ({ params, parent }) => {
users: null, users: null,
usersTotal: null, usersTotal: null,
storageTotal: null, storageTotal: null,
filesStorageTotal: null,
buildsStorageTotal: null,
deploymentsStorageTotal: null,
executions: null, executions: null,
executionsTotal: null, executionsTotal: null,
projects: null projects: null
@@ -159,7 +159,7 @@
showEdit = true; showEdit = true;
showDropdown[index] = false; showDropdown[index] = false;
}}> }}>
Edit Update
</DropListItem> </DropListItem>
{#if !isRelationship(attribute)} {#if !isRelationship(attribute)}
<DropListItem <DropListItem
@@ -26,7 +26,7 @@
await sdk.forProject.databases.updateBooleanAttribute( await sdk.forProject.databases.updateBooleanAttribute(
databaseId, databaseId,
collectionId, collectionId,
data.key, originalKey,
data.required, data.required,
data.default, data.default,
data.key !== originalKey ? data.key : undefined data.key !== originalKey ? data.key : undefined
@@ -27,7 +27,7 @@
await sdk.forProject.databases.updateDatetimeAttribute( await sdk.forProject.databases.updateDatetimeAttribute(
databaseId, databaseId,
collectionId, collectionId,
data.key, originalKey,
data.required, data.required,
data.default, data.default,
data.key !== originalKey ? data.key : undefined data.key !== originalKey ? data.key : undefined
@@ -52,12 +52,16 @@
} }
} }
$: if (showEdit) { $: onShow(showEdit);
currentAttr ??= { ...selectedAttribute };
originalKey = currentAttr.key; function onShow(show: boolean) {
error = null; if (show) {
} else { currentAttr ??= { ...selectedAttribute };
currentAttr = null; originalKey = currentAttr.key;
error = null;
} else {
currentAttr = null;
}
} }
</script> </script>
@@ -28,7 +28,7 @@
await sdk.forProject.databases.updateEmailAttribute( await sdk.forProject.databases.updateEmailAttribute(
databaseId, databaseId,
collectionId, collectionId,
data.key, originalKey,
data.required, data.required,
data.default, data.default,
data.key !== originalKey ? data.key : undefined data.key !== originalKey ? data.key : undefined
@@ -28,7 +28,7 @@
await sdk.forProject.databases.updateEnumAttribute( await sdk.forProject.databases.updateEnumAttribute(
databaseId, databaseId,
collectionId, collectionId,
data.key, originalKey,
data.elements, data.elements,
data.required, data.required,
data.default, data.default,
@@ -29,7 +29,7 @@
await sdk.forProject.databases.updateFloatAttribute( await sdk.forProject.databases.updateFloatAttribute(
databaseId, databaseId,
collectionId, collectionId,
data.key, originalKey,
data.required, data.required,
data.min, data.min,
data.max, data.max,
@@ -29,7 +29,7 @@
await sdk.forProject.databases.updateIntegerAttribute( await sdk.forProject.databases.updateIntegerAttribute(
databaseId, databaseId,
collectionId, collectionId,
data.key, originalKey,
data.required, data.required,
data.min, data.min,
data.max, data.max,
@@ -26,7 +26,7 @@
await sdk.forProject.databases.updateIpAttribute( await sdk.forProject.databases.updateIpAttribute(
databaseId, databaseId,
collectionId, collectionId,
data.key, originalKey,
data.required, data.required,
data.default, data.default,
data.key !== originalKey ? data.key : undefined data.key !== originalKey ? data.key : undefined
@@ -27,7 +27,7 @@
await sdk.forProject.databases.updateUrlAttribute( await sdk.forProject.databases.updateUrlAttribute(
databaseId, databaseId,
collectionId, collectionId,
data.key, originalKey,
data.required, data.required,
data.default, data.default,
data.key !== originalKey ? data.key : undefined data.key !== originalKey ? data.key : undefined
@@ -11,6 +11,7 @@
export let show = false; export let show = false;
export let selectedDeployment: Models.Deployment = null; export let selectedDeployment: Models.Deployment = null;
let error: string;
async function redeploy() { async function redeploy() {
try { try {
@@ -28,17 +29,21 @@
invalidate(Dependencies.FUNCTION); invalidate(Dependencies.FUNCTION);
invalidate(Dependencies.DEPLOYMENTS); invalidate(Dependencies.DEPLOYMENTS);
show = false; show = false;
} catch (error) { } catch (e) {
addNotification({ error = e.message;
type: 'error',
message: error.message trackError(e, Submit.FunctionRedeploy);
});
trackError(error, Submit.FunctionRedeploy);
} }
} }
</script> </script>
<Modal title="Redeploy function" size="big" bind:show onSubmit={redeploy} headerDivider={false}> <Modal
title="Redeploy function"
size="big"
bind:show
bind:error
onSubmit={redeploy}
headerDivider={false}>
<p class="text"> <p class="text">
Are you sure you want to redeploy <b>{$func.name}</b>? Redeploying may affect your Are you sure you want to redeploy <b>{$func.name}</b>? Redeploying may affect your
production code. production code.
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Container } from '$lib/layout'; import { Container } from '$lib/layout';
import { CardGrid, Heading, Card } from '$lib/components'; import { CardGrid, Heading, Card, ProgressBarBig } from '$lib/components';
import { import {
TableBody, TableBody,
TableCell, TableCell,
@@ -13,7 +13,7 @@
import { showUsageRatesModal, tierToPlan, upgradeURL } from '$lib/stores/billing'; import { showUsageRatesModal, tierToPlan, upgradeURL } from '$lib/stores/billing';
import { organization } from '$lib/stores/organization'; import { organization } from '$lib/stores/organization';
import { Button } from '$lib/elements/forms'; import { Button } from '$lib/elements/forms';
import { humanFileSize } from '$lib/helpers/sizeConvertion'; import { bytesToSize, humanFileSize } from '$lib/helpers/sizeConvertion';
import { BarChart } from '$lib/charts'; import { BarChart } from '$lib/charts';
import { formatNum } from '$lib/helpers/string'; import { formatNum } from '$lib/helpers/string';
import { total } from '$lib/layout/usage.svelte'; import { total } from '$lib/layout/usage.svelte';
@@ -28,7 +28,10 @@
$: usersTotal = data.usage.usersTotal; $: usersTotal = data.usage.usersTotal;
$: executions = data.usage.executions; $: executions = data.usage.executions;
$: executionsTotal = data.usage.executionsTotal; $: executionsTotal = data.usage.executionsTotal;
$: storage = data.usage.filesStorageTotal; $: storage =
data.usage.filesStorageTotal +
data.usage.deploymentsStorageTotal +
data.usage.buildsStorageTotal;
const tier = data?.currentInvoice?.plan ?? $organization?.billingPlan; const tier = data?.currentInvoice?.plan ?? $organization?.billingPlan;
const plan = tierToPlan(tier).name; const plan = tierToPlan(tier).name;
@@ -271,6 +274,32 @@
<svelte:fragment slot="aside"> <svelte:fragment slot="aside">
{#if storage} {#if storage}
{@const humanized = humanFileSize(storage)} {@const humanized = humanFileSize(storage)}
{@const progressBarStorageDate = [
{
size: bytesToSize(data.usage.filesStorageTotal, 'MB'),
color: '#85DBD8',
tooltip: {
title: 'File storage',
label: `${Math.round(bytesToSize(data.usage.filesStorageTotal, 'MB') * 100) / 100}MB`
}
},
{
size: bytesToSize(data.usage.deploymentsStorageTotal, 'MB'),
color: '#7C67FE',
tooltip: {
title: 'Deployments storage',
label: `${Math.round(bytesToSize(data.usage.deploymentsStorageTotal, 'MB') * 100) / 100}MB`
}
},
{
size: bytesToSize(data.usage.buildsStorageTotal, 'MB'),
color: '#FE9567',
tooltip: {
title: 'Builds storage',
label: `${Math.round(bytesToSize(data.usage.buildsStorageTotal, 'MB') * 100) / 100}MB`
}
}
]}
<div class="u-flex u-flex-vertical"> <div class="u-flex u-flex-vertical">
<div class="u-flex u-main-space-between"> <div class="u-flex u-main-space-between">
<p> <p>
@@ -279,33 +308,10 @@
</p> </p>
</div> </div>
</div> </div>
{#if data.usage.bucketsBreakdown.length > 0} <ProgressBarBig
<Table noMargin noStyles> progressValue={bytesToSize(storage, 'MB')}
<TableHeader> progressMax={bytesToSize(storage, 'MB')}
<TableCellHead width={285}>Bucket</TableCellHead> progressBarData={progressBarStorageDate} />
<TableCellHead>Usage</TableCellHead>
<TableCellHead width={140} />
</TableHeader>
<TableBody>
{#each data.usage.bucketsBreakdown.sort((a, b) => b.value - a.value) as bucket}
{@const humanized = humanFileSize(bucket.value)}
<TableRow>
<TableCell title="Function">
{bucket.name ?? bucket.resourceId}
</TableCell>
<TableCell title="Usage">
{humanized.value}{humanized.unit}
</TableCell>
<TableCellLink
href={`${baseRoute}/storage/bucket-${bucket.resourceId}`}
title="View bucket">
View bucket
</TableCellLink>
</TableRow>
{/each}
</TableBody>
</Table>
{/if}
{:else} {:else}
<Card isDashed> <Card isDashed>
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex"> <div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { CardGrid, BoxAvatar, Heading, Alert, Id } from '$lib/components'; import { CardGrid, BoxAvatar, Heading, Alert, CopyInput } from '$lib/components';
import { Container } from '$lib/layout'; import { Container } from '$lib/layout';
import { Button } from '$lib/elements/forms'; import { Button } from '$lib/elements/forms';
import { file } from './store'; import { file } from './store';
@@ -92,18 +92,22 @@
</div> </div>
</div> </div>
</a> </a>
<div class="u-flex u-flex-vertical u-gap-16"> <div class="u-flex u-flex-vertical u-gap-4">
<Heading tag="h2" size="7">{$file.name}</Heading> <Heading tag="h2" size="7" trimmed={false} trimmedSecondLine={true}
<Id value={getView($file.$id)}>File URL</Id> >{$file.name}</Heading>
<p>{$file.mimeType}</p>
</div> </div>
</div> </div>
<svelte:fragment slot="aside"> <svelte:fragment slot="aside">
<div> <div>
<p>MIME Type: {$file.mimeType}</p> <p><span class="u-bold">Size:</span> {calculateSize($file.sizeOriginal)}</p>
<p>Size: {calculateSize($file.sizeOriginal)}</p> <p><span class="u-bold">Created:</span> {toLocaleDate($file.$createdAt)}</p>
<p>Created: {toLocaleDate($file.$createdAt)}</p> <p>
<p>Last updated: {toLocaleDate($file.$updatedAt)}</p> <span class="u-bold">Last updated:</span>
{toLocaleDate($file.$updatedAt)}
</p>
</div> </div>
<CopyInput label="File URL" showLabel={true} value={getView($file.$id)} />
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="actions"> <svelte:fragment slot="actions">
@@ -51,17 +51,6 @@
await goto(`${base}/apply-credit?campaign=${data.campaign}`); await goto(`${base}/apply-credit?campaign=${data.campaign}`);
return; return;
} }
if ($page.url.searchParams) {
const redirect = $page.url.searchParams.get('redirect');
$page.url.searchParams.delete('redirect');
if (redirect) {
await goto(`${redirect}${$page.url.search}`);
} else {
await goto(`${base}${$page.url.search ?? ''}`);
}
} else {
await goto(base);
}
} catch (error) { } catch (error) {
disabled = false; disabled = false;
addNotification({ addNotification({
Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

+9 -1
View File
@@ -4,10 +4,18 @@ import { preprocessMeltUI, sequence } from '@melt-ui/pp';
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
const config = { const config = {
preprocess: sequence([sveltePreprocess(), preprocessMeltUI()]), preprocess: sequence([
sveltePreprocess({
scss: {
silenceDeprecations: ['legacy-js-api']
}
}),
preprocessMeltUI()
]),
compilerOptions: { compilerOptions: {
accessors: !!process.env.VITEST accessors: !!process.env.VITEST
}, },
kit: { kit: {
alias: { alias: {
$routes: './src/routes' $routes: './src/routes'