diff --git a/assets/js/components/Config/ChargerModal.vue b/assets/js/components/Config/ChargerModal.vue
index 4db233a11..12d3896f3 100644
--- a/assets/js/components/Config/ChargerModal.vue
+++ b/assets/js/components/Config/ChargerModal.vue
@@ -106,7 +106,7 @@ export default defineComponent({
this.currentTemplate?.Params.some((p: TemplateParam) => p.Name === "connector") &&
this.currentTemplate?.Params.some((p: TemplateParam) => p.Name === "stationid");
if (isOcpp && this.currentValues) {
- return `ws://${window.location.hostname}:8887/${this.currentValues["stationid"] || ""}`;
+ return `ws://${window.location.hostname}:8887/${this.currentValues.stationid || ""}`;
}
return null;
},
@@ -174,9 +174,9 @@ export default defineComponent({
);
},
transformApiData(data: ApiData): ApiData {
- if (this.isYamlInput(data["type"] as ConfigType)) {
+ if (data.type && this.isYamlInput(data.type)) {
// Icon is extracted from yaml on GET for UI purpose only. Don't write it back.
- delete data["icon"];
+ delete data.icon;
}
return data;
},
@@ -189,7 +189,7 @@ export default defineComponent({
ConfigType.SgReadyBoost,
].includes(type);
},
- async handleTemplateChange(e: Event, values: DeviceValues) {
+ handleTemplateChange(e: Event, values: DeviceValues) {
const value = (e.target as HTMLSelectElement).value as ConfigType;
if (this.isYamlInput(value)) {
values.type = value;
@@ -210,8 +210,8 @@ export default defineComponent({
}
});
// default heater icon
- if (hasParam("icon") && values["icon"] === undefined) {
- values["icon"] = "heater";
+ if (hasParam("icon") && values.icon === undefined) {
+ values.icon = "heater";
}
}
},
diff --git a/assets/js/components/Config/DeviceModal/DeviceModalBase.vue b/assets/js/components/Config/DeviceModal/DeviceModalBase.vue
index 9f3e13df5..5c2d36a7a 100644
--- a/assets/js/components/Config/DeviceModal/DeviceModalBase.vue
+++ b/assets/js/components/Config/DeviceModal/DeviceModalBase.vue
@@ -175,11 +175,15 @@ export default defineComponent({
// Optional: provide template options from parent (to avoid circular dependency)
provideTemplateOptions: Function as PropType<(products: Product[]) => TemplateGroup[]>,
// Optional: handle template change (receives event and values, allows setting values.yaml)
- onTemplateChange: Function as PropType<(e: Event, values: DeviceValues) => Promise