Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small ui adjustments #1143

Merged
merged 6 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/app/edge/history/heatingelement/chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class HeatingelementChartComponent extends AbstractHistoryChart implement
options.tooltips.callbacks.label = function (tooltipItem: TooltipItem, data: Data) {
let label = data.datasets[tooltipItem.datasetIndex].label;
let value = tooltipItem.yLabel;
return label + ": " + formatNumber(value, 'de', '1.0-1') + ' kWh'; // TODO get locale dynamically
return label + ": " + formatNumber(value, 'de', '1.0-1'); // TODO get locale dynamically
}
this.options = options;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/live/chpsoc/chpsoc.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActivatedRoute } from '@angular/router';
import { ChannelAddress, Edge, EdgeConfig, Service, Websocket } from '../../../shared/shared';
import { ChpsocModalComponent } from './modal/modal.page';
import { ChpsocModalComponent } from './modal/modal.component';
import { Component, Input } from '@angular/core';
import { ModalController } from '@ionic/angular';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<ion-toolbar color="primary">
<ion-title>{{ component.alias }}</ion-title>
<ion-buttons slot="end">
<ion-button target="_blank"
href="https://openems.github.io/openems.io/openems/latest/edge/controller.html#_chp_control_via_state_of_charge_soc">
<ion-icon name="help-circle-outline"></ion-icon>
</ion-button>
<ion-button (click)="modalCtrl.dismiss()">
<ion-icon name="close-outline"></ion-icon>
</ion-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type mode = 'MANUAL_ON' | 'MANUAL_OFF' | 'AUTOMATIC';

