Skip to content

Commit

Permalink
Merge pull request #80 from benderl/dev
Browse files Browse the repository at this point in the history
change hierarchy display to new format
  • Loading branch information
benderl authored Feb 24, 2022
2 parents 1a773a1 + a1d8bbe commit 66e9c87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
19 changes: 11 additions & 8 deletions src/components/OpenwbNestedList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,16 @@ export default {
methods: {
classes(element) {
var myClasses = "";
if (element.id.startsWith("counter")) {
myClasses += "counter";
} else if (element.id.startsWith("cp")) {
myClasses += "charge-point";
} else if (element.id.startsWith("bat")) {
myClasses += "battery";
} else if (element.id.startsWith("inverter")) {
myClasses += "inverter";
switch (element.type) {
case "bat":
myClasses += "battery";
break;
case "cp":
myClasses += "charge-point";
break;
default:
myClasses += element.type;
break;
}
return myClasses;
},
Expand Down Expand Up @@ -146,6 +148,7 @@ export default {
.element-titel.battery {
background-color: var(--warning);
color: var(--dark);
}
.element-actions {
Expand Down
16 changes: 3 additions & 13 deletions src/views/LoadManagementConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,13 @@ export default {
methods: {
getElementTreeNames(element) {
let myNames = {};
if (element.id.startsWith("cp")) {
let chargePoint = this.getChargePoint(
this.getComponentIndex(element.id)
);
if (element.type == "cp") {
let chargePoint = this.getChargePoint(element.id);
if (chargePoint) {
myNames[element.id] = chargePoint.name;
}
} else {
let component = this.getComponent(
this.getComponentIndex(element.id)
);
let component = this.getComponent(element.id);
if (component) {
myNames[element.id] = component.name;
}
Expand All @@ -263,10 +259,6 @@ export default {
});
return myNames;
},
getComponentIndex(id) {
let index = parseInt(id.match(/(\d+)$/)[0]);
return index;
},
getComponent(componentIndex) {
let myComponent = undefined;
Object.keys(this.$store.state.mqtt).forEach((value) => {
Expand Down Expand Up @@ -298,5 +290,3 @@ export default {
},
};
</script>

<style></style>

0 comments on commit 66e9c87

Please sign in to comment.