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">
|
2021-08-06 22:29:19 +09:00
|
|
|
<MkSelect v-model="chartSrc" style="margin: 0; flex: 1;">
|
2021-10-22 05:36:48 +09:00
|
|
|
<option value="instance-requests">{{ $ts._instanceCharts.requests }}</option>
|
|
|
|
<option value="instance-users">{{ $ts._instanceCharts.users }}</option>
|
|
|
|
<option value="instance-users-total">{{ $ts._instanceCharts.usersTotal }}</option>
|
|
|
|
<option value="instance-notes">{{ $ts._instanceCharts.notes }}</option>
|
|
|
|
<option value="instance-notes-total">{{ $ts._instanceCharts.notesTotal }}</option>
|
|
|
|
<option value="instance-ff">{{ $ts._instanceCharts.ff }}</option>
|
|
|
|
<option value="instance-ff-total">{{ $ts._instanceCharts.ffTotal }}</option>
|
|
|
|
<option value="instance-drive-usage">{{ $ts._instanceCharts.cacheSize }}</option>
|
|
|
|
<option value="instance-drive-usage-total">{{ $ts._instanceCharts.cacheSizeTotal }}</option>
|
|
|
|
<option value="instance-drive-files">{{ $ts._instanceCharts.files }}</option>
|
|
|
|
<option value="instance-drive-files-total">{{ $ts._instanceCharts.filesTotal }}</option>
|
2020-10-17 20:12:00 +09:00
|
|
|
</MkSelect>
|
2021-08-06 22:29:19 +09:00
|
|
|
<MkSelect v-model="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">
|
2021-10-22 05:36:48 +09:00
|
|
|
<MkChart :src="chartSrc" :span="chartSpan" :limit="90" :detailed="true"></MkChart>
|
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>
|
2021-08-06 22:29:19 +09:00
|
|
|
<MkSwitch v-model="isSuspended" class="switch">{{ $ts.stopActivityDelivery }}</MkSwitch>
|
|
|
|
<MkSwitch :model-value="isBlocked" class="switch" @update:modelValue="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>
|
2021-04-20 23:22:59 +09:00
|
|
|
<MkButton @click="deleteAllFiles()" style="margin: 0.5em 0 0.5em 0;"><i class="fas fa-trash-alt"></i> {{ $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>
|
2021-04-20 23:22:59 +09:00
|
|
|
<MkButton @click="removeAllFollowing()" style="margin: 0.5em 0 0.5em 0;"><i class="fas fa-minus-circle"></i> {{ $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">
|
2021-05-11 14:38:34 +09:00
|
|
|
import { defineComponent, markRaw } from 'vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import XModalWindow from '@/components/ui/modal-window.vue';
|
|
|
|
import MkSelect from '@/components/form/select.vue';
|
|
|
|
import MkButton from '@/components/ui/button.vue';
|
|
|
|
import MkSwitch from '@/components/form/switch.vue';
|
|
|
|
import MkInfo from '@/components/ui/info.vue';
|
|
|
|
import MkChart from '@/components/chart.vue';
|
|
|
|
import bytes from '@/filters/bytes';
|
|
|
|
import number from '@/filters/number';
|
|
|
|
import * as os from '@/os';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
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,
|
2021-10-22 05:36:48 +09:00
|
|
|
MkChart,
|
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
|
|
|
chartSrc: 'requests',
|
|
|
|
chartSpan: 'hour',
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
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
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
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-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
|
|
|
showFollowing() {
|
2021-11-12 19:07:59 +09:00
|
|
|
// TODO: ページ遷移
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
showFollowers() {
|
2021-11-12 19:07:59 +09:00
|
|
|
// TODO: ページ遷移
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
showUsers() {
|
2021-11-12 19:07:59 +09:00
|
|
|
// TODO: ページ遷移
|
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>
|