diff --git a/orion-ops-ui/src/assets/style/global.less b/orion-ops-ui/src/assets/style/global.less index d8e5457e..ba877e75 100644 --- a/orion-ops-ui/src/assets/style/global.less +++ b/orion-ops-ui/src/assets/style/global.less @@ -69,6 +69,10 @@ body { } // -- arco +.arco-menu-inner::-webkit-scrollbar { + display: none; +} + .arco-table-td-content { color: rgba(var(--gray-9), .95); font-size: 13px; @@ -119,7 +123,8 @@ body { margin: 0; } } -.arco-scrollbar-track-direction-horizontal{ + +.arco-scrollbar-track-direction-horizontal { height: 9px; .arco-scrollbar-thumb-bar { diff --git a/orion-ops-ui/src/components/asset/host-group/host-group-tree-selector.vue b/orion-ops-ui/src/components/asset/host-group/host-group-tree-selector.vue index 3b48995d..3e47b059 100644 --- a/orion-ops-ui/src/components/asset/host-group/host-group-tree-selector.vue +++ b/orion-ops-ui/src/components/asset/host-group/host-group-tree-selector.vue @@ -2,6 +2,7 @@ @@ -19,7 +20,7 @@ import type { PropType } from 'vue'; import { computed, onBeforeMount, ref } from 'vue'; import { useCacheStore } from '@/store'; - import { getHostGroupTree } from '@/api/asset/host-group'; + import useLoading from '@/hooks/loading'; const props = defineProps({ modelValue: Array as PropType>, @@ -27,6 +28,7 @@ const emits = defineEmits(['update:modelValue']); + const { loading, setLoading } = useLoading(); const cacheStore = useCacheStore(); const value = computed>({ @@ -44,10 +46,14 @@ const treeData = ref>([]); // 初始化选项 - onBeforeMount(() => { - cacheStore.loadHostGroups().then(s => { - treeData.value = s; - }); + onBeforeMount(async () => { + setLoading(true); + try { + treeData.value = await cacheStore.loadHostGroups(); + } catch (e) { + } finally { + setLoading(false); + } }); diff --git a/orion-ops-ui/src/components/asset/host-group/host-group-tree.vue b/orion-ops-ui/src/components/asset/host-group/host-group-tree.vue index bca9d667..9a92134e 100644 --- a/orion-ops-ui/src/components/asset/host-group/host-group-tree.vue +++ b/orion-ops-ui/src/components/asset/host-group/host-group-tree.vue @@ -92,7 +92,7 @@ import { computed, nextTick, onMounted, ref } from 'vue'; import { createGroupGroupPrefix, rootId } from './types/const'; import { findNode, findParentNode, moveNode } from '@/utils/tree'; - import { createHostGroup, deleteHostGroup, getHostGroupTree, updateHostGroupName, moveHostGroup } from '@/api/asset/host-group'; + import { createHostGroup, deleteHostGroup, updateHostGroupName, moveHostGroup } from '@/api/asset/host-group'; import { isString } from '@/utils/is'; import { useCacheStore } from '@/store'; diff --git a/orion-ops-ui/src/components/asset/host-identity/host-identity-selector.vue b/orion-ops-ui/src/components/asset/host-identity/host-identity-selector.vue index e1dd2832..cdce3f89 100644 --- a/orion-ops-ui/src/components/asset/host-identity/host-identity-selector.vue +++ b/orion-ops-ui/src/components/asset/host-identity/host-identity-selector.vue @@ -1,6 +1,7 @@ @@ -15,6 +16,7 @@ import type { SelectOptionData } from '@arco-design/web-vue'; import { computed, onBeforeMount, ref } from 'vue'; import { useCacheStore } from '@/store'; + import useLoading from '@/hooks/loading'; const props = defineProps({ modelValue: Number, @@ -22,6 +24,7 @@ const emits = defineEmits(['update:modelValue']); + const { loading, setLoading } = useLoading(); const cacheStore = useCacheStore(); const value = computed({ @@ -39,15 +42,20 @@ const optionData = ref>([]); // 初始化选项 - onBeforeMount(() => { - cacheStore.loadHostIdentities().then(hostIdentities => { + onBeforeMount(async () => { + setLoading(true); + try { + const hostIdentities = await cacheStore.loadHostIdentities(); optionData.value = hostIdentities.map(s => { return { label: `${s.name} (${s.username})`, value: s.id, }; }); - }); + } catch (e) { + } finally { + setLoading(false); + } }); diff --git a/orion-ops-ui/src/components/asset/host-key/host-key-selector.vue b/orion-ops-ui/src/components/asset/host-key/host-key-selector.vue index 3d6ac95d..b6e3d86d 100644 --- a/orion-ops-ui/src/components/asset/host-key/host-key-selector.vue +++ b/orion-ops-ui/src/components/asset/host-key/host-key-selector.vue @@ -1,6 +1,7 @@ @@ -15,6 +16,7 @@ import type { SelectOptionData } from '@arco-design/web-vue'; import { computed, onBeforeMount, ref } from 'vue'; import { useCacheStore } from '@/store'; + import useLoading from '@/hooks/loading'; const props = defineProps({ modelValue: Number, @@ -22,6 +24,7 @@ const emits = defineEmits(['update:modelValue']); + const { loading, setLoading } = useLoading(); const cacheStore = useCacheStore(); const value = computed({ @@ -39,15 +42,20 @@ const optionData = ref>([]); // 初始化选项 - onBeforeMount(() => { - cacheStore.loadHostKeys().then(hostKeys => { + onBeforeMount(async () => { + setLoading(true); + try { + const hostKeys = await cacheStore.loadHostKeys(); optionData.value = hostKeys.map(s => { return { label: s.name, value: s.id, }; }); - }); + } catch (e) { + } finally { + setLoading(false); + } }); diff --git a/orion-ops-ui/src/components/meta/tag/tag-multi-selector.vue b/orion-ops-ui/src/components/meta/tag/tag-multi-selector.vue index 160435e4..081e43ff 100644 --- a/orion-ops-ui/src/components/meta/tag/tag-multi-selector.vue +++ b/orion-ops-ui/src/components/meta/tag/tag-multi-selector.vue @@ -51,18 +51,6 @@ }); const optionData = ref([]); - // 初始化选项 - onBeforeMount(() => { - cacheStore.loadTags(props.type as string).then((tags) => { - optionData.value = tags.map(s => { - return { - label: s.name, - value: s.id, - }; - }); - }); - }); - // 检查是否可以创建tag const checkCreateTag = async (tags: Array) => { if (!tags.length) { @@ -112,6 +100,23 @@ return id; }; + // 初始化选项 + onBeforeMount(async () => { + setLoading(true); + try { + const tags = await cacheStore.loadTags(props.type as string); + optionData.value = tags.map(s => { + return { + label: s.name, + value: s.id, + }; + }); + } catch (e) { + } finally { + setLoading(false); + } + }); +