インスタンス一覧ページ

This commit is contained in:
syuilo 2021-08-07 10:24:50 +09:00
parent 742a005523
commit 9f9d7325fd
4 changed files with 146 additions and 61 deletions

View File

@ -765,6 +765,8 @@ customCss: "カスタムCSS"
customCssWarn: "この設定は必ず知識のある方が行ってください。不適切な設定を行うとクライアントが正常に使用できなくなる恐れがあります。" customCssWarn: "この設定は必ず知識のある方が行ってください。不適切な設定を行うとクライアントが正常に使用できなくなる恐れがあります。"
global: "グローバル" global: "グローバル"
squareAvatars: "アイコンを四角形で表示" squareAvatars: "アイコンを四角形で表示"
sent: "送信"
received: "受信"
searchResult: "検索結果" searchResult: "検索結果"
_docs: _docs:

View File

@ -113,6 +113,11 @@ export const menuDef = {
icon: 'fas fa-satellite-dish', icon: 'fas fa-satellite-dish',
to: '/channels', to: '/channels',
}, },
federation: {
title: 'federation',
icon: 'fas fa-globe',
to: '/federation',
},
emojis: { emojis: {
title: 'emojis', title: 'emojis',
icon: 'fas fa-laugh', icon: 'fas fa-laugh',

View File

@ -1,9 +1,12 @@
<template> <template>
<div class="enuoauvw"> <div class="taeiyria">
<div class="query"> <div class="query">
<MkInput v-model:value="host" :debounce="true"><span>{{ $ts.host }}</span></MkInput> <MkInput v-model="host" :debounce="true" class="_inputNoTopMargin">
<div class="inputs" style="display: flex;"> <template #prefix><i class="fas fa-search"></i></template>
<MkSelect v-model:value="state" style="margin: 0; flex: 1;"> <template #label>{{ $ts.host }}</template>
</MkInput>
<div class="_inputSplit _inputNoBottomMargin">
<MkSelect v-model="state">
<template #label>{{ $ts.state }}</template> <template #label>{{ $ts.state }}</template>
<option value="all">{{ $ts.all }}</option> <option value="all">{{ $ts.all }}</option>
<option value="federating">{{ $ts.federating }}</option> <option value="federating">{{ $ts.federating }}</option>
@ -13,7 +16,7 @@
<option value="blocked">{{ $ts.blocked }}</option> <option value="blocked">{{ $ts.blocked }}</option>
<option value="notResponding">{{ $ts.notResponding }}</option> <option value="notResponding">{{ $ts.notResponding }}</option>
</MkSelect> </MkSelect>
<MkSelect v-model:value="sort" style="margin: 0; flex: 1;"> <MkSelect v-model="sort">
<template #label>{{ $ts.sort }}</template> <template #label>{{ $ts.sort }}</template>
<option value="+pubSub">{{ $ts.pubSub }} ({{ $ts.descendingOrder }})</option> <option value="+pubSub">{{ $ts.pubSub }} ({{ $ts.descendingOrder }})</option>
<option value="-pubSub">{{ $ts.pubSub }} ({{ $ts.ascendingOrder }})</option> <option value="-pubSub">{{ $ts.pubSub }} ({{ $ts.ascendingOrder }})</option>
@ -38,16 +41,53 @@
</div> </div>
<MkPagination :pagination="pagination" #default="{items}" ref="instances" :key="host + state"> <MkPagination :pagination="pagination" #default="{items}" ref="instances" :key="host + state">
<div class="ppgwaixt _block" v-for="instance in items" :key="instance.id" @click="info(instance)"> <div class="dqokceoi">
<div class="host"><i class="fas fa-circle indicator" :class="getStatus(instance)"></i><b>{{ instance.host }}</b></div> <MkA class="instance" v-for="instance in items" :key="instance.id" :to="`/instance-info/${instance.host}`">
<div class="status"> <div class="host"><img :src="instance.faviconUrl">{{ instance.host }}</div>
<span class="sub" v-if="instance.followersCount > 0"><i class="fas fa-caret-down icon"></i>Sub</span> <div class="table">
<span class="sub" v-else><i class="fas fa-caret-down icon"></i>-</span> <div class="cell">
<span class="pub" v-if="instance.followingCount > 0"><i class="fas fa-caret-up icon"></i>Pub</span> <div class="key">{{ $ts.registeredAt }}</div>
<span class="pub" v-else><i class="fas fa-caret-up icon"></i>-</span> <div class="value"><MkTime :time="instance.caughtAt"/></div>
<span class="lastCommunicatedAt"><i class="fas fa-exchange-alt icon"></i><MkTime :time="instance.lastCommunicatedAt"/></span> </div>
<span class="latestStatus"><i class="fas fa-traffic-light icon"></i>{{ instance.latestStatus || '-' }}</span> <div class="cell">
</div> <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>
</div>
<div class="footer">
<span class="status" :class="getStatus(instance)">{{ getStatus(instance) }}</span>
<span class="pubSub">
<span class="sub" v-if="instance.followersCount > 0"><i class="fas fa-caret-down icon"></i>Sub</span>
<span class="sub" v-else><i class="fas fa-caret-down icon"></i>-</span>
<span class="pub" v-if="instance.followingCount > 0"><i class="fas fa-caret-up icon"></i>Pub</span>
<span class="pub" v-else><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>
</div>
</MkA>
</div> </div>
</MkPagination> </MkPagination>
</div> </div>
@ -59,7 +99,6 @@ import MkButton from '@client/components/ui/button.vue';
import MkInput from '@client/components/ui/input.vue'; import MkInput from '@client/components/ui/input.vue';
import MkSelect from '@client/components/ui/select.vue'; import MkSelect from '@client/components/ui/select.vue';
import MkPagination from '@client/components/ui/pagination.vue'; import MkPagination from '@client/components/ui/pagination.vue';
import MkInstanceInfo from './instance.vue';
import * as os from '@client/os'; import * as os from '@client/os';
import * as symbols from '@client/symbols'; import * as symbols from '@client/symbols';
@ -117,69 +156,108 @@ export default defineComponent({
methods: { methods: {
getStatus(instance) { getStatus(instance) {
if (instance.isSuspended) return 'off'; if (instance.isSuspended) return 'suspended';
if (instance.isNotResponding) return 'red'; if (instance.isNotResponding) return 'error';
return 'green'; return 'alive';
}, },
info(instance) {
os.popup(MkInstanceInfo, {
instance: instance
}, {}, 'closed');
}
} }
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.enuoauvw { .taeiyria {
> .query { > .query {
margin: var(--margin); background: var(--bg);
padding: 16px;
border-bottom: solid 0.5px var(--divider);
} }
} }
.ppgwaixt { .dqokceoi {
cursor: pointer; display: grid;
grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
grid-gap: 12px;
padding: 16px; padding: 16px;
&:hover { > .instance {
color: var(--accent); padding: 16px;
} border: solid 1px var(--divider);
border-radius: 6px;
> .host { &:hover {
> .indicator { border: solid 1px var(--accent);
font-size: 70%; text-decoration: none;
vertical-align: baseline; }
margin-right: 4px;
&.green { > .host {
color: #49c5ba; font-weight: bold;
} white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&.yellow { > img {
color: #c5a549; width: 18px;
} height: 18px;
margin-right: 6px;
&.red { vertical-align: middle;
color: #c54949;
}
&.off {
color: rgba(0, 0, 0, 0.5);
} }
} }
}
> .status { > .table {
display: flex; display: grid;
align-items: center; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
font-size: 90%; grid-gap: 6px;
margin: 6px 0;
font-size: 70%;
> span { > .cell {
flex: 1; > .key, > .value {
white-space: nowrap;
> .icon { overflow: hidden;
margin-right: 6px; text-overflow: ellipsis;
}
> .key {
opacity: 0.7;
}
> .value {
}
}
}
> .footer {
display: flex;
align-items: center;
> .status {
&.suspended {
opacity: 0.5;
}
&.error {
color: var(--error);
}
&.alive {
color: var(--success);
}
}
> .pubSub {
margin-left: 8px;
}
> .right {
margin-left: auto;
font-size: 0.9em;
> .latestStatus {
border: solid 1px var(--divider);
border-radius: 4px;
margin: 0 8px;
padding: 0 4px;
}
} }
} }
} }

View File

@ -100,7 +100,7 @@ export default defineComponent({
case 'overview': return defineAsyncComponent(() => import('./overview.vue')); case 'overview': return defineAsyncComponent(() => import('./overview.vue'));
case 'users': return defineAsyncComponent(() => import('./users.vue')); case 'users': return defineAsyncComponent(() => import('./users.vue'));
case 'emojis': return defineAsyncComponent(() => import('./emojis.vue')); case 'emojis': return defineAsyncComponent(() => import('./emojis.vue'));
case 'federation': return defineAsyncComponent(() => import('./federation.vue')); case 'federation': return defineAsyncComponent(() => import('../federation.vue'));
case 'queue': return defineAsyncComponent(() => import('./queue.vue')); case 'queue': return defineAsyncComponent(() => import('./queue.vue'));
case 'files': return defineAsyncComponent(() => import('./files.vue')); case 'files': return defineAsyncComponent(() => import('./files.vue'));
case 'announcements': return defineAsyncComponent(() => import('./announcements.vue')); case 'announcements': return defineAsyncComponent(() => import('./announcements.vue'));