enhance(frontend): 検索

This commit is contained in:
kakkokari-gtyih 2024-12-10 14:55:25 +09:00
parent 1d837c0e64
commit d5156dbfb9
2 changed files with 15 additions and 12 deletions

View file

@ -13,6 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #header>{{ i18n.ts.options }}</template> <template #header>{{ i18n.ts.options }}</template>
<div class="_gaps_m"> <div class="_gaps_m">
<template v-if="instance.federation !== 'none'">
<MkRadios v-model="hostSelect"> <MkRadios v-model="hostSelect">
<template #label>{{ i18n.ts.host }}</template> <template #label>{{ i18n.ts.host }}</template>
<option value="all" default>{{ i18n.ts.all }}</option> <option value="all" default>{{ i18n.ts.all }}</option>
@ -22,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkInput v-if="noteSearchableScope === 'global'" v-model="hostInput" :disabled="hostSelect !== 'specified'" :large="true" type="search"> <MkInput v-if="noteSearchableScope === 'global'" v-model="hostInput" :disabled="hostSelect !== 'specified'" :large="true" type="search">
<template #prefix><i class="ti ti-server"></i></template> <template #prefix><i class="ti ti-server"></i></template>
</MkInput> </MkInput>
</template>
<MkFolder :defaultOpen="true"> <MkFolder :defaultOpen="true">
<template #label>{{ i18n.ts.specifyUser }}</template> <template #label>{{ i18n.ts.specifyUser }}</template>
@ -102,7 +104,7 @@ setHostSelectWithInput(hostInput.value, undefined);
watch(hostInput, setHostSelectWithInput); watch(hostInput, setHostSelectWithInput);
const searchHost = computed(() => { const searchHost = computed(() => {
if (hostSelect.value === 'local') return '.'; if (hostSelect.value === 'local' || instance.federation === 'none') return '.';
if (hostSelect.value === 'specified') return hostInput.value; if (hostSelect.value === 'specified') return hostInput.value;
return null; return null;
}); });

View file

@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search" @enter.prevent="search"> <MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search" @enter.prevent="search">
<template #prefix><i class="ti ti-search"></i></template> <template #prefix><i class="ti ti-search"></i></template>
</MkInput> </MkInput>
<MkRadios v-model="searchOrigin" @update:modelValue="search()"> <MkRadios v-if="instance.federation !== 'none'" v-model="searchOrigin" @update:modelValue="search()">
<option value="combined">{{ i18n.ts.all }}</option> <option value="combined">{{ i18n.ts.all }}</option>
<option value="local">{{ i18n.ts.local }}</option> <option value="local">{{ i18n.ts.local }}</option>
<option value="remote">{{ i18n.ts.remote }}</option> <option value="remote">{{ i18n.ts.remote }}</option>
@ -33,6 +33,7 @@ import MkInput from '@/components/MkInput.vue';
import MkRadios from '@/components/MkRadios.vue'; import MkRadios from '@/components/MkRadios.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import MkFoldableSection from '@/components/MkFoldableSection.vue'; import MkFoldableSection from '@/components/MkFoldableSection.vue';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
@ -113,7 +114,7 @@ async function search() {
limit: 10, limit: 10,
params: { params: {
query: query, query: query,
origin: searchOrigin.value, origin: instance.federation === 'none' ? 'local' : searchOrigin.value,
}, },
}; };