mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge remote-tracking branch 'origin/feat-database-backups' into feat-database-backups
This commit is contained in:
commit
7b01656200
6 files changed
+360
-10810
No files matched your search
Generated
-10486
File diff suppressed because it is too large.
Load diff
+6
-6
@@ -23,7 +23,7 @@
|
||||
"@appwrite.io/pink": "0.25.0",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@sentry/sveltekit": "^8.31.0",
|
||||
"@sentry/sveltekit": "^8.32.0",
|
||||
"@stripe/stripe-js": "^3.5.0",
|
||||
"ai": "^2.2.37",
|
||||
"analytics": "^0.8.14",
|
||||
@@ -44,7 +44,7 @@
|
||||
"@melt-ui/svelte": "^0.83.0",
|
||||
"@playwright/test": "^1.47.2",
|
||||
"@sveltejs/adapter-static": "^3.0.5",
|
||||
"@sveltejs/kit": "^2.5.28",
|
||||
"@sveltejs/kit": "^2.6.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/jest-dom": "^6.5.0",
|
||||
@@ -57,20 +57,20 @@
|
||||
"@vitest/ui": "^1.6.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-svelte": "^2.44.0",
|
||||
"eslint-plugin-svelte": "^2.44.1",
|
||||
"jsdom": "^22.1.0",
|
||||
"kleur": "^4.1.5",
|
||||
"prettier": "^3.3.3",
|
||||
"prettier-plugin-svelte": "^3.2.6",
|
||||
"prettier-plugin-svelte": "^3.2.7",
|
||||
"sass": "^1.79.3",
|
||||
"svelte": "^4.2.19",
|
||||
"svelte-check": "^3.8.6",
|
||||
"svelte-jester": "^2.3.2",
|
||||
"svelte-preprocess": "^6.0.2",
|
||||
"svelte-preprocess": "^6.0.3",
|
||||
"svelte-sequential-preprocessor": "^2.0.1",
|
||||
"tslib": "^2.7.0",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.4.7",
|
||||
"vite": "^5.4.8",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"type": "module",
|
||||
|
||||
Generated
+314
-303
File diff suppressed because it is too large.
Load diff
@@ -15,6 +15,7 @@
|
||||
import { showCreate } from './store';
|
||||
import { CollectionsPanel } from '$lib/commandCenter/panels';
|
||||
import { canWriteCollections, canWriteDatabases } from '$lib/stores/roles';
|
||||
import { showCreatePolicy } from './backups/store';
|
||||
|
||||
const project = $page.params.project;
|
||||
const databaseId = $page.params.database;
|
||||
@@ -41,6 +42,32 @@
|
||||
group: 'databases',
|
||||
icon: 'plus'
|
||||
},
|
||||
{
|
||||
label: 'Create backup policy',
|
||||
callback: async () => {
|
||||
if (!$page.url.pathname.endsWith('backups')) {
|
||||
goto(`${base}/project-${project}/databases/database-${databaseId}/backups`);
|
||||
}
|
||||
showCreatePolicy.set(true);
|
||||
},
|
||||
keys: $page.url.pathname.endsWith('backups') ? ['c'] : ['c', 'p'],
|
||||
group: 'databases',
|
||||
icon: 'plus',
|
||||
rank: $page.url.pathname.endsWith('backups') ? 10 : 0
|
||||
},
|
||||
{
|
||||
label: 'Create manual backup',
|
||||
callback: async () => {
|
||||
if (!$page.url.pathname.endsWith('backups')) {
|
||||
goto(`${base}/project-${project}/databases/database-${databaseId}/backups`);
|
||||
}
|
||||
showCreatePolicy.set(true);
|
||||
},
|
||||
keys: $page.url.pathname.endsWith('backups') ? ['c'] : ['c', 'b'],
|
||||
group: 'databases',
|
||||
icon: 'plus',
|
||||
rank: $page.url.pathname.endsWith('backups') ? 10 : 0
|
||||
},
|
||||
{
|
||||
label: 'Go to collections',
|
||||
callback() {
|
||||
|
||||
+11
-15
@@ -23,10 +23,9 @@
|
||||
import { feedback } from '$lib/stores/feedback';
|
||||
import { cronExpression, type UserBackupPolicy } from '$lib/helpers/backups';
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import { showCreateBackup, showCreatePolicy } from './store';
|
||||
|
||||
let showCreatePolicy = false;
|
||||
let policyCreateError: string;
|
||||
let showCreateManualBackup = false;
|
||||
let totalPolicies: UserBackupPolicy[] = [];
|
||||
let isDisabled = isSelfHosted || (isCloud && $organization?.billingPlan === BillingPlan.FREE);
|
||||
|
||||
@@ -80,7 +79,7 @@
|
||||
message: error.message
|
||||
});
|
||||
} finally {
|
||||
showCreateManualBackup = false;
|
||||
$showCreateBackup = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -120,7 +119,7 @@
|
||||
});
|
||||
} finally {
|
||||
totalPolicies = [];
|
||||
showCreatePolicy = false;
|
||||
$showCreatePolicy = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -143,10 +142,10 @@
|
||||
buttonEvent="create_backup"
|
||||
buttonType="secondary"
|
||||
buttonDisabled={isDisabled}
|
||||
buttonMethod={() => (showCreatePolicy = true)} />
|
||||
buttonMethod={() => ($showCreatePolicy = true)} />
|
||||
|
||||
<BackupPolicy
|
||||
bind:showCreatePolicy
|
||||
bind:showCreatePolicy={$showCreatePolicy}
|
||||
policies={data.policies}
|
||||
lastBackupDates={data.lastBackupDates} />
|
||||
</div>
|
||||
@@ -158,7 +157,7 @@
|
||||
buttonEvent="create_backup"
|
||||
buttonType="secondary"
|
||||
buttonDisabled={isDisabled}
|
||||
buttonMethod={() => (showCreateManualBackup = true)} />
|
||||
buttonMethod={() => ($showCreateBackup = true)} />
|
||||
|
||||
{#if data.backups.total}
|
||||
<div class="u-padding-block-start-8">
|
||||
@@ -211,20 +210,17 @@
|
||||
title="Create backup policy"
|
||||
size="big"
|
||||
onSubmit={createPolicies}
|
||||
bind:show={showCreatePolicy}
|
||||
bind:show={$showCreatePolicy}
|
||||
bind:error={policyCreateError}>
|
||||
<CreatePolicy bind:totalPolicies isShowing={showCreatePolicy} />
|
||||
<CreatePolicy bind:totalPolicies isShowing={$showCreatePolicy} />
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button secondary on:click={() => (showCreatePolicy = false)}>Cancel</Button>
|
||||
<Button secondary on:click={() => ($showCreatePolicy = false)}>Cancel</Button>
|
||||
<Button submit disabled={!totalPolicies.length}>Create</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title="Create manual backup"
|
||||
bind:show={showCreateManualBackup}
|
||||
onSubmit={createManualBackup}>
|
||||
<Modal title="Create manual backup" bind:show={$showCreateBackup} onSubmit={createManualBackup}>
|
||||
<p class="text" data-private>
|
||||
Manual backups are <b>retained forever</b> unless manually deleted. Use them when making significant
|
||||
changes to your data structure or as a safeguard for future rollbacks.
|
||||
@@ -235,7 +231,7 @@
|
||||
</svelte:fragment>
|
||||
</Alert>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (showCreateManualBackup = false)}>Cancel</Button>
|
||||
<Button text on:click={() => ($showCreateBackup = false)}>Cancel</Button>
|
||||
<Button submit>Create</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
|
||||
@@ -2,6 +2,8 @@ import { writable } from 'svelte/store';
|
||||
import type { UserBackupPolicy } from '$lib/helpers/backups';
|
||||
|
||||
export const policyPricing = 20;
|
||||
export const showCreatePolicy = writable(false);
|
||||
export const showCreateBackup = writable(false);
|
||||
|
||||
export const presetPolicies = writable<UserBackupPolicy[]>([
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user