2021-04-22 07:29:33 -06:00
|
|
|
<template>
|
2021-10-21 14:36:48 -06:00
|
|
|
<div>
|
|
|
|
<MkHeader :info="header"/>
|
|
|
|
|
|
|
|
<div class="edbbcaef">
|
|
|
|
<div class="numbers" v-if="stats">
|
|
|
|
<div class="number _panel">
|
|
|
|
<div class="label">Users</div>
|
|
|
|
<div class="value _monospace">
|
|
|
|
{{ number(stats.originalUsersCount) }}
|
|
|
|
<MkNumberDiff v-if="usersComparedToThePrevDay" class="diff" :value="usersComparedToThePrevDay" v-tooltip="$ts.dayOverDayChanges"><template #before>(</template><template #after>)</template></MkNumberDiff>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="number _panel">
|
|
|
|
<div class="label">Notes</div>
|
|
|
|
<div class="value _monospace">
|
|
|
|
{{ number(stats.originalNotesCount) }}
|
|
|
|
<MkNumberDiff v-if="notesComparedToThePrevDay" class="diff" :value="notesComparedToThePrevDay" v-tooltip="$ts.dayOverDayChanges"><template #before>(</template><template #after>)</template></MkNumberDiff>
|
|
|
|
</div>
|
2021-04-22 07:29:33 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-10-21 14:36:48 -06:00
|
|
|
<MkContainer :foldable="true" class="charts">
|
|
|
|
<template #header><i class="fas fa-chart-bar"></i>{{ $ts.charts }}</template>
|
|
|
|
<div style="padding-top: 12px;">
|
|
|
|
<MkInstanceStats :chart-limit="500" :detailed="true"/>
|
|
|
|
</div>
|
|
|
|
</MkContainer>
|
|
|
|
|
|
|
|
<!--<XMetrics/>-->
|
|
|
|
|
|
|
|
<div class="numbers">
|
|
|
|
<div class="number _panel">
|
|
|
|
<div class="label">Misskey</div>
|
|
|
|
<div class="value _monospace">{{ version }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="number _panel" v-if="serverInfo">
|
|
|
|
<div class="label">Node.js</div>
|
|
|
|
<div class="value _monospace">{{ serverInfo.node }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="number _panel" v-if="serverInfo">
|
|
|
|
<div class="label">PostgreSQL</div>
|
|
|
|
<div class="value _monospace">{{ serverInfo.psql }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="number _panel" v-if="serverInfo">
|
|
|
|
<div class="label">Redis</div>
|
|
|
|
<div class="value _monospace">{{ serverInfo.redis }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="number _panel">
|
|
|
|
<div class="label">Vue</div>
|
|
|
|
<div class="value _monospace">{{ vueVersion }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-04-22 07:29:33 -06:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-10-21 14:36:48 -06:00
|
|
|
import { computed, defineComponent, version as vueVersion } from 'vue';
|
2021-09-29 09:50:45 -06:00
|
|
|
import FormKeyValueView from '@client/components/debobigego/key-value-view.vue';
|
2021-04-22 07:29:33 -06:00
|
|
|
import MkInstanceStats from '@client/components/instance-stats.vue';
|
|
|
|
import MkButton from '@client/components/ui/button.vue';
|
2021-09-29 09:50:45 -06:00
|
|
|
import MkSelect from '@client/components/form/select.vue';
|
2021-10-21 14:36:48 -06:00
|
|
|
import MkNumberDiff from '@client/components/number-diff.vue';
|
2021-04-22 07:29:33 -06:00
|
|
|
import MkContainer from '@client/components/ui/container.vue';
|
|
|
|
import MkFolder from '@client/components/ui/folder.vue';
|
|
|
|
import { version, url } from '@client/config';
|
2021-08-05 01:34:18 -06:00
|
|
|
import bytes from '@client/filters/bytes';
|
|
|
|
import number from '@client/filters/number';
|
2021-04-22 07:29:33 -06:00
|
|
|
import MkInstanceInfo from './instance.vue';
|
|
|
|
import XMetrics from './metrics.vue';
|
|
|
|
import * as os from '@client/os';
|
|
|
|
import * as symbols from '@client/symbols';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
2021-10-21 14:36:48 -06:00
|
|
|
MkNumberDiff,
|
2021-04-22 07:29:33 -06:00
|
|
|
FormKeyValueView,
|
|
|
|
MkInstanceStats,
|
2021-10-21 14:36:48 -06:00
|
|
|
MkContainer,
|
2021-04-22 07:29:33 -06:00
|
|
|
XMetrics,
|
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['info'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
[symbols.PAGE_INFO]: {
|
2021-10-21 14:36:48 -06:00
|
|
|
title: this.$ts.dashboard,
|
2021-10-02 08:11:21 -06:00
|
|
|
icon: 'fas fa-tachometer-alt',
|
|
|
|
bg: 'var(--bg)',
|
2021-04-22 07:29:33 -06:00
|
|
|
},
|
2021-10-21 14:36:48 -06:00
|
|
|
header: {
|
|
|
|
title: this.$ts.dashboard,
|
|
|
|
icon: 'fas fa-tachometer-alt',
|
|
|
|
},
|
2021-04-22 07:29:33 -06:00
|
|
|
version,
|
2021-10-21 14:36:48 -06:00
|
|
|
vueVersion,
|
2021-04-22 07:29:33 -06:00
|
|
|
url,
|
|
|
|
stats: null,
|
2021-05-30 21:02:02 -06:00
|
|
|
meta: null,
|
2021-10-21 14:36:48 -06:00
|
|
|
serverInfo: null,
|
|
|
|
usersComparedToThePrevDay: null,
|
|
|
|
notesComparedToThePrevDay: null,
|
2021-04-22 07:29:33 -06:00
|
|
|
fetchJobs: () => os.api('admin/queue/deliver-delayed', {}),
|
|
|
|
fetchModLogs: () => os.api('admin/show-moderation-logs', {}),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
async mounted() {
|
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
2021-10-21 14:36:48 -06:00
|
|
|
|
|
|
|
os.api('meta', { detail: true }).then(meta => {
|
|
|
|
this.meta = meta;
|
|
|
|
});
|
|
|
|
|
|
|
|
os.api('stats', {}).then(stats => {
|
|
|
|
this.stats = stats;
|
|
|
|
|
|
|
|
os.api('charts/users', { limit: 2, span: 'day' }).then(chart => {
|
|
|
|
this.usersComparedToThePrevDay = this.stats.originalUsersCount - chart.local.total[1];
|
|
|
|
});
|
|
|
|
|
|
|
|
os.api('charts/notes', { limit: 2, span: 'day' }).then(chart => {
|
|
|
|
this.notesComparedToThePrevDay = this.stats.originalNotesCount - chart.local.total[1];
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
os.api('admin/server-info', {}).then(serverInfo => {
|
|
|
|
this.serverInfo = serverInfo;
|
|
|
|
});
|
2021-04-22 07:29:33 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async showInstanceInfo(q) {
|
|
|
|
let instance = q;
|
|
|
|
if (typeof q === 'string') {
|
|
|
|
instance = await os.api('federation/show-instance', {
|
|
|
|
host: q
|
|
|
|
});
|
|
|
|
}
|
|
|
|
os.popup(MkInstanceInfo, {
|
|
|
|
instance: instance
|
|
|
|
}, {}, 'closed');
|
|
|
|
},
|
|
|
|
|
|
|
|
bytes,
|
|
|
|
|
|
|
|
number,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2021-10-21 14:36:48 -06:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.edbbcaef {
|
|
|
|
> .numbers {
|
|
|
|
display: grid;
|
|
|
|
grid-gap: 8px;
|
2021-10-21 23:03:08 -06:00
|
|
|
grid-template-columns: repeat(auto-fill,minmax(150px,1fr));
|
2021-10-21 14:36:48 -06:00
|
|
|
margin: 16px;
|
|
|
|
|
|
|
|
> .number {
|
|
|
|
padding: 12px 16px;
|
|
|
|
|
|
|
|
> .label {
|
|
|
|
opacity: 0.7;
|
|
|
|
font-size: 0.8em;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .value {
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1.2em;
|
|
|
|
|
|
|
|
> .diff {
|
|
|
|
font-size: 0.8em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .charts {
|
|
|
|
margin: var(--margin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|