enter key search

This commit is contained in:
samunohito 2024-02-18 13:53:12 +09:00
parent ac943195cf
commit 38b4197395
2 changed files with 105 additions and 32 deletions

View File

@ -13,49 +13,97 @@
<div class="_gaps"> <div class="_gaps">
<div :class="[[spMode ? $style.searchAreaSp : $style.searchArea]]"> <div :class="[[spMode ? $style.searchAreaSp : $style.searchArea]]">
<MkInput v-model="queryName" :debounce="true" type="search" autocapitalize="off" class="col1 row1"> <MkInput
v-model="queryName"
:debounce="true"
type="search"
autocapitalize="off"
class="col1 row1"
@enter="onSearchRequest"
>
<template #label>name</template> <template #label>name</template>
</MkInput> </MkInput>
<MkInput <MkInput
v-model="queryCategory" :debounce="true" type="search" autocapitalize="off" class="col2 row1" v-model="queryCategory"
:debounce="true"
type="search"
autocapitalize="off"
class="col2 row1"
@enter="onSearchRequest"
> >
<template #label>category</template> <template #label>category</template>
</MkInput> </MkInput>
<MkInput <MkInput
v-model="queryAlias" :debounce="true" type="search" autocapitalize="off" class="col3 row1" v-model="queryAlias"
:debounce="true"
type="search"
autocapitalize="off"
class="col3 row1"
@enter="onSearchRequest"
> >
<template #label>alias</template> <template #label>alias</template>
</MkInput> </MkInput>
<MkInput <MkInput
v-model="queryType" :debounce="true" type="search" autocapitalize="off" class="col1 row2" v-model="queryType"
:debounce="true"
type="search"
autocapitalize="off"
class="col1 row2"
@enter="onSearchRequest"
> >
<template #label>type</template> <template #label>type</template>
</MkInput> </MkInput>
<MkInput <MkInput
v-model="queryLicense" :debounce="true" type="search" autocapitalize="off" class="col2 row2" v-model="queryLicense"
:debounce="true"
type="search"
autocapitalize="off"
class="col2 row2"
@enter="onSearchRequest"
> >
<template #label>license</template> <template #label>license</template>
</MkInput> </MkInput>
<MkSelect v-model="querySensitive" class="col3 row2"> <MkSelect
v-model="querySensitive"
class="col3 row2"
>
<template #label>sensitive</template> <template #label>sensitive</template>
<option :value="null">-</option> <option :value="null">-</option>
<option :value="true">true</option> <option :value="true">true</option>
<option :value="false">false</option> <option :value="false">false</option>
</MkSelect> </MkSelect>
<MkSelect v-model="queryLocalOnly" class="col1 row3"> <MkSelect
v-model="queryLocalOnly"
class="col1 row3"
>
<template #label>localOnly</template> <template #label>localOnly</template>
<option :value="null">-</option> <option :value="null">-</option>
<option :value="true">true</option> <option :value="true">true</option>
<option :value="false">false</option> <option :value="false">false</option>
</MkSelect> </MkSelect>
<MkInput v-model="queryUpdatedAtFrom" :debounce="true" type="date" autocapitalize="off" class="col2 row3"> <MkInput
v-model="queryUpdatedAtFrom"
:debounce="true"
type="date"
autocapitalize="off"
class="col2 row3"
@enter="onSearchRequest"
>
<template #label>updatedAt(from)</template> <template #label>updatedAt(from)</template>
</MkInput> </MkInput>
<MkInput v-model="queryUpdatedAtTo" :debounce="true" type="date" autocapitalize="off" class="col3 row3"> <MkInput
v-model="queryUpdatedAtTo"
:debounce="true"
type="date"
autocapitalize="off"
class="col3 row3"
@enter="onSearchRequest"
>
<template #label>updatedAt(to)</template> <template #label>updatedAt(to)</template>
</MkInput> </MkInput>
<MkInput <MkInput
v-model="queryRolesText" v-model="queryRolesText"
:debounce="true" :debounce="true"
@ -92,7 +140,7 @@
</MkFolder> </MkFolder>
<div :class="[[spMode ? $style.searchButtonsSp : $style.searchButtons]]"> <div :class="[[spMode ? $style.searchButtonsSp : $style.searchButtons]]">
<MkButton primary @click="onSearchButtonClicked"> <MkButton primary @click="onSearchRequest">
{{ i18n.ts.search }} {{ i18n.ts.search }}
</MkButton> </MkButton>
<MkButton @click="onQueryResetButtonClicked"> <MkButton @click="onQueryResetButtonClicked">
@ -502,7 +550,7 @@ function onAddSortOrderButtonClicked(ev: MouseEvent) {
os.contextMenu(menuItems, ev); os.contextMenu(menuItems, ev);
} }
async function onSearchButtonClicked() { async function onSearchRequest() {
await refreshCustomEmojis(); await refreshCustomEmojis();
} }

