mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-05 00:45:50 +02:00
コントロールパネルの検索 (#16343)
* Update settings.vue * Update settings.vue * Update settings.vue * Update settings.vue * Update settings.vue * Update performance.vue * Update performance.vue * Update performance.vue * Update external-services.vue * wip * wip * Update security.vue * Update settings.vue * Update CHANGELOG.md * wip * Update moderation.vue * wip * Update branding.vue * wip * Update email-settings.vue * Update system-webhook.vue * Update MkSuperMenu.vue * Update index.vue
This commit is contained in:
37
packages/frontend/src/utility/inapp-search.ts
Normal file
37
packages/frontend/src/utility/inapp-search.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { GeneratedSearchIndexItem } from 'search-index';
|
||||
|
||||
export type SearchIndexItem = {
|
||||
id: string;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
label: string;
|
||||
keywords: string[];
|
||||
texts: string[];
|
||||
icon?: string;
|
||||
};
|
||||
|
||||
export function genSearchIndexes(generated: GeneratedSearchIndexItem[]): SearchIndexItem[] {
|
||||
const rootMods = new Map(generated.map(item => [item.id, item]));
|
||||
|
||||
// link inlining here
|
||||
for (const item of generated) {
|
||||
if (item.inlining) {
|
||||
for (const id of item.inlining) {
|
||||
const inline = rootMods.get(id);
|
||||
if (inline) {
|
||||
inline.parentId = item.id;
|
||||
inline.path = item.path;
|
||||
} else {
|
||||
console.log('[Settings Search Index] Failed to inline', id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return generated;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { searchIndexes as generated } from 'search-index:settings';
|
||||
import type { GeneratedSearchIndexItem } from 'search-index:settings';
|
||||
|
||||
export type SearchIndexItem = {
|
||||
id: string;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
label: string;
|
||||
keywords: string[];
|
||||
icon?: string;
|
||||
};
|
||||
|
||||
const rootMods = new Map(generated.map(item => [item.id, item]));
|
||||
|
||||
// link inlining here
|
||||
for (const item of generated) {
|
||||
if (item.inlining) {
|
||||
for (const id of item.inlining) {
|
||||
const inline = rootMods.get(id);
|
||||
if (inline) {
|
||||
inline.parentId = item.id;
|
||||
inline.path = item.path;
|
||||
} else {
|
||||
console.log('[Settings Search Index] Failed to inline', id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const searchIndexes: SearchIndexItem[] = generated;
|
||||
|
||||
31
packages/frontend/src/utility/virtual.d.ts
vendored
31
packages/frontend/src/utility/virtual.d.ts
vendored
@@ -3,16 +3,25 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
declare module 'search-index:settings' {
|
||||
export type GeneratedSearchIndexItem = {
|
||||
id: string;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
label: string;
|
||||
keywords: string[];
|
||||
icon?: string;
|
||||
inlining?: string[];
|
||||
};
|
||||
type XGeneratedSearchIndexItem = {
|
||||
id: string;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
label: string;
|
||||
keywords: string[];
|
||||
texts: string[];
|
||||
icon?: string;
|
||||
inlining?: string[];
|
||||
};
|
||||
|
||||
export const searchIndexes: GeneratedSearchIndexItem[];
|
||||
declare module 'search-index' {
|
||||
export type GeneratedSearchIndexItem = XGeneratedSearchIndexItem;
|
||||
}
|
||||
|
||||
declare module 'search-index:settings' {
|
||||
export const searchIndexes: XGeneratedSearchIndexItem[];
|
||||
}
|
||||
|
||||
declare module 'search-index:admin' {
|
||||
export const searchIndexes: XGeneratedSearchIndexItem[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user