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() { async function getVersion() {
if (appStore.version) {
return;
}
const res = await appStore.fetchVersion(); const res = await appStore.fetchVersion();
if (res.errors) { if (res.errors) {
ElMessage.error(res.errors); ElMessage.error(res.errors);

View File

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

View File

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