Skip to content

Commit

Permalink
UI: add null type to null initialization variables (#2701)
Browse files Browse the repository at this point in the history
  • Loading branch information
miettal authored Aug 1, 2024
1 parent bb43bdf commit f03522f
Show file tree
Hide file tree
Showing 60 changed files with 115 additions and 136 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Edge, EdgeConfig, Service } from '../../../../shared/shared';
Expand All @@ -10,9 +9,9 @@ import { Edge, EdgeConfig, Service } from '../../../../shared/shared';
export class ChpSocChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "chpsoc-chart-overview";
public edge: Edge = null;
public config: EdgeConfig = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public config: EdgeConfig | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
7 changes: 3 additions & 4 deletions ui/src/app/edge/history/chpsoc/widget.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { QueryHistoricTimeseriesDataResponse } from 'src/app/shared/jsonrpc/response/queryHistoricTimeseriesDataResponse';
Expand All @@ -18,9 +17,9 @@ export class ChpSocWidgetComponent extends AbstractHistoryWidget implements OnIn
@Input({ required: true }) public period!: DefaultTypes.HistoryPeriod;
@Input({ required: true }) public componentId!: string;

public activeSecondsOverPeriod: number = null;
public edge: Edge = null;
public component: EdgeConfig.Component = null;
public activeSecondsOverPeriod: number | null = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public override service: Service,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Edge, EdgeConfig, Service } from '../../../../shared/shared';
Expand All @@ -10,8 +9,8 @@ import { Edge, EdgeConfig, Service } from '../../../../shared/shared';
export class DelayedSellToGridChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "symmetricpeakshaving-chart-overview";
public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
5 changes: 2 additions & 3 deletions ui/src/app/edge/history/delayedselltogrid/widget.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { ActivatedRoute } from '@angular/router';
import { Component, Input, OnInit } from '@angular/core';
import { DefaultTypes } from 'src/app/shared/service/defaulttypes';
Expand All @@ -14,8 +13,8 @@ export class DelayedSellToGridWidgetComponent implements OnInit {
@Input({ required: true }) public period!: DefaultTypes.HistoryPeriod;
@Input({ required: true }) public componentId!: string;

public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export class FixDigitalOutputChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "fixdigitaloutput-chart-overview";

public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

public showTotal: boolean = false;
public fixDigitalOutputComponents: string[] = [];
Expand Down
10 changes: 4 additions & 6 deletions ui/src/app/edge/history/fixdigitaloutput/widget.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { QueryHistoricTimeseriesDataResponse } from 'src/app/shared/jsonrpc/response/queryHistoricTimeseriesDataResponse';
Expand All @@ -17,12 +16,11 @@ export class FixDigitalOutputWidgetComponent extends AbstractHistoryWidget imple
private static readonly SELECTOR = "fixDigitalOutputWidget";
@Input({ required: true }) public period!: DefaultTypes.HistoryPeriod;
@Input({ required: true }) public componentId!: string;
public component: EdgeConfig.Component = null;
public activeSecondsOverPeriod: number = null;
public edge: Edge = null;
private config: EdgeConfig = null;


public component: EdgeConfig.Component | null = null;
public activeSecondsOverPeriod: number | null = null;
public edge: Edge | null = null;
private config: EdgeConfig | null = null;

constructor(
public override service: Service,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Edge, EdgeConfig, Service } from '../../../../shared/shared';
Expand All @@ -10,8 +9,8 @@ import { Edge, EdgeConfig, Service } from '../../../../shared/shared';
export class HeatingelementChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "heatingelement-chart-overview";
public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
5 changes: 2 additions & 3 deletions ui/src/app/edge/history/heatingelement/widget.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { QueryHistoricTimeseriesDataResponse } from 'src/app/shared/jsonrpc/response/queryHistoricTimeseriesDataResponse';
Expand All @@ -18,13 +17,13 @@ export class HeatingelementWidgetComponent extends AbstractHistoryWidget impleme
@Input({ required: true }) public componentId!: string;


public component: EdgeConfig.Component = null;
public component: EdgeConfig.Component | null = null;

public activeTimeOverPeriodLevel1: number | null = null;
public activeTimeOverPeriodLevel2: number | null = null;
public activeTimeOverPeriodLevel3: number | null = null;

public edge: Edge = null;
public edge: Edge | null = null;

constructor(
public override service: Service,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ModalController } from '@ionic/angular';
Expand All @@ -12,8 +11,8 @@ export class HeatPumpChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "heatpump-chart-overview";

public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/history/heatpump/widget.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class HeatpumpWidgetComponent extends AbstractHistoryWidget implements On
public activeTimeOverPeriodRecommendation: number | null = null;
public activeTimeOverPeriodLock: number | null = null;

public edge: Edge = null;
public edge: Edge | null = null;

constructor(
public override service: Service,
Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/edge/history/history.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ export class HistoryComponent implements OnInit {
public energyChartHeight: string = "250px";

// holds the Widgets
public widgets: Widgets = null;
public widgets: Widgets | null = null;

// holds the current Edge
public edge: Edge = null;
public edge: Edge | null = null;

// holds Channelthreshold Components to display effective active time in %
// public channelthresholdComponents: string[] = [];

public config: EdgeConfig = null;
public config: EdgeConfig | null = null;
protected errorResponse: JsonrpcResponseError | null = null;

constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Edge, EdgeConfig, Service } from '../../../../../shared/shared';
Expand All @@ -10,8 +9,8 @@ import { Edge, EdgeConfig, Service } from '../../../../../shared/shared';
export class AsymmetricPeakshavingChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "asymmetricpeakshaving-chart-overview";
public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { ActivatedRoute } from '@angular/router';
import { Component, Input, OnInit } from '@angular/core';
import { DefaultTypes } from 'src/app/shared/service/defaulttypes';
Expand All @@ -15,8 +14,8 @@ export class AsymmetricPeakshavingWidgetComponent implements OnInit {
@Input({ required: true }) public componentId!: string;


public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Edge, EdgeConfig, Service } from '../../../../../shared/shared';
Expand All @@ -11,8 +10,8 @@ export class SymmetricPeakshavingChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "symmetricpeakshaving-chart-overview";

public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { DefaultTypes } from 'src/app/shared/service/defaulttypes';
Expand All @@ -15,8 +14,8 @@ export class SymmetricPeakshavingWidgetComponent implements OnInit {
@Input({ required: true }) public componentId!: string;


public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Edge, EdgeConfig, Service } from '../../../../../shared/shared';
Expand All @@ -11,8 +10,8 @@ export class TimeslotPeakshavingChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "timeslotpeakshaving-chart-overview";

public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { DefaultTypes } from 'src/app/shared/service/defaulttypes';
Expand All @@ -15,8 +14,8 @@ export class TimeslotPeakshavingWidgetComponent implements OnInit {
@Input({ required: true }) public componentId!: string;


public edge: Edge = null;
public component: EdgeConfig.Component = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public service: Service,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/history/singlethreshold/chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class SinglethresholdChartComponent extends AbstractHistoryChart implemen
});
}
if (channel == inputChannel) {
let inputLabel: string = null;
let inputLabel: string | null = null;
const address = ChannelAddress.fromString(channel);
switch (address.channelId) {
case 'GridActivePower':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export class SinglethresholdChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "channelthreshold-chart-overview";

public edge: Edge = null;
public edge: Edge | null = null;

public component: EdgeConfig.Component = null;
public component: EdgeConfig.Component | null = null;
public inputChannel: string;

// reference to the Utils method to access via html
Expand Down
7 changes: 3 additions & 4 deletions ui/src/app/edge/history/singlethreshold/widget.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { QueryHistoricTimeseriesDataResponse } from 'src/app/shared/jsonrpc/response/queryHistoricTimeseriesDataResponse';
Expand All @@ -19,9 +18,9 @@ export class SinglethresholdWidgetComponent extends AbstractHistoryWidget implem
@Input({ required: true }) public period!: DefaultTypes.HistoryPeriod;
@Input({ required: true }) public componentId!: string;

public activeSecondsOverPeriod: number = null;
public edge: Edge = null;
public component: EdgeConfig.Component = null;
public activeSecondsOverPeriod: number | null = null;
public edge: Edge | null = null;
public component: EdgeConfig.Component | null = null;

constructor(
public override service: Service,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/history/storage/chargerchart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class StorageChargerChartComponent extends AbstractHistoryChart implement
@Input({ required: true }) public period!: DefaultTypes.HistoryPeriod;
@Input({ required: true }) public componentId!: string;

private moreThanOneProducer: boolean = null;
private moreThanOneProducer: boolean | null = null;

constructor(
protected override service: Service,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/history/storage/esschart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class StorageESSChartComponent extends AbstractHistoryChart implements On
@Input({ required: true }) public componentId!: string;
@Input({ required: true }) public showPhases!: boolean;

private moreThanOneProducer: boolean = null;
private moreThanOneProducer: boolean | null = null;

constructor(
protected override service: Service,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export class StorageChartOverviewComponent implements OnInit {

private static readonly SELECTOR = "storage-chart-overview";

public edge: Edge = null;
public edge: Edge | null = null;

public essComponents: EdgeConfig.Component[] = null;
public chargerComponents: EdgeConfig.Component[] = null;
public essComponents: EdgeConfig.Component[] | null = null;
public chargerComponents: EdgeConfig.Component[] | null = null;

public showPhases: boolean = false;
public showTotal: boolean = false;
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/edge/history/storage/widget.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export class StorageComponent extends AbstractHistoryWidget implements OnInit, O
// reference to the Utils method to access via html
public isLastElement = Utils.isLastElement;

public data: Cumulated = null;
public edge: Edge = null;
public data: Cumulated | null = null;
public edge: Edge | null = null;
public essComponents: EdgeConfig.Component[] = [];

constructor(
Expand Down
7 changes: 3 additions & 4 deletions ui/src/app/edge/live/Controller/ChpSoc/ChpSoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ import { Controller_ChpSocModalComponent } from './modal/modal.component';
export class Controller_ChpSocComponent extends AbstractFlatWidget {

private static PROPERTY_MODE: string = '_PropertyMode';

public inputChannel: ChannelAddress = null;
public outputChannel: ChannelAddress = null;
public propertyModeChannel: ChannelAddress = null;
public inputChannel: ChannelAddress | null = null;
public outputChannel: ChannelAddress | null = null;
public propertyModeChannel: ChannelAddress | null = null;
public highThresholdValue: number;
public lowThresholdValue: number;
public state: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class FlatComponent extends AbstractFlatWidget {
public readonly CONVERT_MANUAL_ON_OFF = Utils.CONVERT_MANUAL_ON_OFF(this.translate);

public chargeDischargePower: { name: string, value: number };
public propertyMode: DefaultTypes.ManualOnOff = null;
public propertyMode: DefaultTypes.ManualOnOff | null = null;

async presentModal() {
if (!this.isInitialized) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ModalComponent } from '../modal/modal';
})
export class FlatComponent extends AbstractFlatWidget {

public override component: EdgeConfig.Component = null;
public override component: EdgeConfig.Component | null = null;
public mode: string = '-';
public state: string = '-';
public isSellToGridLimitAvoided: boolean = false;
Expand Down
Loading

0 comments on commit f03522f

Please sign in to comment.