2022-06-29 11:13:32 +09:00
|
|
|
<template>
|
|
|
|
<div class="taeiyria">
|
|
|
|
<div class="query">
|
|
|
|
<MkInput v-model="host" :debounce="true" class="">
|
2022-12-19 19:01:30 +09:00
|
|
|
<template #prefix><i class="ti ti-search"></i></template>
|
2022-07-20 22:24:26 +09:00
|
|
|
<template #label>{{ i18n.ts.host }}</template>
|
2022-06-29 11:13:32 +09:00
|
|
|
</MkInput>
|
|
|
|
<FormSplit style="margin-top: var(--margin);">
|
|
|
|
<MkSelect v-model="state">
|
2022-07-20 22:24:26 +09:00
|
|
|
<template #label>{{ i18n.ts.state }}</template>
|
|
|
|
<option value="all">{{ i18n.ts.all }}</option>
|
|
|
|
<option value="federating">{{ i18n.ts.federating }}</option>
|
|
|
|
<option value="subscribing">{{ i18n.ts.subscribing }}</option>
|
|
|
|
<option value="publishing">{{ i18n.ts.publishing }}</option>
|
|
|
|
<option value="suspended">{{ i18n.ts.suspended }}</option>
|
|
|
|
<option value="blocked">{{ i18n.ts.blocked }}</option>
|
|
|
|
<option value="notResponding">{{ i18n.ts.notResponding }}</option>
|
2022-06-29 11:13:32 +09:00
|
|
|
</MkSelect>
|
|
|
|
<MkSelect v-model="sort">
|
2022-07-20 22:24:26 +09:00
|
|
|
<template #label>{{ i18n.ts.sort }}</template>
|
|
|
|
<option value="+pubSub">{{ i18n.ts.pubSub }} ({{ i18n.ts.descendingOrder }})</option>
|
|
|
|
<option value="-pubSub">{{ i18n.ts.pubSub }} ({{ i18n.ts.ascendingOrder }})</option>
|
|
|
|
<option value="+notes">{{ i18n.ts.notes }} ({{ i18n.ts.descendingOrder }})</option>
|
|
|
|
<option value="-notes">{{ i18n.ts.notes }} ({{ i18n.ts.ascendingOrder }})</option>
|
|
|
|
<option value="+users">{{ i18n.ts.users }} ({{ i18n.ts.descendingOrder }})</option>
|
|
|
|
<option value="-users">{{ i18n.ts.users }} ({{ i18n.ts.ascendingOrder }})</option>
|
|
|
|
<option value="+following">{{ i18n.ts.following }} ({{ i18n.ts.descendingOrder }})</option>
|
|
|
|
<option value="-following">{{ i18n.ts.following }} ({{ i18n.ts.ascendingOrder }})</option>
|
|
|
|
<option value="+followers">{{ i18n.ts.followers }} ({{ i18n.ts.descendingOrder }})</option>
|
|
|
|
<option value="-followers">{{ i18n.ts.followers }} ({{ i18n.ts.ascendingOrder }})</option>
|
2023-01-16 05:02:38 +09:00
|
|
|
<option value="+firstRetrievedAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.descendingOrder }})</option>
|
|
|
|
<option value="-firstRetrievedAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.ascendingOrder }})</option>
|
2022-06-29 11:13:32 +09:00
|
|
|
</MkSelect>
|
|
|
|
</FormSplit>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<MkPagination v-slot="{items}" ref="instances" :key="host + state" :pagination="pagination">
|
|
|
|
<div class="dqokceoi">
|
2023-01-09 09:04:35 +09:00
|
|
|
<MkA v-for="instance in items" :key="instance.id" v-tooltip.mfm="`Status: ${getStatus(instance)}`" class="instance" :to="`/instance-info/${instance.host}`">
|
2023-01-09 09:43:28 +09:00
|
|
|
<MkInstanceCardMini :instance="instance"/>
|
2022-06-29 11:13:32 +09:00
|
|
|
</MkA>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed } from 'vue';
|
2022-09-06 18:21:49 +09:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-01-07 15:09:46 +09:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
|
|
|
import MkSelect from '@/components/MkSelect.vue';
|
2022-09-06 18:21:49 +09:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
2022-08-31 00:24:33 +09:00
|
|
|
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
|
2022-06-29 11:13:32 +09:00
|
|
|
import FormSplit from '@/components/form/split.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { i18n } from '@/i18n';
|
2023-01-01 17:11:33 +09:00
|
|
|
import { dateString } from '@/filters/date';
|
2022-06-29 11:13:32 +09: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,
|
|
|
|
host: host !== '' ? host : null,
|
|
|
|
...(
|
|
|
|
state === 'federating' ? { federating: true } :
|
|
|
|
state === 'subscribing' ? { subscribing: true } :
|
|
|
|
state === 'publishing' ? { publishing: true } :
|
|
|
|
state === 'suspended' ? { suspended: true } :
|
|
|
|
state === 'blocked' ? { blocked: true } :
|
|
|
|
state === 'notResponding' ? { notResponding: true } :
|
|
|
|
{}),
|
|
|
|
})),
|
|
|
|
};
|
|
|
|
|
|
|
|
function getStatus(instance) {
|
|
|
|
if (instance.isSuspended) return 'Suspended';
|
|
|
|
if (instance.isBlocked) return 'Blocked';
|
|
|
|
if (instance.isNotResponding) return 'Error';
|
|
|
|
return 'Alive';
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-12-27 18:29:39 +09:00
|
|
|
<style lang="scss" scoped>
|
2022-06-29 11:13:32 +09:00
|
|
|
.taeiyria {
|
|
|
|
> .query {
|
|
|
|
background: var(--bg);
|
|
|
|
margin-bottom: 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.dqokceoi {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
|
|
|
|
grid-gap: 12px;
|
|
|
|
|
|
|
|
> .instance:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|