View File

@ -10,16 +10,44 @@
<div class="_gaps"> <div class="_gaps">
<div :class="[[spMode ? $style.searchAreaSp : $style.searchArea]]"> <div :class="[[spMode ? $style.searchAreaSp : $style.searchArea]]">
<MkInput v-model="queryName" :debounce="true" type="search" autocapitalize="off" class="col1 row1"> <MkInput
v-model="queryName"
:debounce="true"
type="search"
autocapitalize="off"
class="col1 row1"
@enter="onSearchRequest"
>
<template #label>name</template> <template #label>name</template>
</MkInput> </MkInput>
<MkInput v-model="queryHost" :debounce="true" type="search" autocapitalize="off" class="col2 row1"> <MkInput
v-model="queryHost"
:debounce="true"
type="search"
autocapitalize="off"
class="col2 row1"
@enter="onSearchRequest"
>
<template #label>host</template> <template #label>host</template>
</MkInput> </MkInput>
<MkInput v-model="queryUri" :debounce="true" type="search" autocapitalize="off" class="col1 row2"> <MkInput
v-model="queryUri"
:debounce="true"
type="search"
autocapitalize="off"
class="col1 row2"
@enter="onSearchRequest"
>
<template #label>uri</template> <template #label>uri</template>
</MkInput> </MkInput>
<MkInput v-model="queryPublicUrl" :debounce="true" type="search" autocapitalize="off" class="col2 row2"> <MkInput
v-model="queryPublicUrl"
:debounce="true"
type="search"
autocapitalize="off"
class="col2 row2"
@enter="onSearchRequest"
>
<template #label>publicUrl</template> <template #label>publicUrl</template>
</MkInput> </MkInput>
</div> </div>
@ -46,7 +74,7 @@
</MkFolder> </MkFolder>
<div :class="[[spMode ? $style.searchButtonsSp : $style.searchButtons]]"> <div :class="[[spMode ? $style.searchButtonsSp : $style.searchButtons]]">
<MkButton primary @click="onSearchButtonClicked"> <MkButton primary @click="onSearchRequest">
{{ i18n.ts.search }} {{ i18n.ts.search }}
</MkButton> </MkButton>
<MkButton @click="onQueryResetButtonClicked"> <MkButton @click="onQueryResetButtonClicked">
@ -97,7 +125,6 @@ import { GridSetting } from '@/components/grid/grid.js';
import MkTagItem from '@/components/MkTagItem.vue'; import MkTagItem from '@/components/MkTagItem.vue';
import { deviceKind } from '@/scripts/device-kind.js'; import { deviceKind } from '@/scripts/device-kind.js';
import { MenuItem } from '@/types/menu.js'; import { MenuItem } from '@/types/menu.js';
import MkTab from '@/components/MkTab.vue';
import MkPagingButtons from '@/components/MkPagingButtons.vue'; import MkPagingButtons from '@/components/MkPagingButtons.vue';
type GridItem = { type GridItem = {
@ -209,7 +236,7 @@ function onAddSortOrderButtonClicked(ev: MouseEvent) {
os.contextMenu(menuItems, ev); os.contextMenu(menuItems, ev);
} }
async function onSearchButtonClicked() { async function onSearchRequest() {
await refreshCustomEmojis(); await refreshCustomEmojis();
} }
@ -220,14 +247,6 @@ function onQueryResetButtonClicked() {
queryPublicUrl.value = null; queryPublicUrl.value = null;
} }
async function onLatestButtonClicked() {
await refreshCustomEmojis();
}
async function onOldestButtonClicked() {
await refreshCustomEmojis();
}
async function onImportClicked() { async function onImportClicked() {
const targets = gridItems.value.filter(it => it.checked); const targets = gridItems.value.filter(it => it.checked);
await importEmojis(targets); await importEmojis(targets);
@ -312,12 +331,18 @@ async function refreshCustomEmojis() {
currentPage.value = 1; currentPage.value = 1;
} }
const result = await misskeyApi('admin/emoji/v2/list', { const result = await os.promiseDialog(
misskeyApi('admin/emoji/v2/list', {
limit: 100, limit: 100,
query: query, query: query,
page: currentPage.value, page: currentPage.value,
sort: sortOrders.value.map(({ key, direction }) => ({ key: key as any, direction })), sort: sortOrders.value.map(({ key, direction }) => ({ key: key as any, direction })),
}); }),
() => {
},
() => {
},
);
customEmojis.value = result.emojis; customEmojis.value = result.emojis;
allPages.value = result.allPages; allPages.value = result.allPages;