@Component({
selector: ChpsocModalComponent.SELECTOR,
templateUrl: './modal.page.html'
templateUrl: './modal.component.html'
})
export class ChpsocModalComponent implements OnInit {

Expand Down
41 changes: 30 additions & 11 deletions ui/src/app/edge/live/consumption/consumption.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
</td>
</tr>
</ng-container>
<ng-container *ngIf="evcsComponents.length > 0">
<ng-container *ngFor="let component of evcsComponents">
<ng-container *ngIf="(edge.currentData | async)['channel'] as currentData">
<ng-container *ngIf="(edge.currentData | async)['channel'] as currentData">
<ng-container *ngIf="evcsComponents.length > 0">
<ng-container *ngFor="let component of evcsComponents">
<ng-container *ngIf="currentData[component.id + '/ChargePower'] > 0">
<tr>
<td style="width:65%" *ngIf="component.id == component.alias">{{component.id}}
Expand All @@ -34,16 +34,35 @@
</ng-container>
</ng-container>
</ng-container>

<tr *ngIf="evcsComponents.length != 0">
<td style="width: 65%" translate>General.otherConsumption</td>
<ng-container *ngIf="sum.activePower - currentTotalChargingPower() as otherPower">
<td style="width: 35%" class="align_right">
{{ otherPower | unitvalue:'kW' }}
</td>
<ng-container *ngIf="consumptionMeterComponents.length > 0">
<ng-container *ngFor="let component of consumptionMeterComponents">
<ng-container *ngIf="currentData[component.id + '/ActivePower'] > 0">
<tr>
<td style="width:65%" *ngIf="component.id == component.alias">{{component.id}}
</td>
<td style="width: 65%" *ngIf="component.id != component.alias">
{{component.alias}}
</td>
<td style="width:35%" class="align_right">
{{ currentData[component.id + '/ActivePower'] | unitvalue:'kW' }}
</td>
</tr>
</ng-container>
</ng-container>
</tr>
</ng-container>
</ng-container>

<tr *ngIf="evcsComponents.length != 0 || consumptionMeterComponents.length != 0">
<td style="width: 65%" translate>General.otherConsumption</td>
<ng-container *ngIf="sum.activePower - getTotalOtherPower() as otherPower">
<td style="width: 35%" class="align_right" *ngIf="otherPower > 0">
{{ otherPower | unitvalue:'kW' }}
</td>
<td style="width: 35%" class="align_right" *ngIf="otherPower <= 0">
{{ 0 | unitvalue:'kW' }}
</td>
</ng-container>
</tr>
</table>
</ion-card-content>
</ion-card>
Expand Down
28 changes: 23 additions & 5 deletions ui/src/app/edge/live/consumption/consumption.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class ConsumptionComponent {
public config: EdgeConfig = null;
public edge: Edge = null;
public evcsComponents: EdgeConfig.Component[] = null;
public consumptionMeterComponents: EdgeConfig.Component[] = null;

constructor(
private route: ActivatedRoute,
Expand All @@ -27,6 +28,12 @@ export class ConsumptionComponent {
let channels = [];
this.service.getConfig().then(config => {
this.config = config;
this.consumptionMeterComponents = config.getComponentsImplementingNature("io.openems.edge.meter.api.SymmetricMeter").filter(component => component.properties['type'] == 'CONSUMPTION_METERED');
for (let component of this.consumptionMeterComponents) {
channels.push(
new ChannelAddress(component.id, 'ActivePower'),
)
}
this.evcsComponents = config.getComponentsImplementingNature("io.openems.edge.evcs.api.Evcs").filter(component => !(component.factoryId == 'Evcs.Cluster.SelfConsumtion') && !(component.factoryId == 'Evcs.Cluster.PeakShaving') && !component.isEnabled == false);
for (let component of this.evcsComponents) {
channels.push(
Expand Down Expand Up @@ -59,20 +66,31 @@ export class ConsumptionComponent {
componentProps: {
edge: this.edge,
evcsComponents: this.evcsComponents,
consumptionMeterComponents: this.consumptionMeterComponents,
currentTotalChargingPower: this.currentTotalChargingPower,
sumOfChannel: this.sumOfChannel
currentTotalConsumptionMeterPower: this.currentTotalConsumptionMeterPower,
sumOfChannel: this.sumOfChannel,
getTotalOtherPower: this.getTotalOtherPower,
}
});
return await modal.present();
}

public currentTotalChargingPower(): number {
return this.sumOfChannel("ChargePower");
public getTotalOtherPower(): number {
return this.currentTotalChargingPower() + this.currentTotalConsumptionMeterPower();
}

private currentTotalChargingPower(): number {
return this.sumOfChannel(this.evcsComponents, "ChargePower");
}

private currentTotalConsumptionMeterPower(): number {
return this.sumOfChannel(this.consumptionMeterComponents, "ActivePower");
}

private sumOfChannel(channel: String): number {
private sumOfChannel(components: EdgeConfig.Component[], channel: String): number {
let sum = 0;
this.evcsComponents.forEach(component => {
components.forEach(component => {
let channelValue = this.edge.currentData.value.channel[component.id + "/" + channel];
if (channelValue != null) {
sum += channelValue;
Expand Down
60 changes: 42 additions & 18 deletions ui/src/app/edge/live/consumption/modal/modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,33 +72,57 @@
</ion-card-content>
</ng-container>

<ng-container *ngIf="evcsComponents.length != 0 && (edge.currentData | async)['channel'] as currentData">
<ng-container *ngFor="let component of evcsComponents">
<ion-card-content class="underline">
<table class="full_width">
<tr>
<td style="width:65%" *ngIf="component.id == component.alias">{{component.id}}</td>
<td style="width: 65%" *ngIf="component.id != component.alias">{{component.alias}}
</td>
<td class="align_right" style="width: 35%">
{{ currentData[component.id + '/ChargePower'] | unitvalue:'W' }}
</td>
</tr>
</table>
</ion-card-content>
<ng-container *ngIf="(edge.currentData | async)['channel'] as currentData">
<ng-container *ngIf="evcsComponents.length > 0">
<ng-container *ngFor="let component of evcsComponents">
<ion-card-content class="underline">
<table class="full_width">
<tr>
<td style="width:65%" *ngIf="component.id == component.alias">{{component.id}}</td>
<td style="width: 65%" *ngIf="component.id != component.alias">{{component.alias}}
</td>
<td class="align_right" style="width: 35%">
{{ currentData[component.id + '/ChargePower'] | unitvalue:'W' }}
</td>
</tr>
</table>
</ion-card-content>
</ng-container>
</ng-container>

<ng-container *ngIf="consumptionMeterComponents.length > 0">
<ng-container *ngFor="let component of consumptionMeterComponents">
<ion-card-content class="underline">
<table class="full_width">
<tr>
<td style="width:65%" *ngIf="component.id == component.alias">{{component.id}}
</td>
<td style="width: 65%" *ngIf="component.id != component.alias">
{{component.alias}}
</td>
<td style="width:35%" class="align_right">
{{ currentData[component.id + '/ActivePower'] | unitvalue:'W' }}
</td>
</tr>
</table>
</ion-card-content>
</ng-container>
</ng-container>
</ng-container>

<ng-container *ngIf="edge.currentData | async as currentData">
<ng-container *ngIf="edge.currentData | async as currentData">
<ng-container *ngIf="currentData.summary.consumption as sum">
<ion-card-content>
<table class="full_width" *ngIf="evcsComponents.length != 0">
<table class="full_width" *ngIf="evcsComponents.length != 0 || consumptionMeterComponents.length != 0">
<tr>
<td style="width: 65%" translate>General.otherConsumption</td>
<ng-container *ngIf="sum.activePower - currentTotalChargingPower() as otherPower">
<td style="width: 35%" class="align_right">
{{ otherPower | unitvalue:'W'}}
<ng-container *ngIf="sum.activePower - getTotalOtherPower() as otherPower">
<td style="width: 35%" class="align_right" *ngIf="otherPower > 0">
{{ otherPower | unitvalue:'W' }}
</td>
<td style="width: 35%" class="align_right" *ngIf="otherPower <= 0">
{{ 0 | unitvalue:'W' }}
</td>
</ng-container>
</tr>
Expand Down
4 changes: 4 additions & 0 deletions ui/src/app/edge/live/consumption/modal/modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export class ConsumptionModalComponent {

@Input() public edge: Edge;
@Input() public evcsComponents: EdgeConfig.Component[];
@Input() public consumptionMeterComponents: EdgeConfig.Component[];
@Input() public currentTotalChargingPower: () => number;
@Input() public currentTotalConsumptionMeterPower: () => number;
@Input() public sumOfChannel: () => number;
@Input() public getTotalOtherPower: () => number;

public config: EdgeConfig = null;

Expand Down
4 changes: 4 additions & 0 deletions ui/src/app/edge/live/evcs/modal/modal.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
{{ evcsComponent.alias }}
</ion-title>
<ion-buttons slot="end">
<ion-button target="_blank"
href="https://openems.github.io/openems.io/openems/latest/edge/controller.html#_evcs">
<ion-icon name="help-circle-outline"></ion-icon>
</ion-button>
<ion-button (click)="modalCtrl.dismiss()">
<ion-icon name="close-outline"></ion-icon>
</ion-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<ion-toolbar class="ion-justify-content-center" color="primary">
<ion-title>{{ component.alias }}</ion-title>
<ion-buttons slot="end">
<ion-button target="_blank"
href="https://openems.github.io/openems.io/openems/latest/edge/controller.html#_io_fix_digital_output">
<ion-icon name="help-circle-outline"></ion-icon>
</ion-button>
<ion-button (click)="modalCtrl.dismiss()">
<ion-icon name="close-outline"></ion-icon>
</ion-button>
Expand Down
Loading