mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-15 08:00:41 +00:00
fix: alert config log text
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { onActivated, onDeactivated } from 'vue';
|
||||
import GlobalStore from '@/store/modules/global';
|
||||
import { bindSearchState, type SearchFields } from '@/utils/search-reset';
|
||||
|
||||
interface SearchResetOptions {
|
||||
scope?: () => string | number | undefined;
|
||||
onRevisit: () => unknown;
|
||||
}
|
||||
|
||||
/** 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 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;
|
||||
});
|
||||
onActivated(() => {
|
||||
if (!deactivated) return;
|
||||
deactivated = false;
|
||||
restore();
|
||||
return options.onRevisit();
|
||||
});
|
||||
};
|
||||
@@ -1,27 +1,30 @@
|
||||
import { watch, type Ref } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { onActivated, onDeactivated, onScopeDispose, watch, type Ref } from 'vue';
|
||||
import GlobalStore from '@/store/modules/global';
|
||||
|
||||
export type SearchFields = Record<string, Ref<string | number | undefined>>;
|
||||
type SearchValues = Record<string, string | number | undefined>;
|
||||
|
||||
/** 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>();
|
||||
export const createSearchStateStorage = (storage: () => Storage = () => localStorage) => {
|
||||
const unsaved = new Map<string, SearchValues>();
|
||||
return {
|
||||
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])),
|
||||
),
|
||||
const target = storage();
|
||||
const storageKey = `1panel:search-state:v2:${key}`;
|
||||
const serialized = JSON.stringify(
|
||||
Object.fromEntries(Object.entries(values).map(([name, value]) => [name, value ?? null])),
|
||||
);
|
||||
if (target.getItem(storageKey) !== serialized) target.setItem(storageKey, serialized);
|
||||
unsaved.delete(key);
|
||||
} catch {
|
||||
// Keep in-memory state when storage is unavailable or full.
|
||||
// Only failed writes need an in-memory fallback.
|
||||
unsaved.set(key, { ...values });
|
||||
}
|
||||
},
|
||||
read(key: string): SearchValues | undefined {
|
||||
const cached = entries.get(key);
|
||||
const cached = unsaved.get(key);
|
||||
if (cached) return { ...cached };
|
||||
try {
|
||||
const saved = JSON.parse(storage().getItem(`1panel:search-state:v2:${key}`) || 'null');
|
||||
@@ -43,20 +46,31 @@ export const createSearchVisitCache = (storage: () => Storage = () => localStora
|
||||
};
|
||||
};
|
||||
|
||||
const visitCache = createSearchVisitCache();
|
||||
const searchStorage = createSearchStateStorage();
|
||||
|
||||
export const bindSearchState = (key: () => string | undefined, fields: SearchFields, cache = visitCache) => {
|
||||
export const bindSearchState = (key: () => string | undefined, fields: SearchFields, storage = searchStorage) => {
|
||||
const defaults = Object.fromEntries(Object.entries(fields).map(([name, field]) => [name, field.value]));
|
||||
const names = Object.keys(fields).sort((left, right) => Number(left === 'page') - Number(right === 'page'));
|
||||
let pending: { key: string; values: SearchValues } | undefined;
|
||||
let queued = false;
|
||||
const flush = () => {
|
||||
if (!pending) return;
|
||||
const snapshot = pending;
|
||||
pending = undefined;
|
||||
storage.save(snapshot.key, snapshot.values);
|
||||
};
|
||||
onScopeDispose(flush);
|
||||
let restoring = false;
|
||||
let activeKey: string | undefined;
|
||||
const restore = () => {
|
||||
// Commit the previous node/resource before restoring another one.
|
||||
flush();
|
||||
activeKey = key();
|
||||
if (!activeKey) return;
|
||||
const saved = cache.read(activeKey) || defaults;
|
||||
const saved = storage.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];
|
||||
@@ -71,9 +85,39 @@ export const bindSearchState = (key: () => string | undefined, fields: SearchFie
|
||||
watch(
|
||||
() => Object.fromEntries(Object.entries(fields).map(([name, field]) => [name, field.value])),
|
||||
(values) => {
|
||||
if (!restoring && activeKey) cache.save(activeKey, values);
|
||||
if (restoring || !activeKey) return;
|
||||
pending = { key: activeKey, values };
|
||||
if (queued) return;
|
||||
queued = true;
|
||||
queueMicrotask(() => {
|
||||
queued = false;
|
||||
flush();
|
||||
});
|
||||
},
|
||||
{ immediate: true, flush: 'sync' },
|
||||
{ flush: 'sync' },
|
||||
);
|
||||
return restore;
|
||||
};
|
||||
|
||||
interface SearchStateOptions {
|
||||
scope?: () => string | number | undefined;
|
||||
onRevisit: () => unknown;
|
||||
}
|
||||
|
||||
/** Keep queries across page visits and reload data when a cached page becomes active. */
|
||||
export const useSearchState = (page: string, fields: SearchFields, options: SearchStateOptions) => {
|
||||
const { currentNode } = storeToRefs(GlobalStore());
|
||||
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;
|
||||
});
|
||||
onActivated(() => {
|
||||
if (!deactivated) return;
|
||||
deactivated = false;
|
||||
return options.onRevisit();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Refresh, Search } from '@element-plus/icons-vue';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
@@ -193,7 +193,7 @@ const searching = ref(false);
|
||||
const operating = ref('');
|
||||
const keyword = ref('');
|
||||
const marketKeyword = ref('');
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'ai/agents/agent/config/tabs/plugins',
|
||||
{ keyword, marketKeyword },
|
||||
{
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Refresh, Search } from '@element-plus/icons-vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -169,7 +169,7 @@ const getDefaultMarketSource = (): HermesSkillMarketSource => {
|
||||
const marketSource = ref<HermesSkillMarketSource>(getDefaultMarketSource());
|
||||
const marketSearched = ref(false);
|
||||
const agentId = ref(0);
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'ai/agents/agent/config/tabs/skills/hermes',
|
||||
{ installedKeyword, marketKeyword },
|
||||
{
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Refresh, Search } from '@element-plus/icons-vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -181,7 +181,7 @@ const getDefaultMarketSource = (): SkillMarketSource => {
|
||||
const marketSource = ref<SkillMarketSource>(getDefaultMarketSource());
|
||||
const marketSearched = ref(false);
|
||||
const agentId = ref(0);
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'ai/agents/agent/config/tabs/skills/openclaw',
|
||||
{ installedKeyword, marketKeyword },
|
||||
{
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { toRef, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { deleteAgentCheck, pageAgents, resetAgentToken, unbindAgentWebsite, updateAgentRemark } from '@/api/modules/ai';
|
||||
@@ -400,7 +400,7 @@ const paginationConfig = reactive({
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'ai/agents/agent/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteAgentAccount, getAgentProviders, pageAgentAccounts } from '@/api/modules/ai';
|
||||
import { AI } from '@/api/interface/ai';
|
||||
@@ -111,7 +111,7 @@ const paginationConfig = reactive({
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'ai/agents/model/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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';
|
||||
@@ -237,7 +237,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'ai/model/ollama/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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,7 @@ const req = reactive({
|
||||
resource: 'all',
|
||||
showCurrentArch: false,
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'app-store/apps/index',
|
||||
{ search: toRef(req, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search(req) },
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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,7 @@ const searchReq = reactive({
|
||||
update: false,
|
||||
sync: false,
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'app-store/installed/index',
|
||||
{ search: toRef(searchReq, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -522,7 +522,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { computed, h, ref } from 'vue';
|
||||
import CodemirrorPro from '@/components/codemirror-pro/index.vue';
|
||||
import ContainerLog from '@/components/log/container/index.vue';
|
||||
@@ -577,7 +577,7 @@ const dialogBackupRef = ref();
|
||||
const uploadRef = ref();
|
||||
|
||||
const searchName = ref('');
|
||||
useSearchReset('container/compose/index', { search: searchName }, { onRevisit: () => search() });
|
||||
useSearchState('container/compose/index', { 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 { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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';
|
||||
@@ -551,7 +551,7 @@ const taskLogRef = ref();
|
||||
|
||||
const tags = ref([]);
|
||||
const activeTag = ref('all');
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'container/container/index',
|
||||
{
|
||||
search: searchName,
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { toRef, reactive, ref, computed } from 'vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { newUUID } from '@/utils/id';
|
||||
@@ -200,7 +200,7 @@ const paginationConfig = reactive({
|
||||
orderBy: 'createdAt',
|
||||
order: 'null',
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'container/image/index',
|
||||
{ search: toRef(paginationConfig, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import CreateDialog from '@/views/container/network/create/index.vue';
|
||||
import DetailDrawer from '@/views/container/network/detail/index.vue';
|
||||
import { toRef, reactive, ref } from 'vue';
|
||||
@@ -121,7 +121,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'container/network/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import OperatorDialog from '@/views/container/repo/operator/index.vue';
|
||||
import { toRef, reactive, ref } from 'vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
@@ -78,7 +78,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'container/repo/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { toRef, reactive, ref } from 'vue';
|
||||
import { dateFormat, getCurrentDateFormatted } from '@/utils/date';
|
||||
import { downloadWithContent } from '@/utils/file';
|
||||
@@ -111,7 +111,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'container/template/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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';
|
||||
@@ -158,7 +158,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'container/volume/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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';
|
||||
@@ -332,7 +332,7 @@ const pageState = usePageState(() => ({
|
||||
}));
|
||||
const paginationConfig = pageState.paginationConfig;
|
||||
const { defaultGroupID, searchName, searchGroupID } = toRefs(pageState);
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'cronjob/cronjob/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { dateFormat, getCurrentDateFormatted } from '@/utils/date';
|
||||
import { deepCopy } from '@/utils/misc';
|
||||
import { newUUID } from '@/utils/id';
|
||||
@@ -170,7 +170,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchInfo = ref<string>('');
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'cronjob/library/index',
|
||||
{ search: searchInfo, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -323,7 +323,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { toRef, nextTick, onMounted, reactive, ref } from 'vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { getRandomStr } from '@/utils/id';
|
||||
@@ -399,7 +399,7 @@ const paginationConfig = reactive({
|
||||
orderBy: 'createdAt',
|
||||
order: 'null',
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'database/mongodb/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteCheckDatabase, searchDatabases } from '@/api/modules/database';
|
||||
@@ -101,7 +101,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'database/mongodb/remote/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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';
|
||||
@@ -301,7 +301,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'database/mysql/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteCheckDatabase, searchDatabases } from '@/api/modules/database';
|
||||
@@ -100,7 +100,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'database/mysql/remote/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -241,7 +241,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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';
|
||||
@@ -313,7 +313,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'database/postgresql/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteCheckDatabase, searchDatabases } from '@/api/modules/database';
|
||||
@@ -100,7 +100,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'database/postgresql/remote/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import { deleteCheckDatabase, searchDatabases } from '@/api/modules/database';
|
||||
@@ -99,7 +99,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'database/redis/remote/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -739,7 +739,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { toRef, computed, nextTick, onBeforeUnmount, onMounted, reactive, ref } from 'vue';
|
||||
import {
|
||||
addFavorite,
|
||||
@@ -985,7 +985,7 @@ const paginationConfig = reactive({
|
||||
pageSize: Number(localStorage.getItem('file-page-size')) || 100,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'host/file-management/index',
|
||||
{ search: toRef(req, 'search'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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';
|
||||
@@ -263,7 +263,7 @@ const openRuleTask = (taskID: string) => taskLogRef.value?.openWithTaskID(taskID
|
||||
const orphanDrawerVisible = ref(false);
|
||||
const orphanSearchName = ref('');
|
||||
const searchName = ref('');
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'host/firewall/docker/index',
|
||||
{ search: searchName },
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import OperateDialog from './operate/index.vue';
|
||||
import ImportDialog from './import/index.vue';
|
||||
import FireRouter from '@/views/host/firewall/index.vue';
|
||||
@@ -188,7 +188,7 @@ const paginationConfig = reactive({
|
||||
pageSize: Number(localStorage.getItem('firewall-forward-page-size')) || 20,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'host/firewall/forward/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { Firewall } from '@/api/interface/firewall';
|
||||
import type { FuTableOperationButton } from '@/components/table/shared';
|
||||
import { buildHostRuleExport } from './transfer';
|
||||
@@ -432,7 +432,7 @@ const paginationConfig = reactive({
|
||||
pageSize: Number(localStorage.getItem('firewall-rule-page-size')) || 20,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'host/firewall/rule/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
|
||||
import { dateFormatServerTimezone } from '@/utils/date';
|
||||
import { downloadFile } from '@/utils/file';
|
||||
@@ -120,7 +120,7 @@ const exportConfig = reactive({
|
||||
status: 'All',
|
||||
});
|
||||
const searchInfo = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'host/ssh/log/log',
|
||||
{ search: searchInfo, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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: '',
|
||||
});
|
||||
useSearchReset('host/ssh/session/index', { search: toRef(sshSearch, 'loginUser') }, { onRevisit: () => search() });
|
||||
useSearchState('host/ssh/session/index', { search: toRef(sshSearch, 'loginUser') }, { onRevisit: () => search() });
|
||||
|
||||
const buttons = [
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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('');
|
||||
useSearchReset('log/host-system/index', { keyword }, { onRevisit: () => scheduleFilterSearch() });
|
||||
useSearchState('log/host-system/index', { keyword }, { onRevisit: () => scheduleFilterSearch() });
|
||||
const priority = ref('');
|
||||
const service = ref('');
|
||||
const services = ref<string[]>([]);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
|
||||
import LogRouter from '@/views/log/router/index.vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
@@ -67,7 +67,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchInfo = ref<string>('');
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'log/login/index',
|
||||
{ search: searchInfo, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
|
||||
import LogRouter from '@/views/log/router/index.vue';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
@@ -160,7 +160,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const searchName = ref<string>('');
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'log/operation/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { dateFormat } from '@/utils/date';
|
||||
import { toRef, onMounted, ref } from 'vue';
|
||||
import { searchBackup, deleteBackup, refreshToken } from '@/api/modules/backup';
|
||||
@@ -143,7 +143,7 @@ const paginationConfig = reactive({
|
||||
type: '',
|
||||
name: '',
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'setting/backup-account/index',
|
||||
{ search: toRef(paginationConfig, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import {
|
||||
searchSnapshotPage,
|
||||
snapshotDelete,
|
||||
@@ -261,7 +261,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'setting/snapshot/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { Command } from '@/api/interface/command';
|
||||
import GroupDialog from '@/components/group/index.vue';
|
||||
import OperateDialog from '@/views/terminal/command/operate/index.vue';
|
||||
@@ -124,7 +124,7 @@ const paginationConfig = reactive({
|
||||
order: 'ascending',
|
||||
});
|
||||
const info = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'terminal/command/index',
|
||||
{ search: info, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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';
|
||||
@@ -100,7 +100,7 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
const info = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'terminal/host/index',
|
||||
{ search: info, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
@@ -218,7 +218,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'toolbox/clam/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { toRef, onMounted, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { MsgError, MsgSuccess } from '@/utils/message';
|
||||
@@ -201,7 +201,7 @@ const paginationConfig = reactive({
|
||||
order: 'null',
|
||||
});
|
||||
const searchName = ref();
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'toolbox/ftp/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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('');
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'website/runtime/php/extension-management/index',
|
||||
{ search: searchName },
|
||||
{ onRevisit: () => searchByName() },
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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,7 @@ const req = reactive({
|
||||
orderBy: 'updated_at',
|
||||
order: 'descending',
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'website/ssl/index',
|
||||
{ search: toRef(req, 'domain'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import { Website } from '@/api/interface/website';
|
||||
import { deleteTemplate, searchTemplates } from '@/api/modules/website';
|
||||
import TemplateOperate from '@/views/website/template/operate/index.vue';
|
||||
@@ -90,7 +90,7 @@ const paginationConfig = reactive({
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
});
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'website/template/index',
|
||||
{ search: searchName, page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
@@ -346,7 +346,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useSearchReset } from '@/composables/useSearchReset';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
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,7 @@ const pageState = usePageState(() => ({
|
||||
}));
|
||||
const paginationConfig = pageState.paginationConfig;
|
||||
const req = pageState.req;
|
||||
useSearchReset(
|
||||
useSearchState(
|
||||
'website/website/index',
|
||||
{ search: toRef(req, 'name'), page: toRef(paginationConfig, 'currentPage') },
|
||||
{ onRevisit: () => search() },
|
||||
|
||||
Reference in New Issue
Block a user