File tree 4 files changed +34
-9
lines changed
src/routes/(console)/project-[project]
functions/function-[function]/settings
sites/site-[site]/settings
4 files changed +34
-9
lines changed Original file line number Diff line number Diff line change 27
27
</svelte:fragment >
28
28
</CardGrid >
29
29
30
- <Delete bind:showDelete />
30
+ <Delete projectFunction ={ $func } bind:showDelete />
Original file line number Diff line number Diff line change 6
6
import Confirm from ' $lib/components/confirm.svelte' ;
7
7
import { addNotification } from ' $lib/stores/notifications' ;
8
8
import { sdk } from ' $lib/stores/sdk' ;
9
+ import { type Models } from ' @appwrite.io/console' ;
10
+ import { FormList , InputCheckbox } from ' $lib/elements/forms' ;
9
11
10
12
export let showDelete = false ;
11
- const functionId = $page .params .function ;
13
+ export let projectFunction: Models .Function ;
14
+
12
15
let error: string ;
16
+ let confirmedDeletion = false ;
17
+
13
18
const handleSubmit = async () => {
14
19
try {
15
- await sdk .forProject .functions .delete (functionId );
20
+ await sdk .forProject .functions .delete (projectFunction . $id );
16
21
showDelete = false ;
17
22
addNotification ({
18
23
type: ' success' ,
27
32
};
28
33
</script >
29
34
30
- <Confirm onSubmit ={handleSubmit } title ="Delete function" bind:open ={showDelete } bind:error >
31
- Are you sure you want to delete this function and all associated deployments from your project?
35
+ <Confirm
36
+ onSubmit ={handleSubmit }
37
+ disabled ={! confirmedDeletion }
38
+ title =" Delete function"
39
+ bind:open ={showDelete }
40
+ bind:error >
41
+ <FormList >
42
+ <p data-private >Are you sure you want to delete <strong >{projectFunction .name }</strong >?</p >
43
+
44
+ <p data-private >
45
+ The function and all associated deployments will be permanently deleted. This action is
46
+ irreversible.
47
+ </p >
48
+
49
+ <InputCheckbox
50
+ size =" s"
51
+ required
52
+ id =" delete_function"
53
+ bind:checked ={confirmedDeletion }
54
+ label =" I understand and confirm" />
55
+ </FormList >
32
56
</Confirm >
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import { BoxAvatar , CardGrid } from ' $lib/components' ;
3
- import Heading from ' $lib/components/heading.svelte' ;
4
3
import { Button } from ' $lib/elements/forms' ;
5
4
import { toLocaleDateTime } from ' $lib/helpers/date' ;
6
5
import type { Models } from ' @appwrite.io/console' ;
28
27
</svelte:fragment >
29
28
</CardGrid >
30
29
31
- <Delete bind:showDelete />
30
+ <Delete { site } bind:showDelete />
Original file line number Diff line number Diff line change 6
6
import Confirm from ' $lib/components/confirm.svelte' ;
7
7
import { addNotification } from ' $lib/stores/notifications' ;
8
8
import { sdk } from ' $lib/stores/sdk' ;
9
+ import { type Models } from ' @appwrite.io/console' ;
9
10
11
+ export let site: Models .Site ;
10
12
export let showDelete = false ;
11
- const siteId = $page . params . site ;
13
+
12
14
let error: string ;
13
15
const handleSubmit = async () => {
14
16
try {
15
- await sdk .forProject .sites .delete (siteId );
17
+ await sdk .forProject .sites .delete (site . $id );
16
18
showDelete = false ;
17
19
addNotification ({
18
20
type: ' success' ,
You can’t perform that action at this time.
0 commit comments