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 { .rk-opt-wrapper {
color: #606266;
position: absolute; position: absolute;
top: 26px; top: 26px;
left: 0; left: 0;

View File

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

View File

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

View File

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