File tree Expand file tree Collapse file tree 4 files changed +14
-12
lines changed
onboarding/create-project
organization-[organization] Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 28
28
label: region .name ,
29
29
value: region .$id ,
30
30
leadingHtml: ` <img src='${getFlagUrl (region .flag )}' alt='Region flag'/> ` ,
31
- disabled: region .disabled
31
+ disabled: region .disabled || ! region . available
32
32
};
33
33
});
34
34
}
39
39
<link rel ="preload" as ="image" href ={getFlagUrl (region .flag )} />
40
40
{/each }
41
41
</svelte:head >
42
+
42
43
<form on:submit |preventDefault >
43
44
<Layout .Stack direction =" column" gap =" xxl" >
44
45
{#if showTitle }
Original file line number Diff line number Diff line change 10
10
import { base } from ' $app/paths' ;
11
11
import { addNotification } from ' $lib/stores/notifications' ;
12
12
import CreateProject from ' $lib/layout/createProject.svelte' ;
13
+ import { loadAvailableRegions } from ' $routes/(console)/regions' ;
14
+ import { regions as regionsStore } from ' $lib/stores/organization' ;
13
15
14
16
let isLoading = false ;
15
17
let id: string ;
49
51
});
50
52
}
51
53
}
54
+
55
+ // safe side!
56
+ loadAvailableRegions (data .organization .$id );
52
57
</script >
53
58
54
59
<svelte:head >
74
79
alt =" Appwrite Logo" />
75
80
<Card .Base variant =" primary" padding =" l" >
76
81
<CreateProject
77
- regions ={isCloud ? data .regions . regions : [] }
82
+ regions ={$regionsStore .regions }
78
83
bind:projectName
79
84
bind:id
80
85
bind:region
Original file line number Diff line number Diff line change @@ -8,8 +8,10 @@ import { BillingPlan } from '$lib/constants';
8
8
import { redirect } from '@sveltejs/kit' ;
9
9
import { base } from '$app/paths' ;
10
10
11
+ // TODO: this needs to be cleaned up!
11
12
export const load : PageLoad = async ( { parent } ) => {
12
13
const { organizations } = await parent ( ) ;
14
+
13
15
try {
14
16
if ( ! organizations ?. total ) {
15
17
try {
@@ -29,8 +31,7 @@ export const load: PageLoad = async ({ parent }) => {
29
31
30
32
if ( isOrganization ( org ) ) {
31
33
return {
32
- organization : org ,
33
- regions : await sdk . forConsole . billing . listRegions ( org . $id )
34
+ organization : org
34
35
} ;
35
36
} else {
36
37
const e = new Error ( org . message , {
@@ -43,8 +44,7 @@ export const load: PageLoad = async ({ parent }) => {
43
44
organization : await sdk . forConsole . teams . create (
44
45
ID . unique ( ) ,
45
46
'Personal projects'
46
- ) ,
47
- regions : null
47
+ )
48
48
} ;
49
49
}
50
50
} catch ( e ) {
@@ -57,10 +57,8 @@ export const load: PageLoad = async ({ parent }) => {
57
57
Query . limit ( 1 )
58
58
] ) ;
59
59
if ( ! projects . total ) {
60
- const regions = isCloud ? await sdk . forConsole . billing . listRegions ( org . $id ) : null ;
61
60
return {
62
- organization : org ,
63
- regions
61
+ organization : org
64
62
} ;
65
63
} else {
66
64
redirect ( 303 , `${ base } /console/organization-${ org . $id } ` ) ;
Original file line number Diff line number Diff line change 120
120
});
121
121
122
122
function findRegion(project : Models .Project ) {
123
- return $regionsStore ?.regions ?.find (
124
- (region ) => region .$id === (project as Models .Project & { region: string }).region
125
- );
123
+ return $regionsStore ?.regions ?.find ((region ) => region .$id === project .region );
126
124
}
127
125
</script >
128
126
You can’t perform that action at this time.
0 commit comments