Quick action implement (#13878)
* enhance(frontend): quick action for file admin-lookup * docs(changelog): update changelog * enhance(frontend): quick action for general admin-lookup, remove unimplemented note, instance admin-lookup * docs(changelog): update changelog * chore: fix lint
This commit is contained in:
parent
d013e4516d
commit
6af9492ea5
|
@ -49,6 +49,8 @@
|
|||
- Enhance: AiScriptを0.18.0にバージョンアップ
|
||||
- Enhance: 通常のノートでも、お気に入りに登録したチャンネルにリノートできるように
|
||||
- Enhance: 長いテキストをペーストした際にテキストファイルとして添付するかどうかを選択できるように
|
||||
- Enhance: コントロールパネルのクイックアクションからファイルを照会できるように
|
||||
- Enhance: コントロールパネルのクイックアクションから通常の照会を行えるように
|
||||
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
||||
- Fix: 周年の実績が閏年を考慮しない問題を修正
|
||||
- Fix: ローカルURLのプレビューポップアップが左上に表示される
|
||||
|
|
|
@ -42,7 +42,7 @@ import MkInput from '@/components/MkInput.vue';
|
|||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import MkFileListForAdmin from '@/components/MkFileListForAdmin.vue';
|
||||
import * as os from '@/os.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { lookupFile } from '@/scripts/admin-lookup.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
|
||||
|
@ -73,33 +73,10 @@ function clear() {
|
|||
});
|
||||
}
|
||||
|
||||
function show(file) {
|
||||
os.pageWindow(`/admin/file/${file.id}`);
|
||||
}
|
||||
|
||||
async function find() {
|
||||
const { canceled, result: q } = await os.inputText({
|
||||
title: i18n.ts.fileIdOrUrl,
|
||||
minLength: 1,
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
misskeyApi('admin/drive/show-file', q.startsWith('http://') || q.startsWith('https://') ? { url: q.trim() } : { fileId: q.trim() }).then(file => {
|
||||
show(file);
|
||||
}).catch(err => {
|
||||
if (err.code === 'NO_SUCH_FILE') {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: i18n.ts.notFound,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const headerActions = computed(() => [{
|
||||
text: i18n.ts.lookup,
|
||||
icon: 'ti ti-search',
|
||||
handler: find,
|
||||
handler: lookupFile,
|
||||
}, {
|
||||
text: i18n.ts.clearCachedFiles,
|
||||
icon: 'ti ti-trash',
|
||||
|
|
|
@ -33,9 +33,10 @@ import { i18n } from '@/i18n.js';
|
|||
import MkSuperMenu from '@/components/MkSuperMenu.vue';
|
||||
import MkInfo from '@/components/MkInfo.vue';
|
||||
import { instance } from '@/instance.js';
|
||||
import { lookup } from '@/scripts/lookup.js';
|
||||
import * as os from '@/os.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { lookupUser, lookupUserByEmail } from '@/scripts/lookup-user.js';
|
||||
import { lookupUser, lookupUserByEmail, lookupFile } from '@/scripts/admin-lookup.js';
|
||||
import { PageMetadata, definePageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
|
||||
import { useRouter } from '@/router/supplier.js';
|
||||
|
||||
|
@ -82,7 +83,7 @@ const menuDef = computed(() => [{
|
|||
type: 'button',
|
||||
icon: 'ti ti-search',
|
||||
text: i18n.ts.lookup,
|
||||
action: lookup,
|
||||
action: adminLookup,
|
||||
}, ...(instance.disableRegistration ? [{
|
||||
type: 'button',
|
||||
icon: 'ti ti-user-plus',
|
||||
|
@ -282,7 +283,7 @@ function invite() {
|
|||
});
|
||||
}
|
||||
|
||||
function lookup(ev: MouseEvent) {
|
||||
function adminLookup(ev: MouseEvent) {
|
||||
os.popupMenu([{
|
||||
text: i18n.ts.user,
|
||||
icon: 'ti ti-user',
|
||||
|
@ -295,23 +296,17 @@ function lookup(ev: MouseEvent) {
|
|||
action: () => {
|
||||
lookupUserByEmail();
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts.note,
|
||||
icon: 'ti ti-pencil',
|
||||
action: () => {
|
||||
alert('TODO');
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts.file,
|
||||
icon: 'ti ti-cloud',
|
||||
action: () => {
|
||||
alert('TODO');
|
||||
lookupFile();
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts.instance,
|
||||
icon: 'ti ti-planet',
|
||||
text: i18n.ts.lookup,
|
||||
icon: 'ti ti-world-search',
|
||||
action: () => {
|
||||
alert('TODO');
|
||||
lookup();
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ import MkInput from '@/components/MkInput.vue';
|
|||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import MkPagination from '@/components/MkPagination.vue';
|
||||
import * as os from '@/os.js';
|
||||
import { lookupUser } from '@/scripts/lookup-user.js';
|
||||
import { lookupUser } from '@/scripts/admin-lookup.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||
|
|
|
@ -63,3 +63,26 @@ export async function lookupUserByEmail() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookupFile() {
|
||||
const { canceled, result: q } = await os.inputText({
|
||||
title: i18n.ts.fileIdOrUrl,
|
||||
minLength: 1,
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
const show = (file) => {
|
||||
os.pageWindow(`/admin/file/${file.id}`);
|
||||
};
|
||||
|
||||
misskeyApi('admin/drive/show-file', q.startsWith('http://') || q.startsWith('https://') ? { url: q.trim() } : { fileId: q.trim() }).then(file => {
|
||||
show(file);
|
||||
}).catch(err => {
|
||||
if (err.code === 'NO_SUCH_FILE') {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: i18n.ts.notFound,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue