2020-01-29 13:37:25 -06:00
|
|
|
<template>
|
2022-06-20 03:38:49 -05:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
|
|
<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>
|
|
|
|
<FormSplit style="margin-top: var(--margin);">
|
|
|
|
<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>
|
|
|
|
</FormSplit>
|
|
|
|
</div>
|
2021-04-22 08:29:33 -05:00
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
<MkPagination v-slot="{items}" ref="instances" :key="host + state" :pagination="pagination">
|
|
|
|
<div class="dqokceoi">
|
2022-06-21 03:55:38 -05:00
|
|
|
<MkA v-for="instance in items" :key="instance.id" v-tooltip.mfm="`Last communicated: ${new Date(instance.lastCommunicatedAt).toLocaleString()}\nStatus: ${getStatus(instance)}`" class="instance" :to="`/instance-info/${instance.host}`" :behavior="'window'">
|
2022-06-22 09:40:53 -05:00
|
|
|
<MkInstanceCardMini :instance="instance"/>
|
2022-06-20 03:38:49 -05:00
|
|
|
</MkA>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2020-01-29 13:37:25 -06:00
|
|
|
</template>
|
|
|
|
|
2022-01-14 08:23:08 -06:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed } from 'vue';
|
2021-11-11 11:02:25 -06: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';
|
2022-06-22 09:40:53 -05:00
|
|
|
import MkInstanceCardMini from '@/components/instance-card-mini.vue';
|
2021-12-30 06:47:48 -06:00
|
|
|
import FormSplit from '@/components/form/split.vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import * as os from '@/os';
|
2022-01-14 08:23:08 -06:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 03:38:49 -05:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2022-01-14 08:23:08 -06: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 09:27:22 -06:00
|
|
|
host: host !== '' ? host : null,
|
2022-01-14 08:23:08 -06: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 } :
|
2022-06-20 03:38:49 -05:00
|
|
|
{}),
|
|
|
|
})),
|
2022-01-14 08:23:08 -06:00
|
|
|
};
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2022-01-14 08:23:08 -06:00
|
|
|
function getStatus(instance) {
|
2022-06-21 03:55:38 -05:00
|
|
|
if (instance.isSuspended) return 'Suspended';
|
|
|
|
if (instance.isBlocked) return 'Blocked';
|
|
|
|
if (instance.isNotResponding) return 'Error';
|
|
|
|
return 'Alive';
|
2022-06-10 00:36:55 -05:00
|
|
|
}
|
2021-04-22 08:29:33 -05:00
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.federation,
|
|
|
|
icon: 'fas fa-globe',
|
|
|
|
bg: 'var(--bg)',
|
2020-01-29 13:37:25 -06:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-08-06 20:24:50 -05:00
|
|
|
.taeiyria {
|
2021-04-22 08:29:33 -05:00
|
|
|
> .query {
|
2021-08-06 20:24:50 -05:00
|
|
|
background: var(--bg);
|
2021-11-28 05:07:37 -06:00
|
|
|
margin-bottom: 16px;
|
2021-04-22 08:29:33 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-06 20:24:50 -05:00
|
|
|
.dqokceoi {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
|
|
|
|
grid-gap: 12px;
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2022-06-21 03:55:38 -05:00
|
|
|
> .instance:hover {
|
|
|
|
text-decoration: none;
|
2020-01-29 13:37:25 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|