2022-06-20 10:38:49 +02:00
|
|
|
<template><MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
|
|
<MkSpacer :content-max="800" :margin-min="16" :margin-max="32">
|
2023-03-29 22:35:10 +02:00
|
|
|
<FormButton primary @click="indexPosts">{{ i18n.ts.indexPosts }}</FormButton>
|
2021-11-19 11:36:12 +01:00
|
|
|
<FormSuspense v-slot="{ result: database }" :p="databasePromiseFactory">
|
2022-01-04 13:37:16 +01:00
|
|
|
<MkKeyValue v-for="table in database" :key="table[0]" oneline style="margin: 1em 0;">
|
|
|
|
<template #key>{{ table[0] }}</template>
|
|
|
|
<template #value>{{ bytes(table[1].size) }} ({{ number(table[1].count) }} recs)</template>
|
|
|
|
</MkKeyValue>
|
2021-04-22 15:29:33 +02:00
|
|
|
</FormSuspense>
|
2022-06-20 10:38:49 +02:00
|
|
|
</MkSpacer></MkStickyContainer>
|
2021-04-22 15:29:33 +02:00
|
|
|
</template>
|
|
|
|
|
2022-05-14 14:35:08 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2022-01-04 13:37:16 +01:00
|
|
|
import FormSuspense from '@/components/form/suspense.vue';
|
2023-03-29 22:30:02 +02:00
|
|
|
import FormButton from '@/components/MkButton.vue';
|
2022-08-30 17:24:33 +02:00
|
|
|
import MkKeyValue from '@/components/MkKeyValue.vue';
|
2021-11-11 18:02:25 +01:00
|
|
|
import * as os from '@/os';
|
|
|
|
import bytes from '@/filters/bytes';
|
|
|
|
import number from '@/filters/number';
|
2022-05-14 14:35:08 +02:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 10:38:49 +02:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2021-04-22 15:29:33 +02:00
|
|
|
|
2023-03-29 22:30:02 +02:00
|
|
|
async function indexPosts() {
|
|
|
|
const { canceled, result: index } = await os.inputText({
|
|
|
|
title: i18n.ts.indexFrom,
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
|
|
|
|
if (index == null || index === "") {
|
|
|
|
await os.api('admin/search/index-all');
|
|
|
|
await os.alert({
|
|
|
|
type: 'info',
|
|
|
|
text: i18n.ts.indexNotice
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
await os.api('admin/search/index-all', {
|
|
|
|
cursor: index
|
|
|
|
});
|
|
|
|
await os.alert({
|
|
|
|
type: 'info',
|
|
|
|
text: i18n.ts.indexNotice
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-14 14:35:08 +02:00
|
|
|
const databasePromiseFactory = () => os.api('admin/get-table-stats').then(res => Object.entries(res).sort((a, b) => b[1].size - a[1].size));
|
2021-04-22 15:29:33 +02:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.database,
|
2023-03-11 22:01:04 +01:00
|
|
|
icon: 'ph-database ph-bold ph-lg',
|
2021-04-22 15:29:33 +02:00
|
|
|
});
|
|
|
|
</script>
|