2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-10-17 20:12:00 +09:00
|
|
|
<XModalWindow ref="dialog"
|
|
|
|
:width="520"
|
|
|
|
:height="500"
|
|
|
|
@close="$refs.dialog.close()"
|
|
|
|
@closed="$emit('closed')"
|
|
|
|
>
|
2020-01-30 04:37:25 +09:00
|
|
|
<template #header>{{ instance.host }}</template>
|
|
|
|
<div class="mk-instance-info">
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_table section">
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.software }}</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_data">{{ instance.softwareName || '?' }}</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.version }}</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_data">{{ instance.softwareVersion || '?' }}</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_table data section">
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.registeredAt }}</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_data">{{ new Date(instance.caughtAt).toLocaleString() }} (<MkTime :time="instance.caughtAt"/>)</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.following }}</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<button class="_data _textButton" @click="showFollowing()">{{ number(instance.followingCount) }}</button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.followers }}</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<button class="_data _textButton" @click="showFollowers()">{{ number(instance.followersCount) }}</button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.users }}</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<button class="_data _textButton" @click="showUsers()">{{ number(instance.usersCount) }}</button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.notes }}</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_data">{{ number(instance.notesCount) }}</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.files }}</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_data">{{ number(instance.driveFiles) }}</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.storageUsage }}</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_data">{{ bytes(instance.driveUsage) }}</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.latestRequestSentAt }}</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_data"><MkTime v-if="instance.latestRequestSentAt" :time="instance.latestRequestSentAt"/><span v-else>N/A</span></div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.latestStatus }}</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_data">{{ instance.latestStatus ? instance.latestStatus : 'N/A' }}</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 15:51:02 +09:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 10:47:36 +09:00
|
|
|
<div class="_label">{{ $ts.latestRequestReceivedAt }}</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_data"><MkTime v-if="instance.latestRequestReceivedAt" :time="instance.latestRequestReceivedAt"/><span v-else>N/A</span></div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="chart">
|
|
|
|
<div class="header">
|
2020-12-26 10:47:36 +09:00
|
|
|
<span class="label">{{ $ts.charts }}</span>
|
2020-01-30 04:37:25 +09:00
|
|
|
<div class="selects">
|
2020-10-17 20:12:00 +09:00
|
|
|
<MkSelect v-model:value="chartSrc" style="margin: 0; flex: 1;">
|
2020-12-26 10:47:36 +09:00
|
|
|
<option value="requests">{{ $ts._instanceCharts.requests }}</option>
|
|
|
|
<option value="users">{{ $ts._instanceCharts.users }}</option>
|
|
|
|
<option value="users-total">{{ $ts._instanceCharts.usersTotal }}</option>
|
|
|
|
<option value="notes">{{ $ts._instanceCharts.notes }}</option>
|
|
|
|
<option value="notes-total">{{ $ts._instanceCharts.notesTotal }}</option>
|
|
|
|
<option value="ff">{{ $ts._instanceCharts.ff }}</option>
|
|
|
|
<option value="ff-total">{{ $ts._instanceCharts.ffTotal }}</option>
|
|
|
|
<option value="drive-usage">{{ $ts._instanceCharts.cacheSize }}</option>
|
|
|
|
<option value="drive-usage-total">{{ $ts._instanceCharts.cacheSizeTotal }}</option>
|
|
|
|
<option value="drive-files">{{ $ts._instanceCharts.files }}</option>
|
|
|
|
<option value="drive-files-total">{{ $ts._instanceCharts.filesTotal }}</option>
|
2020-10-17 20:12:00 +09:00
|
|
|
</MkSelect>
|
|
|
|
<MkSelect v-model:value="chartSpan" style="margin: 0;">
|
2020-12-26 10:47:36 +09:00
|
|
|
<option value="hour">{{ $ts.perHour }}</option>
|
|
|
|
<option value="day">{{ $ts.perDay }}</option>
|
2020-10-17 20:12:00 +09:00
|
|
|
</MkSelect>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="chart">
|
2020-10-17 20:12:00 +09:00
|
|
|
<canvas :ref="setChart"></canvas>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="operations section">
|
2020-12-26 10:47:36 +09:00
|
|
|
<span class="label">{{ $ts.operations }}</span>
|
|
|
|
<MkSwitch v-model:value="isSuspended" class="switch">{{ $ts.stopActivityDelivery }}</MkSwitch>
|
|
|
|
<MkSwitch :value="isBlocked" class="switch" @update:value="changeBlock">{{ $ts.blockThisInstance }}</MkSwitch>
|
2020-04-13 23:27:12 +09:00
|
|
|
<details>
|
2020-12-26 10:47:36 +09:00
|
|
|
<summary>{{ $ts.deleteAllFiles }}</summary>
|
|
|
|
<MkButton @click="deleteAllFiles()" style="margin: 0.5em 0 0.5em 0;"><Fa :icon="faTrashAlt"/> {{ $ts.deleteAllFiles }}</MkButton>
|
2020-04-13 23:27:12 +09:00
|
|
|
</details>
|
|
|
|
<details>
|
2020-12-26 10:47:36 +09:00
|
|
|
<summary>{{ $ts.removeAllFollowing }}</summary>
|
|
|
|
<MkButton @click="removeAllFollowing()" style="margin: 0.5em 0 0.5em 0;"><Fa :icon="faMinusCircle"/> {{ $ts.removeAllFollowing }}</MkButton>
|
2020-10-17 20:12:00 +09:00
|
|
|
<MkInfo warn>{{ $t('removeAllFollowingDescription', { host: instance.host }) }}</MkInfo>
|
2020-04-13 23:27:12 +09:00
|
|
|
</details>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<details class="metadata section">
|
2020-12-26 10:47:36 +09:00
|
|
|
<summary class="label">{{ $ts.metadata }}</summary>
|
2020-04-13 23:27:12 +09:00
|
|
|
<pre><code>{{ JSON.stringify(instance, null, 2) }}</code></pre>
|
2020-01-30 04:37:25 +09:00
|
|
|
</details>
|
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</XModalWindow>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 20:12:00 +09:00
|
|
|
import { defineComponent } from 'vue';
|
2020-01-30 04:37:25 +09:00
|
|
|
import Chart from 'chart.js';
|
2020-04-13 23:27:12 +09:00
|
|
|
import { faTimes, faCrosshairs, faCloudDownloadAlt, faCloudUploadAlt, faUsers, faPencilAlt, faFileImage, faDatabase, faTrafficLight, faLongArrowAltUp, faLongArrowAltDown, faMinusCircle, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
2021-03-23 17:30:14 +09:00
|
|
|
import XModalWindow from '@client/components/ui/modal-window.vue';
|
|
|
|
import MkUsersDialog from '@client/components/users-dialog.vue';
|
|
|
|
import MkSelect from '@client/components/ui/select.vue';
|
|
|
|
import MkButton from '@client/components/ui/button.vue';
|
|
|
|
import MkSwitch from '@client/components/ui/switch.vue';
|
|
|
|
import MkInfo from '@client/components/ui/info.vue';
|
2020-10-17 20:12:00 +09:00
|
|
|
import bytes from '../../filters/bytes';
|
|
|
|
import number from '../../filters/number';
|
2021-03-23 17:30:14 +09:00
|
|
|
import * as os from '@client/os';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
const chartLimit = 90;
|
|
|
|
const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b));
|
|
|
|
const negate = arr => arr.map(x => -x);
|
|
|
|
const alpha = hex => {
|
|
|
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)!;
|
|
|
|
const r = parseInt(result[1], 16);
|
|
|
|
const g = parseInt(result[2], 16);
|
|
|
|
const b = parseInt(result[3], 16);
|
|
|
|
return `rgba(${r}, ${g}, ${b}, 0.1)`;
|
|
|
|
};
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
export default defineComponent({
|
2020-01-30 04:37:25 +09:00
|
|
|
components: {
|
2020-10-17 20:12:00 +09:00
|
|
|
XModalWindow,
|
2020-01-30 04:37:25 +09:00
|
|
|
MkSelect,
|
2020-04-13 23:27:12 +09:00
|
|
|
MkButton,
|
2020-01-30 04:37:25 +09:00
|
|
|
MkSwitch,
|
2020-04-13 23:27:12 +09:00
|
|
|
MkInfo,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
instance: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
emits: ['closed'],
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
data() {
|
|
|
|
return {
|
2020-02-10 23:17:42 +09:00
|
|
|
isSuspended: this.instance.isSuspended,
|
2020-01-30 04:37:25 +09:00
|
|
|
now: null,
|
2020-10-17 20:12:00 +09:00
|
|
|
canvas: null,
|
2020-01-30 04:37:25 +09:00
|
|
|
chart: null,
|
|
|
|
chartInstance: null,
|
|
|
|
chartSrc: 'requests',
|
|
|
|
chartSpan: 'hour',
|
2020-04-13 23:27:12 +09:00
|
|
|
faTimes, faCrosshairs, faCloudDownloadAlt, faCloudUploadAlt, faUsers, faPencilAlt, faFileImage, faDatabase, faTrafficLight, faLongArrowAltUp, faLongArrowAltDown, faMinusCircle, faTrashAlt
|
2020-01-30 04:37:25 +09:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
data(): any {
|
|
|
|
if (this.chart == null) return null;
|
|
|
|
switch (this.chartSrc) {
|
|
|
|
case 'requests': return this.requestsChart();
|
|
|
|
case 'users': return this.usersChart(false);
|
|
|
|
case 'users-total': return this.usersChart(true);
|
|
|
|
case 'notes': return this.notesChart(false);
|
|
|
|
case 'notes-total': return this.notesChart(true);
|
|
|
|
case 'ff': return this.ffChart(false);
|
|
|
|
case 'ff-total': return this.ffChart(true);
|
|
|
|
case 'drive-usage': return this.driveUsageChart(false);
|
|
|
|
case 'drive-usage-total': return this.driveUsageChart(true);
|
|
|
|
case 'drive-files': return this.driveFilesChart(false);
|
|
|
|
case 'drive-files-total': return this.driveFilesChart(true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
stats(): any[] {
|
|
|
|
const stats =
|
|
|
|
this.chartSpan == 'day' ? this.chart.perDay :
|
|
|
|
this.chartSpan == 'hour' ? this.chart.perHour :
|
|
|
|
null;
|
|
|
|
|
|
|
|
return stats;
|
2020-02-10 23:17:42 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
meta() {
|
2020-12-19 10:55:52 +09:00
|
|
|
return this.$instance;
|
2020-02-10 23:17:42 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
isBlocked() {
|
2020-10-17 20:12:00 +09:00
|
|
|
return this.meta && this.meta.blockedHosts && this.meta.blockedHosts.includes(this.instance.host);
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
isSuspended() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('admin/federation/update-instance', {
|
2020-01-30 04:37:25 +09:00
|
|
|
host: this.instance.host,
|
|
|
|
isSuspended: this.isSuspended
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
chartSrc() {
|
|
|
|
this.renderChart();
|
|
|
|
},
|
|
|
|
|
|
|
|
chartSpan() {
|
|
|
|
this.renderChart();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
async created() {
|
2020-01-30 04:37:25 +09:00
|
|
|
this.now = new Date();
|
|
|
|
|
|
|
|
const [perHour, perDay] = await Promise.all([
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('charts/instance', { host: this.instance.host, limit: chartLimit, span: 'hour' }),
|
|
|
|
os.api('charts/instance', { host: this.instance.host, limit: chartLimit, span: 'day' }),
|
2020-01-30 04:37:25 +09:00
|
|
|
]);
|
|
|
|
|
|
|
|
const chart = {
|
|
|
|
perHour: perHour,
|
|
|
|
perDay: perDay
|
|
|
|
};
|
|
|
|
|
|
|
|
this.chart = chart;
|
|
|
|
|
|
|
|
this.renderChart();
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2020-10-17 20:12:00 +09:00
|
|
|
setChart(el) {
|
|
|
|
this.canvas = el;
|
|
|
|
},
|
|
|
|
|
2020-02-10 23:17:42 +09:00
|
|
|
changeBlock(e) {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('admin/update-meta', {
|
2020-02-10 23:17:42 +09:00
|
|
|
blockedHosts: this.isBlocked ? this.meta.blockedHosts.concat([this.instance.host]) : this.meta.blockedHosts.filter(x => x !== this.instance.host)
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
setSrc(src) {
|
|
|
|
this.chartSrc = src;
|
|
|
|
},
|
|
|
|
|
2020-04-13 23:27:12 +09:00
|
|
|
removeAllFollowing() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.apiWithDialog('admin/federation/remove-all-following', {
|
2020-04-13 23:27:12 +09:00
|
|
|
host: this.instance.host
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
deleteAllFiles() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.apiWithDialog('admin/federation/delete-all-files', {
|
2020-04-13 23:27:12 +09:00
|
|
|
host: this.instance.host
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
renderChart() {
|
|
|
|
if (this.chartInstance) {
|
|
|
|
this.chartInstance.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
Chart.defaults.global.defaultFontColor = getComputedStyle(document.documentElement).getPropertyValue('--fg');
|
2020-10-17 20:12:00 +09:00
|
|
|
this.chartInstance = new Chart(this.canvas, {
|
2020-01-30 04:37:25 +09:00
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
labels: new Array(chartLimit).fill(0).map((_, i) => this.getDate(i).toLocaleString()).slice().reverse(),
|
|
|
|
datasets: this.data.series.map(x => ({
|
|
|
|
label: x.name,
|
|
|
|
data: x.data.slice().reverse(),
|
|
|
|
pointRadius: 0,
|
|
|
|
lineTension: 0,
|
|
|
|
borderWidth: 2,
|
|
|
|
borderColor: x.color,
|
|
|
|
backgroundColor: alpha(x.color),
|
|
|
|
}))
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
aspectRatio: 2.5,
|
|
|
|
layout: {
|
|
|
|
padding: {
|
|
|
|
left: 16,
|
|
|
|
right: 16,
|
|
|
|
top: 16,
|
|
|
|
bottom: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
position: 'bottom',
|
|
|
|
labels: {
|
|
|
|
boxWidth: 16,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
gridLines: {
|
|
|
|
display: false
|
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
position: 'right',
|
|
|
|
ticks: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
intersect: false,
|
|
|
|
mode: 'index',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
getDate(ago: number) {
|
|
|
|
const y = this.now.getFullYear();
|
|
|
|
const m = this.now.getMonth();
|
|
|
|
const d = this.now.getDate();
|
|
|
|
const h = this.now.getHours();
|
|
|
|
|
|
|
|
return this.chartSpan == 'day' ? new Date(y, m, d - ago) : new Date(y, m, d, h - ago);
|
|
|
|
},
|
|
|
|
|
|
|
|
format(arr) {
|
|
|
|
return arr;
|
|
|
|
},
|
|
|
|
|
|
|
|
requestsChart(): any {
|
|
|
|
return {
|
|
|
|
series: [{
|
|
|
|
name: 'In',
|
|
|
|
color: '#008FFB',
|
|
|
|
data: this.format(this.stats.requests.received)
|
|
|
|
}, {
|
|
|
|
name: 'Out (succ)',
|
|
|
|
color: '#00E396',
|
|
|
|
data: this.format(this.stats.requests.succeeded)
|
|
|
|
}, {
|
|
|
|
name: 'Out (fail)',
|
|
|
|
color: '#FEB019',
|
|
|
|
data: this.format(this.stats.requests.failed)
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
usersChart(total: boolean): any {
|
|
|
|
return {
|
|
|
|
series: [{
|
|
|
|
name: 'Users',
|
|
|
|
color: '#008FFB',
|
|
|
|
data: this.format(total
|
|
|
|
? this.stats.users.total
|
|
|
|
: sum(this.stats.users.inc, negate(this.stats.users.dec))
|
|
|
|
)
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
notesChart(total: boolean): any {
|
|
|
|
return {
|
|
|
|
series: [{
|
|
|
|
name: 'Notes',
|
|
|
|
color: '#008FFB',
|
|
|
|
data: this.format(total
|
|
|
|
? this.stats.notes.total
|
|
|
|
: sum(this.stats.notes.inc, negate(this.stats.notes.dec))
|
|
|
|
)
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
ffChart(total: boolean): any {
|
|
|
|
return {
|
|
|
|
series: [{
|
|
|
|
name: 'Following',
|
|
|
|
color: '#008FFB',
|
|
|
|
data: this.format(total
|
|
|
|
? this.stats.following.total
|
|
|
|
: sum(this.stats.following.inc, negate(this.stats.following.dec))
|
|
|
|
)
|
|
|
|
}, {
|
|
|
|
name: 'Followers',
|
|
|
|
color: '#00E396',
|
|
|
|
data: this.format(total
|
|
|
|
? this.stats.followers.total
|
|
|
|
: sum(this.stats.followers.inc, negate(this.stats.followers.dec))
|
|
|
|
)
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
driveUsageChart(total: boolean): any {
|
|
|
|
return {
|
|
|
|
bytes: true,
|
|
|
|
series: [{
|
|
|
|
name: 'Drive usage',
|
|
|
|
color: '#008FFB',
|
|
|
|
data: this.format(total
|
|
|
|
? this.stats.drive.totalUsage
|
|
|
|
: sum(this.stats.drive.incUsage, negate(this.stats.drive.decUsage))
|
|
|
|
)
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
driveFilesChart(total: boolean): any {
|
|
|
|
return {
|
|
|
|
series: [{
|
|
|
|
name: 'Drive files',
|
|
|
|
color: '#008FFB',
|
|
|
|
data: this.format(total
|
|
|
|
? this.stats.drive.totalFiles
|
|
|
|
: sum(this.stats.drive.incFiles, negate(this.stats.drive.decFiles))
|
|
|
|
)
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
showFollowing() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.modal(MkUsersDialog, {
|
2020-12-26 10:47:36 +09:00
|
|
|
title: this.$ts.instanceFollowing,
|
2020-01-30 04:37:25 +09:00
|
|
|
pagination: {
|
|
|
|
endpoint: 'federation/following',
|
|
|
|
limit: 10,
|
|
|
|
params: {
|
|
|
|
host: this.instance.host
|
|
|
|
}
|
|
|
|
},
|
|
|
|
extract: item => item.follower
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
showFollowers() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.modal(MkUsersDialog, {
|
2020-12-26 10:47:36 +09:00
|
|
|
title: this.$ts.instanceFollowers,
|
2020-01-30 04:37:25 +09:00
|
|
|
pagination: {
|
|
|
|
endpoint: 'federation/followers',
|
|
|
|
limit: 10,
|
|
|
|
params: {
|
|
|
|
host: this.instance.host
|
|
|
|
}
|
|
|
|
},
|
|
|
|
extract: item => item.followee
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
showUsers() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.modal(MkUsersDialog, {
|
2020-12-26 10:47:36 +09:00
|
|
|
title: this.$ts.instanceUsers,
|
2020-01-30 04:37:25 +09:00
|
|
|
pagination: {
|
|
|
|
endpoint: 'federation/users',
|
|
|
|
limit: 10,
|
|
|
|
params: {
|
|
|
|
host: this.instance.host
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
bytes,
|
|
|
|
|
|
|
|
number
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.mk-instance-info {
|
|
|
|
overflow: auto;
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> .section {
|
|
|
|
padding: 16px 32px;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
2020-10-17 20:12:00 +09:00
|
|
|
padding: 8px 16px;
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
&:not(:first-child) {
|
2021-04-10 12:40:50 +09:00
|
|
|
border-top: solid 0.5px var(--divider);
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .chart {
|
2021-04-10 12:40:50 +09:00
|
|
|
border-top: solid 0.5px var(--divider);
|
2020-10-17 20:12:00 +09:00
|
|
|
padding: 16px 0 12px 0;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
> .header {
|
|
|
|
padding: 0 32px;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
padding: 0 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .label {
|
|
|
|
font-size: 80%;
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .selects {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .chart {
|
|
|
|
padding: 0 16px;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .operations {
|
|
|
|
> .label {
|
|
|
|
font-size: 80%;
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .switch {
|
|
|
|
margin: 16px 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .metadata {
|
|
|
|
> .label {
|
|
|
|
font-size: 80%;
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
|
|
|
|
> pre > code {
|
|
|
|
display: block;
|
|
|
|
max-height: 200px;
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|