2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2021-11-28 11:07:37 +00:00
|
|
|
<MkSpacer :content-max="1000">
|
|
|
|
<div class="taeiyria">
|
|
|
|
<div class="query">
|
|
|
|
<MkInput v-model="host" :debounce="true" class="">
|
|
|
|
<template #prefix><i class="fas fa-search"></i></template>
|
|
|
|
<template #label>{{ $ts.host }}</template>
|
|
|
|
</MkInput>
|
2021-12-30 12:47:48 +00:00
|
|
|
<FormSplit style="margin-top: var(--margin);">
|
2021-11-28 11:07:37 +00:00
|
|
|
<MkSelect v-model="state">
|
|
|
|
<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="sort">
|
|
|
|
<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.registeredAt }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-caughtAt">{{ $ts.registeredAt }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
<option value="+lastCommunicatedAt">{{ $ts.lastCommunication }} ({{ $ts.descendingOrder }})</option>
|
|
|
|
<option value="-lastCommunicatedAt">{{ $ts.lastCommunication }} ({{ $ts.ascendingOrder }})</option>
|
|
|
|
</MkSelect>
|
2021-12-30 12:47:48 +00:00
|
|
|
</FormSplit>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2021-12-02 11:09:12 +00:00
|
|
|
<MkPagination v-slot="{items}" ref="instances" :key="host + state" :pagination="pagination">
|
2021-11-28 11:07:37 +00:00
|
|
|
<div class="dqokceoi">
|
|
|
|
<MkA v-for="instance in items" :key="instance.id" class="instance" :to="`/instance-info/${instance.host}`">
|
|
|
|
<div class="host"><img :src="instance.faviconUrl">{{ instance.host }}</div>
|
|
|
|
<div class="table">
|
|
|
|
<div class="cell">
|
|
|
|
<div class="key">{{ $ts.registeredAt }}</div>
|
|
|
|
<div class="value"><MkTime :time="instance.caughtAt"/></div>
|
|
|
|
</div>
|
|
|
|
<div class="cell">
|
|
|
|
<div class="key">{{ $ts.software }}</div>
|
|
|
|
<div class="value">{{ instance.softwareName || `(${$ts.unknown})` }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="cell">
|
|
|
|
<div class="key">{{ $ts.version }}</div>
|
|
|
|
<div class="value">{{ instance.softwareVersion || `(${$ts.unknown})` }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="cell">
|
|
|
|
<div class="key">{{ $ts.users }}</div>
|
|
|
|
<div class="value">{{ instance.usersCount }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="cell">
|
|
|
|
<div class="key">{{ $ts.notes }}</div>
|
|
|
|
<div class="value">{{ instance.notesCount }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="cell">
|
|
|
|
<div class="key">{{ $ts.sent }}</div>
|
|
|
|
<div class="value"><MkTime v-if="instance.latestRequestSentAt" :time="instance.latestRequestSentAt"/><span v-else>N/A</span></div>
|
|
|
|
</div>
|
|
|
|
<div class="cell">
|
|
|
|
<div class="key">{{ $ts.received }}</div>
|
|
|
|
<div class="value"><MkTime v-if="instance.latestRequestReceivedAt" :time="instance.latestRequestReceivedAt"/><span v-else>N/A</span></div>
|
|
|
|
</div>
|
2021-10-23 19:03:07 +00:00
|
|
|
</div>
|
2021-11-28 11:07:37 +00:00
|
|
|
<div class="footer">
|
|
|
|
<span class="status" :class="getStatus(instance)">{{ getStatus(instance) }}</span>
|
|
|
|
<span class="pubSub">
|
|
|
|
<span v-if="instance.followersCount > 0" class="sub"><i class="fas fa-caret-down icon"></i>Sub</span>
|
|
|
|
<span v-else class="sub"><i class="fas fa-caret-down icon"></i>-</span>
|
|
|
|
<span v-if="instance.followingCount > 0" class="pub"><i class="fas fa-caret-up icon"></i>Pub</span>
|
|
|
|
<span v-else class="pub"><i class="fas fa-caret-up icon"></i>-</span>
|
|
|
|
</span>
|
|
|
|
<span class="right">
|
|
|
|
<span class="latestStatus">{{ instance.latestStatus || '-' }}</span>
|
|
|
|
<span class="lastCommunicatedAt"><MkTime :time="instance.lastCommunicatedAt"/></span>
|
|
|
|
</span>
|
2021-10-23 19:03:07 +00:00
|
|
|
</div>
|
2021-11-28 11:07:37 +00:00
|
|
|
</MkA>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
2020-01-29 19:37:25 +00:00
|
|
|
</template>
|
|
|
|
|
2022-01-14 14:23:08 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed } from 'vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import MkButton from '@/components/ui/button.vue';
|
|
|
|
import MkInput from '@/components/form/input.vue';
|
|
|
|
import MkSelect from '@/components/form/select.vue';
|
|
|
|
import MkPagination from '@/components/ui/pagination.vue';
|
2021-12-30 12:47:48 +00:00
|
|
|
import FormSplit from '@/components/form/split.vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import * as os from '@/os';
|
|
|
|
import * as symbols from '@/symbols';
|
2022-01-14 14:23:08 +00:00
|
|
|
import { i18n } from '@/i18n';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-01-14 14:23:08 +00:00
|
|
|
let host = $ref('');
|
|
|
|
let state = $ref('federating');
|
|
|
|
let sort = $ref('+pubSub');
|
|
|
|
const pagination = {
|
|
|
|
endpoint: 'federation/instances' as const,
|
|
|
|
limit: 10,
|
|
|
|
offsetMode: true,
|
|
|
|
params: computed(() => ({
|
|
|
|
sort: sort,
|
2022-02-01 15:27:22 +00:00
|
|
|
host: host !== '' ? host : null,
|
2022-01-14 14:23:08 +00:00
|
|
|
...(
|
|
|
|
state === 'federating' ? { federating: true } :
|
|
|
|
state === 'subscribing' ? { subscribing: true } :
|
|
|
|
state === 'publishing' ? { publishing: true } :
|
|
|
|
state === 'suspended' ? { suspended: true } :
|
|
|
|
state === 'blocked' ? { blocked: true } :
|
|
|
|
state === 'notResponding' ? { notResponding: true } :
|
|
|
|
{})
|
|
|
|
}))
|
|
|
|
};
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-01-14 14:23:08 +00:00
|
|
|
function getStatus(instance) {
|
|
|
|
if (instance.isSuspended) return 'suspended';
|
|
|
|
if (instance.isNotResponding) return 'error';
|
|
|
|
return 'alive';
|
|
|
|
};
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2022-01-14 14:23:08 +00:00
|
|
|
defineExpose({
|
|
|
|
[symbols.PAGE_INFO]: {
|
2022-01-28 02:39:49 +00:00
|
|
|
title: i18n.ts.federation,
|
2022-01-14 14:23:08 +00:00
|
|
|
icon: 'fas fa-globe',
|
|
|
|
bg: 'var(--bg)',
|
2020-01-29 19:37:25 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-08-07 01:24:50 +00:00
|
|
|
.taeiyria {
|
2021-04-22 13:29:33 +00:00
|
|
|
> .query {
|
2021-08-07 01:24:50 +00:00
|
|
|
background: var(--bg);
|
2021-11-28 11:07:37 +00:00
|
|
|
margin-bottom: 16px;
|
2021-04-22 13:29:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-07 01:24:50 +00:00
|
|
|
.dqokceoi {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
|
|
|
|
grid-gap: 12px;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-08-07 01:24:50 +00:00
|
|
|
> .instance {
|
|
|
|
padding: 16px;
|
2022-02-01 15:27:22 +00:00
|
|
|
background: var(--panel);
|
|
|
|
border-radius: 8px;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-08-07 01:24:50 +00:00
|
|
|
&:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-08-07 01:24:50 +00:00
|
|
|
> .host {
|
|
|
|
font-weight: bold;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
|
|
> img {
|
|
|
|
width: 18px;
|
|
|
|
height: 18px;
|
|
|
|
margin-right: 6px;
|
|
|
|
vertical-align: middle;
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
2021-08-07 01:24:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
> .table {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
|
|
|
|
grid-gap: 6px;
|
|
|
|
margin: 6px 0;
|
|
|
|
font-size: 70%;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-08-07 01:24:50 +00:00
|
|
|
> .cell {
|
|
|
|
> .key, > .value {
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .key {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .value {
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
2021-08-07 01:24:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
> .footer {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2021-08-09 12:45:46 +00:00
|
|
|
font-size: 0.9em;
|
2021-08-07 01:24:50 +00:00
|
|
|
|
|
|
|
> .status {
|
|
|
|
&.suspended {
|
|
|
|
opacity: 0.5;
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2021-08-07 01:24:50 +00:00
|
|
|
&.error {
|
|
|
|
color: var(--error);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.alive {
|
|
|
|
color: var(--success);
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-08-07 01:24:50 +00:00
|
|
|
> .pubSub {
|
|
|
|
margin-left: 8px;
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-08-07 01:24:50 +00:00
|
|
|
> .right {
|
|
|
|
margin-left: auto;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-08-07 01:24:50 +00:00
|
|
|
> .latestStatus {
|
|
|
|
border: solid 1px var(--divider);
|
|
|
|
border-radius: 4px;
|
|
|
|
margin: 0 8px;
|
|
|
|
padding: 0 4px;
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|