This commit is contained in:
tetsuya-ki 2024-10-20 06:13:32 +00:00 committed by GitHub
commit 6aa8d584c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 8 deletions

View file

@ -6,6 +6,7 @@
### Client
- Enhance: Bull DashboardでRelationship Queueの状態も確認できるように
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/751)
- Feat: コントロールパネル内のファイル一覧でファイル名と説明で検索できるように(#14789)
### Server
-

View file

@ -43,6 +43,8 @@ export const paramDef = {
default: null,
description: 'The local host is represented with `null`.',
},
name: { type: 'string', nullable: true },
comment: { type: 'string', nullable: true },
},
required: [],
} as const;
@ -81,6 +83,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
}
if (ps.name) {
// 前方一致検索(%と_は無害化)
query.andWhere('file.name ilike :name', { name: ps.name.replaceAll('%', '\\%').replaceAll('_', '\\_') + '%' });
}
if (ps.comment) {
// 前方一致検索(%と_は無害化)
query.andWhere('file.comment ilike :comment', { comment: ps.comment.replaceAll('%', '\\%').replaceAll('_', '\\_') + '%' });
}
const files = await query.limit(ps.limit).getMany();
return await this.driveFileEntityService.packMany(files, { detail: true, withUser: true, self: true });

View file

@ -20,14 +20,25 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.host }}</template>
</MkInput>
</div>
<div class="inputs" style="display: flex; gap: var(--MI-margin); flex-wrap: wrap;">
<MkInput v-model="userId" :debounce="true" type="search" style="margin: 0; flex: 1;">
<template #label>User ID</template>
</MkInput>
<MkInput v-model="type" :debounce="true" type="search" style="margin: 0; flex: 1;">
<template #label>MIME type</template>
</MkInput>
</div>
<MkFolder :defaultOpen="false">
<template #label>{{ i18n.ts.options }}</template>
<div class="inputs" style="display: flex; gap: var(--MI-margin); flex-wrap: wrap;">
<MkInput v-model="userId" :debounce="true" type="search" style="margin: 0; flex: 1;">
<template #label>User ID</template>
</MkInput>
<MkInput v-model="type" :debounce="true" type="search" style="margin: 0; flex: 1;">
<template #label>MIME type</template>
</MkInput>
</div>
<div class="inputs" style="display: flex; gap: var(--MI-margin); flex-wrap: wrap;">
<MkInput v-model="name" :debounce="true" type="search" style="margin: 0; flex: 1;">
<template #label>File Name</template>
</MkInput>
<MkInput v-model="comment" :debounce="true" type="search" style="margin: 0; flex: 1;">
<template #label>Comment</template>
</MkInput>
</div>
</MkFolder>
<MkFileListForAdmin :pagination="pagination" :viewMode="viewMode"/>
</div>
</MkSpacer>
@ -41,6 +52,7 @@ import XHeader from './_header_.vue';
import MkInput from '@/components/MkInput.vue';
import MkSelect from '@/components/MkSelect.vue';
import MkFileListForAdmin from '@/components/MkFileListForAdmin.vue';
import MkFolder from '@/components/MkFolder.vue';
import * as os from '@/os.js';
import { lookupFile } from '@/scripts/admin-lookup.js';
import { i18n } from '@/i18n.js';
@ -51,6 +63,8 @@ const type = ref<string | null>(null);
const searchHost = ref('');
const userId = ref('');
const viewMode = ref('grid');
const name = ref('');
const comment = ref('');
const pagination = {
endpoint: 'admin/drive/files' as const,
limit: 10,
@ -59,6 +73,8 @@ const pagination = {
userId: (userId.value && userId.value !== '') ? userId.value : null,
origin: origin.value,
hostname: (searchHost.value && searchHost.value !== '') ? searchHost.value : null,
name: (name.value && name.value !== '') ? name.value : null,
comment: (comment.value && comment.value !== '') ? comment.value : null,
})),
};

View file

@ -6812,6 +6812,8 @@ export type operations = {
* @default null
*/
hostname?: string | null;
name?: string | null;
comment?: string | null;
};
};
};