2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-06-29 04:13:32 +02:00
|
|
|
<template>
|
2023-11-02 01:12:09 +01:00
|
|
|
<div class="_gaps">
|
2023-05-19 09:20:53 +02:00
|
|
|
<div>
|
2022-06-29 04:13:32 +02:00
|
|
|
<MkInput v-model="host" :debounce="true" class="">
|
2023-09-30 21:53:52 +02:00
|
|
|
<template #prefix><i class="ph-magnifying-glass ph-bold ph-lg"></i></template>
|
2022-07-20 15:24:26 +02:00
|
|
|
<template #label>{{ i18n.ts.host }}</template>
|
2022-06-29 04:13:32 +02:00
|
|
|
</MkInput>
|
|
|
|
<FormSplit style="margin-top: var(--margin);">
|
|
|
|
<MkSelect v-model="state">
|
2022-07-20 15:24:26 +02: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>
|
2023-12-05 22:19:53 +01:00
|
|
|
<option value="nsfw">NSFW</option>
|
2022-07-20 15:24:26 +02:00
|
|
|
<option value="suspended">{{ i18n.ts.suspended }}</option>
|
2023-10-16 13:11:27 +02:00
|
|
|
<option value="silenced">{{ i18n.ts.silence }}</option>
|
2022-07-20 15:24:26 +02:00
|
|
|
<option value="blocked">{{ i18n.ts.blocked }}</option>
|
|
|
|
<option value="notResponding">{{ i18n.ts.notResponding }}</option>
|
2022-06-29 04:13:32 +02:00
|
|
|
</MkSelect>
|
|
|
|
<MkSelect v-model="sort">
|
2022-07-20 15:24:26 +02: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-15 21:02:38 +01:00
|
|
|
<option value="+firstRetrievedAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.descendingOrder }})</option>
|
|
|
|
<option value="-firstRetrievedAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.ascendingOrder }})</option>
|
2022-06-29 04:13:32 +02:00
|
|
|
</MkSelect>
|
|
|
|
</FormSplit>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<MkPagination v-slot="{items}" ref="instances" :key="host + state" :pagination="pagination">
|
2023-05-19 09:20:53 +02:00
|
|
|
<div :class="$style.items">
|
|
|
|
<MkA v-for="instance in items" :key="instance.id" v-tooltip.mfm="`Status: ${getStatus(instance)}`" :class="$style.item" :to="`/instance-info/${instance.host}`">
|
2023-01-09 01:43:28 +01:00
|
|
|
<MkInstanceCardMini :instance="instance"/>
|
2022-06-29 04:13:32 +02:00
|
|
|
</MkA>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
import { computed, ref } from 'vue';
|
2023-01-07 07:09:46 +01:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
|
|
|
import MkSelect from '@/components/MkSelect.vue';
|
2023-08-06 14:16:49 +02:00
|
|
|
import MkPagination, { Paging } from '@/components/MkPagination.vue';
|
2022-08-30 17:24:33 +02:00
|
|
|
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
|
2022-06-29 04:13:32 +02:00
|
|
|
import FormSplit from '@/components/form/split.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { i18n } from '@/i18n.js';
|
2022-06-29 04:13:32 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const host = ref('');
|
|
|
|
const state = ref('federating');
|
|
|
|
const sort = ref('+pubSub');
|
2022-06-29 04:13:32 +02:00
|
|
|
const pagination = {
|
|
|
|
endpoint: 'federation/instances' as const,
|
|
|
|
limit: 10,
|
2023-08-06 14:16:49 +02:00
|
|
|
displayLimit: 50,
|
2022-06-29 04:13:32 +02:00
|
|
|
offsetMode: true,
|
|
|
|
params: computed(() => ({
|
2023-12-07 06:42:09 +01:00
|
|
|
sort: sort.value,
|
|
|
|
host: host.value !== '' ? host.value : null,
|
2022-06-29 04:13:32 +02:00
|
|
|
...(
|
2023-12-07 06:42:09 +01:00
|
|
|
state.value === 'federating' ? { federating: true } :
|
|
|
|
state.value === 'subscribing' ? { subscribing: true } :
|
|
|
|
state.value === 'publishing' ? { publishing: true } :
|
|
|
|
state.value === 'suspended' ? { suspended: true } :
|
|
|
|
state.value === 'blocked' ? { blocked: true } :
|
|
|
|
state.value === 'silenced' ? { silenced: true } :
|
|
|
|
state.value === 'notResponding' ? { notResponding: true } :
|
2023-12-23 02:09:23 +01:00
|
|
|
state.value === 'nsfw' ? { nsfw: true } :
|
2022-06-29 04:13:32 +02:00
|
|
|
{}),
|
|
|
|
})),
|
2023-08-06 14:16:49 +02:00
|
|
|
} as Paging;
|
2022-06-29 04:13:32 +02:00
|
|
|
|
|
|
|
function getStatus(instance) {
|
|
|
|
if (instance.isSuspended) return 'Suspended';
|
|
|
|
if (instance.isBlocked) return 'Blocked';
|
2023-10-16 13:11:27 +02:00
|
|
|
if (instance.isSilenced) return 'Silenced';
|
2022-06-29 04:13:32 +02:00
|
|
|
if (instance.isNotResponding) return 'Error';
|
2023-12-05 22:19:53 +01:00
|
|
|
if (instance.isNSFW) return 'NSFW';
|
2022-06-29 04:13:32 +02:00
|
|
|
return 'Alive';
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2023-05-19 09:20:53 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.items {
|
2022-06-29 04:13:32 +02:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
|
|
|
|
grid-gap: 12px;
|
2023-05-19 09:20:53 +02:00
|
|
|
}
|
2022-06-29 04:13:32 +02:00
|
|
|
|
2023-05-19 09:20:53 +02:00
|
|
|
.item:hover {
|
|
|
|
text-decoration: none;
|
2022-06-29 04:13:32 +02:00
|
|
|
}
|
|
|
|
</style>
|