ダッシュボードにモデレーター一覧を表示
This commit is contained in:
parent
c801434d11
commit
dd4c411d22
|
@ -26,7 +26,7 @@ export const paramDef = {
|
||||||
properties: {
|
properties: {
|
||||||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||||
offset: { type: 'integer', default: 0 },
|
offset: { type: 'integer', default: 0 },
|
||||||
sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt'] },
|
sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt', '+lastActiveDate', '-lastActiveDate'] },
|
||||||
state: { type: 'string', enum: ['all', 'alive', 'available', 'admin', 'moderator', 'adminOrModerator', 'silenced', 'suspended'], default: 'all' },
|
state: { type: 'string', enum: ['all', 'alive', 'available', 'admin', 'moderator', 'adminOrModerator', 'silenced', 'suspended'], default: 'all' },
|
||||||
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'combined' },
|
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'combined' },
|
||||||
username: { type: 'string', nullable: true, default: null },
|
username: { type: 'string', nullable: true, default: null },
|
||||||
|
@ -82,6 +82,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
case '-createdAt': query.orderBy('user.createdAt', 'ASC'); break;
|
case '-createdAt': query.orderBy('user.createdAt', 'ASC'); break;
|
||||||
case '+updatedAt': query.orderBy('user.updatedAt', 'DESC', 'NULLS LAST'); break;
|
case '+updatedAt': query.orderBy('user.updatedAt', 'DESC', 'NULLS LAST'); break;
|
||||||
case '-updatedAt': query.orderBy('user.updatedAt', 'ASC', 'NULLS FIRST'); break;
|
case '-updatedAt': query.orderBy('user.updatedAt', 'ASC', 'NULLS FIRST'); break;
|
||||||
|
case '+lastActiveDate': query.orderBy('user.lastActiveDate', 'DESC', 'NULLS LAST'); break;
|
||||||
|
case '-lastActiveDate': query.orderBy('user.lastActiveDate', 'ASC', 'NULLS FIRST'); break;
|
||||||
default: query.orderBy('user.id', 'ASC'); break;
|
default: query.orderBy('user.id', 'ASC'); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<MkLoading v-if="fetching"/>
|
||||||
|
<div v-else :class="$style.root">
|
||||||
|
<MkA v-for="user in moderators" :key="user.id" v-user-preview="user.id" class="user" :to="`/user-info/${user.id}`">
|
||||||
|
<MkAvatar :user="user" class="avatar" :show-indicator="true" :disable-link="true"/>
|
||||||
|
</MkA>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onMounted, onUnmounted, ref } from 'vue';
|
||||||
|
import * as os from '@/os';
|
||||||
|
import number from '@/filters/number';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
|
||||||
|
let moderators: any = $ref(null);
|
||||||
|
let fetching = $ref(true);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
moderators = await os.api('admin/show-users', {
|
||||||
|
sort: '+lastActiveDate',
|
||||||
|
state: 'adminOrModerator',
|
||||||
|
limit: 30,
|
||||||
|
});
|
||||||
|
|
||||||
|
fetching = false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
.root {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(30px, 40px));
|
||||||
|
grid-gap: 12px;
|
||||||
|
place-content: center;
|
||||||
|
|
||||||
|
&:global {
|
||||||
|
> .user {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
|
||||||
|
> .avatar {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue