mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: dates and stores
This commit is contained in:
1 parent
93975ed2b5
commit
9449596a7b
7 files changed
+20
-18
No files matched your search
@@ -3,6 +3,6 @@
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-no-redundant-roles -->
|
||||
<form role="form" class="form" class:common-section={single} on:submit|preventDefault>
|
||||
<form role="form" class="form" class:common-section={!single} on:submit|preventDefault>
|
||||
<slot />
|
||||
</form>
|
||||
@@ -9,7 +9,7 @@ export const toLocaleDate = (datetime: string) => {
|
||||
return date.toLocaleDateString('en', options);
|
||||
};
|
||||
|
||||
export const toLocaleDateTime = (datetime: string) => {
|
||||
export const toLocaleDateTime = (datetime: string | number) => {
|
||||
const date = new Date(datetime);
|
||||
const options: Intl.DateTimeFormatOptions = {
|
||||
year: 'numeric',
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
import { Query } from '@aw-labs/appwrite-console';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
|
||||
let search = '';
|
||||
let offset = 0;
|
||||
@@ -34,7 +35,7 @@
|
||||
wizard.hide();
|
||||
});
|
||||
|
||||
$: functionList.load([Query.limit(0), Query.offset(0)], search);
|
||||
$: functionList.load([Query.limit(6), Query.offset(0)], search);
|
||||
$: if (search) offset = 0;
|
||||
</script>
|
||||
|
||||
@@ -89,7 +90,7 @@
|
||||
aria-hidden="true"
|
||||
use:tooltip={{
|
||||
content: `Next execution:
|
||||
${func.scheduleNext}`
|
||||
${toLocaleDateTime(func.scheduleNext)}`
|
||||
}} />
|
||||
</li>
|
||||
{/if}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
import { calculateSize } from '$lib/helpers/sizeConvertion';
|
||||
import Activate from './_activate.svelte';
|
||||
import { Query } from '@aw-labs/appwrite-console';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
|
||||
let search = '';
|
||||
let offset = 0;
|
||||
@@ -75,8 +76,8 @@
|
||||
<svelte:fragment slot="aside">
|
||||
<div class="u-flex u-main-space-between">
|
||||
<div>
|
||||
<p>Created at: {$func.$createdAt}</p>
|
||||
<p>Updated at: {$func.$updatedAt}</p>
|
||||
<p>Created at: {toLocaleDateTime($func.$createdAt)}</p>
|
||||
<p>Updated at: {toLocaleDateTime($func.$updatedAt)}</p>
|
||||
<p>Entrypoint: {activeDeployment?.entrypoint}</p>
|
||||
</div>
|
||||
{activeDeployment.status}
|
||||
@@ -146,7 +147,7 @@
|
||||
</Copy>
|
||||
</TableCell>
|
||||
<TableCellText title="Created">
|
||||
{deployment.$createdAt}
|
||||
{toLocaleDateTime(deployment.$createdAt)}
|
||||
</TableCellText>
|
||||
<TableCellText title="Status">{deployment.status}</TableCellText>
|
||||
<TableCellText title="Build Time"
|
||||
|
||||
+2
-2
@@ -7,7 +7,6 @@
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Pagination, Copy, Empty } from '$lib/components';
|
||||
|
||||
import {
|
||||
Table,
|
||||
TableHeader,
|
||||
@@ -19,6 +18,7 @@
|
||||
} from '$lib/elements/table';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { calculateTime } from '$lib/helpers/timeConversion';
|
||||
import { Query } from '@aw-labs/appwrite-console';
|
||||
|
||||
let search = '';
|
||||
let offset = 0;
|
||||
@@ -26,7 +26,7 @@
|
||||
// let selectedExecution: Models.Execution = null;
|
||||
const functionId = $page.params.function;
|
||||
|
||||
$: executionList.load(functionId, $pageLimit, offset ?? 0, search);
|
||||
$: executionList.load(functionId, [Query.offset(offset), Query.limit($pageLimit)], search);
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
|
||||
+3
-4
@@ -5,15 +5,14 @@ import { cachedStore } from '$lib/helpers/cache';
|
||||
export const executionList = cachedStore<
|
||||
Models.ExecutionList,
|
||||
{
|
||||
load: (functionId: string, limit: number, offset: number, search: string) => Promise<void>;
|
||||
load: (functionId: string, queries?: string[], search?: string) => Promise<void>;
|
||||
}
|
||||
>('executionList', function ({ set }) {
|
||||
return {
|
||||
load: async (functionId, limit, offset, search) => {
|
||||
load: async (functionId, queries, search) => {
|
||||
const response = await sdkForProject.functions.listExecutions(
|
||||
functionId,
|
||||
limit,
|
||||
offset,
|
||||
queries,
|
||||
search
|
||||
);
|
||||
set(response);
|
||||
|
||||
+6
-5
@@ -20,6 +20,7 @@
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import Variable from '../../../createVariable.svelte';
|
||||
import Upload from './uploadVariables.svelte';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
|
||||
const functionId = $page.params.function;
|
||||
let showDelete = false;
|
||||
@@ -136,8 +137,8 @@
|
||||
<div class="u-flex u-main-space-between">
|
||||
<div>
|
||||
<p>Function ID: {$func.$id}</p>
|
||||
<p>Created at: {$func.$createdAt}</p>
|
||||
<p>Updated at: {$func.$updatedAt}</p>
|
||||
<p>Created at: {toLocaleDateTime($func.$createdAt)}</p>
|
||||
<p>Updated at: {toLocaleDateTime($func.$updatedAt)}</p>
|
||||
</div>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
@@ -153,7 +154,7 @@
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
|
||||
<Form single on:submit={() => console.log($func.schedule)}>
|
||||
<Form on:submit={() => console.log($func.schedule)}>
|
||||
<CardGrid>
|
||||
<h2 class="heading-level-6">Update CRON Schedule</h2>
|
||||
<p>
|
||||
@@ -179,7 +180,7 @@
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
<Form single on:submit={updateTimeout}>
|
||||
<Form on:submit={updateTimeout}>
|
||||
<CardGrid>
|
||||
<h2 class="heading-level-6">Update Timeout</h2>
|
||||
<p>
|
||||
@@ -335,7 +336,7 @@
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold">{$func.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p>Last Updated: {$func.$updatedAt}</p>
|
||||
<p>Last Updated: {toLocaleDateTime($func.$updatedAt)}</p>
|
||||
</Box>
|
||||
</svelte:fragment>
|
||||
|
||||
|
||||
Reference in new issue
Block a user