mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-10 08:00:32 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ade1accd3f |
@@ -15,7 +15,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue';
|
||||
import { onActivated, ref, watch } from 'vue';
|
||||
defineOptions({ name: 'TableSearch' });
|
||||
|
||||
const emit = defineEmits(['search', 'update:searchName']);
|
||||
@@ -42,6 +42,10 @@ watch(
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
onActivated(() => {
|
||||
searchInfo.value = props.searchName;
|
||||
});
|
||||
|
||||
const search = () => {
|
||||
emit('update:searchName', searchInfo.value);
|
||||
emit('search');
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, useAttrs } from 'vue';
|
||||
import { computed, onDeactivated, onMounted, ref, useAttrs } from 'vue';
|
||||
import { useGlobalStore } from '@/composables/useGlobalStore';
|
||||
import { flattenVNodes, type FuTableOperationButton } from '@/components/table/shared';
|
||||
import { useCardColumns } from './useCardColumns';
|
||||
@@ -459,6 +459,8 @@ watch([currentViewMode, tableData, () => props.syncCardContentHeight], scheduleC
|
||||
flush: 'post',
|
||||
});
|
||||
|
||||
onDeactivated(clearSelects);
|
||||
|
||||
watch([() => props.paginationConfig?.currentPage, () => props.paginationConfig?.pageSize], clearSelects, {
|
||||
flush: 'sync',
|
||||
});
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { reactive, type UnwrapNestedRefs } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useGlobalStore } from '@/composables/useGlobalStore';
|
||||
import { getPageState } from '@/utils/page-state-cache';
|
||||
|
||||
/** A new page visit starts from its defaults instead of restoring the previous page number. */
|
||||
export const usePageState = <T extends object>(factory: () => T): UnwrapNestedRefs<T> => {
|
||||
const route = useRoute();
|
||||
const { currentNode } = useGlobalStore();
|
||||
const key = `${currentNode.value}:${String(route.name || route.path)}`;
|
||||
return reactive(getPageState(key, factory));
|
||||
return reactive(factory());
|
||||
};
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { watch, type Ref } from 'vue';
|
||||
import GlobalStore from '@/store/modules/global';
|
||||
|
||||
type SearchValue = string | number | undefined;
|
||||
type SearchFields = Record<string, Ref<SearchValue>>;
|
||||
|
||||
export const useSearchPersistence = (page: string, fields: SearchFields, scope?: () => SearchValue) => {
|
||||
const { currentNode } = storeToRefs(GlobalStore());
|
||||
const defaults = Object.fromEntries(Object.entries(fields).map(([name, field]) => [name, field.value]));
|
||||
let initialized = false;
|
||||
let restoring = false;
|
||||
let activeKey: string | undefined;
|
||||
|
||||
watch(
|
||||
() => {
|
||||
const context = scope?.();
|
||||
if (scope && context === undefined) return undefined;
|
||||
return `1panel:search:v1:${JSON.stringify([currentNode.value, page, context ?? ''])}`;
|
||||
},
|
||||
(key) => {
|
||||
activeKey = key;
|
||||
let saved: Record<string, unknown> = {};
|
||||
try {
|
||||
const parsed = activeKey ? JSON.parse(localStorage.getItem(activeKey) || '{}') : {};
|
||||
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) saved = parsed;
|
||||
} catch {}
|
||||
restoring = true;
|
||||
for (const [name, field] of Object.entries(fields)) {
|
||||
const value = saved[name];
|
||||
const initial = defaults[name];
|
||||
let fallback = initial;
|
||||
if (initialized) {
|
||||
fallback = typeof initial === 'string' ? '' : undefined;
|
||||
}
|
||||
const valid =
|
||||
(typeof value === 'string' || (typeof value === 'number' && Number.isFinite(value))) &&
|
||||
(fallback === undefined || typeof value === typeof fallback);
|
||||
if (value === null) {
|
||||
field.value = typeof initial === 'string' ? '' : undefined;
|
||||
} else if (valid) {
|
||||
field.value = value as SearchValue;
|
||||
} else {
|
||||
field.value = fallback;
|
||||
}
|
||||
}
|
||||
restoring = false;
|
||||
initialized = true;
|
||||
},
|
||||
{ immediate: true, flush: 'sync' },
|
||||
);
|
||||
|
||||
watch(
|
||||
() => Object.fromEntries(Object.entries(fields).map(([name, field]) => [name, field.value ?? null])),
|
||||
(value) => {
|
||||
if (restoring || !activeKey) return;
|
||||
try {
|
||||
localStorage.setItem(activeKey, JSON.stringify(value));
|
||||
} catch {}
|
||||
},
|
||||
{ flush: 'sync' },
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { onActivated, onDeactivated } from 'vue';
|
||||
import GlobalStore from '@/store/modules/global';
|
||||
import { bindSearchReset, type SearchFields } from '@/utils/search-reset';
|
||||
|
||||
interface SearchResetOptions {
|
||||
scope?: () => string | number | undefined;
|
||||
onRevisit: () => unknown;
|
||||
}
|
||||
|
||||
export const useSearchReset = (fields: SearchFields, options: SearchResetOptions) => {
|
||||
const { currentNode } = storeToRefs(GlobalStore());
|
||||
const reset = bindSearchReset(options.scope ? [currentNode, options.scope] : [currentNode], fields);
|
||||
let deactivated = false;
|
||||
onDeactivated(() => {
|
||||
deactivated = true;
|
||||
});
|
||||
onActivated(() => {
|
||||
if (!deactivated) return;
|
||||
deactivated = false;
|
||||
reset();
|
||||
return options.onRevisit();
|
||||
});
|
||||
};
|
||||
@@ -1,4 +1,6 @@
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { bindSearchReset } from '@/utils/search-reset';
|
||||
import router from '@/routers/router';
|
||||
import { useGlobalStore } from '@/composables/useGlobalStore';
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref, reactive, toRef } from 'vue';
|
||||
import { MsgError } from '@/utils/message';
|
||||
@@ -47,12 +49,12 @@ export const ProcessStore = defineStore('ProcessStore', () => {
|
||||
port: undefined,
|
||||
});
|
||||
|
||||
useSearchPersistence('host/process/process', {
|
||||
const { currentNode } = useGlobalStore();
|
||||
bindSearchReset([() => router.currentRoute.value.path, currentNode], {
|
||||
pid: toRef(psSearch, 'pid'),
|
||||
name: toRef(psSearch, 'name'),
|
||||
username: toRef(psSearch, 'username'),
|
||||
});
|
||||
useSearchPersistence('host/process/network', {
|
||||
|
||||
processID: toRef(netSearch, 'processID'),
|
||||
processName: toRef(netSearch, 'processName'),
|
||||
port: toRef(netSearch, 'port'),
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { watch, type Ref, type WatchSource } 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;
|
||||
};
|
||||
@@ -172,7 +172,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Refresh, Search } from '@element-plus/icons-vue';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
@@ -193,10 +193,16 @@ const searching = ref(false);
|
||||
const operating = ref('');
|
||||
const keyword = ref('');
|
||||
const marketKeyword = ref('');
|
||||
useSearchPersistence(
|
||||
'ai/agents/agent/config/tabs/plugins',
|
||||
useSearchReset(
|
||||
{ keyword, marketKeyword },
|
||||
() => agentId.value || undefined,
|
||||
{
|
||||
scope: () => agentId.value || undefined,
|
||||
onRevisit: () => {
|
||||
page.value = 1;
|
||||
marketResults.value = [];
|
||||
marketSearched.value = false;
|
||||
},
|
||||
},
|
||||
);
|
||||
const origin = ref('');
|
||||
const status = ref('');
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Refresh, Search } from '@element-plus/icons-vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -169,10 +169,15 @@ const getDefaultMarketSource = (): HermesSkillMarketSource => {
|
||||
const marketSource = ref<HermesSkillMarketSource>(getDefaultMarketSource());
|
||||
const marketSearched = ref(false);
|
||||
const agentId = ref(0);
|
||||
useSearchPersistence(
|
||||
'ai/agents/agent/config/tabs/skills/hermes',
|
||||
useSearchReset(
|
||||
{ installedKeyword, marketKeyword },
|
||||
() => agentId.value || undefined,
|
||||
{
|
||||
scope: () => agentId.value || undefined,
|
||||
onRevisit: () => {
|
||||
marketResults.value = [];
|
||||
marketSearched.value = false;
|
||||
},
|
||||
},
|
||||
);
|
||||
const installedSkills = ref<AI.AgentSkillItem[]>([]);
|
||||
const marketResults = ref<AI.AgentSkillSearchItem[]>([]);
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Refresh, Search } from '@element-plus/icons-vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -181,10 +181,15 @@ const getDefaultMarketSource = (): SkillMarketSource => {
|
||||
const marketSource = ref<SkillMarketSource>(getDefaultMarketSource());
|
||||
const marketSearched = ref(false);
|
||||
const agentId = ref(0);
|
||||
useSearchPersistence(
|
||||
'ai/agents/agent/config/tabs/skills/openclaw',
|
||||
useSearchReset(
|
||||
{ installedKeyword, marketKeyword },
|
||||
() => agentId.value || undefined,
|
||||
{
|
||||
scope: () => agentId.value || undefined,
|
||||
onRevisit: () => {
|
||||
marketResults.value = [];
|
||||
marketSearched.value = false;
|
||||
},
|
||||
},
|
||||
);
|
||||
const skills = ref<AI.AgentSkillItem[]>([]);
|
||||
const marketResults = ref<AI.AgentSkillSearchItem[]>([]);
|
||||
|
||||
@@ -272,8 +272,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { toRef, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { deleteAgentCheck, pageAgents, resetAgentToken, unbindAgentWebsite, updateAgentRemark } from '@/api/modules/ai';
|
||||
import { checkAppInstalled, installedOp, searchApp, searchAppInstalled } from '@/api/modules/app';
|
||||
@@ -341,7 +341,6 @@ const isActive = ref(false);
|
||||
const isExist = ref(false);
|
||||
const noApp = ref(false);
|
||||
const searchName = ref('');
|
||||
useSearchPersistence('ai/agents/agent/index', { search: searchName });
|
||||
const defaultHttpsPort = ref(443);
|
||||
const openrestyPortLoaded = ref(false);
|
||||
const websiteDomainsMap = ref<Record<number, Website.Domain[]>>({});
|
||||
@@ -401,6 +400,7 @@ const paginationConfig = reactive({
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const checkNoApp = async () => {
|
||||
try {
|
||||
|
||||
@@ -69,8 +69,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteAgentAccount, getAgentProviders, pageAgentAccounts } from '@/api/modules/ai';
|
||||
import { AI } from '@/api/interface/ai';
|
||||
import AddDialog from '@/views/ai/agents/model/add/index.vue';
|
||||
@@ -86,7 +86,6 @@ const items = ref<AI.AgentAccountItem[]>([]);
|
||||
const addRef = ref();
|
||||
const modelPoolRef = ref();
|
||||
const searchName = ref('');
|
||||
useSearchPersistence('ai/agents/model/index', { search: searchName });
|
||||
const apiType = ref('');
|
||||
const apiTypeOptions = ref<string[]>([]);
|
||||
|
||||
@@ -112,6 +111,7 @@ const paginationConfig = reactive({
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const search = async () => {
|
||||
const req: AI.AgentAccountSearch = {
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import AppStatus from '@/components/app-status/index.vue';
|
||||
import AddDialog from '@/views/ai/model/ollama/add/index.vue';
|
||||
import Conn from '@/views/ai/model/ollama/conn/index.vue';
|
||||
@@ -195,7 +195,7 @@ import Terminal from '@/views/ai/model/ollama/terminal/index.vue';
|
||||
import Del from '@/views/ai/model/ollama/del/index.vue';
|
||||
import PortJumpDialog from '@/components/port-jump/index.vue';
|
||||
import CodemirrorDrawer from '@/components/codemirror-pro/drawer.vue';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { App } from '@/api/interface/app';
|
||||
import {
|
||||
@@ -237,7 +237,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('ai/model/ollama/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
const appInstallID = ref(0);
|
||||
|
||||
const opRef = ref();
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { App } from '@/api/interface/app';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { searchApp, syncApp, syncCutomAppStore, syncLocalApp, getCurrentNodeCustomAppConfig } from '@/api/modules/app';
|
||||
@@ -105,7 +105,10 @@ const req = reactive({
|
||||
resource: 'all',
|
||||
showCurrentArch: false,
|
||||
});
|
||||
useSearchPersistence('app-store/apps/index', { search: toRef(req, 'name') });
|
||||
useSearchReset(
|
||||
{ search: toRef(req, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search(req) },
|
||||
);
|
||||
|
||||
const apps = ref<App.AppItem[]>([]);
|
||||
const loading = ref(false);
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import AppCard from '@/views/app-store/installed/app/card.vue';
|
||||
import Backups from '@/components/backup/index.vue';
|
||||
import Uploads from '@/components/upload/index.vue';
|
||||
@@ -211,7 +211,10 @@ const searchReq = reactive({
|
||||
update: false,
|
||||
sync: false,
|
||||
});
|
||||
useSearchPersistence('app-store/installed/index', { search: toRef(searchReq, 'name') });
|
||||
useSearchReset(
|
||||
{ search: toRef(searchReq, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const router = useRouter();
|
||||
const activeName = ref(i18n.global.t('app.installed'));
|
||||
const mode = ref('installed');
|
||||
|
||||
@@ -521,7 +521,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { computed, h, ref } from 'vue';
|
||||
import CodemirrorPro from '@/components/codemirror-pro/index.vue';
|
||||
import ContainerLog from '@/components/log/container/index.vue';
|
||||
@@ -576,7 +576,7 @@ const dialogBackupRef = ref();
|
||||
const uploadRef = ref();
|
||||
|
||||
const searchName = ref('');
|
||||
useSearchPersistence('container/compose/index', { search: searchName });
|
||||
useSearchReset({ search: searchName }, { onRevisit: () => search() });
|
||||
const includeAppStore = ref(localStorage.getItem('includeAppStore') !== 'false');
|
||||
const showType = ref('compose');
|
||||
const containerStats = ref<any[]>([]);
|
||||
|
||||
@@ -474,7 +474,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import PruneDialog from '@/views/container/container/prune/index.vue';
|
||||
import RenameDialog from '@/views/container/container/rename/index.vue';
|
||||
import UpgradeDialog from '@/views/container/container/upgrade/index.vue';
|
||||
@@ -490,7 +490,7 @@ import Uploads from '@/components/upload/index.vue';
|
||||
import DockerStatus from '@/views/container/docker-status/index.vue';
|
||||
import ContainerLogDialog from '@/components/log/container-drawer/index.vue';
|
||||
import Status from '@/components/status/index.vue';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { toRef, computed, reactive, ref } from 'vue';
|
||||
import {
|
||||
containerItemStats,
|
||||
containerListStats,
|
||||
@@ -536,7 +536,7 @@ const paginationConfig = reactive({
|
||||
order: 'ascending',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('container/container/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
const dialogUpgradeRef = ref();
|
||||
const dialogCommitRef = ref();
|
||||
const dialogPortJumpRef = ref();
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { toRef, reactive, ref, computed } from 'vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { newUUID } from '@/utils/id';
|
||||
@@ -200,7 +200,10 @@ const paginationConfig = reactive({
|
||||
orderBy: 'createdAt',
|
||||
order: 'null',
|
||||
});
|
||||
useSearchPersistence('container/image/index', { search: toRef(paginationConfig, 'name') });
|
||||
useSearchReset(
|
||||
{ search: toRef(paginationConfig, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const columns = ref([]);
|
||||
|
||||
const isActive = ref(false);
|
||||
|
||||
@@ -95,10 +95,10 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import CreateDialog from '@/views/container/network/create/index.vue';
|
||||
import DetailDrawer from '@/views/container/network/detail/index.vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { toRef, reactive, ref } from 'vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { newUUID } from '@/utils/id';
|
||||
import { deleteNetwork, searchNetwork, inspect, containerPrune } from '@/api/modules/container';
|
||||
@@ -121,7 +121,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('container/network/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const opRef = ref();
|
||||
const isActive = ref(false);
|
||||
|
||||
@@ -59,9 +59,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import OperatorDialog from '@/views/container/repo/operator/index.vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { toRef, reactive, ref } from 'vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { Container } from '@/api/interface/container';
|
||||
import { checkRepoStatus, deleteImageRepo, searchImageRepo } from '@/api/modules/container';
|
||||
@@ -78,7 +78,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('container/repo/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const opRef = ref();
|
||||
const confirmDialog = ref();
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { toRef, reactive, ref } from 'vue';
|
||||
import { dateFormat, getCurrentDateFormatted } from '@/utils/date';
|
||||
import { downloadWithContent } from '@/utils/file';
|
||||
import { Container } from '@/api/interface/container';
|
||||
@@ -111,7 +111,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('container/template/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const search = async () => {
|
||||
if (!isActive.value || !isExist.value) {
|
||||
|
||||
@@ -124,11 +124,11 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import CreateDialog from '@/views/container/volume/create/index.vue';
|
||||
import CodemirrorDrawer from '@/components/codemirror-pro/drawer.vue';
|
||||
import DockerStatus from '@/views/container/docker-status/index.vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { toRef, reactive, ref } from 'vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { newUUID } from '@/utils/id';
|
||||
import { deleteVolume, searchVolume, inspect, containerPrune } from '@/api/modules/container';
|
||||
@@ -158,7 +158,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('container/volume/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
const isActive = ref(false);
|
||||
const isExist = ref(false);
|
||||
|
||||
|
||||
@@ -272,11 +272,11 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import Records from '@/views/cronjob/cronjob/record/index.vue';
|
||||
import Backups from '@/views/cronjob/cronjob/backup/index.vue';
|
||||
import Import from '@/views/cronjob/cronjob/import/index.vue';
|
||||
import { onMounted, ref, toRefs } from 'vue';
|
||||
import { toRef, onMounted, ref, toRefs } from 'vue';
|
||||
import {
|
||||
deleteCronjob,
|
||||
editCronjobGroup,
|
||||
@@ -332,7 +332,7 @@ const pageState = usePageState(() => ({
|
||||
}));
|
||||
const paginationConfig = pageState.paginationConfig;
|
||||
const { defaultGroupID, searchName, searchGroupID } = toRefs(pageState);
|
||||
useSearchPersistence('cronjob/cronjob/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const search = async (column?: any) => {
|
||||
if (column) {
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { dateFormat, getCurrentDateFormatted } from '@/utils/date';
|
||||
import { deepCopy } from '@/utils/misc';
|
||||
import { newUUID } from '@/utils/id';
|
||||
@@ -141,7 +141,7 @@ import TaskLog from '@/components/log/task/index.vue';
|
||||
import OperateDialog from '@/views/cronjob/library/operate/index.vue';
|
||||
import TerminalDialog from '@/views/cronjob/library/run/index.vue';
|
||||
import { deleteScript, searchScript, syncScript } from '@/api/modules/cronjob';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { Cronjob } from '@/api/interface/cronjob';
|
||||
import i18n from '@/lang';
|
||||
import { useGlobalStore } from '@/composables/useGlobalStore';
|
||||
@@ -170,7 +170,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchInfo = ref<string>('');
|
||||
useSearchPersistence('cronjob/library/index', { search: searchInfo });
|
||||
useSearchReset({ search: searchInfo, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
const group = ref<string>('');
|
||||
const groupOptions = ref();
|
||||
|
||||
|
||||
@@ -323,8 +323,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { nextTick, onMounted, reactive, ref } from 'vue';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { toRef, nextTick, onMounted, reactive, ref } from 'vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { getRandomStr } from '@/utils/id';
|
||||
import { Position } from '@element-plus/icons-vue';
|
||||
@@ -366,7 +366,6 @@ const loading = ref(false);
|
||||
const maskShow = ref(true);
|
||||
const submitLoading = ref(false);
|
||||
const searchName = ref('');
|
||||
useSearchPersistence('database/mongodb/index', { search: searchName });
|
||||
const createVisible = ref(false);
|
||||
const appStatusRef = ref();
|
||||
const bindRef = ref();
|
||||
@@ -400,6 +399,7 @@ const paginationConfig = reactive({
|
||||
orderBy: 'createdAt',
|
||||
order: 'null',
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
type FormInstance = InstanceType<typeof ElForm>;
|
||||
const formRef = ref<FormInstance>();
|
||||
|
||||
@@ -75,9 +75,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteCheckDatabase, searchDatabases } from '@/api/modules/database';
|
||||
import AppResources from '@/views/database/postgresql/check/index.vue';
|
||||
import OperateDialog from '@/views/database/mongodb/remote/operate/index.vue';
|
||||
@@ -101,7 +101,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('database/mongodb/remote/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const search = async (column?: any) => {
|
||||
paginationConfig.orderBy = column?.order ? column.prop : paginationConfig.orderBy;
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import BindDialog from '@/views/database/mysql/bind/index.vue';
|
||||
import UserDialog from '@/views/database/mysql/user/index.vue';
|
||||
import OperateDialog from '@/views/database/mysql/create/index.vue';
|
||||
@@ -241,7 +241,7 @@ import PortJumpDialog from '@/components/port-jump/index.vue';
|
||||
import Tooltip from '@/components/tooltip/index.vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import {
|
||||
deleteCheckMysqlDB,
|
||||
listDatabases,
|
||||
@@ -301,7 +301,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('database/mysql/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const mysqlContainer = ref();
|
||||
const mysqlStatus = ref();
|
||||
|
||||
@@ -74,9 +74,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteCheckDatabase, searchDatabases } from '@/api/modules/database';
|
||||
import AppResources from '@/views/database/mysql/check/index.vue';
|
||||
import OperateDialog from '@/views/database/mysql/remote/operate/index.vue';
|
||||
@@ -100,7 +100,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('database/mysql/remote/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const search = async (column?: any) => {
|
||||
paginationConfig.orderBy = column?.order ? column.prop : paginationConfig.orderBy;
|
||||
|
||||
@@ -241,7 +241,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import BindDialog from '@/views/database/postgresql/bind/index.vue';
|
||||
import OperateDialog from '@/views/database/postgresql/create/index.vue';
|
||||
import DeleteDialog from '@/views/database/postgresql/delete/index.vue';
|
||||
@@ -256,7 +256,7 @@ import UploadDialog from '@/components/upload/index.vue';
|
||||
import PortJumpDialog from '@/components/port-jump/index.vue';
|
||||
import Tooltip from '@/components/tooltip/index.vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import {
|
||||
deleteCheckPostgresqlDB,
|
||||
listDatabases,
|
||||
@@ -313,7 +313,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('database/postgresql/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const postgresqlContainer = ref();
|
||||
const postgresqlStatus = ref();
|
||||
|
||||
@@ -74,9 +74,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteCheckDatabase, searchDatabases } from '@/api/modules/database';
|
||||
import AppResources from '@/views/database/postgresql/check/index.vue';
|
||||
import OperateDialog from '@/views/database/postgresql/remote/operate/index.vue';
|
||||
@@ -100,7 +100,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('database/postgresql/remote/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const search = async (column?: any) => {
|
||||
paginationConfig.orderBy = column?.order ? column.prop : paginationConfig.orderBy;
|
||||
|
||||
@@ -73,9 +73,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteCheckDatabase, searchDatabases } from '@/api/modules/database';
|
||||
import AppResources from '@/views/database/redis/check/index.vue';
|
||||
import OperateDialog from '@/views/database/redis/remote/operate/index.vue';
|
||||
@@ -99,7 +99,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('database/redis/remote/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const search = async (column?: any) => {
|
||||
paginationConfig.orderBy = column?.order ? column.prop : paginationConfig.orderBy;
|
||||
|
||||
@@ -739,7 +739,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { toRef, computed, nextTick, onBeforeUnmount, onMounted, reactive, ref } from 'vue';
|
||||
import {
|
||||
addFavorite,
|
||||
@@ -853,7 +853,6 @@ const initData = () => ({
|
||||
sortOrder: 'ascending',
|
||||
});
|
||||
let req = reactive(initData());
|
||||
useSearchPersistence('host/file-management/index', { search: toRef(req, 'search') });
|
||||
let loading = ref(false);
|
||||
const paths = ref<FilePaths[]>([]);
|
||||
const breadcrumbVisiblePaths = ref<FilePaths[]>([]);
|
||||
@@ -986,6 +985,10 @@ const paginationConfig = reactive({
|
||||
pageSize: Number(localStorage.getItem('file-page-size')) || 100,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset(
|
||||
{ search: toRef(req, 'search'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
|
||||
const btnWrapperRefs = ref<Record<string, any>>({});
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import FireRouter from '@/views/host/firewall/index.vue';
|
||||
import DockerGuardStatus from '@/views/host/firewall/docker/status/index.vue';
|
||||
@@ -264,7 +264,14 @@ const openRuleTask = (taskID: string) => taskLogRef.value?.openWithTaskID(taskID
|
||||
const orphanDrawerVisible = ref(false);
|
||||
const orphanSearchName = ref('');
|
||||
const searchName = ref('');
|
||||
useSearchPersistence('host/firewall/docker/index', { search: searchName });
|
||||
useSearchReset(
|
||||
{ search: searchName },
|
||||
{
|
||||
onRevisit: () => {
|
||||
paginationConfig.currentPage = 1;
|
||||
},
|
||||
},
|
||||
);
|
||||
const selects = ref<Firewall.DockerGuardContainer[]>([]);
|
||||
const orphanSelects = ref<Firewall.DockerGuardEndpoint[]>([]);
|
||||
const data = reactive<Firewall.DockerGuardList>({
|
||||
|
||||
@@ -120,14 +120,14 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import OperateDialog from './operate/index.vue';
|
||||
import ImportDialog from './import/index.vue';
|
||||
import FireRouter from '@/views/host/firewall/index.vue';
|
||||
import FireStatus from '@/views/host/firewall/status/index.vue';
|
||||
import RuleReset from '@/views/host/firewall/components/rule-reset.vue';
|
||||
import TaskLog from '@/components/log/task/index.vue';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { resetFirewallRules, operateForwardRule, searchForwardRule } from '@/api/modules/firewall';
|
||||
import { Firewall } from '@/api/interface/firewall';
|
||||
import { buildForwardRuleExport } from './transfer';
|
||||
@@ -141,7 +141,6 @@ import { ElMessageBox } from 'element-plus';
|
||||
const loading = ref();
|
||||
const selects = ref<any>([]);
|
||||
const searchName = ref();
|
||||
useSearchPersistence('host/firewall/forward/index', { search: searchName });
|
||||
|
||||
const isInit = ref(false);
|
||||
const isBind = ref(false);
|
||||
@@ -192,6 +191,7 @@ const paginationConfig = reactive({
|
||||
pageSize: Number(localStorage.getItem('firewall-forward-page-size')) || 20,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const search = async () => {
|
||||
if (!isInit.value || !isBind.value || fireName.value === '-') {
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { Firewall } from '@/api/interface/firewall';
|
||||
import type { FuTableOperationButton } from '@/components/table/shared';
|
||||
import { buildHostRuleExport } from './transfer';
|
||||
@@ -330,7 +330,7 @@ import RuleReset from '@/views/host/firewall/components/rule-reset.vue';
|
||||
import TaskLog from '@/components/log/task/index.vue';
|
||||
import DockerRestart from '@/components/docker-proxy/docker-restart.vue';
|
||||
import { loadDockerStatus } from '@/api/modules/container';
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue';
|
||||
import { useElementSize } from '@vueuse/core';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { Expand, Loading, Lock, Refresh } from '@element-plus/icons-vue';
|
||||
@@ -405,7 +405,6 @@ const showFirewallUnavailablePrompt = computed(
|
||||
const firewallVersion = ref('');
|
||||
const selectedRuleFilters = ref<RuleFilter[]>(loadCachedFilterValues(ruleFilterStorageKey, ruleFilterOptions, []));
|
||||
const searchName = ref('');
|
||||
useSearchPersistence('host/firewall/rule/index', { search: searchName });
|
||||
const inventoryItems = ref<Firewall.InventoryItem[]>([]);
|
||||
const positionRanges = ref<Partial<Record<Firewall.Family, Firewall.PositionRange>>>({});
|
||||
const inventoryTotal = ref(0);
|
||||
@@ -433,6 +432,7 @@ const paginationConfig = reactive({
|
||||
pageSize: Number(localStorage.getItem('firewall-rule-page-size')) || 20,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const providerScopes = (): Firewall.Scope[] => {
|
||||
if (provider.value === 'iptables' || provider.value === 'nftables') {
|
||||
|
||||
@@ -93,11 +93,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
|
||||
import { dateFormatServerTimezone } from '@/utils/date';
|
||||
import { downloadFile } from '@/utils/file';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { cleanSSHLogs, exportSSHLogs, loadSSHLogs } from '@/api/modules/host';
|
||||
import { useGlobalStore } from '@/composables/useGlobalStore';
|
||||
import i18n from '@/lang';
|
||||
@@ -120,7 +120,7 @@ const exportConfig = reactive({
|
||||
status: 'All',
|
||||
});
|
||||
const searchInfo = ref();
|
||||
useSearchPersistence('host/ssh/log/log', { search: searchInfo });
|
||||
useSearchReset({ search: searchInfo, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
const searchStatus = ref('All');
|
||||
|
||||
const search = async () => {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import FireRouter from '@/views/host/ssh/index.vue';
|
||||
import { toRef, ref, onMounted, onUnmounted, reactive } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
@@ -38,7 +38,7 @@ const sshSearch = reactive({
|
||||
type: 'ssh',
|
||||
loginUser: '',
|
||||
});
|
||||
useSearchPersistence('host/ssh/session/index', { search: toRef(sshSearch, 'loginUser') });
|
||||
useSearchReset({ search: toRef(sshSearch, 'loginUser') }, { onRevisit: () => search() });
|
||||
|
||||
const buttons = [
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
||||
import { Log } from '@/api/interface/log';
|
||||
import { getSystemLogStatus, listRunningServices, readSystemLogs } from '@/api/modules/log';
|
||||
@@ -114,7 +114,7 @@ const logs = ref<Log.SystemLogItem[]>([]);
|
||||
const loading = ref(false);
|
||||
const watching = ref(false);
|
||||
const keyword = ref('');
|
||||
useSearchPersistence('log/host-system/index', { keyword });
|
||||
useSearchReset({ keyword }, { onRevisit: () => scheduleFilterSearch() });
|
||||
const priority = ref('');
|
||||
const service = ref('');
|
||||
const services = ref<string[]>([]);
|
||||
@@ -274,11 +274,13 @@ onUnmounted(() => {
|
||||
if (filterTimer) clearTimeout(filterTimer);
|
||||
});
|
||||
|
||||
watch([keyword, priority, service], () => {
|
||||
const scheduleFilterSearch = () => {
|
||||
requestID++;
|
||||
if (filterTimer) clearTimeout(filterTimer);
|
||||
filterTimer = setTimeout(resetAndLoadLogs, 300);
|
||||
});
|
||||
};
|
||||
|
||||
watch([keyword, priority, service], scheduleFilterSearch);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -45,12 +45,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
|
||||
import LogRouter from '@/views/log/router/index.vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { cleanLogs, getLoginLogs } from '@/api/modules/log';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { useGlobalStore } from '@/composables/useGlobalStore';
|
||||
@@ -67,7 +67,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchInfo = ref<string>('');
|
||||
useSearchPersistence('log/login/index', { search: searchInfo });
|
||||
useSearchReset({ search: searchInfo, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
const searchStatus = ref<string>('');
|
||||
|
||||
const search = async () => {
|
||||
|
||||
@@ -125,12 +125,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
|
||||
import LogRouter from '@/views/log/router/index.vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { cleanLogs, getOperationLogs } from '@/api/modules/log';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { useGlobalStore } from '@/composables/useGlobalStore';
|
||||
@@ -146,7 +146,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref<string>('');
|
||||
useSearchPersistence('log/operation/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
const searchGroup = ref<string>('');
|
||||
const searchStatus = ref<string>('');
|
||||
const searchNode = ref<string>('');
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { toRef, onMounted, ref } from 'vue';
|
||||
import { searchBackup, deleteBackup, refreshToken } from '@/api/modules/backup';
|
||||
@@ -143,7 +143,10 @@ const paginationConfig = reactive({
|
||||
type: '',
|
||||
name: '',
|
||||
});
|
||||
useSearchPersistence('setting/backup-account/index', { search: toRef(paginationConfig, 'name') });
|
||||
useSearchReset(
|
||||
{ search: toRef(paginationConfig, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const opRef = ref();
|
||||
const dialogRef = ref();
|
||||
const detailRef = ref();
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import {
|
||||
searchSnapshotPage,
|
||||
snapshotDelete,
|
||||
@@ -233,7 +233,7 @@ import {
|
||||
snapshotRollback,
|
||||
updateSnapshotDescription,
|
||||
} from '@/api/modules/setting';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { computeSize } from '@/utils/size';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { newUUID } from '@/utils/id';
|
||||
@@ -261,7 +261,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('setting/snapshot/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const opRef = ref();
|
||||
|
||||
|
||||
@@ -100,13 +100,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { Command } from '@/api/interface/command';
|
||||
import GroupDialog from '@/components/group/index.vue';
|
||||
import OperateDialog from '@/views/terminal/command/operate/index.vue';
|
||||
import ImportDialog from '@/views/terminal/command/import/index.vue';
|
||||
import { editCommand, deleteCommand, getCommandPage, exportCommands } from '@/api/modules/command';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { toRef, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { getGroupList } from '@/api/modules/group';
|
||||
@@ -124,7 +124,7 @@ const paginationConfig = reactive({
|
||||
order: 'ascending',
|
||||
});
|
||||
const info = ref();
|
||||
useSearchPersistence('terminal/command/index', { search: info });
|
||||
useSearchReset({ search: info, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
const group = ref<string>('');
|
||||
const dialogRef = ref();
|
||||
const opRef = ref();
|
||||
|
||||
@@ -79,12 +79,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import GroupDialog from '@/components/agent-group/index.vue';
|
||||
import OperateDialog from '@/views/terminal/host/operate/index.vue';
|
||||
import { deleteHost, editHostGroup, searchHosts } from '@/api/modules/terminal';
|
||||
import { getAgentGroupList } from '@/api/modules/group';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { toRef, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { Host } from '@/api/interface/host';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
@@ -100,7 +100,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const info = ref();
|
||||
useSearchPersistence('terminal/host/index', { search: info });
|
||||
useSearchReset({ search: info, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
const group = ref<string>('');
|
||||
|
||||
const opRef = ref();
|
||||
|
||||
@@ -190,8 +190,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { deleteClam, handleClamScan, searchClam, updateClam, updateClamStatus } from '@/api/modules/toolbox';
|
||||
@@ -218,7 +218,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('toolbox/clam/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const opRef = ref();
|
||||
const dialogRef = ref();
|
||||
|
||||
@@ -174,8 +174,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { MsgError, MsgSuccess } from '@/utils/message';
|
||||
import { deleteFtp, searchFtp, updateFtp, syncFtp, operateFtp, getFtpBase } from '@/api/modules/toolbox';
|
||||
@@ -201,7 +201,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchPersistence('toolbox/ftp/index', { search: searchName });
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const form = reactive({
|
||||
isActive: true,
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { Runtime } from '@/api/interface/runtime';
|
||||
import { GetPHPExtensions, InstallPHPExtension, UnInstallPHPExtension } from '@/api/modules/runtime';
|
||||
import i18n from '@/lang';
|
||||
@@ -49,7 +49,7 @@ const supportExtensions = ref([]);
|
||||
const loading = ref(false);
|
||||
const taskLogRef = ref();
|
||||
const searchName = ref('');
|
||||
useSearchPersistence('website/runtime/php/extension-management/index', { search: searchName });
|
||||
useSearchReset({ search: searchName }, { onRevisit: () => searchByName() });
|
||||
const data = ref([]);
|
||||
|
||||
const handleClose = () => {
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { toRef, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteSSL, downloadFile, pushSSLToNode, searchSSL, updateSSL } from '@/api/modules/website';
|
||||
import DnsAccount from './dns-account/index.vue';
|
||||
@@ -287,7 +287,10 @@ const req = reactive({
|
||||
orderBy: 'updated_at',
|
||||
order: 'descending',
|
||||
});
|
||||
useSearchPersistence('website/ssl/index', { search: toRef(req, 'domain') });
|
||||
useSearchReset(
|
||||
{ search: toRef(req, 'domain'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const pushForm = ref({
|
||||
id: 0,
|
||||
pushNode: true,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { Website } from '@/api/interface/website';
|
||||
import { deleteTemplate, searchTemplates } from '@/api/modules/website';
|
||||
import TemplateOperate from '@/views/website/template/operate/index.vue';
|
||||
@@ -67,12 +67,11 @@ import OutputCreate from '@/views/website/template/output/create.vue';
|
||||
import OutputList from '@/views/website/template/output/index.vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import i18n from '@/lang';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { toRef, reactive, ref, onMounted } from 'vue';
|
||||
|
||||
const loading = ref(false);
|
||||
const data = ref<Website.Template[]>([]);
|
||||
const searchName = ref('');
|
||||
useSearchPersistence('website/template/index', { search: searchName });
|
||||
const opRef = ref();
|
||||
const operateRef = ref();
|
||||
const outputCreateRef = ref();
|
||||
@@ -91,6 +90,7 @@ const paginationConfig = reactive({
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
|
||||
|
||||
const buttons = [
|
||||
{
|
||||
|
||||
@@ -346,7 +346,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchPersistence } from '@/composables/useSearchPersistence';
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import Backups from '@/components/backup/index.vue';
|
||||
import UploadDialog from '@/components/upload/index.vue';
|
||||
import DefaultServer from '@/views/website/website/default/index.vue';
|
||||
@@ -451,7 +451,10 @@ const pageState = usePageState(() => ({
|
||||
}));
|
||||
const paginationConfig = pageState.paginationConfig;
|
||||
const req = pageState.req;
|
||||
useSearchPersistence('website/website/index', { search: toRef(req, 'name') });
|
||||
useSearchReset(
|
||||
{ search: toRef(req, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
);
|
||||
const tableSort = pageState.tableSort;
|
||||
|
||||
const goRouter = async (key: string) => {
|
||||
|
||||
Reference in New Issue
Block a user