small fixes to sites

This commit is contained in:
Arman
2025-02-17 14:22:19 +01:00
parent 9591bfc53a
commit ddc4eb5bb4
5 changed files with 39 additions and 65 deletions
@@ -9,6 +9,7 @@
import type { Models } from '@appwrite.io/console';
import { base } from '$app/paths';
import { canWriteSites } from '$lib/stores/roles';
import { IconList, IconPlus, IconSearch } from '@appwrite.io/pink-icons-svelte';
onMount(() => {
let previousStatus = null;
@@ -45,8 +46,8 @@
}
},
keys: $page.url.pathname.endsWith($page.params.site) ? ['c'] : ['c', 'd'],
group: 'functions',
icon: 'plus',
group: 'sites',
icon: IconPlus,
disabled: !$canWriteSites
},
{
@@ -57,22 +58,11 @@
);
scrollBy({ top: -100 });
},
icon: 'search',
group: 'functions',
disabled: !$canWriteSites
},
{
label: 'Events',
async callback() {
await goto(
`${base}/project-${$project.$id}/sites/site-${$page.params.site}/settings#events`
);
scrollBy({ top: -100 });
},
icon: 'calendar',
group: 'functions',
icon: IconSearch,
group: 'sites',
disabled: !$canWriteSites
},
{
label: 'Variables',
async callback() {
@@ -80,42 +70,19 @@
`${base}/project-${$project.$id}/sites/site-${$page.params.site}/settings#variables`
);
},
icon: 'list',
group: 'functions',
disabled: !$canWriteSites
},
{
label: 'Timeout',
callback() {
goto(
`${base}/project-${$project.$id}/sites/site-${$page.params.site}/settings#timeout`
);
},
icon: 'x-circle',
group: 'functions',
disabled: !$canWriteSites
},
{
label: 'Schedule',
async callback() {
await goto(
`${base}/project-${$project.$id}/sites/site-${$page.params.site}/settings#schedule`
);
scrollBy({ top: -100 });
},
icon: 'clock',
group: 'functions',
icon: IconList,
group: 'sites',
disabled: !$canWriteSites
},
{
label: 'Go to deployments',
callback() {
goto(`${base}/project-${$project.$id}/sites/site-${$page.params.site}`);
goto(`${base}/project-${$project.$id}/sites/site-${$page.params.site}/deployments`);
},
keys: ['g', 'd'],
group: 'navigation',
rank: 10,
disabled: $page.url.pathname.endsWith($page.params.site)
disabled: $page.url.pathname.endsWith('deployments')
},
{
label: 'Go to usage',
@@ -128,14 +95,14 @@
disabled: $page.url.pathname.endsWith('usage')
},
{
label: 'Go to executions',
label: 'Go to logs',
callback() {
goto(`${base}/project-${$project.$id}/sites/site-${$page.params.site}/executions`);
goto(`${base}/project-${$project.$id}/sites/site-${$page.params.site}/logs`);
},
keys: ['g', 'e'],
group: 'navigation',
rank: 10,
disabled: $page.url.pathname.endsWith('executions')
disabled: $page.url.pathname.endsWith('logs')
},
{
label: 'Go to settings',
@@ -21,6 +21,7 @@
let hasRepository = !!site?.providerRepositoryId;
let selectedRepository: string = null;
let branch: string = null;
let error = '';
onMount(async () => {
installations = await sdk.forProject.vcs.listInstallations();
@@ -79,16 +80,13 @@
message: 'Deployment has been created successfully',
type: 'success'
});
} catch (error) {
addNotification({
message: error.message,
type: 'error'
});
} catch (e) {
error = e.message;
}
}
</script>
<Modal title="Create Git deployment" bind:show onSubmit={createDeployment}>
<Modal title="Create Git deployment" bind:show onSubmit={createDeployment} bind:error>
<span slot="description">
Enter a valid commit reference to create a new deployment from <InlineCode code="test" /> or
use the CLI to deploy. <Link href="#">Learn more</Link>
@@ -20,32 +20,32 @@
{
id: 'buildsTotal',
value: null,
description: 'Total build count'
description: 'Total builds count'
},
{
id: 'buildsStorageTotal',
value: null,
description: 'Total build size'
description: 'Total builds size'
},
{
id: 'buildsTimeTotal',
value: null,
description: 'Total build time'
description: 'Total builds time'
},
{
id: 'avgTime',
value: null,
description: 'Average build time'
description: 'Average builds time'
},
{
id: 'success',
value: null,
description: 'Successful deployment'
description: 'Successful deployments'
},
{
id: 'failed',
value: null,
description: 'Failed deployment'
description: 'Failed deployments'
}
];
onMount(async () => {
@@ -22,6 +22,7 @@
} from '@appwrite.io/pink-icons-svelte';
import { columns } from './store';
import ActivateDeploymentModal from '../../activateDeploymentModal.svelte';
import { deploymentStatusConverter } from '../store';
export let data: PageData;
@@ -61,13 +62,7 @@
{#if data?.activeDeployment?.$id === deployment?.$id}
<Status status="complete" label="active" />
{:else}
<Status
status={status === 'failed'
? status
: status === 'building'
? 'pending'
: 'ready'}
label={status} />
<Status status={deploymentStatusConverter(status)} label={status} />
{/if}
</Table.Cell>
{:else if column.id === 'domains'}
@@ -3,3 +3,17 @@ import type { Models } from '@appwrite.io/console';
import { derived } from 'svelte/store';
export const site = derived(page, ($page) => $page.data.site as Models.Site);
export function deploymentStatusConverter(status: string) {
// Status component possible values - status: 'waiting' | 'ready' | 'processing' | 'pending' | 'failed' | 'complete';
switch (status) {
case 'ready':
return 'ready';
case 'processing':
return 'processing';
case 'building':
return 'waiting';
case 'failed':
return 'failed';
}
}