save loading

This commit is contained in:
Qiuxia Fan 2022-03-23 17:23:09 +08:00
parent e3779d2a06
commit 6b8491c542

View File

@ -72,7 +72,7 @@ limitations under the License. -->
/>
</div>
</div>
<div class="flex-h tools">
<div class="flex-h tools" v-loading="loading">
<div class="tool-icons flex-h" v-if="dashboardStore.editMode">
<span
@click="clickIcons(t)"
@ -118,7 +118,6 @@ import { useSelectorStore } from "@/store/modules/selectors";
import { ElMessage } from "element-plus";
import { Option } from "@/types/app";
import { useI18n } from "vue-i18n";
import { useThrottleFn } from "@vueuse/core";
const { t } = useI18n();
const dashboardStore = useDashboardStore();
@ -128,6 +127,7 @@ const params = useRoute().params;
const toolIcons = ref<{ name: string; content: string; id: string }[]>(
EndpointRelationTools
);
const loading = ref<boolean>(false);
const states = reactive<{
destService: string;
destPod: string;
@ -145,7 +145,6 @@ const states = reactive<{
currentDestService: "",
currentDestPod: "",
});
const applyDashboard = useThrottleFn(dashboardStore.saveDashboard, 3000);
setCurrentDashboard();
appStore.setEventStack([initSelector]);
@ -329,9 +328,11 @@ function changeMode() {
ElMessage.warning(t("viewWarning"));
}
function clickIcons(t: { id: string; content: string; name: string }) {
async function clickIcons(t: { id: string; content: string; name: string }) {
if (t.id === "apply") {
applyDashboard();
loading.value = true;
await dashboardStore.saveDashboard();
loading.value = false;
return;
}
if (