This commit is contained in:
Fine 2022-10-30 11:12:53 +08:00
parent e8062dc2d9
commit f072b8273f
3 changed files with 13 additions and 22 deletions

View File

@ -399,7 +399,7 @@ export function usePodsSource(
} }
d[key]["values"] = values; d[key]["values"] = values;
if (idx === 0) { if (idx === 0) {
names.push(item.label); names.push(key);
metricConfigArr.push({ ...c, index: i }); metricConfigArr.push({ ...c, index: i });
metricTypesArr.push(config.metricTypes[index]); metricTypesArr.push(config.metricTypes[index]);
} }

View File

@ -177,11 +177,16 @@ async function searchList() {
await queryEndpoints(); await queryEndpoints();
} }
watch( watch(
() => [...(props.config.metricTypes || []), ...(props.config.metrics || [])], () => [
...(props.config.metricTypes || []),
...(props.config.metrics || []),
...(props.config.metricConfig || []),
],
(data, old) => { (data, old) => {
if (JSON.stringify(data) === JSON.stringify(old)) { if (JSON.stringify(data) === JSON.stringify(old)) {
return; return;
} }
metricConfig.value = props.config.metricConfig;
queryEndpointMetrics(endpoints.value); queryEndpointMetrics(endpoints.value);
} }
); );
@ -191,16 +196,6 @@ watch(
queryEndpoints(); queryEndpoints();
} }
); );
watch(
() => [...(props.config.metricConfig || [])],
(data, old) => {
if (JSON.stringify(data) === JSON.stringify(old)) {
return;
}
metricConfig.value = data;
queryEndpointMetrics(endpoints.value);
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./style.scss"; @import "./style.scss";

View File

@ -227,11 +227,16 @@ function searchList() {
} }
watch( watch(
() => [...(props.config.metricTypes || []), ...(props.config.metrics || [])], () => [
...(props.config.metricTypes || []),
...(props.config.metrics || []),
...(props.config.metricConfig || []),
],
(data, old) => { (data, old) => {
if (JSON.stringify(data) === JSON.stringify(old)) { if (JSON.stringify(data) === JSON.stringify(old)) {
return; return;
} }
metricConfig.value = props.config.metricConfig;
queryInstanceMetrics(instances.value); queryInstanceMetrics(instances.value);
} }
); );
@ -241,15 +246,6 @@ watch(
queryInstance(); queryInstance();
} }
); );
watch(
() => [...(props.config.metricConfig || [])],
(data, old) => {
if (JSON.stringify(data) === JSON.stringify(old)) {
return;
}
queryInstanceMetrics(instances.value);
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./style.scss"; @import "./style.scss";