You've already forked obsidian-visualiser
Adding prestyled base tags and testing admin dashboard
This commit is contained in:
@@ -1,3 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
const job = ref<string>('');
|
||||
|
||||
const data = ref(), status = ref<'idle' | 'pending' | 'success' | 'error'>('idle'), success = ref(false), err = ref(false), error = ref();
|
||||
async function fetch()
|
||||
{
|
||||
status.value = 'pending';
|
||||
data.value = null;
|
||||
error.value = null;
|
||||
err.value = false;
|
||||
success.value = false;
|
||||
|
||||
try
|
||||
{
|
||||
data.value = await $fetch(`/api/admin/jobs/${job.value}`, {
|
||||
method: 'POST',
|
||||
});
|
||||
status.value = 'success';
|
||||
error.value = null;
|
||||
err.value = false;
|
||||
success.value = true;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
status.value = 'error';
|
||||
error.value = e;
|
||||
err.value = true;
|
||||
success.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
Administration
|
||||
<Head>
|
||||
<Title>Administration</Title>
|
||||
</Head>
|
||||
<div class="flex flex-col justify-start">
|
||||
<ProseH2>Administration</ProseH2>
|
||||
<Select label="Job" v-model="job">
|
||||
<SelectItem label="Synchroniser" value="sync" />
|
||||
<SelectItem label="Nettoyer la base" value="clear" />
|
||||
<SelectItem label="Reconstruire" value="rebuild" disabled />
|
||||
</Select>
|
||||
<Button class="self-center" @click="() => !!job && fetch()" :loading="status === 'pending'">
|
||||
<span>Executer</span>
|
||||
</Button>
|
||||
<Toast :duration="10000" title="Erreur" :content="error?.message" v-model="err" />
|
||||
<Toast :duration="10000" content="Traitement terminé" v-model="success" :closeable="false" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -13,11 +13,11 @@ watch(loading, (value) => {
|
||||
<Head>
|
||||
<Title>Accueil</Title>
|
||||
</Head>
|
||||
<div class="h-100 w-100 flex flex-1 flex-col justify-center items-center">
|
||||
<div class="h-full w-full flex flex-1 flex-col justify-center items-center">
|
||||
<div class="w-1/2 flex flex-1 flex-col justify-center items-center gap-2">
|
||||
<Collapsible label="Options">
|
||||
<div class="flex flex-col justify-start items-start">
|
||||
<div class="flex flex-row">
|
||||
<div class="w-full flex flex-row justify-center">
|
||||
<Switch v-model="disabled" onIcon="radix-icons:lock-closed" offIcon="radix-icons:lock-open-2" />
|
||||
<ThemeSwitch />
|
||||
</div>
|
||||
@@ -28,9 +28,8 @@ watch(loading, (value) => {
|
||||
</div>
|
||||
</Collapsible>
|
||||
|
||||
<Button @click="() => loading = true">
|
||||
<Button :loading="loading" @click="() => loading = true">
|
||||
<span v-if="!loading">Load data</span>
|
||||
<Loading v-else size="small" />
|
||||
</Button>
|
||||
<Toast v-model="open" :duration="7500" content="Je suis un long texte pour tester comment ça se comporte aaaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaa" :closeable="false" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user