mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-14 16:00:46 +00:00
fix: container list search
This commit is contained in:
@@ -1,52 +1,21 @@
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { onActivated, onDeactivated, watch } from 'vue';
|
||||
import { useRouter, type Router } from 'vue-router';
|
||||
import { onActivated, onDeactivated } from 'vue';
|
||||
import GlobalStore from '@/store/modules/global';
|
||||
import { bindSearchReset, createSearchVisitCache, type SearchFields } from '@/utils/search-reset';
|
||||
import { bindSearchState, type SearchFields } from '@/utils/search-reset';
|
||||
|
||||
interface SearchResetOptions {
|
||||
scope?: () => string | number | undefined;
|
||||
onRevisit: () => unknown;
|
||||
preserveOnRoutes?: string[];
|
||||
}
|
||||
|
||||
const visitCache = createSearchVisitCache();
|
||||
const observedRouters = new WeakSet<Router>();
|
||||
|
||||
export const useSearchReset = (fields: SearchFields, options: SearchResetOptions) => {
|
||||
/** Retain the existing entry point while keeping queries across all page visits. */
|
||||
export const useSearchReset = (page: string, fields: SearchFields, options: SearchResetOptions) => {
|
||||
const { currentNode } = storeToRefs(GlobalStore());
|
||||
const reset = bindSearchReset(options.scope ? [currentNode, options.scope] : [currentNode], fields);
|
||||
let restoreVisit: (() => boolean) | undefined;
|
||||
if (options.preserveOnRoutes?.length) {
|
||||
const router = useRouter();
|
||||
const routes = options.preserveOnRoutes;
|
||||
const key = () => JSON.stringify([routes, options.scope?.()]);
|
||||
const context = () => currentNode.value;
|
||||
// This observer must outlive the list, which may unmount while the editor is open.
|
||||
if (!observedRouters.has(router)) {
|
||||
observedRouters.add(router);
|
||||
router.afterEach((to, _from, failure) => {
|
||||
if (!failure) visitCache.navigate(String(to.name || ''), context());
|
||||
});
|
||||
}
|
||||
visitCache.navigate(String(router.currentRoute.value.name || ''), context());
|
||||
restoreVisit = () => {
|
||||
const saved = visitCache.read(key(), context());
|
||||
if (!saved) return false;
|
||||
// Query watchers may reset pagination; restore the requested page last.
|
||||
for (const [name, field] of Object.entries(fields)) {
|
||||
if (name !== 'page') field.value = saved[name];
|
||||
}
|
||||
if (fields.page) fields.page.value = saved.page;
|
||||
return true;
|
||||
};
|
||||
restoreVisit();
|
||||
watch(
|
||||
() => Object.fromEntries(Object.entries(fields).map(([name, field]) => [name, field.value])),
|
||||
(values) => visitCache.save(key(), routes, String(router.currentRoute.value.name || ''), context(), values),
|
||||
{ immediate: true, flush: 'sync' },
|
||||
);
|
||||
}
|
||||
const restore = bindSearchState(() => {
|
||||
const scope = options.scope?.();
|
||||
if (options.scope && scope === undefined) return undefined;
|
||||
return JSON.stringify([currentNode.value, page, scope ?? '']);
|
||||
}, fields);
|
||||
let deactivated = false;
|
||||
onDeactivated(() => {
|
||||
deactivated = true;
|
||||
@@ -54,7 +23,7 @@ export const useSearchReset = (fields: SearchFields, options: SearchResetOptions
|
||||
onActivated(() => {
|
||||
if (!deactivated) return;
|
||||
deactivated = false;
|
||||
if (!restoreVisit?.()) reset();
|
||||
restore();
|
||||
return options.onRevisit();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { bindSearchReset } from '@/utils/search-reset';
|
||||
import router from '@/routers/router';
|
||||
import { bindSearchState } from '@/utils/search-reset';
|
||||
import { useGlobalStore } from '@/composables/useGlobalStore';
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref, reactive, toRef } from 'vue';
|
||||
@@ -50,7 +49,7 @@ export const ProcessStore = defineStore('ProcessStore', () => {
|
||||
});
|
||||
|
||||
const { currentNode } = useGlobalStore();
|
||||
bindSearchReset([() => router.currentRoute.value.path, currentNode], {
|
||||
bindSearchState(() => JSON.stringify([currentNode.value, 'host/process', '']), {
|
||||
pid: toRef(psSearch, 'pid'),
|
||||
name: toRef(psSearch, 'name'),
|
||||
username: toRef(psSearch, 'username'),
|
||||
|
||||
@@ -1,41 +1,79 @@
|
||||
import { watch, type Ref, type WatchSource } from 'vue';
|
||||
import { watch, type Ref } from 'vue';
|
||||
|
||||
export type SearchFields = Record<string, Ref<string | number | undefined>>;
|
||||
|
||||
export const bindSearchReset = (sources: WatchSource[], fields: SearchFields) => {
|
||||
const defaults = Object.values(fields).map((field) => ({ field, value: field.value }));
|
||||
const reset = () => {
|
||||
for (const { field, value } of defaults) field.value = value;
|
||||
};
|
||||
watch(sources, reset, { flush: 'sync' });
|
||||
return reset;
|
||||
};
|
||||
|
||||
type SearchValues = Record<string, string | number | undefined>;
|
||||
|
||||
/** A short-lived return state, discarded as soon as navigation leaves its list/edit flow. */
|
||||
export const createSearchVisitCache = () => {
|
||||
const entries = new Map<string, { routes: string[]; values: SearchValues }>();
|
||||
let context: unknown;
|
||||
const syncContext = (next: unknown) => {
|
||||
if (context !== next) entries.clear();
|
||||
context = next;
|
||||
};
|
||||
/** Shared by normal page visits and edit-return visits; navigation never evicts a query. */
|
||||
export const createSearchVisitCache = (storage: () => Storage = () => localStorage) => {
|
||||
const entries = new Map<string, SearchValues>();
|
||||
return {
|
||||
navigate(route: string, nextContext: unknown) {
|
||||
syncContext(nextContext);
|
||||
for (const [key, entry] of entries) {
|
||||
if (!entry.routes.includes(route)) entries.delete(key);
|
||||
save(key: string, values: SearchValues) {
|
||||
entries.set(key, { ...values });
|
||||
try {
|
||||
storage().setItem(
|
||||
`1panel:search-state:v2:${key}`,
|
||||
JSON.stringify(
|
||||
Object.fromEntries(Object.entries(values).map(([name, value]) => [name, value ?? null])),
|
||||
),
|
||||
);
|
||||
} catch {
|
||||
// Keep in-memory state when storage is unavailable or full.
|
||||
}
|
||||
},
|
||||
save(key: string, routes: string[], route: string, nextContext: unknown, values: SearchValues) {
|
||||
syncContext(nextContext);
|
||||
if (routes.includes(route)) entries.set(key, { routes, values: { ...values } });
|
||||
},
|
||||
read(key: string, nextContext: unknown) {
|
||||
syncContext(nextContext);
|
||||
const values = entries.get(key)?.values;
|
||||
return values ? { ...values } : undefined;
|
||||
read(key: string): SearchValues | undefined {
|
||||
const cached = entries.get(key);
|
||||
if (cached) return { ...cached };
|
||||
try {
|
||||
const saved = JSON.parse(storage().getItem(`1panel:search-state:v2:${key}`) || 'null');
|
||||
if (!saved || typeof saved !== 'object' || Array.isArray(saved)) return undefined;
|
||||
return Object.fromEntries(
|
||||
Object.entries(saved)
|
||||
.filter(
|
||||
([, value]) =>
|
||||
value === null ||
|
||||
typeof value === 'string' ||
|
||||
(typeof value === 'number' && Number.isFinite(value)),
|
||||
)
|
||||
.map(([name, value]) => [name, value === null ? undefined : value]),
|
||||
) as SearchValues;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const visitCache = createSearchVisitCache();
|
||||
|
||||
export const bindSearchState = (key: () => string | undefined, fields: SearchFields, cache = visitCache) => {
|
||||
const defaults = Object.fromEntries(Object.entries(fields).map(([name, field]) => [name, field.value]));
|
||||
let restoring = false;
|
||||
let activeKey: string | undefined;
|
||||
const restore = () => {
|
||||
activeKey = key();
|
||||
if (!activeKey) return;
|
||||
const saved = cache.read(activeKey) || defaults;
|
||||
restoring = true;
|
||||
try {
|
||||
// Restore pagination last: search/filter watchers may reset it to page one.
|
||||
const names = Object.keys(fields).sort((left, right) => Number(left === 'page') - Number(right === 'page'));
|
||||
for (const name of names) {
|
||||
const value = Object.hasOwn(saved, name) ? saved[name] : defaults[name];
|
||||
const initial = defaults[name];
|
||||
fields[name].value =
|
||||
initial !== undefined && value !== undefined && typeof value !== typeof initial ? initial : value;
|
||||
}
|
||||
} finally {
|
||||
restoring = false;
|
||||
}
|
||||
};
|
||||
watch(key, restore, { immediate: true, flush: 'sync' });
|
||||
watch(
|
||||
() => Object.fromEntries(Object.entries(fields).map(([name, field]) => [name, field.value])),
|
||||
(values) => {
|
||||
if (!restoring && activeKey) cache.save(activeKey, values);
|
||||
},
|
||||
{ immediate: true, flush: 'sync' },
|
||||
);
|
||||
return restore;
|
||||
};
|
||||
|
||||
@@ -194,6 +194,7 @@ const operating = ref('');
|
||||
const keyword = ref('');
|
||||
const marketKeyword = ref('');
|
||||
useSearchReset(
|
||||
'ai/agents/agent/config/tabs/plugins',
|
||||
{ keyword, marketKeyword },
|
||||
{
|
||||
scope: () => agentId.value || undefined,
|
||||
|
||||
@@ -170,6 +170,7 @@ const marketSource = ref<HermesSkillMarketSource>(getDefaultMarketSource());
|
||||
const marketSearched = ref(false);
|
||||
const agentId = ref(0);
|
||||
useSearchReset(
|
||||
'ai/agents/agent/config/tabs/skills/hermes',
|
||||
{ installedKeyword, marketKeyword },
|
||||
{
|
||||
scope: () => agentId.value || undefined,
|
||||
|
||||
@@ -182,6 +182,7 @@ const marketSource = ref<SkillMarketSource>(getDefaultMarketSource());
|
||||
const marketSearched = ref(false);
|
||||
const agentId = ref(0);
|
||||
useSearchReset(
|
||||
'ai/agents/agent/config/tabs/skills/openclaw',
|
||||
{ installedKeyword, marketKeyword },
|
||||
{
|
||||
scope: () => agentId.value || undefined,
|
||||
|
||||
@@ -400,7 +400,11 @@ const paginationConfig = reactive({
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'ai/agents/agent/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const checkNoApp = async () => {
|
||||
try {
|
||||
|
||||
@@ -111,7 +111,11 @@ const paginationConfig = reactive({
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'ai/agents/model/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const search = async () => {
|
||||
const req: AI.AgentAccountSearch = {
|
||||
|
||||
@@ -237,7 +237,11 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'ai/model/ollama/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const appInstallID = ref(0);
|
||||
|
||||
const opRef = ref();
|
||||
|
||||
@@ -106,6 +106,7 @@ const req = reactive({
|
||||
showCurrentArch: false,
|
||||
});
|
||||
useSearchReset(
|
||||
'app-store/apps/index',
|
||||
{ search: toRef(req, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search(req) },
|
||||
);
|
||||
|
||||
@@ -212,6 +212,7 @@ const searchReq = reactive({
|
||||
sync: false,
|
||||
});
|
||||
useSearchReset(
|
||||
'app-store/installed/index',
|
||||
{ search: toRef(searchReq, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
@@ -577,7 +577,7 @@ const dialogBackupRef = ref();
|
||||
const uploadRef = ref();
|
||||
|
||||
const searchName = ref('');
|
||||
useSearchReset({ search: searchName }, { onRevisit: () => search() });
|
||||
useSearchReset('container/compose/index', { search: searchName }, { onRevisit: () => search() });
|
||||
const includeAppStore = ref(localStorage.getItem('includeAppStore') !== 'false');
|
||||
const showType = ref('compose');
|
||||
const containerStats = ref<any[]>([]);
|
||||
|
||||
@@ -552,6 +552,7 @@ const taskLogRef = ref();
|
||||
const tags = ref([]);
|
||||
const activeTag = ref('all');
|
||||
useSearchReset(
|
||||
'container/container/index',
|
||||
{
|
||||
search: searchName,
|
||||
page: toRef(paginationConfig, 'currentPage'),
|
||||
@@ -560,7 +561,7 @@ useSearchReset(
|
||||
orderBy: toRef(paginationConfig, 'orderBy'),
|
||||
order: toRef(paginationConfig, 'order'),
|
||||
},
|
||||
{ onRevisit: () => search(), preserveOnRoutes: ['ContainerItem', 'ContainerCreate'] },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const activeDropdownContainerId = ref('');
|
||||
|
||||
@@ -201,6 +201,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
useSearchReset(
|
||||
'container/image/index',
|
||||
{ search: toRef(paginationConfig, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
@@ -121,7 +121,11 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'container/network/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const opRef = ref();
|
||||
const isActive = ref(false);
|
||||
|
||||
@@ -78,7 +78,11 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'container/repo/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const opRef = ref();
|
||||
const confirmDialog = ref();
|
||||
|
||||
@@ -111,7 +111,11 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'container/template/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const search = async () => {
|
||||
if (!isActive.value || !isExist.value) {
|
||||
|
||||
@@ -158,7 +158,11 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'container/volume/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const isActive = ref(false);
|
||||
const isExist = ref(false);
|
||||
|
||||
|
||||
@@ -332,7 +332,11 @@ const pageState = usePageState(() => ({
|
||||
}));
|
||||
const paginationConfig = pageState.paginationConfig;
|
||||
const { defaultGroupID, searchName, searchGroupID } = toRefs(pageState);
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'cronjob/cronjob/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const search = async (column?: any) => {
|
||||
if (column) {
|
||||
|
||||
@@ -170,7 +170,11 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchInfo = ref<string>('');
|
||||
useSearchReset({ search: searchInfo, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'cronjob/library/index',
|
||||
{ search: searchInfo, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const group = ref<string>('');
|
||||
const groupOptions = ref();
|
||||
|
||||
|
||||
@@ -399,7 +399,11 @@ const paginationConfig = reactive({
|
||||
orderBy: 'createdAt',
|
||||
order: 'null',
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'database/mongodb/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
type FormInstance = InstanceType<typeof ElForm>;
|
||||
const formRef = ref<FormInstance>();
|
||||
|
||||
@@ -101,7 +101,11 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'database/mongodb/remote/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const search = async (column?: any) => {
|
||||
paginationConfig.orderBy = column?.order ? column.prop : paginationConfig.orderBy;
|
||||
|
||||
@@ -301,7 +301,11 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'database/mysql/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const mysqlContainer = ref();
|
||||
const mysqlStatus = ref();
|
||||
|
||||
@@ -100,7 +100,11 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'database/mysql/remote/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const search = async (column?: any) => {
|
||||
paginationConfig.orderBy = column?.order ? column.prop : paginationConfig.orderBy;
|
||||
|
||||
@@ -313,7 +313,11 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'database/postgresql/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const postgresqlContainer = ref();
|
||||
const postgresqlStatus = ref();
|
||||
|
||||
@@ -100,7 +100,11 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'database/postgresql/remote/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const search = async (column?: any) => {
|
||||
paginationConfig.orderBy = column?.order ? column.prop : paginationConfig.orderBy;
|
||||
|
||||
@@ -99,7 +99,11 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'database/redis/remote/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const search = async (column?: any) => {
|
||||
paginationConfig.orderBy = column?.order ? column.prop : paginationConfig.orderBy;
|
||||
|
||||
@@ -986,6 +986,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset(
|
||||
'host/file-management/index',
|
||||
{ search: toRef(req, 'search'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
@@ -264,6 +264,7 @@ const orphanDrawerVisible = ref(false);
|
||||
const orphanSearchName = ref('');
|
||||
const searchName = ref('');
|
||||
useSearchReset(
|
||||
'host/firewall/docker/index',
|
||||
{ search: searchName },
|
||||
{
|
||||
onRevisit: () => {
|
||||
|
||||
@@ -188,7 +188,11 @@ const paginationConfig = reactive({
|
||||
pageSize: Number(localStorage.getItem('firewall-forward-page-size')) || 20,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'host/firewall/forward/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const search = async () => {
|
||||
if (!isInit.value || !isBind.value || fireName.value === '-') {
|
||||
|
||||
@@ -432,7 +432,11 @@ const paginationConfig = reactive({
|
||||
pageSize: Number(localStorage.getItem('firewall-rule-page-size')) || 20,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'host/firewall/rule/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const providerScopes = (): Firewall.Scope[] => {
|
||||
if (provider.value === 'iptables' || provider.value === 'nftables') {
|
||||
|
||||
@@ -120,7 +120,11 @@ const exportConfig = reactive({
|
||||
status: 'All',
|
||||
});
|
||||
const searchInfo = ref();
|
||||
useSearchReset({ search: searchInfo, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'host/ssh/log/log',
|
||||
{ search: searchInfo, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const searchStatus = ref('All');
|
||||
|
||||
const search = async () => {
|
||||
|
||||
@@ -38,7 +38,7 @@ const sshSearch = reactive({
|
||||
type: 'ssh',
|
||||
loginUser: '',
|
||||
});
|
||||
useSearchReset({ search: toRef(sshSearch, 'loginUser') }, { onRevisit: () => search() });
|
||||
useSearchReset('host/ssh/session/index', { search: toRef(sshSearch, 'loginUser') }, { onRevisit: () => search() });
|
||||
|
||||
const buttons = [
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ const logs = ref<Log.SystemLogItem[]>([]);
|
||||
const loading = ref(false);
|
||||
const watching = ref(false);
|
||||
const keyword = ref('');
|
||||
useSearchReset({ keyword }, { onRevisit: () => scheduleFilterSearch() });
|
||||
useSearchReset('log/host-system/index', { keyword }, { onRevisit: () => scheduleFilterSearch() });
|
||||
const priority = ref('');
|
||||
const service = ref('');
|
||||
const services = ref<string[]>([]);
|
||||
|
||||
@@ -67,7 +67,11 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchInfo = ref<string>('');
|
||||
useSearchReset({ search: searchInfo, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'log/login/index',
|
||||
{ search: searchInfo, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const searchStatus = ref<string>('');
|
||||
|
||||
const search = async () => {
|
||||
|
||||
@@ -160,7 +160,11 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref<string>('');
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'log/operation/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const searchGroup = ref<string>('');
|
||||
const searchStatus = ref<string>('');
|
||||
const searchNode = ref<string>('');
|
||||
|
||||
@@ -144,6 +144,7 @@ const paginationConfig = reactive({
|
||||
name: '',
|
||||
});
|
||||
useSearchReset(
|
||||
'setting/backup-account/index',
|
||||
{ search: toRef(paginationConfig, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
@@ -261,7 +261,11 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'setting/snapshot/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const opRef = ref();
|
||||
|
||||
|
||||
@@ -124,7 +124,11 @@ const paginationConfig = reactive({
|
||||
order: 'ascending',
|
||||
});
|
||||
const info = ref();
|
||||
useSearchReset({ search: info, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'terminal/command/index',
|
||||
{ search: info, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const group = ref<string>('');
|
||||
const dialogRef = ref();
|
||||
const opRef = ref();
|
||||
|
||||
@@ -100,7 +100,11 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const info = ref();
|
||||
useSearchReset({ search: info, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'terminal/host/index',
|
||||
{ search: info, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const group = ref<string>('');
|
||||
|
||||
const opRef = ref();
|
||||
|
||||
@@ -218,7 +218,11 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'toolbox/clam/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const opRef = ref();
|
||||
const dialogRef = ref();
|
||||
|
||||
@@ -201,7 +201,11 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'toolbox/ftp/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const form = reactive({
|
||||
isActive: true,
|
||||
|
||||
@@ -49,7 +49,11 @@ const supportExtensions = ref([]);
|
||||
const loading = ref(false);
|
||||
const taskLogRef = ref();
|
||||
const searchName = ref('');
|
||||
useSearchReset({ search: searchName }, { onRevisit: () => searchByName() });
|
||||
useSearchReset(
|
||||
'website/runtime/php/extension-management/index',
|
||||
{ search: searchName },
|
||||
{ onRevisit: () => searchByName() },
|
||||
);
|
||||
const data = ref([]);
|
||||
|
||||
const handleClose = () => {
|
||||
|
||||
@@ -288,6 +288,7 @@ const req = reactive({
|
||||
order: 'descending',
|
||||
});
|
||||
useSearchReset(
|
||||
'website/ssl/index',
|
||||
{ search: toRef(req, 'domain'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
@@ -90,7 +90,11 @@ const paginationConfig = reactive({
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
useSearchReset(
|
||||
'website/template/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const buttons = [
|
||||
{
|
||||
|
||||
@@ -452,6 +452,7 @@ const pageState = usePageState(() => ({
|
||||
const paginationConfig = pageState.paginationConfig;
|
||||
const req = pageState.req;
|
||||
useSearchReset(
|
||||
'website/website/index',
|
||||
{ search: toRef(req, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user