2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
2020-10-17 14:12:00 +03:00
|
|
|
<XModalWindow ref="dialog"
|
|
|
|
:width="520"
|
|
|
|
:height="500"
|
|
|
|
@close="$refs.dialog.close()"
|
|
|
|
@closed="$emit('closed')"
|
|
|
|
>
|
2020-01-29 21:37:25 +02:00
|
|
|
<template #header>{{ instance.host }}</template>
|
|
|
|
<div class="mk-instance-info">
|
2020-10-17 14:12:00 +03:00
|
|
|
<div class="_table section">
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.software }}</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_data">{{ instance.softwareName || '?' }}</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.version }}</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_data">{{ instance.softwareVersion || '?' }}</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<div class="_table data section">
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.registeredAt }}</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<div class="_data">{{ new Date(instance.caughtAt).toLocaleString() }} (<MkTime :time="instance.caughtAt"/>)</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.following }}</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<button class="_data _textButton" @click="showFollowing()">{{ number(instance.followingCount) }}</button>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.followers }}</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<button class="_data _textButton" @click="showFollowers()">{{ number(instance.followersCount) }}</button>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.users }}</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<button class="_data _textButton" @click="showUsers()">{{ number(instance.usersCount) }}</button>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.notes }}</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<div class="_data">{{ number(instance.notesCount) }}</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.files }}</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<div class="_data">{{ number(instance.driveFiles) }}</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.storageUsage }}</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<div class="_data">{{ bytes(instance.driveUsage) }}</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.latestRequestSentAt }}</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<div class="_data"><MkTime v-if="instance.latestRequestSentAt" :time="instance.latestRequestSentAt"/><span v-else>N/A</span></div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.latestStatus }}</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_data">{{ instance.latestStatus ? instance.latestStatus : 'N/A' }}</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-09 09:51:02 +03:00
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell">
|
2020-12-26 03:47:36 +02:00
|
|
|
<div class="_label">{{ $ts.latestRequestReceivedAt }}</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<div class="_data"><MkTime v-if="instance.latestRequestReceivedAt" :time="instance.latestRequestReceivedAt"/><span v-else>N/A</span></div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="chart">
|
|
|
|
<div class="header">
|
2020-12-26 03:47:36 +02:00
|
|
|
<span class="label">{{ $ts.charts }}</span>
|
2020-01-29 21:37:25 +02:00
|
|
|
<div class="selects">
|
2021-08-06 16:29:19 +03:00
|
|
|
<MkSelect v-model="chartSrc" style="margin: 0; flex: 1;">
|
2021-10-21 23:36:48 +03: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 14:12:00 +03:00
|
|
|
</MkSelect>
|
2021-08-06 16:29:19 +03:00
|
|
|
<MkSelect v-model="chartSpan" style="margin: 0;">
|
2020-12-26 03:47:36 +02:00
|
|
|
<option value="hour">{{ $ts.perHour }}</option>
|
|
|
|
<option value="day">{{ $ts.perDay }}</option>
|
2020-10-17 14:12:00 +03:00
|
|
|
</MkSelect>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="chart">
|
2021-10-21 23:36:48 +03:00
|
|
|
<MkChart :src="chartSrc" :span="chartSpan" :limit="90" :detailed="true"></MkChart>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<div class="operations section">
|
2020-12-26 03:47:36 +02:00
|
|
|
<span class="label">{{ $ts.operations }}</span>
|
2021-08-06 16:29:19 +03: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 17:27:12 +03:00
|
|
|
<details>
|
2020-12-26 03:47:36 +02:00
|
|
|
<summary>{{ $ts.deleteAllFiles }}</summary>
|
2021-04-20 17:22:59 +03: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 17:27:12 +03:00
|
|
|
</details>
|
|
|
|
<details>
|
2020-12-26 03:47:36 +02:00
|
|
|
<summary>{{ $ts.removeAllFollowing }}</summary>
|
2021-04-20 17:22:59 +03: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 14:12:00 +03:00
|
|
|
<MkInfo warn>{{ $t('removeAllFollowingDescription', { host: instance.host }) }}</MkInfo>
|
2020-04-13 17:27:12 +03:00
|
|
|
</details>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<details class="metadata section">
|
2020-12-26 03:47:36 +02:00
|
|
|
<summary class="label">{{ $ts.metadata }}</summary>
|
2020-04-13 17:27:12 +03:00
|
|
|
<pre><code>{{ JSON.stringify(instance, null, 2) }}</code></pre>
|
2020-01-29 21:37:25 +02:00
|
|
|
</details>
|
|
|
|
</div>
|
2020-10-17 14:12:00 +03:00
|
|
|
</XModalWindow>
|
2020-01-29 21:37:25 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-05-11 08:38:34 +03:00
|
|
|
import { defineComponent, markRaw } from 'vue';
|
2021-11-11 19:02:25 +02:00
|
|
|
import XModalWindow from '@/components/ui/modal-window.vue';
|
|
|
|
import MkUsersDialog from '@/components/users-dialog.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-29 21:37:25 +02:00
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
export default defineComponent({
|
2020-01-29 21:37:25 +02:00
|
|
|
components: {
|
2020-10-17 14:12:00 +03:00
|
|
|
XModalWindow,
|
2020-01-29 21:37:25 +02:00
|
|
|
MkSelect,
|
2020-04-13 17:27:12 +03:00
|
|
|
MkButton,
|
2020-01-29 21:37:25 +02:00
|
|
|
MkSwitch,
|
2020-04-13 17:27:12 +03:00
|
|
|
MkInfo,
|
2021-10-21 23:36:48 +03:00
|
|
|
MkChart,
|
2020-01-29 21:37:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
instance: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
emits: ['closed'],
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
data() {
|
|
|
|
return {
|
2020-02-10 16:17:42 +02:00
|
|
|
isSuspended: this.instance.isSuspended,
|
2020-01-29 21:37:25 +02:00
|
|
|
chartSrc: 'requests',
|
|
|
|
chartSpan: 'hour',
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2020-02-10 16:17:42 +02:00
|
|
|
meta() {
|
2020-12-19 03:55:52 +02:00
|
|
|
return this.$instance;
|
2020-02-10 16:17:42 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
isBlocked() {
|
2020-10-17 14:12:00 +03:00
|
|
|
return this.meta && this.meta.blockedHosts && this.meta.blockedHosts.includes(this.instance.host);
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
isSuspended() {
|
2020-10-17 14:12:00 +03:00
|
|
|
os.api('admin/federation/update-instance', {
|
2020-01-29 21:37:25 +02:00
|
|
|
host: this.instance.host,
|
|
|
|
isSuspended: this.isSuspended
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2020-02-10 16:17:42 +02:00
|
|
|
changeBlock(e) {
|
2020-10-17 14:12:00 +03:00
|
|
|
os.api('admin/update-meta', {
|
2020-02-10 16:17:42 +02:00
|
|
|
blockedHosts: this.isBlocked ? this.meta.blockedHosts.concat([this.instance.host]) : this.meta.blockedHosts.filter(x => x !== this.instance.host)
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-04-13 17:27:12 +03:00
|
|
|
removeAllFollowing() {
|
2020-10-17 14:12:00 +03:00
|
|
|
os.apiWithDialog('admin/federation/remove-all-following', {
|
2020-04-13 17:27:12 +03:00
|
|
|
host: this.instance.host
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
deleteAllFiles() {
|
2020-10-17 14:12:00 +03:00
|
|
|
os.apiWithDialog('admin/federation/delete-all-files', {
|
2020-04-13 17:27:12 +03:00
|
|
|
host: this.instance.host
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
showFollowing() {
|
2020-10-17 14:12:00 +03:00
|
|
|
os.modal(MkUsersDialog, {
|
2020-12-26 03:47:36 +02:00
|
|
|
title: this.$ts.instanceFollowing,
|
2020-01-29 21:37:25 +02:00
|
|
|
pagination: {
|
|
|
|
endpoint: 'federation/following',
|
|
|
|
limit: 10,
|
|
|
|
params: {
|
|
|
|
host: this.instance.host
|
|
|
|
}
|
|
|
|
},
|
|
|
|
extract: item => item.follower
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
showFollowers() {
|
2020-10-17 14:12:00 +03:00
|
|
|
os.modal(MkUsersDialog, {
|
2020-12-26 03:47:36 +02:00
|
|
|
title: this.$ts.instanceFollowers,
|
2020-01-29 21:37:25 +02:00
|
|
|
pagination: {
|
|
|
|
endpoint: 'federation/followers',
|
|
|
|
limit: 10,
|
|
|
|
params: {
|
|
|
|
host: this.instance.host
|
|
|
|
}
|
|
|
|
},
|
|
|
|
extract: item => item.followee
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
showUsers() {
|
2020-10-17 14:12:00 +03:00
|
|
|
os.modal(MkUsersDialog, {
|
2020-12-26 03:47:36 +02:00
|
|
|
title: this.$ts.instanceUsers,
|
2020-01-29 21:37:25 +02:00
|
|
|
pagination: {
|
|
|
|
endpoint: 'federation/users',
|
|
|
|
limit: 10,
|
|
|
|
params: {
|
|
|
|
host: this.instance.host
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
bytes,
|
|
|
|
|
|
|
|
number
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.mk-instance-info {
|
|
|
|
overflow: auto;
|
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
> .section {
|
|
|
|
padding: 16px 32px;
|
2020-01-29 21:37:25 +02:00
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
2020-10-17 14:12:00 +03:00
|
|
|
padding: 8px 16px;
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
&:not(:first-child) {
|
2021-04-10 06:40:50 +03:00
|
|
|
border-top: solid 0.5px var(--divider);
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .chart {
|
2021-04-10 06:40:50 +03:00
|
|
|
border-top: solid 0.5px var(--divider);
|
2020-10-17 14:12:00 +03:00
|
|
|
padding: 16px 0 12px 0;
|
2020-01-29 21:37:25 +02: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>
|