2019-02-07 11:11:20 +02:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<ui-card>
|
2019-03-15 18:20:13 +02:00
|
|
|
<template #title><fa :icon="faTerminal"/> {{ $t('instance') }}</template>
|
2019-02-07 11:11:20 +02:00
|
|
|
<section class="fit-top">
|
2019-02-08 18:53:46 +02:00
|
|
|
<ui-input class="target" v-model="target" type="text" @enter="showInstance()">
|
2019-02-07 11:11:20 +02:00
|
|
|
<span>{{ $t('host') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faServer"/></template>
|
2019-02-07 11:11:20 +02:00
|
|
|
</ui-input>
|
2019-02-08 18:53:46 +02:00
|
|
|
<ui-button @click="showInstance()"><fa :icon="faSearch"/> {{ $t('lookup') }}</ui-button>
|
2019-02-07 11:11:20 +02:00
|
|
|
|
|
|
|
<div class="instance" v-if="instance">
|
2019-03-15 18:20:13 +02:00
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-input :value="instance.host" type="text" readonly>
|
|
|
|
<span>{{ $t('host') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faServer"/></template>
|
2019-03-15 18:20:13 +02:00
|
|
|
</ui-input>
|
|
|
|
<ui-input :value="instance.caughtAt | date" type="text" readonly>
|
|
|
|
<span>{{ $t('caught-at') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faCrosshairs"/></template>
|
2019-03-15 18:20:13 +02:00
|
|
|
</ui-input>
|
|
|
|
</ui-horizon-group>
|
2019-02-07 14:23:12 +02:00
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-input :value="instance.notesCount | number" type="text" readonly>
|
|
|
|
<span>{{ $t('notes') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faEnvelopeOpenText"/></template>
|
2019-02-07 14:23:12 +02:00
|
|
|
</ui-input>
|
|
|
|
<ui-input :value="instance.usersCount | number" type="text" readonly>
|
|
|
|
<span>{{ $t('users') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faUsers"/></template>
|
2019-02-07 14:23:12 +02:00
|
|
|
</ui-input>
|
|
|
|
</ui-horizon-group>
|
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-input :value="instance.followingCount | number" type="text" readonly>
|
|
|
|
<span>{{ $t('following') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faCaretDown"/></template>
|
2019-02-07 14:23:12 +02:00
|
|
|
</ui-input>
|
|
|
|
<ui-input :value="instance.followersCount | number" type="text" readonly>
|
|
|
|
<span>{{ $t('followers') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faCaretUp"/></template>
|
2019-02-07 14:23:12 +02:00
|
|
|
</ui-input>
|
|
|
|
</ui-horizon-group>
|
|
|
|
<ui-horizon-group inputs>
|
2019-03-15 18:20:13 +02:00
|
|
|
<ui-input :value="instance.latestRequestSentAt | date" type="text" readonly>
|
2019-02-07 14:23:12 +02:00
|
|
|
<span>{{ $t('latest-request-sent-at') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faPaperPlane"/></template>
|
2019-02-07 14:23:12 +02:00
|
|
|
</ui-input>
|
|
|
|
<ui-input :value="instance.latestStatus" type="text" readonly>
|
|
|
|
<span>{{ $t('status') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faTrafficLight"/></template>
|
2019-02-07 14:23:12 +02:00
|
|
|
</ui-input>
|
|
|
|
</ui-horizon-group>
|
2019-03-15 18:20:13 +02:00
|
|
|
<ui-input :value="instance.latestRequestReceivedAt | date" type="text" readonly>
|
2019-02-07 14:23:12 +02:00
|
|
|
<span>{{ $t('latest-request-received-at') }}</span>
|
2019-03-15 18:34:21 +02:00
|
|
|
<template #prefix><fa :icon="faInbox"/></template>
|
2019-02-07 14:23:12 +02:00
|
|
|
</ui-input>
|
2019-02-07 21:26:43 +02:00
|
|
|
<ui-switch v-model="instance.isBlocked" @change="updateInstance()">{{ $t('block') }}</ui-switch>
|
2019-02-08 13:56:16 +02:00
|
|
|
<ui-switch v-model="instance.isMarkedAsClosed" @change="updateInstance()">{{ $t('marked-as-closed') }}</ui-switch>
|
2019-02-08 09:58:57 +02:00
|
|
|
<details>
|
|
|
|
<summary>{{ $t('charts') }}</summary>
|
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-select v-model="chartSrc">
|
|
|
|
<option value="requests">{{ $t('chart-srcs.requests') }}</option>
|
|
|
|
<option value="users">{{ $t('chart-srcs.users') }}</option>
|
|
|
|
<option value="users-total">{{ $t('chart-srcs.users-total') }}</option>
|
|
|
|
<option value="notes">{{ $t('chart-srcs.notes') }}</option>
|
|
|
|
<option value="notes-total">{{ $t('chart-srcs.notes-total') }}</option>
|
|
|
|
<option value="ff">{{ $t('chart-srcs.ff') }}</option>
|
|
|
|
<option value="ff-total">{{ $t('chart-srcs.ff-total') }}</option>
|
|
|
|
<option value="drive-usage">{{ $t('chart-srcs.drive-usage') }}</option>
|
|
|
|
<option value="drive-usage-total">{{ $t('chart-srcs.drive-usage-total') }}</option>
|
|
|
|
<option value="drive-files">{{ $t('chart-srcs.drive-files') }}</option>
|
|
|
|
<option value="drive-files-total">{{ $t('chart-srcs.drive-files-total') }}</option>
|
|
|
|
</ui-select>
|
|
|
|
<ui-select v-model="chartSpan">
|
|
|
|
<option value="hour">{{ $t('chart-spans.hour') }}</option>
|
|
|
|
<option value="day">{{ $t('chart-spans.day') }}</option>
|
|
|
|
</ui-select>
|
|
|
|
</ui-horizon-group>
|
|
|
|
<div ref="chart"></div>
|
|
|
|
</details>
|
2019-02-07 21:36:23 +02:00
|
|
|
<details>
|
|
|
|
<summary>{{ $t('remove-all-following') }}</summary>
|
|
|
|
<ui-button @click="removeAllFollowing()" style="margin-top: 16px;"><fa :icon="faMinusCircle"/> {{ $t('remove-all-following') }}</ui-button>
|
2019-02-07 14:59:18 +02:00
|
|
|
<ui-info warn>{{ $t('remove-all-following-info', { host: instance.host }) }}</ui-info>
|
2019-02-07 21:36:23 +02:00
|
|
|
</details>
|
2019-02-07 11:11:20 +02:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</ui-card>
|
|
|
|
|
|
|
|
<ui-card>
|
2019-02-18 04:13:56 +02:00
|
|
|
<template #title><fa :icon="faServer"/> {{ $t('instances') }}</template>
|
2019-02-07 11:11:20 +02:00
|
|
|
<section class="fit-top">
|
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-select v-model="sort">
|
2019-02-18 04:13:56 +02:00
|
|
|
<template #label>{{ $t('sort') }}</template>
|
2019-02-07 11:11:20 +02:00
|
|
|
<option value="-caughtAt">{{ $t('sorts.caughtAtAsc') }}</option>
|
|
|
|
<option value="+caughtAt">{{ $t('sorts.caughtAtDesc') }}</option>
|
2019-02-08 13:56:16 +02:00
|
|
|
<option value="-lastCommunicatedAt">{{ $t('sorts.lastCommunicatedAtAsc') }}</option>
|
|
|
|
<option value="+lastCommunicatedAt">{{ $t('sorts.lastCommunicatedAtDesc') }}</option>
|
2019-02-07 11:11:20 +02:00
|
|
|
<option value="-notes">{{ $t('sorts.notesAsc') }}</option>
|
|
|
|
<option value="+notes">{{ $t('sorts.notesDesc') }}</option>
|
|
|
|
<option value="-users">{{ $t('sorts.usersAsc') }}</option>
|
|
|
|
<option value="+users">{{ $t('sorts.usersDesc') }}</option>
|
|
|
|
<option value="-following">{{ $t('sorts.followingAsc') }}</option>
|
|
|
|
<option value="+following">{{ $t('sorts.followingDesc') }}</option>
|
|
|
|
<option value="-followers">{{ $t('sorts.followersAsc') }}</option>
|
|
|
|
<option value="+followers">{{ $t('sorts.followersDesc') }}</option>
|
2019-02-08 09:58:57 +02:00
|
|
|
<option value="-driveUsage">{{ $t('sorts.driveUsageAsc') }}</option>
|
|
|
|
<option value="+driveUsage">{{ $t('sorts.driveUsageDesc') }}</option>
|
|
|
|
<option value="-driveFiles">{{ $t('sorts.driveFilesAsc') }}</option>
|
|
|
|
<option value="+driveFiles">{{ $t('sorts.driveFilesDesc') }}</option>
|
2019-02-07 11:11:20 +02:00
|
|
|
</ui-select>
|
2019-02-07 21:26:43 +02:00
|
|
|
<ui-select v-model="state">
|
2019-02-18 04:13:56 +02:00
|
|
|
<template #label>{{ $t('state') }}</template>
|
2019-02-07 21:26:43 +02:00
|
|
|
<option value="all">{{ $t('states.all') }}</option>
|
|
|
|
<option value="blocked">{{ $t('states.blocked') }}</option>
|
2019-02-08 13:56:16 +02:00
|
|
|
<option value="notResponding">{{ $t('states.not-responding') }}</option>
|
|
|
|
<option value="markedAsClosed">{{ $t('states.marked-as-closed') }}</option>
|
2019-02-07 21:26:43 +02:00
|
|
|
</ui-select>
|
2019-02-07 11:11:20 +02:00
|
|
|
</ui-horizon-group>
|
|
|
|
|
|
|
|
<div class="instances">
|
|
|
|
<header>
|
|
|
|
<span>{{ $t('host') }}</span>
|
|
|
|
<span>{{ $t('notes') }}</span>
|
|
|
|
<span>{{ $t('users') }}</span>
|
|
|
|
<span>{{ $t('following') }}</span>
|
|
|
|
<span>{{ $t('followers') }}</span>
|
|
|
|
<span>{{ $t('status') }}</span>
|
|
|
|
</header>
|
2019-02-09 05:34:42 +02:00
|
|
|
<div v-for="instance in instances" :style="{ opacity: instance.isNotResponding ? 0.5 : 1 }">
|
|
|
|
<a @click.prevent="showInstance(instance.host)" target="_blank" :href="`https://${instance.host}`" :style="{ textDecoration: instance.isMarkedAsClosed ? 'line-through' : 'none' }">{{ instance.host }}</a>
|
2019-02-07 11:11:20 +02:00
|
|
|
<span>{{ instance.notesCount | number }}</span>
|
|
|
|
<span>{{ instance.usersCount | number }}</span>
|
|
|
|
<span>{{ instance.followingCount | number }}</span>
|
|
|
|
<span>{{ instance.followersCount | number }}</span>
|
|
|
|
<span>{{ instance.latestStatus }}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-02-07 21:26:43 +02:00
|
|
|
|
|
|
|
<ui-info v-if="instances.length == limit">{{ $t('result-is-truncated', { n: limit }) }}</ui-info>
|
2019-02-07 11:11:20 +02:00
|
|
|
</section>
|
|
|
|
</ui-card>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import i18n from '../../i18n';
|
2019-03-15 18:34:21 +02:00
|
|
|
import { faPaperPlane } from '@fortawesome/free-regular-svg-icons';
|
|
|
|
import { faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faTrafficLight, faInbox } from '@fortawesome/free-solid-svg-icons';
|
2019-02-08 09:58:57 +02:00
|
|
|
import ApexCharts from 'apexcharts';
|
|
|
|
import * as tinycolor from 'tinycolor2';
|
|
|
|
|
|
|
|
const chartLimit = 90;
|
|
|
|
const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b));
|
|
|
|
const negate = arr => arr.map(x => -x);
|
2019-02-07 11:11:20 +02:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
i18n: i18n('admin/views/federation.vue'),
|
|
|
|
|
2019-03-15 18:20:13 +02:00
|
|
|
filters: {
|
|
|
|
date: v => v ? new Date(v).toLocaleString() : 'N/A'
|
|
|
|
},
|
|
|
|
|
2019-02-07 11:11:20 +02:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
instance: null,
|
|
|
|
target: null,
|
2019-02-10 12:46:47 +02:00
|
|
|
sort: '+lastCommunicatedAt',
|
2019-02-07 21:26:43 +02:00
|
|
|
state: 'all',
|
2019-02-07 11:11:20 +02:00
|
|
|
limit: 50,
|
|
|
|
instances: [],
|
2019-02-08 09:58:57 +02:00
|
|
|
chart: null,
|
|
|
|
chartSrc: 'requests',
|
|
|
|
chartSpan: 'hour',
|
|
|
|
chartInstance: null,
|
2019-03-15 18:34:21 +02:00
|
|
|
faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faPaperPlane, faTrafficLight, faInbox
|
2019-02-07 11:11:20 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2019-02-08 09:58:57 +02: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;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-02-07 11:11:20 +02:00
|
|
|
watch: {
|
|
|
|
sort() {
|
2019-02-07 21:26:43 +02:00
|
|
|
this.fetchInstances();
|
|
|
|
},
|
|
|
|
|
|
|
|
state() {
|
2019-02-07 11:11:20 +02:00
|
|
|
this.fetchInstances();
|
|
|
|
},
|
2019-02-08 09:58:57 +02:00
|
|
|
|
|
|
|
async instance() {
|
|
|
|
this.now = new Date();
|
|
|
|
|
|
|
|
const [perHour, perDay] = await Promise.all([
|
|
|
|
this.$root.api('charts/instance', { host: this.instance.host, limit: chartLimit, span: 'hour' }),
|
|
|
|
this.$root.api('charts/instance', { host: this.instance.host, limit: chartLimit, span: 'day' }),
|
|
|
|
]);
|
|
|
|
|
|
|
|
const chart = {
|
|
|
|
perHour: perHour,
|
|
|
|
perDay: perDay
|
|
|
|
};
|
|
|
|
|
|
|
|
this.chart = chart;
|
|
|
|
|
|
|
|
this.renderChart();
|
|
|
|
},
|
|
|
|
|
|
|
|
chartSrc() {
|
|
|
|
this.renderChart();
|
|
|
|
},
|
|
|
|
|
|
|
|
chartSpan() {
|
|
|
|
this.renderChart();
|
|
|
|
}
|
2019-02-07 11:11:20 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
this.fetchInstances();
|
|
|
|
},
|
|
|
|
|
2019-02-08 09:58:57 +02:00
|
|
|
beforeDestroy() {
|
|
|
|
this.chartInstance.destroy();
|
|
|
|
},
|
|
|
|
|
2019-02-07 11:11:20 +02:00
|
|
|
methods: {
|
2019-02-08 18:53:46 +02:00
|
|
|
showInstance(target?: string) {
|
2019-02-07 11:11:20 +02:00
|
|
|
this.$root.api('federation/show-instance', {
|
2019-02-08 18:53:46 +02:00
|
|
|
host: target || this.target
|
2019-02-07 11:11:20 +02:00
|
|
|
}).then(instance => {
|
|
|
|
if (instance == null) {
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'error',
|
|
|
|
text: this.$t('instance-not-registered')
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.instance = instance;
|
|
|
|
this.target = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
fetchInstances() {
|
2019-02-07 21:26:43 +02:00
|
|
|
this.instances = [];
|
2019-02-07 11:11:20 +02:00
|
|
|
this.$root.api('federation/instances', {
|
2019-02-08 13:56:16 +02:00
|
|
|
blocked: this.state === 'blocked' ? true : null,
|
|
|
|
notResponding: this.state === 'notResponding' ? true : null,
|
|
|
|
markedAsClosed: this.state === 'markedAsClosed' ? true : null,
|
2019-02-07 15:00:55 +02:00
|
|
|
sort: this.sort,
|
2019-02-07 21:26:43 +02:00
|
|
|
limit: this.limit
|
2019-02-07 11:11:20 +02:00
|
|
|
}).then(instances => {
|
|
|
|
this.instances = instances;
|
|
|
|
});
|
2019-02-07 14:59:18 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
removeAllFollowing() {
|
|
|
|
this.$root.api('admin/federation/remove-all-following', {
|
|
|
|
host: this.instance.host
|
|
|
|
}).then(() => {
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'success',
|
|
|
|
splash: true
|
|
|
|
});
|
|
|
|
});
|
2019-02-07 21:26:43 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
updateInstance() {
|
|
|
|
this.$root.api('admin/federation/update-instance', {
|
|
|
|
host: this.instance.host,
|
2019-02-08 13:56:16 +02:00
|
|
|
isBlocked: this.instance.isBlocked || false,
|
|
|
|
isClosed: this.instance.isMarkedAsClosed || false
|
2019-02-07 21:26:43 +02:00
|
|
|
});
|
|
|
|
},
|
2019-02-08 09:58:57 +02:00
|
|
|
|
|
|
|
setSrc(src) {
|
|
|
|
this.chartSrc = src;
|
|
|
|
},
|
|
|
|
|
|
|
|
renderChart() {
|
|
|
|
if (this.chartInstance) {
|
|
|
|
this.chartInstance.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.chartInstance = new ApexCharts(this.$refs.chart, {
|
|
|
|
chart: {
|
|
|
|
type: 'area',
|
|
|
|
height: 300,
|
|
|
|
animations: {
|
|
|
|
dynamicAnimation: {
|
|
|
|
enabled: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
toolbar: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
zoom: {
|
|
|
|
enabled: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
dataLabels: {
|
|
|
|
enabled: false
|
|
|
|
},
|
|
|
|
grid: {
|
|
|
|
clipMarkers: false,
|
|
|
|
borderColor: 'rgba(0, 0, 0, 0.1)'
|
|
|
|
},
|
|
|
|
stroke: {
|
|
|
|
curve: 'straight',
|
|
|
|
width: 2
|
|
|
|
},
|
2019-02-09 05:43:26 +02:00
|
|
|
tooltip: {
|
|
|
|
theme: this.$store.state.device.darkmode ? 'dark' : 'light'
|
|
|
|
},
|
2019-02-08 09:58:57 +02:00
|
|
|
legend: {
|
|
|
|
labels: {
|
|
|
|
colors: tinycolor(getComputedStyle(document.documentElement).getPropertyValue('--text')).toRgbString()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
xaxis: {
|
|
|
|
type: 'datetime',
|
|
|
|
labels: {
|
|
|
|
style: {
|
|
|
|
colors: tinycolor(getComputedStyle(document.documentElement).getPropertyValue('--text')).toRgbString()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
axisBorder: {
|
|
|
|
color: 'rgba(0, 0, 0, 0.1)'
|
|
|
|
},
|
|
|
|
axisTicks: {
|
|
|
|
color: 'rgba(0, 0, 0, 0.1)'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
yaxis: {
|
|
|
|
labels: {
|
|
|
|
formatter: this.data.bytes ? v => Vue.filter('bytes')(v, 0) : v => Vue.filter('number')(v),
|
|
|
|
style: {
|
|
|
|
color: tinycolor(getComputedStyle(document.documentElement).getPropertyValue('--text')).toRgbString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
series: this.data.series
|
|
|
|
});
|
|
|
|
|
|
|
|
this.chartInstance.render();
|
|
|
|
},
|
|
|
|
|
|
|
|
getDate(i: 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 - i) :
|
|
|
|
this.chartSpan == 'hour' ? new Date(y, m, d, h - i) :
|
|
|
|
null
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
format(arr) {
|
|
|
|
return arr.map((v, i) => ({ x: this.getDate(i).getTime(), y: v }));
|
|
|
|
},
|
|
|
|
|
|
|
|
requestsChart(): any {
|
|
|
|
return {
|
|
|
|
series: [{
|
|
|
|
name: 'Incoming',
|
|
|
|
data: this.format(this.stats.requests.received)
|
|
|
|
}, {
|
|
|
|
name: 'Outgoing (succeeded)',
|
|
|
|
data: this.format(this.stats.requests.succeeded)
|
|
|
|
}, {
|
|
|
|
name: 'Outgoing (failed)',
|
|
|
|
data: this.format(this.stats.requests.failed)
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
usersChart(total: boolean): any {
|
|
|
|
return {
|
|
|
|
series: [{
|
|
|
|
name: 'Users',
|
|
|
|
type: 'area',
|
|
|
|
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',
|
|
|
|
type: 'area',
|
|
|
|
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',
|
|
|
|
type: 'area',
|
|
|
|
data: this.format(total
|
|
|
|
? this.stats.following.total
|
|
|
|
: sum(this.stats.following.inc, negate(this.stats.following.dec))
|
|
|
|
)
|
|
|
|
}, {
|
|
|
|
name: 'Followers',
|
|
|
|
type: 'area',
|
|
|
|
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',
|
|
|
|
type: 'area',
|
|
|
|
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',
|
|
|
|
type: 'area',
|
|
|
|
data: this.format(total
|
|
|
|
? this.stats.drive.totalFiles
|
|
|
|
: sum(this.stats.drive.incFiles, negate(this.stats.drive.decFiles))
|
|
|
|
)
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
},
|
2019-02-07 11:11:20 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.target
|
|
|
|
margin-bottom 16px !important
|
|
|
|
|
|
|
|
.instances
|
|
|
|
width 100%
|
|
|
|
|
|
|
|
> header
|
|
|
|
display flex
|
|
|
|
|
|
|
|
> *
|
|
|
|
color var(--text)
|
|
|
|
font-weight bold
|
|
|
|
|
|
|
|
> div
|
|
|
|
display flex
|
|
|
|
|
|
|
|
> * > *
|
|
|
|
flex 1
|
|
|
|
overflow auto
|
|
|
|
|
|
|
|
&:first-child
|
|
|
|
min-width 200px
|
|
|
|
|
|
|
|
</style>
|