Skip to content

Commit d629145

Browse files
authored
UI: Refactor GridHistory like ProductionHistory (OpenEMS#2191)
- Change production charts legend label 'Total' to have same hiding style as others - Change order of gridBuy and gridSell to be the same as in history- energy monitor
1 parent 7df7406 commit d629145

39 files changed

+630
-286
lines changed

ui/src/app/app-routing.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import { ChangelogViewComponent } from './changelog/view/view';
66
import { EdgeComponent } from './edge/edge.component';
77
import { ChannelthresholdChartOverviewComponent } from './edge/history/channelthreshold/channelthresholdchartoverview/channelthresholdchartoverview.component';
88
import { OverviewComponent as AutarchyChartOverviewComponent } from './edge/history/common/autarchy/overview/overview';
9+
import { OverviewComponent as GridChartOverviewComponent } from './edge/history/common/grid/overview/overview';
910
import { OverviewComponent as ProductionChartOverviewComponent } from './edge/history/common/production/overview/overview';
1011
import { OverviewComponent as SelfconsumptionChartOverviewComponent } from './edge/history/common/selfconsumption/overview/overview';
1112
import { ConsumptionChartOverviewComponent } from './edge/history/consumption/consumptionchartoverview/consumptionchartoverview.component';
1213
import { DelayedSellToGridChartOverviewComponent } from './edge/history/delayedselltogrid/symmetricpeakshavingchartoverview/delayedselltogridchartoverview.component';
1314
import { FixDigitalOutputChartOverviewComponent } from './edge/history/fixdigitaloutput/fixdigitaloutputchartoverview/fixdigitaloutputchartoverview.component';
14-
import { GridChartOverviewComponent } from './edge/history/grid/gridchartoverview/gridchartoverview.component';
1515
import { GridOptimizedChargeChartOverviewComponent } from './edge/history/gridoptimizedcharge/gridoptimizedchargechartoverview/gridoptimizedchargechartoverview.component';
1616
import { HeatingelementChartOverviewComponent } from './edge/history/heatingelement/heatingelementchartoverview/heatingelementchartoverview.component';
1717
import { HeatPumpChartOverviewComponent } from './edge/history/heatpump/heatpumpchartoverview/heatpumpchartoverview.component';
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { NgModule } from '@angular/core';
2+
3+
import { Common_Autarchy } from './autarchy/Autarchy';
4+
import { CommonEnergyMonitor } from './energy/energy';
5+
import { Common_Grid } from './grid/grid';
6+
import { Common_Production } from './production/production';
7+
import { Common_Selfconsumption } from './selfconsumption/SelfConsumption';
8+
9+
@NgModule({
10+
imports: [
11+
Common_Autarchy,
12+
CommonEnergyMonitor,
13+
Common_Grid,
14+
Common_Production,
15+
Common_Selfconsumption
16+
],
17+
exports: [
18+
Common_Autarchy,
19+
CommonEnergyMonitor,
20+
Common_Grid,
21+
Common_Production,
22+
Common_Selfconsumption
23+
]
24+
})
25+
export class Common { }

ui/src/app/edge/history/common/energy/chart/channels.spec.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { OeChartTester } from "src/app/shared/genericComponents/shared/tester";
1+
import { TimeUnit } from "chart.js";
2+
import { OeTester } from "src/app/shared/genericComponents/shared/testing/common";
3+
import { OeChartTester } from "src/app/shared/genericComponents/shared/testing/tester";
24
import { QueryHistoricTimeseriesDataResponse } from "src/app/shared/jsonrpc/response/queryHistoricTimeseriesDataResponse";
35
import { QueryHistoricTimeseriesEnergyPerPeriodResponse } from "src/app/shared/jsonrpc/response/queryHistoricTimeseriesEnergyPerPeriodResponse";
46
import { QueryHistoricTimeseriesEnergyResponse } from "src/app/shared/jsonrpc/response/queryHistoricTimeseriesEnergyResponse";
@@ -86,7 +88,7 @@ export namespace History {
8688
"quarter": "[Q]Q - YYYY",
8789
"year": "YYYY"
8890
},
89-
"unit": period
91+
"unit": period as TimeUnit
9092
},
9193
"bounds": "ticks"
9294
}
@@ -168,7 +170,7 @@ export namespace History {
168170
"quarter": "[Q]Q - YYYY",
169171
"year": "YYYY"
170172
},
171-
"unit": period
173+
"unit": period as TimeUnit
172174
},
173175
"offset": true,
174176
"bounds": "ticks"
@@ -184,23 +186,13 @@ export namespace History {
184186
"responsive": true
185187
}
186188
});
187-
export type OeChannels = {
188-
189-
/** Always one value for each channel from a {@link QueryHistoricTimeseriesEnergyResponse} */
190-
energyChannelWithValues: QueryHistoricTimeseriesEnergyResponse,
191-
192-
/** data from a {@link QueryHistoricTimeseriesEnergyPerPeriodResponse} */
193-
energyPerPeriodChannelWithValues?: QueryHistoricTimeseriesEnergyPerPeriodResponse,
194-
/** data from a {@link QueryHistoricTimeseriesDataResponse} */
195-
dataChannelWithValues?: QueryHistoricTimeseriesDataResponse
196-
}
197189

