2023-04-08 02:01:42 +02:00
|
|
|
<template>
|
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header
|
|
|
|
><MkPageHeader
|
|
|
|
:actions="headerActions"
|
|
|
|
:tabs="headerTabs"
|
|
|
|
:display-back-button="true"
|
|
|
|
/></template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<MkSpacer :content-max="800" :margin-min="16" :margin-max="32">
|
2023-04-08 02:01:42 +02:00
|
|
|
<FormButton primary @click="indexPosts">{{
|
|
|
|
i18n.ts.indexPosts
|
|
|
|
}}</FormButton>
|
|
|
|
<FormSuspense
|
|
|
|
v-slot="{ result: database }"
|
|
|
|
:p="databasePromiseFactory"
|
|
|
|
>
|
|
|
|
<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>
|
|
|
|
</FormSuspense>
|
|
|
|
</MkSpacer></MkStickyContainer
|
|
|
|
>
|
2021-04-22 15:29:33 +02:00
|
|
|
</template>
|
|
|
|
|
2022-05-14 14:35:08 +02:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 02:01:42 +02:00
|
|
|
import {} from "vue";
|
|
|
|
import FormSuspense from "@/components/form/suspense.vue";
|
|
|
|
import FormButton from "@/components/MkButton.vue";
|
|
|
|
import MkKeyValue from "@/components/MkKeyValue.vue";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import bytes from "@/filters/bytes";
|
|
|
|
import number from "@/filters/number";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
2023-04-11 19:07:03 +02:00
|
|
|
import { indexPosts } from "@/scripts/index-posts";
|
2023-03-29 22:30:02 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
const databasePromiseFactory = () =>
|
|
|
|
os
|
|
|
|
.api("admin/get-table-stats")
|
|
|
|
.then((res) =>
|
2023-07-06 03:28:27 +02:00
|
|
|
Object.entries(res).sort((a, b) => b[1].size - a[1].size),
|
2023-04-08 02:01:42 +02:00
|
|
|
);
|
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-04-08 02:01:42 +02:00
|
|
|
icon: "ph-database ph-bold ph-lg",
|
2021-04-22 15:29:33 +02:00
|
|
|
});
|
|
|
|
</script>
|