2019-02-07 18:11:20 +09:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<ui-card>
|
|
|
|
<div slot="title"><fa :icon="faTerminal"/> {{ $t('federation') }}</div>
|
|
|
|
<section class="fit-top">
|
|
|
|
<ui-input class="target" v-model="target" type="text" @enter="showInstance">
|
|
|
|
<span>{{ $t('host') }}</span>
|
|
|
|
</ui-input>
|
|
|
|
<ui-button @click="showInstance"><fa :icon="faSearch"/> {{ $t('lookup') }}</ui-button>
|
|
|
|
|
|
|
|
<div class="instance" v-if="instance">
|
2019-02-07 21:23:12 +09:00
|
|
|
<ui-input :value="instance.host" type="text" readonly>
|
|
|
|
<span>{{ $t('host') }}</span>
|
|
|
|
</ui-input>
|
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-input :value="instance.notesCount | number" type="text" readonly>
|
|
|
|
<span>{{ $t('notes') }}</span>
|
|
|
|
</ui-input>
|
|
|
|
<ui-input :value="instance.usersCount | number" type="text" readonly>
|
|
|
|
<span>{{ $t('users') }}</span>
|
|
|
|
</ui-input>
|
|
|
|
</ui-horizon-group>
|
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-input :value="instance.followingCount | number" type="text" readonly>
|
|
|
|
<span>{{ $t('following') }}</span>
|
|
|
|
</ui-input>
|
|
|
|
<ui-input :value="instance.followersCount | number" type="text" readonly>
|
|
|
|
<span>{{ $t('followers') }}</span>
|
|
|
|
</ui-input>
|
|
|
|
</ui-horizon-group>
|
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-input :value="instance.latestRequestSentAt" type="text" readonly>
|
|
|
|
<span>{{ $t('latest-request-sent-at') }}</span>
|
|
|
|
</ui-input>
|
|
|
|
<ui-input :value="instance.latestStatus" type="text" readonly>
|
|
|
|
<span>{{ $t('status') }}</span>
|
|
|
|
</ui-input>
|
|
|
|
</ui-horizon-group>
|
|
|
|
<ui-input :value="instance.latestRequestReceivedAt" type="text" readonly>
|
|
|
|
<span>{{ $t('latest-request-received-at') }}</span>
|
|
|
|
</ui-input>
|
2019-02-08 04:26:43 +09:00
|
|
|
<ui-switch v-model="instance.isBlocked" @change="updateInstance()">{{ $t('block') }}</ui-switch>
|
2019-02-08 04:36:23 +09: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 21:59:18 +09:00
|
|
|
<ui-info warn>{{ $t('remove-all-following-info', { host: instance.host }) }}</ui-info>
|
2019-02-08 04:36:23 +09:00
|
|
|
</details>
|
2019-02-07 18:11:20 +09:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</ui-card>
|
|
|
|
|
|
|
|
<ui-card>
|
|
|
|
<div slot="title"><fa :icon="faUsers"/> {{ $t('instances') }}</div>
|
|
|
|
<section class="fit-top">
|
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-select v-model="sort">
|
|
|
|
<span slot="label">{{ $t('sort') }}</span>
|
|
|
|
<option value="-caughtAt">{{ $t('sorts.caughtAtAsc') }}</option>
|
|
|
|
<option value="+caughtAt">{{ $t('sorts.caughtAtDesc') }}</option>
|
|
|
|
<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>
|
|
|
|
</ui-select>
|
2019-02-08 04:26:43 +09:00
|
|
|
<ui-select v-model="state">
|
|
|
|
<span slot="label">{{ $t('state') }}</span>
|
|
|
|
<option value="all">{{ $t('states.all') }}</option>
|
|
|
|
<option value="blocked">{{ $t('states.blocked') }}</option>
|
|
|
|
</ui-select>
|
2019-02-07 18:11:20 +09: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>
|
|
|
|
<div v-for="instance in instances">
|
|
|
|
<span>{{ instance.host }}</span>
|
|
|
|
<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-08 04:26:43 +09:00
|
|
|
|
|
|
|
<ui-info v-if="instances.length == limit">{{ $t('result-is-truncated', { n: limit }) }}</ui-info>
|
2019-02-07 18:11:20 +09:00
|
|
|
</section>
|
|
|
|
</ui-card>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import i18n from '../../i18n';
|
2019-02-07 23:42:56 +09:00
|
|
|
import { faGlobe, faTerminal, faSearch, faMinusCircle } from '@fortawesome/free-solid-svg-icons';
|
2019-02-07 18:11:20 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
i18n: i18n('admin/views/federation.vue'),
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
instance: null,
|
|
|
|
target: null,
|
|
|
|
sort: '+caughtAt',
|
2019-02-08 04:26:43 +09:00
|
|
|
state: 'all',
|
2019-02-07 18:11:20 +09:00
|
|
|
limit: 50,
|
|
|
|
instances: [],
|
2019-02-07 23:42:56 +09:00
|
|
|
faGlobe, faTerminal, faSearch, faMinusCircle
|
2019-02-07 18:11:20 +09:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
sort() {
|
2019-02-08 04:26:43 +09:00
|
|
|
this.fetchInstances();
|
|
|
|
},
|
|
|
|
|
|
|
|
state() {
|
2019-02-07 18:11:20 +09:00
|
|
|
this.fetchInstances();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
this.fetchInstances();
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
showInstance() {
|
|
|
|
this.$root.api('federation/show-instance', {
|
|
|
|
host: this.target
|
|
|
|
}).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-08 04:26:43 +09:00
|
|
|
this.instances = [];
|
2019-02-07 18:11:20 +09:00
|
|
|
this.$root.api('federation/instances', {
|
2019-02-08 04:26:43 +09:00
|
|
|
state: this.state,
|
2019-02-07 22:00:55 +09:00
|
|
|
sort: this.sort,
|
2019-02-08 04:26:43 +09:00
|
|
|
limit: this.limit
|
2019-02-07 18:11:20 +09:00
|
|
|
}).then(instances => {
|
|
|
|
this.instances = instances;
|
|
|
|
});
|
2019-02-07 21:59:18 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
removeAllFollowing() {
|
|
|
|
this.$root.api('admin/federation/remove-all-following', {
|
|
|
|
host: this.instance.host
|
|
|
|
}).then(() => {
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'success',
|
|
|
|
splash: true
|
|
|
|
});
|
|
|
|
});
|
2019-02-08 04:26:43 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
updateInstance() {
|
|
|
|
this.$root.api('admin/federation/update-instance', {
|
|
|
|
host: this.instance.host,
|
|
|
|
isBlocked: this.instance.isBlocked,
|
|
|
|
});
|
|
|
|
},
|
2019-02-07 18:11:20 +09: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>
|