This commit is contained in:
Qiuxia Fan 2022-03-23 15:30:22 +08:00
parent 93161b6ec9
commit 5bdc31012c
3 changed files with 22 additions and 6 deletions

View File

@ -66,6 +66,7 @@ limitations under the License. -->
i: data.i,
}"
:standard="data.standard"
:needQuery="needQuery"
/>
</div>
<div v-else class="no-data">{{ t("noData") }}</div>
@ -112,6 +113,7 @@ export default defineComponent({
}
async function queryMetrics() {
console.log(props.data);
const params = await useQueryProcessor(props.data);
if (!params) {
@ -153,6 +155,7 @@ export default defineComponent({
if (props.data.i !== dashboardStore.selectedGrid.i) {
return;
}
const isList = ListChartTypes.includes(props.data.graph.type || "");
if (
ListChartTypes.includes(dashboardStore.selectedGrid.graph.type) ||
isList
@ -165,6 +168,7 @@ export default defineComponent({
watch(
() => [selectorStore.currentService, selectorStore.currentDestService],
() => {
const isList = ListChartTypes.includes(props.data.graph.type || "");
if (isList) {
return;
}

View File

@ -110,6 +110,7 @@ const props = defineProps({
default: () => ({ dashboardName: "", fontSize: 12, i: "" }),
},
intervalTime: { type: Array as PropType<string[]>, default: () => [] },
needQuery: { type: Boolean, default: false },
});
const selectorStore = useSelectorStore();
const dashboardStore = useDashboardStore();
@ -119,8 +120,9 @@ const searchEndpoints = ref<Endpoint[]>([]);
const pageSize = 5;
const searchText = ref<string>("");
queryEndpoints();
if (props.needQuery) {
queryEndpoints();
}
async function queryEndpoints() {
chartLoading.value = true;
const resp = await selectorStore.getEndpoints();
@ -193,7 +195,7 @@ watch(
}
);
watch(
() => [selectorStore.currentService],
() => selectorStore.currentService,
() => {
queryEndpoints();
}

View File

@ -113,6 +113,7 @@ const props = defineProps({
}),
},
intervalTime: { type: Array as PropType<string[]>, default: () => [] },
needQuery: { type: Boolean, default: false },
});
const selectorStore = useSelectorStore();
const dashboardStore = useDashboardStore();
@ -122,15 +123,18 @@ const searchInstances = ref<Instance[]>([]); // all instances
const pageSize = 5;
const searchText = ref<string>("");
queryInstance();
if (props.needQuery) {
queryInstance();
}
async function queryInstance() {
chartLoading.value = true;
const resp = await selectorStore.getServiceInstances();
chartLoading.value = false;
if (resp.errors) {
if (resp && resp.errors) {
ElMessage.error(resp.errors);
searchInstances.value = [];
instances.value = [];
return;
}
searchInstances.value = selectorStore.pods;
@ -193,6 +197,12 @@ watch(
}
}
);
watch(
() => selectorStore.currentService,
() => {
queryInstance();
}
);
</script>
<style lang="scss" scoped>
@import "./style.scss";