2020-01-29 13:37:25 -06:00
|
|
|
<template>
|
2020-10-17 06:12:00 -05:00
|
|
|
<div>
|
|
|
|
<div class="_section">
|
2020-01-29 13:37:25 -06:00
|
|
|
<div class="_content">
|
2020-10-17 06:12:00 -05:00
|
|
|
<MkInput v-model:value="host" :debounce="true"><span>{{ $t('host') }}</span></MkInput>
|
2020-01-29 13:37:25 -06:00
|
|
|
<div class="inputs" style="display: flex;">
|
2020-10-17 06:12:00 -05:00
|
|
|
<MkSelect v-model:value="state" style="margin: 0; flex: 1;">
|
2020-03-28 20:14:33 -05:00
|
|
|
<template #label>{{ $t('state') }}</template>
|
2020-07-24 11:56:52 -05:00
|
|
|
<option value="all">{{ $t('all') }}</option>
|
|
|
|
<option value="federating">{{ $t('federating') }}</option>
|
|
|
|
<option value="subscribing">{{ $t('subscribing') }}</option>
|
|
|
|
<option value="publishing">{{ $t('publishing') }}</option>
|
|
|
|
<option value="suspended">{{ $t('suspended') }}</option>
|
|
|
|
<option value="blocked">{{ $t('blocked') }}</option>
|
|
|
|
<option value="notResponding">{{ $t('notResponding') }}</option>
|
2020-10-17 06:12:00 -05:00
|
|
|
</MkSelect>
|
|
|
|
<MkSelect v-model:value="sort" style="margin: 0; flex: 1;">
|
2020-03-28 20:14:33 -05:00
|
|
|
<template #label>{{ $t('sort') }}</template>
|
|
|
|
<option value="+pubSub">{{ $t('pubSub') }} ({{ $t('descendingOrder') }})</option>
|
|
|
|
<option value="-pubSub">{{ $t('pubSub') }} ({{ $t('ascendingOrder') }})</option>
|
|
|
|
<option value="+notes">{{ $t('notes') }} ({{ $t('descendingOrder') }})</option>
|
|
|
|
<option value="-notes">{{ $t('notes') }} ({{ $t('ascendingOrder') }})</option>
|
|
|
|
<option value="+users">{{ $t('users') }} ({{ $t('descendingOrder') }})</option>
|
|
|
|
<option value="-users">{{ $t('users') }} ({{ $t('ascendingOrder') }})</option>
|
|
|
|
<option value="+following">{{ $t('following') }} ({{ $t('descendingOrder') }})</option>
|
|
|
|
<option value="-following">{{ $t('following') }} ({{ $t('ascendingOrder') }})</option>
|
|
|
|
<option value="+followers">{{ $t('followers') }} ({{ $t('descendingOrder') }})</option>
|
|
|
|
<option value="-followers">{{ $t('followers') }} ({{ $t('ascendingOrder') }})</option>
|
|
|
|
<option value="+caughtAt">{{ $t('caughtAt') }} ({{ $t('descendingOrder') }})</option>
|
|
|
|
<option value="-caughtAt">{{ $t('caughtAt') }} ({{ $t('ascendingOrder') }})</option>
|
|
|
|
<option value="+lastCommunicatedAt">{{ $t('lastCommunicatedAt') }} ({{ $t('descendingOrder') }})</option>
|
|
|
|
<option value="-lastCommunicatedAt">{{ $t('lastCommunicatedAt') }} ({{ $t('ascendingOrder') }})</option>
|
|
|
|
<option value="+driveUsage">{{ $t('driveUsage') }} ({{ $t('descendingOrder') }})</option>
|
|
|
|
<option value="-driveUsage">{{ $t('driveUsage') }} ({{ $t('ascendingOrder') }})</option>
|
|
|
|
<option value="+driveFiles">{{ $t('driveFiles') }} ({{ $t('descendingOrder') }})</option>
|
|
|
|
<option value="-driveFiles">{{ $t('driveFiles') }} ({{ $t('ascendingOrder') }})</option>
|
2020-10-17 06:12:00 -05:00
|
|
|
</MkSelect>
|
2020-01-29 13:37:25 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-17 06:12:00 -05:00
|
|
|
</div>
|
|
|
|
<div class="_section">
|
2020-01-29 13:37:25 -06:00
|
|
|
<div class="_content">
|
2020-10-17 06:12:00 -05:00
|
|
|
<MkPagination :pagination="pagination" #default="{items}" ref="instances" :key="host + state">
|
|
|
|
<div class="ppgwaixt _panel" v-for="instance in items" :key="instance.id" @click="info(instance)">
|
|
|
|
<div class="host"><Fa :icon="faCircle" class="indicator" :class="getStatus(instance)"/><b>{{ instance.host }}</b></div>
|
2020-01-29 13:37:25 -06:00
|
|
|
<div class="status">
|
2020-10-17 06:12:00 -05:00
|
|
|
<span class="sub" v-if="instance.followersCount > 0"><Fa :icon="faCaretDown" class="icon"/>Sub</span>
|
|
|
|
<span class="sub" v-else><Fa :icon="faCaretDown" class="icon"/>-</span>
|
|
|
|
<span class="pub" v-if="instance.followingCount > 0"><Fa :icon="faCaretUp" class="icon"/>Pub</span>
|
|
|
|
<span class="pub" v-else><Fa :icon="faCaretUp" class="icon"/>-</span>
|
|
|
|
<span class="lastCommunicatedAt"><Fa :icon="faExchangeAlt" class="icon"/><MkTime :time="instance.lastCommunicatedAt"/></span>
|
|
|
|
<span class="latestStatus"><Fa :icon="faTrafficLight" class="icon"/>{{ instance.latestStatus || '-' }}</span>
|
2020-01-29 13:37:25 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-17 06:12:00 -05:00
|
|
|
</MkPagination>
|
2020-01-29 13:37:25 -06:00
|
|
|
</div>
|
2020-10-17 06:12:00 -05:00
|
|
|
</div>
|
2020-01-29 13:37:25 -06:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 06:12:00 -05:00
|
|
|
import { defineComponent } from 'vue';
|
2020-01-29 13:37:25 -06:00
|
|
|
import { faGlobe, faCircle, faExchangeAlt, faCaretDown, faCaretUp, faTrafficLight } from '@fortawesome/free-solid-svg-icons';
|
2020-10-17 06:12:00 -05:00
|
|
|
import MkButton from '@/components/ui/button.vue';
|
|
|
|
import MkInput from '@/components/ui/input.vue';
|
|
|
|
import MkSelect from '@/components/ui/select.vue';
|
|
|
|
import MkPagination from '@/components/ui/pagination.vue';
|
2020-08-10 06:23:51 -05:00
|
|
|
import MkInstanceInfo from './instance.vue';
|
2020-10-17 06:12:00 -05:00
|
|
|
import * as os from '@/os';
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
export default defineComponent({
|
2020-01-29 13:37:25 -06:00
|
|
|
components: {
|
|
|
|
MkButton,
|
|
|
|
MkInput,
|
|
|
|
MkSelect,
|
|
|
|
MkPagination,
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-10-17 06:12:00 -05:00
|
|
|
INFO: {
|
|
|
|
header: [{
|
|
|
|
title: this.$t('federation'),
|
|
|
|
icon: faGlobe
|
|
|
|
}],
|
|
|
|
},
|
2020-01-29 13:37:25 -06: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 } :
|
|
|
|
{})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
faGlobe, faCircle, faExchangeAlt, faCaretDown, faCaretUp, faTrafficLight
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
host() {
|
|
|
|
this.$refs.instances.reload();
|
|
|
|
},
|
|
|
|
state() {
|
|
|
|
this.$refs.instances.reload();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
getStatus(instance) {
|
|
|
|
if (instance.isSuspended) return 'off';
|
|
|
|
if (instance.isNotResponding) return 'red';
|
|
|
|
return 'green';
|
|
|
|
},
|
|
|
|
|
|
|
|
info(instance) {
|
2020-10-17 06:12:00 -05:00
|
|
|
os.popup(MkInstanceInfo, {
|
2020-01-29 13:37:25 -06:00
|
|
|
instance: instance
|
2020-10-17 06:12:00 -05:00
|
|
|
}, {}, 'closed');
|
2020-01-29 13:37:25 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-10-17 06:12:00 -05:00
|
|
|
.ppgwaixt {
|
|
|
|
cursor: pointer;
|
|
|
|
padding: 16px;
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
&:hover {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
> .host {
|
|
|
|
> .indicator {
|
|
|
|
font-size: 70%;
|
|
|
|
vertical-align: baseline;
|
|
|
|
margin-right: 4px;
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
&.green {
|
|
|
|
color: #49c5ba;
|
|
|
|
}
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
&.yellow {
|
|
|
|
color: #c5a549;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.red {
|
|
|
|
color: #c54949;
|
|
|
|
}
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
&.off {
|
|
|
|
color: rgba(0, 0, 0, 0.5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
> .status {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
font-size: 90%;
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
> span {
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
> .icon {
|
|
|
|
margin-right: 6px;
|
2020-01-29 13:37:25 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|