Sharkey/packages/client/src/pages/admin/database.vue

32 lines
1 KiB
Vue
Raw Normal View History

<template>
2022-01-04 15:42:04 +02:00
<MkSpacer :content-max="800" :margin-min="16" :margin-max="32">
2021-11-19 12:36:12 +02:00
<FormSuspense v-slot="{ result: database }" :p="databasePromiseFactory">
2022-01-04 14:37:16 +02: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>
</FormSuspense>
2022-01-04 14:37:16 +02:00
</MkSpacer>
</template>
<script lang="ts" setup>
import { } from 'vue';
2022-01-04 14:37:16 +02:00
import FormSuspense from '@/components/form/suspense.vue';
import MkKeyValue from '@/components/key-value.vue';
2021-11-11 19:02:25 +02:00
import * as os from '@/os';
import * as symbols from '@/symbols';
import bytes from '@/filters/bytes';
import number from '@/filters/number';
import { i18n } from '@/i18n';
const databasePromiseFactory = () => os.api('admin/get-table-stats').then(res => Object.entries(res).sort((a, b) => b[1].size - a[1].size));
defineExpose({
[symbols.PAGE_INFO]: {
title: i18n.ts.database,
icon: 'fas fa-database',
bg: 'var(--bg)',
}
});
</script>