Skip to content

Commit

Permalink
webapp: DPL: order inverters as configured
Browse files Browse the repository at this point in the history
order the appearance of inverters in the DPL settings like configured in
the list of all inverters.
  • Loading branch information
schlimmchen committed Nov 18, 2024
1 parent a8f57d9 commit 61aa32a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/WebApi_powerlimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void WebApiPowerLimiterClass::onMetaData(AsyncWebServerRequest* request)
JsonObject obj = inverters.add<JsonObject>();
obj["serial"] = inv->serialString();
obj["pos"] = i;
obj["order"] = config.Inverter[i].Order;
obj["name"] = String(config.Inverter[i].Name);
obj["poll_enable"] = config.Inverter[i].Poll_Enable;
obj["poll_enable_night"] = config.Inverter[i].Poll_Enable_Night;
Expand Down
1 change: 1 addition & 0 deletions webapp/src/types/PowerLimiterConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface PowerLimiterInverterInfo {
serial: string;
pos: number;
order: number;
name: string;
poll_enable: boolean;
poll_enable_night: boolean;
Expand Down
6 changes: 6 additions & 0 deletions webapp/src/views/PowerLimiterAdminView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,12 @@ export default defineComponent({
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;
},
savePowerLimiterConfig(e: Event) {
Expand Down

0 comments on commit 61aa32a

Please sign in to comment.