|
1 | 1 | <script lang="ts"> |
2 | | - import { base } from '$app/paths'; |
3 | 2 | import { SvgIcon } from '$lib/components'; |
4 | 3 | import { page } from '$app/state'; |
5 | 4 | import { Click, trackEvent } from '$lib/actions/analytics'; |
6 | 5 | import type { Models } from '@appwrite.io/console'; |
7 | 6 | import { isSelfHosted } from '$lib/system'; |
8 | | - import { afterNavigate, goto } from '$app/navigation'; |
| 7 | + import { goto } from '$app/navigation'; |
| 8 | + import { resolveRoute } from '$lib/stores/navigation'; |
9 | 9 | import { installation, repository } from '$lib/stores/vcs'; |
10 | 10 | import { Repositories } from '$lib/components/git'; |
11 | 11 | import { |
|
26 | 26 | export let data; |
27 | 27 |
|
28 | 28 | const isVcsEnabled = $regionalConsoleVariables?._APP_VCS_ENABLED === true; |
29 | | - const wizardBase = `${base}/project-${page.params.region}-${page.params.project}/functions`; |
30 | | - let previousPage: string = wizardBase; |
31 | | - afterNavigate(({ from }) => { |
32 | | - previousPage = from?.url?.pathname || previousPage; |
33 | | - }); |
| 29 | + const wizardBase = resolveRoute('/(console)/project-[region]-[project]/functions', page.params); |
34 | 30 |
|
35 | 31 | let selectedRepository: string; |
36 | 32 |
|
|
56 | 52 | function connect(e: Models.ProviderRepository) { |
57 | 53 | trackEvent(Click.ConnectRepositoryClick, { from: 'cover' }); |
58 | 54 | repository.set(e); |
59 | | - goto(`${wizardBase}/create-function/repository-${e.id}?installation=${$installation.$id}`); |
| 55 | + goto( |
| 56 | + resolveRoute( |
| 57 | + '/(console)/project-[region]-[project]/functions/create-function/repository-[repository]', |
| 58 | + { |
| 59 | + ...page.params, |
| 60 | + repository: e.id |
| 61 | + } |
| 62 | + ) + `?installation=${$installation.$id}` |
| 63 | + ); |
60 | 64 | } |
61 | 65 | </script> |
62 | 66 |
|
63 | | -<Wizard title="Create function" href={previousPage} column columnSize="l" hideFooter> |
| 67 | +<Wizard title="Create function" href={wizardBase} column columnSize="l" hideFooter> |
64 | 68 | <Layout.Stack gap="l"> |
65 | 69 | <Layout.GridFraction start={4} end={6} gap="l" rowSize="auto"> |
66 | 70 | <Card.Base> |
|
105 | 109 | }} |
106 | 110 | {connect} /> |
107 | 111 | </Layout.Stack> |
108 | | - {#if data.installations.total} |
| 112 | + {#if $installation} |
109 | 113 | <Layout.Stack gap="l"> |
110 | 114 | <Divider /> |
111 | | - <Link variant="quiet" href="#/"> |
| 115 | + <Link |
| 116 | + variant="quiet" |
| 117 | + external |
| 118 | + href={`https://github.com/settings/installations/${$installation.providerInstallationId}`}> |
112 | 119 | <Layout.Stack direction="row" gap="xs"> |
113 | 120 | Missing a repository? check your permissions <Icon |
114 | 121 | icon={IconArrowSmRight} /> |
|
140 | 147 | runtime: template.name |
141 | 148 | }); |
142 | 149 | }} |
143 | | - href={`${wizardBase}/create-function/template-${starterTemplate.id}?runtime=${runtimeDetail.$id}`}> |
| 150 | + href={resolveRoute( |
| 151 | + '/(console)/project-[region]-[project]/functions/create-function/template-[template]', |
| 152 | + { |
| 153 | + ...page.params, |
| 154 | + template: starterTemplate.id |
| 155 | + } |
| 156 | + ) + `?runtime=${runtimeDetail.$id}`}> |
144 | 157 | <Layout.Stack direction="row" gap="s" alignItems="center"> |
145 | 158 | <Avatar size="xs" alt={template.name} empty={!template.name}> |
146 | 159 | <SvgIcon name={iconName} iconSize="small" /> |
|
168 | 181 | <Card.Link |
169 | 182 | radius="s" |
170 | 183 | padding="xs" |
171 | | - href={`${wizardBase}/create-function/template-${template.id}`} |
| 184 | + href={resolveRoute( |
| 185 | + '/(console)/project-[region]-[project]/functions/create-function/template-[template]', |
| 186 | + { |
| 187 | + ...page.params, |
| 188 | + template: template.id |
| 189 | + } |
| 190 | + )} |
172 | 191 | on:click={() => { |
173 | 192 | trackEvent('click_connect_template', { |
174 | 193 | from: 'cover', |
|
198 | 217 | {/each} |
199 | 218 | </Layout.Grid> |
200 | 219 |
|
201 | | - <Link variant="quiet" href={`${wizardBase}/templates`}> |
| 220 | + <Link |
| 221 | + variant="quiet" |
| 222 | + href={resolveRoute( |
| 223 | + '/(console)/project-[region]-[project]/functions/templates', |
| 224 | + page.params |
| 225 | + )}> |
202 | 226 | <Layout.Stack direction="row" gap="xs"> |
203 | 227 | Browse all templates <Icon icon={IconArrowSmRight} /> |
204 | 228 | </Layout.Stack> |
|
212 | 236 | on:click={() => { |
213 | 237 | trackEvent('click_create_function_manual', { from: 'cover' }); |
214 | 238 | }} |
215 | | - href={`${wizardBase}/create-function/manual`}>manually</Link> |
| 239 | + href={resolveRoute( |
| 240 | + '/(console)/project-[region]-[project]/functions/create-function/manual', |
| 241 | + page.params |
| 242 | + )}>manually</Link> |
216 | 243 | or using the CLI. |
217 | 244 | <Link href="https://appwrite.io/docs/products/functions/deployment" external |
218 | 245 | >Learn more</Link |
|
0 commit comments