198190
/**
199191
* up to 288 datapoints (5 min aggregated values) from a
200192
*
201193
* {@link Day.energyPerPeriodChannelWithValues} and {@link Day.dataChannelWithValues}
202194
* */
203-
export const DAY: History.OeChannels = ({
195+
export const DAY: OeTester.Types.Channels = ({
204196
energyChannelWithValues: new QueryHistoricTimeseriesEnergyResponse("0", {
205197
data: {
206198
'_sum/GridBuyActiveEnergy': 938,
@@ -1952,7 +1944,7 @@ export namespace History {
19521944
/**
19531945
* up to 164 datapoints(1 hour values) from a {@link Day.energyPerPeriodChannelWithValues} and {@link Day.dataChannelWithValues}
19541946
* */
1955-
export const WEEK: OeChannels = {
1947+
export const WEEK: OeTester.Types.Channels = {
19561948
energyChannelWithValues: new QueryHistoricTimeseriesEnergyResponse("0", {
19571949
data: {
19581950
'_sum/GridBuyActiveEnergy': 2368,
@@ -3150,7 +3142,7 @@ export namespace History {
31503142

31513143
/**
31523144
* up to 31 datapoints(1 day values) from a {@link Day.energyPerPeriodChannelWithValues} and {@link Day.dataChannelWithValues}*/
3153-
export const MONTH: OeChannels = {
3145+
export const MONTH: OeTester.Types.Channels = {
31543146
energyChannelWithValues: new QueryHistoricTimeseriesEnergyResponse("0", {
31553147
data: {
31563148
'_sum/GridBuyActiveEnergy': 773000,
@@ -3392,7 +3384,7 @@ export namespace History {
33923384

33933385
/**
33943386
* up to 12 datapoints(1 month values) from a {@link Day.energyPerPeriodChannelWithValues} and {@link Day.dataChannelWithValues}*/
3395-
export const YEAR: OeChannels = {
3387+
export const YEAR: OeTester.Types.Channels = {
33963388
energyChannelWithValues: new QueryHistoricTimeseriesEnergyResponse("0", {
33973389
data: {
33983390
'_sum/GridBuyActiveEnergy': 23209000,

ui/src/app/edge/history/common/energy/chart/chart.constants.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import { DummyConfig } from "src/app/shared/edge/edgeconfig.spec";
2+
import { OeTester } from "src/app/shared/genericComponents/shared/testing/common";
13
import { EdgeConfig } from "src/app/shared/shared";
2-
import { TestContext, removeFunctions } from "src/app/shared/test/utils.spec";
3-
import { History } from "src/app/edge/history/common/energy/chart/channels.spec";
4+
import { removeFunctions, TestContext } from "src/app/shared/test/utils.spec";
45

5-
import { DummyConfig } from "src/app/shared/edge/edgeconfig.spec";
6-
import { OeChartTester } from "../../../../../shared/genericComponents/shared/tester";
6+
import { OeChartTester } from "../../../../../shared/genericComponents/shared/testing/tester";
77
import { ChartComponent } from "./chart";
88

9-
export function expectView(config: EdgeConfig, testContext: TestContext, chartType: 'line' | 'bar', channels: History.OeChannels, view: OeChartTester.View): void {
9+
export function expectView(config: EdgeConfig, testContext: TestContext, chartType: 'line' | 'bar', channels: OeTester.Types.Channels, view: OeChartTester.View): void {
1010
expect(removeFunctions(OeChartTester
1111
.apply(ChartComponent
1212
.getChartData(DummyConfig.convertDummyEdgeConfigToRealEdgeConfig(config), chartType, testContext.translate), chartType, channels, testContext)))

0 commit comments

Comments
 (0)