fix dashboards

This commit is contained in:
Qiuxia Fan 2022-04-02 00:05:44 +08:00
parent f57fdf9312
commit f3c8a3a9db
2 changed files with 9 additions and 4 deletions

View File

@ -53,6 +53,9 @@ const available = computed(
(Array.isArray(props.option.series.data) && props.option.series.data[0]) (Array.isArray(props.option.series.data) && props.option.series.data[0])
); );
onMounted(async () => { onMounted(async () => {
if (!available.value) {
return;
}
await setOptions(props.option); await setOptions(props.option);
chartRef.value && addResizeListener(unref(chartRef), resize); chartRef.value && addResizeListener(unref(chartRef), resize);
setTimeout(() => { setTimeout(() => {
@ -70,6 +73,9 @@ onMounted(async () => {
watch( watch(
() => props.option, () => props.option,
(newVal, oldVal) => { (newVal, oldVal) => {
if (!available.value) {
return;
}
if (JSON.stringify(newVal) === JSON.stringify(oldVal)) { if (JSON.stringify(newVal) === JSON.stringify(oldVal)) {
return; return;
} }

View File

@ -169,7 +169,6 @@ const key = computed(() => {
const type = EntityType.find( const type = EntityType.find(
(d: Option) => d.value === dashboardStore.entity (d: Option) => d.value === dashboardStore.entity
); );
return (type && type.key) || 0; return (type && type.key) || 0;
}); });
@ -268,9 +267,9 @@ async function setDestSelector() {
return; return;
} }
const destPod = params.destPodId || selectorStore.destPods[0].id; const destPod = params.destPodId || selectorStore.destPods[0].id;
const currentDestPod = selectorStore.destPods.filter( const currentDestPod = selectorStore.destPods.find(
(d: { id: string }) => d.id === destPod (d: { id: string }) => d.id === destPod
)[0]; );
if (currentDestPod) { if (currentDestPod) {
selectorStore.setCurrentDestPod(currentDestPod); selectorStore.setCurrentDestPod(currentDestPod);
states.currentDestPod = currentDestPod.label; states.currentDestPod = currentDestPod.label;
@ -278,7 +277,7 @@ async function setDestSelector() {
} }
async function getServices() { async function getServices() {
if (key.value === 10 || key.value === 0) { if (key.value === 10) {
return; return;
} }
if (!dashboardStore.layerId) { if (!dashboardStore.layerId) {