webapp: DPL: order inverters as configured
order the appearance of inverters in the DPL settings like configured in the list of all inverters.
This commit is contained in:
parent
a8f57d98a4
commit
61aa32ab5e
@ -60,6 +60,7 @@ void WebApiPowerLimiterClass::onMetaData(AsyncWebServerRequest* request)
|
|||||||
JsonObject obj = inverters.add<JsonObject>();
|
JsonObject obj = inverters.add<JsonObject>();
|
||||||
obj["serial"] = inv->serialString();
|
obj["serial"] = inv->serialString();
|
||||||
obj["pos"] = i;
|
obj["pos"] = i;
|
||||||
|
obj["order"] = config.Inverter[i].Order;
|
||||||
obj["name"] = String(config.Inverter[i].Name);
|
obj["name"] = String(config.Inverter[i].Name);
|
||||||
obj["poll_enable"] = config.Inverter[i].Poll_Enable;
|
obj["poll_enable"] = config.Inverter[i].Poll_Enable;
|
||||||
obj["poll_enable_night"] = config.Inverter[i].Poll_Enable_Night;
|
obj["poll_enable_night"] = config.Inverter[i].Poll_Enable_Night;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
export interface PowerLimiterInverterInfo {
|
export interface PowerLimiterInverterInfo {
|
||||||
serial: string;
|
serial: string;
|
||||||
pos: number;
|
pos: number;
|
||||||
|
order: number;
|
||||||
name: string;
|
name: string;
|
||||||
poll_enable: boolean;
|
poll_enable: boolean;
|
||||||
poll_enable_night: boolean;
|
poll_enable_night: boolean;
|
||||||
|
|||||||
@ -651,6 +651,12 @@ export default defineComponent({
|
|||||||
inverters.push(newInv);
|
inverters.push(newInv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inverters = inverters.sort((a, b) => {
|
||||||
|
const orderA = this.getInverterInfo(a.serial).order;
|
||||||
|
const orderB = this.getInverterInfo(b.serial).order;
|
||||||
|
return orderA < orderB ? -1 : 1;
|
||||||
|
});
|
||||||
|
|
||||||
return inverters;
|
return inverters;
|
||||||
},
|
},
|
||||||
savePowerLimiterConfig(e: Event) {
|
savePowerLimiterConfig(e: Event) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user