fix config

This commit is contained in:
Qiuxia Fan 2022-03-26 14:06:36 +08:00
parent 63e2458cff
commit 75fd69b644
4 changed files with 12 additions and 10 deletions

View File

@ -118,6 +118,7 @@ function removeSelected() {
}
.rk-opt-wrapper {
color: #606266;
position: absolute;
top: 26px;
left: 0;

View File

@ -56,7 +56,7 @@ limitations under the License. -->
</span>
</template>
<Standard
@update="queryMetrics"
@update="queryListMetrics"
:currentMetricConfig="currentMetricConfig"
:index="index"
/>
@ -339,6 +339,12 @@ function changeMetricType(index: number, opt: Option[] | any) {
}
queryMetrics();
}
async function queryListMetrics(metricConfig: MetricConfigOpt[]) {
dashboardStore.selectWidget({
...dashboardStore.selectedGrid,
metricConfig,
});
}
async function queryMetrics() {
if (states.isList) {
return;

View File

@ -97,11 +97,8 @@ const metricType = ref<string>(
function changeConfigs(index: number, param: { [key: string]: string }) {
const metricConfig = dashboardStore.selectedGrid.metricConfig || [];
metricConfig[index] = { ...metricConfig[index], ...param };
dashboardStore.selectWidget({
...dashboardStore.selectedGrid,
metricConfig,
});
emit("update");
emit("update", metricConfig);
}
</script>
<style lang="scss" scoped>

View File

@ -157,7 +157,7 @@ async function queryEndpointMetrics(currentPods: Endpoint[]) {
return;
}
const metricConfig = props.config.metricConfig || [];
console.log(props.config.metricConfig);
endpoints.value = usePodsSource(currentPods, json, {
...props.config,
metricConfig: metricConfig,
@ -193,9 +193,7 @@ async function searchList() {
watch(
() => [props.config.metricTypes, props.config.metrics],
async () => {
if (props.isEdit) {
queryEndpointMetrics(endpoints.value);
}
queryEndpointMetrics(endpoints.value);
// emit("changeOpt", false);
}
);