fix query

This commit is contained in:
Qiuxia Fan 2022-04-01 21:54:45 +08:00
parent 12e3570171
commit cdeb0c520b
3 changed files with 22 additions and 13 deletions

View File

@ -94,6 +94,9 @@ watch(
}
);
async function getVersion() {
if (appStore.version) {
return;
}
const res = await appStore.fetchVersion();
if (res.errors) {
ElMessage.error(res.errors);

View File

@ -109,11 +109,14 @@ export default defineComponent({
const selectorStore = useSelectorStore();
const graph = computed(() => props.data.graph || {});
const widget = computed(() => props.data.widget || {});
const isList = ListChartTypes.includes(
(props.data.graph && props.data.graph.type) || ""
const isList = computed(() =>
ListChartTypes.includes((props.data.graph && props.data.graph.type) || "")
);
if ((props.needQuery || !dashboardStore.currentDashboard.id) && !isList) {
if (
(props.needQuery || !dashboardStore.currentDashboard.id) &&
!isList.value
) {
queryMetrics();
}
@ -162,11 +165,8 @@ export default defineComponent({
if (props.data.i !== dashboardStore.selectedGrid.i) {
return;
}
const isList = ListChartTypes.includes(
(props.data.graph && props.data.graph.type) || ""
);
const chart = dashboardStore.selectedGrid.graph || {};
if (ListChartTypes.includes(chart.type) || isList) {
if (ListChartTypes.includes(chart.type) || isList.value) {
return;
}
queryMetrics();
@ -175,10 +175,7 @@ export default defineComponent({
watch(
() => [selectorStore.currentService, selectorStore.currentDestService],
() => {
const isList = ListChartTypes.includes(
(props.data.graph && props.data.graph.type) || ""
);
if (isList) {
if (isList.value) {
return;
}
if (
@ -195,12 +192,18 @@ export default defineComponent({
if (dashboardStore.entity === EntityType[0].value) {
return;
}
if (isList.value) {
return;
}
queryMetrics();
}
);
watch(
() => appStore.durationTime,
() => {
if (isList.value) {
return;
}
if (dashboardStore.entity === EntityType[1].value) {
queryMetrics();
}

View File

@ -245,9 +245,9 @@ async function setSourceSelector() {
return;
}
const pod = params.podId || selectorStore.pods[0].id;
const currentPod = selectorStore.pods.filter(
const currentPod = selectorStore.pods.find(
(d: { id: string }) => d.id === pod
)[0];
);
if (currentPod) {
selectorStore.setCurrentPod(currentPod);
states.currentPod = currentPod.label;
@ -278,6 +278,9 @@ async function setDestSelector() {
}
async function getServices() {
if (key.value === 10 || key.value === 0) {
return;
}
if (!dashboardStore.layerId) {
return;
}