2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2021-04-22 13:29:33 +00:00
|
|
|
<div class="enuoauvw">
|
|
|
|
<div class="query">
|
|
|
|
<MkInput v-model:value="host" :debounce="true"><span>{{ $ts.host }}</span></MkInput>
|
|
|
|
<div class="inputs" style="display: flex;">
|
|
|
|
<MkSelect v-model:value="state" style="margin: 0; flex: 1;">
|
|
|
|
<template #label>{{ $ts.state }}</template>
|
|
|
|
<option value="all">{{ $ts.all }}</option>
|
|
|
|
<option value="federating">{{ $ts.federating }}</option>
|
|
|
|
<option value="subscribing">{{ $ts.subscribing }}</option>
|
|
|
|
<option value="publishing">{{ $ts.publishing }}</option>
|
|
|
|
<option value="suspended">{{ $ts.suspended }}</option>
|
|
|
|
<option value="blocked">{{ $ts.blocked }}</option>
|
|
|
|
<option value="notResponding">{{ $ts.notResponding }}</option>
|
|
|
|
</MkSelect>
|
|
|
|
<MkSelect v-model:value="sort" style="margin: 0; flex: 1;">
|
|
|
|
<template #label>{{ $ts.sort }}</template>
|
|
|
|
<option value="+pubSub">{{ $ts.pubSub }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-pubSub">{{ $ts.pubSub }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
<option value="+notes">{{ $ts.notes }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-notes">{{ $ts.notes }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
<option value="+users">{{ $ts.users }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-users">{{ $ts.users }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
<option value="+following">{{ $ts.following }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-following">{{ $ts.following }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
<option value="+followers">{{ $ts.followers }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-followers">{{ $ts.followers }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
<option value="+caughtAt">{{ $ts.caughtAt }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-caughtAt">{{ $ts.caughtAt }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
<option value="+lastCommunicatedAt">{{ $ts.lastCommunicatedAt }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-lastCommunicatedAt">{{ $ts.lastCommunicatedAt }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
<option value="+driveUsage">{{ $ts.driveUsage }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-driveUsage">{{ $ts.driveUsage }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
<option value="+driveFiles">{{ $ts.driveFiles }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-driveFiles">{{ $ts.driveFiles }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
</MkSelect>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
2021-04-22 13:29:33 +00:00
|
|
|
|
|
|
|
<MkPagination :pagination="pagination" #default="{items}" ref="instances" :key="host + state">
|
|
|
|
<div class="ppgwaixt _block" v-for="instance in items" :key="instance.id" @click="info(instance)">
|
|
|
|
<div class="host"><i class="fas fa-circle indicator" :class="getStatus(instance)"></i><b>{{ instance.host }}</b></div>
|
|
|
|
<div class="status">
|
|
|
|
<span class="sub" v-if="instance.followersCount > 0"><i class="fas fa-caret-down icon"></i>Sub</span>
|
|
|
|
<span class="sub" v-else><i class="fas fa-caret-down icon"></i>-</span>
|
|
|
|
<span class="pub" v-if="instance.followingCount > 0"><i class="fas fa-caret-up icon"></i>Pub</span>
|
|
|
|
<span class="pub" v-else><i class="fas fa-caret-up icon"></i>-</span>
|
|
|
|
<span class="lastCommunicatedAt"><i class="fas fa-exchange-alt icon"></i><MkTime :time="instance.lastCommunicatedAt"/></span>
|
|
|
|
<span class="latestStatus"><i class="fas fa-traffic-light icon"></i>{{ instance.latestStatus || '-' }}</span>
|
|
|
|
</div>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
2021-04-22 13:29:33 +00:00
|
|
|
</MkPagination>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 11:12:00 +00:00
|
|
|
import { defineComponent } from 'vue';
|
2021-03-23 08:30:14 +00:00
|
|
|
import MkButton from '@client/components/ui/button.vue';
|
|
|
|
import MkInput from '@client/components/ui/input.vue';
|
|
|
|
import MkSelect from '@client/components/ui/select.vue';
|
|
|
|
import MkPagination from '@client/components/ui/pagination.vue';
|
2020-08-10 11:23:51 +00:00
|
|
|
import MkInstanceInfo from './instance.vue';
|
2021-03-23 08:30:14 +00:00
|
|
|
import * as os from '@client/os';
|
2021-04-10 03:54:12 +00:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
export default defineComponent({
|
2020-01-29 19:37:25 +00:00
|
|
|
components: {
|
|
|
|
MkButton,
|
|
|
|
MkInput,
|
|
|
|
MkSelect,
|
|
|
|
MkPagination,
|
|
|
|
},
|
|
|
|
|
2021-04-22 13:29:33 +00:00
|
|
|
emits: ['info'],
|
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2021-04-10 03:54:12 +00:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-12-26 01:47:36 +00:00
|
|
|
title: this.$ts.federation,
|
2021-04-20 14:22:59 +00:00
|
|
|
icon: 'fas fa-globe'
|
2020-10-17 11:12:00 +00:00
|
|
|
},
|
2020-01-29 19:37:25 +00:00
|
|
|
host: '',
|
|
|
|
state: 'federating',
|
|
|
|
sort: '+pubSub',
|
|
|
|
pagination: {
|
|
|
|
endpoint: 'federation/instances',
|
|
|
|
limit: 10,
|
|
|
|
offsetMode: true,
|
|
|
|
params: () => ({
|
|
|
|
sort: this.sort,
|
|
|
|
host: this.host != '' ? this.host : null,
|
|
|
|
...(
|
|
|
|
this.state === 'federating' ? { federating: true } :
|
|
|
|
this.state === 'subscribing' ? { subscribing: true } :
|
|
|
|
this.state === 'publishing' ? { publishing: true } :
|
|
|
|
this.state === 'suspended' ? { suspended: true } :
|
|
|
|
this.state === 'blocked' ? { blocked: true } :
|
|
|
|
this.state === 'notResponding' ? { notResponding: true } :
|
|
|
|
{})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
host() {
|
|
|
|
this.$refs.instances.reload();
|
|
|
|
},
|
|
|
|
state() {
|
|
|
|
this.$refs.instances.reload();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-04-22 13:29:33 +00:00
|
|
|
mounted() {
|
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
|
|
|
},
|
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
methods: {
|
|
|
|
getStatus(instance) {
|
|
|
|
if (instance.isSuspended) return 'off';
|
|
|
|
if (instance.isNotResponding) return 'red';
|
|
|
|
return 'green';
|
|
|
|
},
|
|
|
|
|
|
|
|
info(instance) {
|
2020-10-17 11:12:00 +00:00
|
|
|
os.popup(MkInstanceInfo, {
|
2020-01-29 19:37:25 +00:00
|
|
|
instance: instance
|
2020-10-17 11:12:00 +00:00
|
|
|
}, {}, 'closed');
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-04-22 13:29:33 +00:00
|
|
|
.enuoauvw {
|
|
|
|
> .query {
|
|
|
|
margin: var(--margin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
.ppgwaixt {
|
|
|
|
cursor: pointer;
|
|
|
|
padding: 16px;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
&:hover {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> .host {
|
|
|
|
> .indicator {
|
|
|
|
font-size: 70%;
|
|
|
|
vertical-align: baseline;
|
|
|
|
margin-right: 4px;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
&.green {
|
|
|
|
color: #49c5ba;
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
&.yellow {
|
|
|
|
color: #c5a549;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.red {
|
|
|
|
color: #c54949;
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
&.off {
|
|
|
|
color: rgba(0, 0, 0, 0.5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> .status {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
font-size: 90%;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> span {
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
> .icon {
|
|
|
|
margin-right: 6px;
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|