From 47fc603b864b52a70157515f29ec741dd9192f3a Mon Sep 17 00:00:00 2001 From: Herbert Eiselt Date: Fri, 7 Jun 2019 17:55:16 +0200 Subject: SDNR align ODLUX Add missing chart view to UX Performance app Issue-ID: SDNC-790 Signed-off-by: Herbert Eiselt Change-Id: I6f5af1e01d2246927b8d05f826f629c7dd5f59a5 Signed-off-by: Herbert Eiselt --- .../odlux/apps/performanceHistoryApp/package.json | 5 +- .../src/actions/connectedNetworkElementsActions.ts | 39 +- .../performanceHistoryApp/src/actions/ltpAction.ts | 62 +-- .../src/components/adaptiveModulation.tsx | 502 ++++++++++++++++----- .../src/components/crossPolarDiscrimination.tsx | 132 ++++-- .../src/components/performanceData.tsx | 128 ++++-- .../src/components/receiveLevel.tsx | 131 ++++-- .../src/components/signalToInterference.tsx | 129 ++++-- .../src/components/temperature.tsx | 131 ++++-- .../src/components/transmissionPower.tsx | 129 ++++-- .../src/handlers/availableLtpsActionHandler.ts | 4 +- .../connectedNetworkElementsActionHandler.ts | 16 +- .../src/handlers/performanceHistoryRootHandler.ts | 6 +- .../src/handlers/temperature15minHandler.ts | 29 ++ .../src/handlers/temperature15minHandler.tsx | 29 -- .../src/handlers/transmissionPower15minHandler.ts | 29 ++ .../src/handlers/transmissionPower15minHandler.tsx | 29 -- .../apps/performanceHistoryApp/src/index.html | 5 +- .../src/models/adaptiveModulationDataType.ts | 3 +- .../src/models/availableLtps.ts | 8 +- .../performanceHistoryApp/src/models/chartTypes.ts | 33 ++ .../src/models/connectedNetworkElements.ts | 5 +- .../src/models/crossPolarDiscriminationDataType.ts | 1 - .../src/models/performanceDataType.ts | 1 - .../src/models/receiveLevelDataType.ts | 3 +- .../src/models/signalToInteferenceDataType.ts | 3 +- .../src/models/temperatureDataType.ts | 3 +- .../src/models/transmissionPowerDataType.ts | 3 +- .../src/services/performanceHistoryService.ts | 46 ++ .../src/services/performanceHistoryService.tsx | 93 ---- .../performanceHistoryApp/src/utils/chartUtils.tsx | 51 +++ .../performanceHistoryApp/src/utils/tableUtils.ts | 5 + .../src/views/performanceHistoryApplication.tsx | 61 +-- 33 files changed, 1228 insertions(+), 626 deletions(-) create mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/temperature15minHandler.ts delete mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/temperature15minHandler.tsx create mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/transmissionPower15minHandler.ts delete mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/transmissionPower15minHandler.tsx create mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/models/chartTypes.ts create mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts delete mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.tsx create mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/utils/chartUtils.tsx create mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/utils/tableUtils.ts (limited to 'sdnr/wt/odlux/apps/performanceHistoryApp') diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/package.json b/sdnr/wt/odlux/apps/performanceHistoryApp/package.json index 91e0bf3d3..74b4d9c68 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/package.json +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/package.json @@ -21,7 +21,10 @@ "author": "Sai Neetha Phulmali", "license": "Apache License, Version 2.0", "dependencies": { - "@odlux/framework" : "*" + "@odlux/framework" : "*", + "@odlux/connect-app": "*", + "react-chartjs-2":"2.7.6", + "chart.js":"2.8.0" }, "peerDependencies": { "@types/react": "16.4.14", diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts index 0906584b7..8f7e99c40 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts @@ -1,8 +1,8 @@ import { Action } from '../../../../framework/src/flux/action'; import { Dispatch } from '../../../../framework/src/flux/store'; +import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; -import { ConnectedNetworkElements } from '../models/connectedNetworkElements'; -import { PerformanceHistoryService } from '../services/performanceHistoryService'; +import { ConnectedNetworkElementIds } from '../models/connectedNetworkElements'; /** * Represents the base action. @@ -10,32 +10,41 @@ import { PerformanceHistoryService } from '../services/performanceHistoryService export class BaseAction extends Action { } /** - * Represents an action causing the store to load all connected network elements. + * Represents an action causing the store to load all connected network element Ids. */ export class LoadAllConnectedNetworkElementsAction extends BaseAction { } /** - * Represents an action causing the store to update all connected network elements. + * Represents an action causing the store to update all connected network element Ids. */ -export class AllConnectedNetworkElementsLoadedAction extends BaseAction { +export class AllConnectedNetworkElementsLoadedAction extends BaseAction { /** * Initialize this instance. * - * @param connectedNetworkElements The network elements which are returned from the restconf. + * @param connectedNetworkElements The connected network element Ids which are loaded from the state of connectApp. */ - constructor(public connectedNetworkElements: ConnectedNetworkElements[] | null, public error?: string) { + constructor(public connectedNetworkElementIds: ConnectedNetworkElementIds[] | null, public error?: string) { super(); } } /** - * Represents an asynchronous thunk action to load all connected network elements from the restconf. + * Represents an asynchronous thunk action to load all connected network element Ids. */ -export const loadAllConnectedNetworkElementsAsync = (dispatch: Dispatch) => { - dispatch(new LoadAllConnectedNetworkElementsAction()); - PerformanceHistoryService.getConnectedNetworkElementsList().then(networkElements => { - networkElements && dispatch(new AllConnectedNetworkElementsLoadedAction(networkElements)); - }).catch(error => { - dispatch(new AllConnectedNetworkElementsLoadedAction(null, error)); - }); +export const loadAllConnectedNetworkElementsAsync = (dispatch: Dispatch, getState: () => IApplicationStoreState) => { + dispatch(new LoadAllConnectedNetworkElementsAction()); + const connectedNetworkElementsIds = getState().connect.mountedNetworkElements; + let mountIdList: ConnectedNetworkElementIds[] = []; + connectedNetworkElementsIds.elements.forEach(element => { + const connectedNetworkElement = { + mountId: element.mountId + } + mountIdList.push(connectedNetworkElement); + }); + mountIdList.sort((a, b) => { + if (a.mountId < b.mountId) return -1; + if (a.mountId > b.mountId) return 1; + return 0; + }); + dispatch(new AllConnectedNetworkElementsLoadedAction(mountIdList)); }; \ No newline at end of file diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/ltpAction.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/ltpAction.ts index d8842ffbe..577066cee 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/ltpAction.ts +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/ltpAction.ts @@ -1,7 +1,7 @@ import { Action } from '../../../../framework/src/flux/action'; import { Dispatch } from '../../../../framework/src/flux/store'; -import { Ltp } from '../models/availableLtps'; +import { LtpIds } from '../models/availableLtps'; import { PerformanceHistoryService } from '../services/performanceHistoryService'; /** @@ -22,7 +22,7 @@ export class AllAvailableLtpsLoadedAction extends BaseAction { * Initialize this instance. * @param availableLtps The available ltps which are returned from the database. */ - constructor(public availableLtps: Ltp[] | null, public error?: string) { + constructor(public availableLtps: LtpIds[] | null, public error?: string) { super(); } } @@ -37,39 +37,25 @@ export class AllAvailableLtpsLoadedAction extends BaseAction { * @param resetLtp The function to verify if the selected ltp is also available in the selected time period database else reset the Ltp dropdown to select. */ export const loadDistinctLtpsbyNetworkElementAsync = (networkElement: string, selectedTimePeriod: string, selectedLtp: string, selectFirstLtp?: Function, resetLtp?: Function) => (dispatch: Dispatch) => { - if (selectedTimePeriod == "15min") { - dispatch(new LoadAllAvailableLtpsAction()); - PerformanceHistoryService.getDistinctLtpsFrom15minDatabase(networkElement).then(distinctLtps => { - if(distinctLtps) { - let ltpNotSelected: boolean = true; - selectFirstLtp && selectFirstLtp(distinctLtps[0].key); - distinctLtps.forEach((value: Ltp) => { - if(value.key === selectedLtp) { - ltpNotSelected = false; - } - }); - resetLtp && resetLtp(ltpNotSelected); - dispatch(new AllAvailableLtpsLoadedAction(distinctLtps)) - } - }).catch(error => { - dispatch(new AllAvailableLtpsLoadedAction(null, error)); - }); - } else { - dispatch(new LoadAllAvailableLtpsAction()); - PerformanceHistoryService.getDistinctLtpsFrom24hoursDatabase(networkElement).then(distinctLtps => { - if(distinctLtps) { - let ltpNotSelected: boolean = true; - selectFirstLtp && selectFirstLtp(distinctLtps[0].key); - distinctLtps.forEach((value: Ltp) => { - if(value.key === selectedLtp) { - ltpNotSelected = false; - } - }); - resetLtp && resetLtp(ltpNotSelected); - dispatch(new AllAvailableLtpsLoadedAction(distinctLtps)) - } - }).catch(error => { - dispatch(new AllAvailableLtpsLoadedAction(null, error)); - }); - } -}; \ No newline at end of file + dispatch(new LoadAllAvailableLtpsAction()); + PerformanceHistoryService.getDistinctLtpsFromDatabase(networkElement, selectedTimePeriod).then(distinctLtps => { + if (distinctLtps) { + const ltps = getDistinctLtps(distinctLtps, selectedLtp, selectFirstLtp, resetLtp); + dispatch(new AllAvailableLtpsLoadedAction(ltps)); + } + }).catch(error => { + dispatch(new AllAvailableLtpsLoadedAction(null, error)); + }); +}; + +const getDistinctLtps = (distinctLtps: LtpIds[], selectedLtp: string, selectFirstLtp?: Function, resetLtp?: Function) => { + let ltpNotSelected: boolean = true; + selectFirstLtp && selectFirstLtp(distinctLtps[0].key); + distinctLtps.forEach((value: LtpIds) => { + if (value.key === selectedLtp) { + ltpNotSelected = false; + } + }); + resetLtp && resetLtp(ltpNotSelected); + return distinctLtps; +} \ No newline at end of file diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/adaptiveModulation.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/adaptiveModulation.tsx index 024315c3a..281ee2f8d 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/adaptiveModulation.tsx +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/adaptiveModulation.tsx @@ -2,23 +2,25 @@ import * as React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { MaterialTable, ColumnType, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; +import { MaterialTable, ColumnType, ColumnModel, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect'; import { AdaptiveModulationDataType } from '../models/adaptiveModulationDataType'; -import { createAdaptiveModulation15minProperties, createAdaptiveModulation15minActions, adaptiveModulation15minReloadAction } from '../handlers/adaptiveModulation15minHandler'; -import { createAdaptiveModulation24hoursProperties, createAdaptiveModulation24hoursActions, adaptiveModulation24hoursReloadAction } from '../handlers/adaptiveModulation24hoursHandler'; - +import { IDataSet, IDataSetsObject } from '../models/chartTypes'; +import { createAdaptiveModulation15minProperties, createAdaptiveModulation15minActions } from '../handlers/adaptiveModulation15minHandler'; +import { createAdaptiveModulation24hoursProperties, createAdaptiveModulation24hoursActions } from '../handlers/adaptiveModulation24hoursHandler'; +import { lineChart, sortDataByTimeStamp } from '../utils/chartUtils'; +import { addColumnLabels } from '../utils/tableUtils'; const mapProps = (state: IApplicationStoreState) => ({ adaptiveModulation15minProperties: createAdaptiveModulation15minProperties(state), - adaptiveModulation24hoursProperties: createAdaptiveModulation24hoursProperties(state), + adaptiveModulation24hoursProperties: createAdaptiveModulation24hoursProperties(state) }); const mapDisp = (dispatcher: IDispatcher) => ({ adaptiveModulation15minActions: createAdaptiveModulation15minActions(dispatcher.dispatch), - adaptiveModulation24hoursActions: createAdaptiveModulation24hoursActions(dispatcher.dispatch), + adaptiveModulation24hoursActions: createAdaptiveModulation24hoursActions(dispatcher.dispatch) }); type AdaptiveModulationComponentProps = RouteComponentProps & Connect & { @@ -32,109 +34,391 @@ const AdaptiveModulationTable = MaterialTable as MaterialTableCtorType{ render(): JSX.Element { - if (this.props.selectedTimePeriod == "15min") { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "time2-states-s", title: "QAM2S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2-states", title: "QAM2", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2-states-l", title: "QAM2L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4-states-s", title: "QAM4S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4-states", title: "QAM4", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4-states-l", title: "QAM4L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time16-states-s", title: "QAM16S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time16-states", title: "QAM16", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time16-states-l", title: "QAM16L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time32-states-s", title: "QAM32S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time32-states", title: "QAM32", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time32-states-l", title: "QAM32L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time64-states-s", title: "QAM64S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time64-states", title: "QAM64", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time64-states-l", title: "QAM64L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time128-states-s", title: "QAM128S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time128-states", title: "QAM128", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time128-states-l", title: "QAM128L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time256-states-s", title: "QAM256S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time256-states", title: "QAM256", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time256-states-l", title: "QAM256L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time512-states-s", title: "QAM512S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time512-states", title: "QAM512", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time512-states-l", title: "QAM512L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time1024-states-s", title: "QAM1024S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time1024-states", title: "QAM1024", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time1024-states-l", title: "QAM1024L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2048-states-s", title: "QAM2048S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2048-states", title: "QAM2048", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2048-states-l", title: "QAM2048L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4096-states-s", title: "QAM4096S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4096-states", title: "QAM4096", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4096-states-l", title: "QAM4096L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time8192-states-s", title: "QAM8192S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time8192-states", title: "QAM8192", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time8192-states-l", title: "QAM8192L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.adaptiveModulation15minProperties} {...this.props.adaptiveModulation15minActions} /> - ); - } else { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "time2-states-s", title: "QAM2S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2-states", title: "QAM2", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2-states-l", title: "QAM2L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4-states-s", title: "QAM4S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4-states", title: "QAM4", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4-states-l", title: "QAM4L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time16-states-s", title: "QAM16S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time16-states", title: "QAM16", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time16-states-l", title: "QAM16L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time32-states-s", title: "QAM32S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time32-states", title: "QAM32", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time32-states-l", title: "QAM32L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time64-states-s", title: "QAM64S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time64-states", title: "QAM64", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time64-states-l", title: "QAM64L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time128-states-s", title: "QAM128S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time128-states", title: "QAM128", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time128-states-l", title: "QAM128L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time256-states-s", title: "QAM256S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time256-states", title: "QAM256", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time256-states-l", title: "QAM256L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time512-states-s", title: "QAM512S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time512-states", title: "QAM512", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time512-states-l", title: "QAM512L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time1024-states-s", title: "QAM1024S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time1024-states", title: "QAM1024", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time1024-states-l", title: "QAM1024L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2048-states-s", title: "QAM2048S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2048-states", title: "QAM2048", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time2048-states-l", title: "QAM2048L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4096-states-s", title: "QAM4096S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4096-states", title: "QAM4096", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time4096-states-l", title: "QAM4096L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time8192-states-s", title: "QAM8192S", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time8192-states", title: "QAM8192", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "time8192-states-l", title: "QAM8192L", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.adaptiveModulation24hoursProperties} {...this.props.adaptiveModulation24hoursActions} /> - ); - } + const properties = this.props.selectedTimePeriod === "15min" + ? this.props.adaptiveModulation15minProperties + : this.props.adaptiveModulation24hoursProperties; + + const actions = this.props.selectedTimePeriod === "15min" + ? this.props.adaptiveModulation15minActions + : this.props.adaptiveModulation24hoursActions; + + const chartPagedData = this.getChartDataValues(properties.rows); + const adaptiveModulationColumns: ColumnModel[] = [ + { property: "radio-signal-id", title: "Radio signal", type: ColumnType.text }, + { property: "scanner-id", title: "Scanner ID", type: ColumnType.text }, + { property: "time-stamp", title: "End Time", type: ColumnType.text, disableFilter: true }, + { + property: "suspect-interval-flag", title: "Suspect Interval", type: ColumnType.custom, customControl: ({ rowData }) => { + const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); + return
{suspectIntervalFlag}
+ } + }]; + + chartPagedData.datasets.forEach(ds => { + adaptiveModulationColumns.push(addColumnLabels(ds.name, ds.columnLabel)); + }); + + return ( + <> + {lineChart(chartPagedData)} + + + ); }; -} -export const AdaptiveModulation = withRouter(connect(mapProps, mapDisp)(AdaptiveModulationComponent)); + /** + * This function gets the performance values for Adaptive modulation according on the chartjs dataset structure + * which is to be sent to the chart. + */ + + private getChartDataValues = (rows: AdaptiveModulationDataType[]): IDataSetsObject => { + const _rows = [...rows]; + sortDataByTimeStamp(_rows); + + const datasets: IDataSet[] = [{ + name: "time2-states-s", + label: "QAM2S", + borderColor: '#62a309fc', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM2S", + }, { + name: "time2-states", + label: "QAM2", + borderColor: '#62a309fc', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM2", + }, { + name: "time2-states-l", + label: "QAM2L", + borderColor: '#62a309fc', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM2L", + }, { + name: "time4-states-s", + label: "QAM4S", + borderColor: '#b308edde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM4S", + }, { + name: "time4-states", + label: "QAM4", + borderColor: '#b308edde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM4", + }, { + name: "time4-states-l", + label: "QAM4L", + borderColor: '#b308edde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM4L", + }, { + name: "time16-states-s", + label: "QAM16S", + borderColor: '#9b15e2', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM16S", + }, { + name: "time16-states", + label: "QAM16", + borderColor: '#9b15e2', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM16", + }, { + name: "time16-states-l", + label: "QAM16L", + borderColor: '#9b15e2', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM16L", + }, { + name: "time32-states-s", + label: "QAM32S", + borderColor: '#2704f5f0', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM32S", + }, { + name: "time32-states", + label: "QAM32", + borderColor: '#2704f5f0', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM32", + }, { + name: "time32-states-l", + label: "QAM32L", + borderColor: '#2704f5f0', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM32L", + }, { + name: "time64-states-s", + label: "QAM64S", + borderColor: '#347692', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM64S", + }, { + name: "time64-states", + label: "QAM64", + borderColor: '#347692', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM64", + }, { + name: "time64-states-l", + label: "QAM64L", + borderColor: '#347692', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM64L", + }, { + name: "time128-states-s", + label: "QAM128S", + borderColor: '#885e22', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM128S", + }, { + name: "time128-states", + label: "QAM128", + borderColor: '#885e22', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM128", + }, { + name: "time128-states-l", + label: "QAM128L", + borderColor: '#885e22', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM128L", + }, { + name: "time256-states-s", + label: "QAM256S", + borderColor: '#de07807a', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM256S", + }, { + name: "time256-states", + label: "QAM256", + borderColor: '#de07807a', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM256", + }, { + name: "time256-states-l", + label: "QAM256L", + borderColor: '#de07807a', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM256L", + }, { + name: "time512-states-s", + label: "QAM512S", + borderColor: '#8fdaacde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM512S", + }, { + name: "time512-states", + label: "QAM512", + borderColor: '#8fdaacde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM512", + }, { + + name: "time512-states-l", + label: "QAM512L", + borderColor: '#8fdaacde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM512L", + }, { + + name: "time1024-states-s", + label: "QAM1024S", + borderColor: '#435b22', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM1024S", + }, { + + name: "time1024-states", + label: "QAM1024", + borderColor: '#435b22', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM1024", + }, { + + name: "time1024-states-l", + label: "QAM1024L", + borderColor: '#435b22', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM1024L", + }, { + name: "time2048-states-s", + label: "QAM2048S", + borderColor: '#e87a5b', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM2048S", + }, { + name: "time2048-states", + label: "QAM2048", + borderColor: '#e87a5b', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM2048", + }, { + name: "time2048-states-l", + label: "QAM2048L", + borderColor: '#e87a5b', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM2048L", + }, { + name: "time4096-states-s", + label: "QAM4096S", + borderColor: '#5be878', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM4096S", + }, { + name: "time4096-states", + label: "QAM4096", + borderColor: '#5be878', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM4096", + }, { + name: "time4096-states-l", + label: "QAM4096L", + borderColor: '#5be878', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM4096L", + }, { + name: "time8192-states-s", + label: "QAM8192s", + borderColor: '#cb5be8', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM8192S", + }, { + name: "time8192-states", + label: "QAM8192", + borderColor: '#cb5be8', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM8192", + }, { + name: "time8192-states-l", + label: "QAM8192L", + borderColor: '#cb5be8', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "QAM8192L", + } + ]; + + _rows.forEach(row => { + datasets.forEach(ds => { + ds.data.push({ + x: row["time-stamp"], + y: row[ds.name as keyof AdaptiveModulationDataType] as string + }); + }); + }); + + return { + datasets: datasets + }; + } +} +const AdaptiveModulation = withRouter(connect(mapProps, mapDisp)(AdaptiveModulationComponent)); export default AdaptiveModulation; diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/crossPolarDiscrimination.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/crossPolarDiscrimination.tsx index bbed8abfe..42e3f93a6 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/crossPolarDiscrimination.tsx +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/crossPolarDiscrimination.tsx @@ -2,23 +2,25 @@ import * as React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { MaterialTable, ColumnType, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; +import { MaterialTable, ColumnType, MaterialTableCtorType, ColumnModel } from '../../../../framework/src/components/material-table'; import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect'; import { CrossPolarDiscriminationDataType } from '../models/crossPolarDiscriminationDataType'; -import { createCrossPolarDiscrimination15minProperties, createCrossPolarDiscrimination15minActions, crossPolarDiscrimination15minReloadAction } from '../handlers/crossPolarDiscrimination15minHandler'; -import { createCrossPolarDiscrimination24hoursProperties, createCrossPolarDiscrimination24hoursActions, crossPolarDiscrimination24hoursReloadAction } from '../handlers/crossPolarDiscrimination24hoursHandler'; - +import { IDataSet, IDataSetsObject } from '../models/chartTypes'; +import { createCrossPolarDiscrimination15minProperties, createCrossPolarDiscrimination15minActions } from '../handlers/crossPolarDiscrimination15minHandler'; +import { createCrossPolarDiscrimination24hoursProperties, createCrossPolarDiscrimination24hoursActions } from '../handlers/crossPolarDiscrimination24hoursHandler'; +import { lineChart, sortDataByTimeStamp } from '../utils/chartUtils'; +import { addColumnLabels } from '../utils/tableUtils'; const mapProps = (state: IApplicationStoreState) => ({ crossPolarDiscrimination15minProperties: createCrossPolarDiscrimination15minProperties(state), - crossPolarDiscrimination24hoursProperties: createCrossPolarDiscrimination24hoursProperties(state), + crossPolarDiscrimination24hoursProperties: createCrossPolarDiscrimination24hoursProperties(state) }); const mapDisp = (dispatcher: IDispatcher) => ({ crossPolarDiscrimination15minActions: createCrossPolarDiscrimination15minActions(dispatcher.dispatch), - crossPolarDiscrimination24hoursActions: createCrossPolarDiscrimination24hoursActions(dispatcher.dispatch), + crossPolarDiscrimination24hoursActions: createCrossPolarDiscrimination24hoursActions(dispatcher.dispatch) }); type CrossPolarDiscriminationComponentProps = RouteComponentProps & Connect & { @@ -32,43 +34,87 @@ const CrossPolarDiscriminationTable = MaterialTable as MaterialTableCtorType{ render(): JSX.Element { - if (this.props.selectedTimePeriod == "15min") { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "xpd-min", title: "CPD (min)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "xpd-avg", title: "CPD (avg)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "xpd-max", title: "CPD (max)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.crossPolarDiscrimination15minProperties} {...this.props.crossPolarDiscrimination15minActions} /> - ); - } else { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "xpd-min", title: "CPD (min)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "xpd-avg", title: "CPD (avg)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "xpd-max", title: "CPD (max)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.crossPolarDiscrimination24hoursProperties} {...this.props.crossPolarDiscrimination24hoursActions} /> - ); - } + const properties = this.props.selectedTimePeriod === "15min" + ? this.props.crossPolarDiscrimination15minProperties + : this.props.crossPolarDiscrimination24hoursProperties; + const actions = this.props.selectedTimePeriod === "15min" + ? this.props.crossPolarDiscrimination15minActions + : this.props.crossPolarDiscrimination24hoursActions; + + const chartPagedData = this.getChartDataValues(properties.rows); + + const cpdColumns: ColumnModel[] = [ + { property: "radio-signal-id", title: "Radio signal", type: ColumnType.text }, + { property: "scanner-id", title: "Scanner ID", type: ColumnType.text }, + { property: "time-stamp", title: "End Time", type: ColumnType.text, disableFilter: true }, + { + property: "suspect-interval-flag", title: "Suspect Interval", type: ColumnType.custom, customControl: ({ rowData }) => { + const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); + return
{suspectIntervalFlag}
+ } + } + ]; + + chartPagedData.datasets.forEach(ds => { + cpdColumns.push(addColumnLabels(ds.name, ds.columnLabel)); + }); + return ( + <> + {lineChart(chartPagedData)} + + + ); }; -} -export const CrossPolarDiscrimination = withRouter(connect(mapProps, mapDisp)(CrossPolarDiscriminationComponent)); + /** + * This function gets the performance values for CPD according on the chartjs dataset structure + * which is to be sent to the chart. + */ + private getChartDataValues = (rows: CrossPolarDiscriminationDataType[]): IDataSetsObject => { + const _rows = [...rows]; + sortDataByTimeStamp(_rows); + + const datasets: IDataSet[] = [{ + name: "xpd-min", + label: "xpd-min", + borderColor: '#0e17f3de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "CPD (min)[db]" + }, { + name: "xpd-avg", + label: "xpd-avg", + borderColor: '#08edb6de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "CPD (avg)[db]" + }, { + name: "xpd-max", + label: "xpd-max", + borderColor: '#b308edde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "CPD (max)[db]" + }]; + + _rows.forEach(row => { + datasets.forEach(ds => { + ds.data.push({ + x: row["time-stamp"], + y: row[ds.name as keyof CrossPolarDiscriminationDataType] as string + }); + }); + }); + return { + datasets: datasets + }; + } +} +const CrossPolarDiscrimination = withRouter(connect(mapProps, mapDisp)(CrossPolarDiscriminationComponent)); export default CrossPolarDiscrimination; diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/performanceData.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/performanceData.tsx index e9a373b11..578022db7 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/performanceData.tsx +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/performanceData.tsx @@ -2,22 +2,24 @@ import * as React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { MaterialTable, ColumnType, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; +import { MaterialTable, ColumnType, ColumnModel, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect'; - import { PerformanceDataType } from '../models/performanceDataType'; +import { IDataSet, IDataSetsObject } from '../models/chartTypes'; import { createPerformanceData15minProperties, createPerformanceData15minActions } from '../handlers/performanceData15minHandler'; import { createPerformanceData24hoursProperties, createPerformanceData24hoursActions } from '../handlers/performanceData24hoursHandler'; +import { lineChart, sortDataByTimeStamp } from '../utils/chartUtils'; +import { addColumnLabels } from '../utils/tableUtils'; const mapProps = (state: IApplicationStoreState) => ({ performanceData15minProperties: createPerformanceData15minProperties(state), - performanceData24hoursProperties: createPerformanceData24hoursProperties(state), + performanceData24hoursProperties: createPerformanceData24hoursProperties(state) }); const mapDisp = (dispatcher: IDispatcher) => ({ performanceData15minActions: createPerformanceData15minActions(dispatcher.dispatch), - performanceData24hoursActions: createPerformanceData24hoursActions(dispatcher.dispatch), + performanceData24hoursActions: createPerformanceData24hoursActions(dispatcher.dispatch) }); type PerformanceDataComponentProps = RouteComponentProps & Connect & { @@ -31,45 +33,87 @@ const PerformanceDataTable = MaterialTable as MaterialTableCtorType{ render(): JSX.Element { - if (this.props.selectedTimePeriod == "15min") { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "es", title: "ES", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "ses", title: "SES", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "unavailability", title: "UAS", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.performanceData15minProperties} {...this.props.performanceData15minActions} - /> - ); - } else { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "es", title: "ES", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "ses", title: "SES", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "unavailability", title: "UAS", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.performanceData24hoursProperties} {...this.props.performanceData24hoursActions} - /> - ); - } + const properties = this.props.selectedTimePeriod === "15min" + ? this.props.performanceData15minProperties + : this.props.performanceData24hoursProperties; + const actions = this.props.selectedTimePeriod === "15min" + ? this.props.performanceData15minActions + : this.props.performanceData24hoursActions; + + const chartPagedData = this.getChartDataValues(properties.rows); + const performanceColumns: ColumnModel[] = [ + { property: "radio-signal-id", title: "Radio signal", type: ColumnType.text }, + { property: "scanner-id", title: "Scanner ID", type: ColumnType.text }, + { property: "time-stamp", title: "End Time", type: ColumnType.text, disableFilter: true }, + { + property: "suspect-interval-flag", title: "Suspect Interval", type: ColumnType.custom, customControl: ({ rowData }) => { + const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); + return
{suspectIntervalFlag}
+ } + } + ]; + + chartPagedData.datasets.forEach(ds => { + performanceColumns.push(addColumnLabels(ds.name, ds.columnLabel)); + }); + return ( + <> + {lineChart(chartPagedData)} + + + ); }; + + /** + * This function gets the performance values for PerformanceData according on the chartjs dataset structure + * which is to be sent to the chart. + */ + private getChartDataValues = (rows: PerformanceDataType[]): IDataSetsObject => { + const _rows = [...rows]; + sortDataByTimeStamp(_rows); + + const datasets: IDataSet[] = [{ + name: "es", + label: "es", + borderColor: '#0e17f3de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "ES" + }, { + name: "ses", + label: "ses", + borderColor: '#08edb6de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "SES" + }, { + name: "unavailability", + label: "unavailability", + borderColor: '#b308edde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Unavailability" + }]; + + _rows.forEach(row => { + datasets.forEach(ds => { + ds.data.push({ + x: row["time-stamp"], + y: row[ds.name as keyof PerformanceDataType] as string + }); + }); + }); + return { + datasets: datasets + }; + } } -export const PerformanceData = withRouter(connect(mapProps, mapDisp)(PerformanceDataComponent)); +const PerformanceData = withRouter(connect(mapProps, mapDisp)(PerformanceDataComponent)); export default PerformanceData; diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx index 5f62e585a..b893ce149 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx @@ -2,23 +2,25 @@ import * as React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { MaterialTable, ColumnType, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; +import { MaterialTable, ColumnType, ColumnModel, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect'; import { ReceiveLevelDataType } from '../models/receiveLevelDataType'; -import { createReceiveLevel15minProperties, createReceiveLevel15minActions, receiveLevel15minReloadAction } from '../handlers/receiveLevel15minHandler'; -import { createReceiveLevel24hoursProperties, createReceiveLevel24hoursActions, receiveLevel24hoursReloadAction } from '../handlers/receiveLevel24hoursHandler'; - +import { IDataSet, IDataSetsObject } from '../models/chartTypes'; +import { createReceiveLevel15minProperties, createReceiveLevel15minActions } from '../handlers/receiveLevel15minHandler'; +import { createReceiveLevel24hoursProperties, createReceiveLevel24hoursActions } from '../handlers/receiveLevel24hoursHandler'; +import { lineChart, sortDataByTimeStamp } from '../utils/chartUtils'; +import { addColumnLabels } from '../utils/tableUtils'; const mapProps = (state: IApplicationStoreState) => ({ receiveLevel15minProperties: createReceiveLevel15minProperties(state), - receiveLevel24hoursProperties: createReceiveLevel24hoursProperties(state), + receiveLevel24hoursProperties: createReceiveLevel24hoursProperties(state) }); const mapDisp = (dispatcher: IDispatcher) => ({ receiveLevel15minActions: createReceiveLevel15minActions(dispatcher.dispatch), - receiveLevel24hoursActions: createReceiveLevel24hoursActions(dispatcher.dispatch), + receiveLevel24hoursActions: createReceiveLevel24hoursActions(dispatcher.dispatch) }); type ReceiveLevelComponentProps = RouteComponentProps & Connect & { @@ -32,43 +34,88 @@ const ReceiveLevelTable = MaterialTable as MaterialTableCtorType{ render(): JSX.Element { - if (this.props.selectedTimePeriod == "15min") { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "rx-level-min", title: "Rx min", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "rx-level-avg", title: "Rx avg", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "rx-level-max", title: "Rx max", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.receiveLevel15minProperties} {...this.props.receiveLevel15minActions} /> - ); - } else { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "rx-level-min", title: "Rx min", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "rx-level-avg", title: "Rx avg", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "rx-level-max", title: "Rx max", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.receiveLevel24hoursProperties} {...this.props.receiveLevel24hoursActions} /> - ); - } + const properties = this.props.selectedTimePeriod === "15min" + ? this.props.receiveLevel15minProperties + : this.props.receiveLevel24hoursProperties; + const actions = this.props.selectedTimePeriod === "15min" + ? this.props.receiveLevel15minActions + : this.props.receiveLevel24hoursActions; + + const chartPagedData = this.getChartDataValues(properties.rows); + const receiveLevelColumns: ColumnModel[] = [ + { property: "radio-signal-id", title: "Radio signal", type: ColumnType.text }, + { property: "scanner-id", title: "Scanner ID", type: ColumnType.text }, + { property: "time-stamp", title: "End Time", type: ColumnType.text, disableFilter: true }, + { + property: "suspect-interval-flag", title: "Suspect Interval", type: ColumnType.custom, customControl: ({ rowData }) => { + const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); + return
{suspectIntervalFlag}
+ } + } + ]; + + chartPagedData.datasets.forEach(ds => { + receiveLevelColumns.push(addColumnLabels(ds.name, ds.columnLabel)); + }); + + return ( + <> + {lineChart(chartPagedData)} + + + ); }; + + /** + * This function gets the performance values for ReceiveLevel according on the chartjs dataset structure + * which is to be sent to the chart. + */ + private getChartDataValues = (rows: ReceiveLevelDataType[]): IDataSetsObject => { + const _rows = [...rows]; + sortDataByTimeStamp(_rows); + + const datasets: IDataSet[] = [{ + name: "rx-level-min", + label: "rx-level-min", + borderColor: '#0e17f3de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Rx min" + }, { + name: "rx-level-avg", + label: "rx-level-avg", + borderColor: '#08edb6de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Rx avg" + }, { + name: "rx-level-max", + label: "rx-level-max", + borderColor: '#b308edde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Rx max" + }]; + + _rows.forEach(row => { + datasets.forEach(ds => { + ds.data.push({ + x: row["time-stamp"], + y: row[ds.name as keyof ReceiveLevelDataType] as string + }); + }); + }); + return { + datasets: datasets + }; + } } -export const ReceiveLevel = withRouter(connect(mapProps, mapDisp)(ReceiveLevelComponent)); +const ReceiveLevel = withRouter(connect(mapProps, mapDisp)(ReceiveLevelComponent)); export default ReceiveLevel; diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/signalToInterference.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/signalToInterference.tsx index bd612822e..90ed1a9cb 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/signalToInterference.tsx +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/signalToInterference.tsx @@ -2,22 +2,25 @@ import * as React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { MaterialTable, ColumnType, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; +import { MaterialTable, ColumnType, ColumnModel, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect'; import { SignalToInterferenceDataType } from '../models/signalToInteferenceDataType'; +import { IDataSet, IDataSetsObject } from '../models/chartTypes'; import { createSignalToInterference15minProperties, createSignalToInterference15minActions } from '../handlers/signalToInterference15minHandler'; import { createSignalToInterference24hoursProperties, createSignalToInterference24hoursActions } from '../handlers/signalToInterference24hoursHandler'; +import { lineChart, sortDataByTimeStamp } from '../utils/chartUtils'; +import { addColumnLabels } from '../utils/tableUtils'; const mapProps = (state: IApplicationStoreState) => ({ signalToInterference15minProperties: createSignalToInterference15minProperties(state), - signalToInterference24hoursProperties: createSignalToInterference24hoursProperties(state), + signalToInterference24hoursProperties: createSignalToInterference24hoursProperties(state) }); const mapDisp = (dispatcher: IDispatcher) => ({ signalToInterference15minActions: createSignalToInterference15minActions(dispatcher.dispatch), - signalToInterference24hoursActions: createSignalToInterference24hoursActions(dispatcher.dispatch), + signalToInterference24hoursActions: createSignalToInterference24hoursActions(dispatcher.dispatch) }); type SignalToInterferenceComponentProps = RouteComponentProps & Connect & { @@ -31,45 +34,91 @@ const SignalToInterferenceTable = MaterialTable as MaterialTableCtorType{ render(): JSX.Element { - if (this.props.selectedTimePeriod == "15min") { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "snir-min", title: "SINR (min)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "snir-avg", title: "SINR (avg)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "snir-max", title: "SINR (max)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.signalToInterference15minProperties} {...this.props.signalToInterference15minActions} - /> - ); - } else { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "snir-min", title: "SINR (min)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "snir-avg", title: "SINR (avg)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "snir-max", title: "SINR (max)[db]", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.signalToInterference24hoursProperties} {...this.props.signalToInterference24hoursActions} + const properties = this.props.selectedTimePeriod === "15min" + ? this.props.signalToInterference15minProperties + : this.props.signalToInterference24hoursProperties; + const actions = this.props.selectedTimePeriod === "15min" + ? this.props.signalToInterference15minActions + : this.props.signalToInterference24hoursActions; + + const chartPagedData = this.getChartDataValues(properties.rows); + + const sinrColumns: ColumnModel[] = [ + + { property: "radio-signal-id", title: "Radio signal", type: ColumnType.text }, + { property: "scanner-id", title: "Scanner ID", type: ColumnType.text }, + { property: "time-stamp", title: "End Time", type: ColumnType.text, disableFilter: true }, + { + property: "suspect-interval-flag", title: "Suspect Interval", type: ColumnType.custom, customControl: ({ rowData }) => { + const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); + return
{suspectIntervalFlag}
+ } + } + ]; + + chartPagedData.datasets.forEach(ds => { + sinrColumns.push(addColumnLabels(ds.name, ds.columnLabel)); + }); + return ( + <> + {lineChart(chartPagedData)} + - ); - } + + ); }; + + /** + * This function gets the performance values for SINR according on the chartjs dataset structure + * which is to be sent to the chart. + */ + + private getChartDataValues = (rows: SignalToInterferenceDataType[]): IDataSetsObject => { + const _rows = [...rows]; + sortDataByTimeStamp(_rows); + + const datasets: IDataSet[] = [{ + name: "snir-min", + label: "snir-min", + borderColor: '#0e17f3de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "SINR (min)[db]" + }, { + name: "snir-avg", + label: "snir-avg", + borderColor: '#08edb6de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "SINR (avg)[db]" + }, { + name: "snir-max", + label: "snir-max", + borderColor: '#b308edde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "SINR (max)[db]" + }]; + + _rows.forEach(row => { + datasets.forEach(ds => { + ds.data.push({ + x: row["time-stamp"], + y: row[ds.name as keyof SignalToInterferenceDataType] as string + }); + }); + }); + return { + datasets: datasets + }; + } } -export const SignalToInterference = withRouter(connect(mapProps, mapDisp)(SignalToInterferenceComponent)); +const SignalToInterference = withRouter(connect(mapProps, mapDisp)(SignalToInterferenceComponent)); export default SignalToInterference; diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/temperature.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/temperature.tsx index 1496396aa..f105bfd46 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/temperature.tsx +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/temperature.tsx @@ -2,23 +2,25 @@ import * as React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { MaterialTable, ColumnType, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; +import { MaterialTable, ColumnType, ColumnModel, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect'; import { TemperatureDataType } from '../models/temperatureDataType'; -import { createTemperature15minProperties, createTemperature15minActions, temperature15minReloadAction } from '../handlers/temperature15minHandler'; -import { createTemperature24hoursProperties, createTemperature24hoursActions, temperature24hoursReloadAction } from '../handlers/temperature24hoursHandler'; - +import { IDataSet, IDataSetsObject } from '../models/chartTypes'; +import { createTemperature15minProperties, createTemperature15minActions } from '../handlers/temperature15minHandler'; +import { createTemperature24hoursProperties, createTemperature24hoursActions } from '../handlers/temperature24hoursHandler'; +import { lineChart, sortDataByTimeStamp } from '../utils/chartUtils'; +import { addColumnLabels } from '../utils/tableUtils'; const mapProps = (state: IApplicationStoreState) => ({ temperature15minProperties: createTemperature15minProperties(state), - temperature24hoursProperties: createTemperature24hoursProperties(state), + temperature24hoursProperties: createTemperature24hoursProperties(state) }); const mapDisp = (dispatcher: IDispatcher) => ({ temperature15minActions: createTemperature15minActions(dispatcher.dispatch), - temperature24hoursActions: createTemperature24hoursActions(dispatcher.dispatch), + temperature24hoursActions: createTemperature24hoursActions(dispatcher.dispatch) }); type TemperatureComponentProps = RouteComponentProps & Connect & { @@ -32,43 +34,88 @@ const TemperatureTable = MaterialTable as MaterialTableCtorType{ render(): JSX.Element { - if (this.props.selectedTimePeriod == "15min") { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "rf-temp-min", title: "Rx min", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "rf-temp-avg", title: "Rx avg", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "rf-temp-max", title: "Rx max", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.temperature15minProperties} {...this.props.temperature15minActions} /> - ); - } else { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "rf-temp-min", title: "Rx min", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "rf-temp-avg", title: "Rx avg", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "rf-temp-max", title: "Rx max", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.temperature24hoursProperties} {...this.props.temperature24hoursActions} /> - ); - } + const properties = this.props.selectedTimePeriod === "15min" + ? this.props.temperature15minProperties + : this.props.temperature24hoursProperties; + const actions = this.props.selectedTimePeriod === "15min" + ? this.props.temperature15minActions + : this.props.temperature24hoursActions; + + const chartPagedData = this.getChartDataValues(properties.rows); + const temperatureColumns: ColumnModel[] = [ + { property: "radio-signal-id", title: "Radio signal", type: ColumnType.text }, + { property: "scanner-id", title: "Scanner ID", type: ColumnType.text }, + { property: "time-stamp", title: "End Time", type: ColumnType.text, disableFilter: true }, + { + property: "suspect-interval-flag", title: "Suspect Interval", type: ColumnType.custom, customControl: ({ rowData }) => { + const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); + return
{suspectIntervalFlag}
+ } + } + ]; + + chartPagedData.datasets.forEach(ds => { + temperatureColumns.push(addColumnLabels(ds.name, ds.columnLabel)); + }); + return ( + <> + {lineChart(chartPagedData)} + + + ); }; + + /** + * This function gets the performance values for Temperature according on the chartjs dataset structure + * which is to be sent to the chart. + */ + + private getChartDataValues = (rows: TemperatureDataType[]): IDataSetsObject => { + const _rows = [...rows]; + sortDataByTimeStamp(_rows); + + const datasets: IDataSet[] = [{ + name: "rf-temp-min", + label: "rf-temp-min", + borderColor: '#0e17f3de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Rf Temp Min[deg C]" + }, { + name: "rf-temp-avg", + label: "rf-temp-avg", + borderColor: '#08edb6de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Rf Temp Avg[deg C]" + }, { + name: "rf-temp-max", + label: "rf-temp-max", + borderColor: '#b308edde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Rf Temp Max[deg C]" + }]; + + _rows.forEach(row => { + datasets.forEach(ds => { + ds.data.push({ + x: row["time-stamp"], + y: row[ds.name as keyof TemperatureDataType] as string + }); + }); + }); + return { + datasets: datasets + }; + } } -export const Temperature = withRouter(connect(mapProps, mapDisp)(TemperatureComponent)); +const Temperature = withRouter(connect(mapProps, mapDisp)(TemperatureComponent)); export default Temperature; diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/transmissionPower.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/transmissionPower.tsx index 10c25874a..088a83eed 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/transmissionPower.tsx +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/transmissionPower.tsx @@ -2,23 +2,25 @@ import * as React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { MaterialTable, ColumnType, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; +import { MaterialTable, ColumnType, ColumnModel, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect'; import { TransmissionPowerDataType } from '../models/transmissionPowerDataType'; +import { IDataSet, IDataSetsObject } from '../models/chartTypes'; import { createTransmissionPower15minProperties, createTransmissionPower15minActions } from '../handlers/transmissionPower15minHandler'; import { createTransmissionPower24hoursProperties, createTransmissionPower24hoursActions } from '../handlers/transmissionPower24hoursHandler'; - +import { lineChart, sortDataByTimeStamp } from '../utils/chartUtils'; +import { addColumnLabels } from '../utils/tableUtils'; const mapProps = (state: IApplicationStoreState) => ({ transmissionPower15minProperties: createTransmissionPower15minProperties(state), - transmissionPower24hoursProperties: createTransmissionPower24hoursProperties(state), + transmissionPower24hoursProperties: createTransmissionPower24hoursProperties(state) }); const mapDisp = (dispatcher: IDispatcher) => ({ transmissionPower15minActions: createTransmissionPower15minActions(dispatcher.dispatch), - transmissionPower24hoursActions: createTransmissionPower24hoursActions(dispatcher.dispatch), + transmissionPower24hoursActions: createTransmissionPower24hoursActions(dispatcher.dispatch) }); type TransmissionPowerComponentProps = RouteComponentProps & Connect & { @@ -32,43 +34,90 @@ const TransmissionPowerTable = MaterialTable as MaterialTableCtorType{ render(): JSX.Element { - if (this.props.selectedTimePeriod == "15min") { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "tx-level-min", title: "Tx min", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "tx-level-avg", title: "Tx avg", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "tx-level-max", title: "Tx max", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.transmissionPower15minProperties} {...this.props.transmissionPower15minActions} /> - ); - } else { - return ( - { - const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); - return
{suspectIntervalFlag}
- } - }, - { property: "tx-level-min", title: "Tx min", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "tx-level-avg", title: "Tx avg", type: ColumnType.text, disableFilter: true, disableSorting: true }, - { property: "tx-level-max", title: "Tx max", type: ColumnType.text, disableFilter: true, disableSorting: true }, - ]} {...this.props.transmissionPower24hoursProperties} {...this.props.transmissionPower24hoursActions} /> - ); - } + const properties = this.props.selectedTimePeriod === "15min" + ? this.props.transmissionPower15minProperties + : this.props.transmissionPower24hoursProperties; + const actions = this.props.selectedTimePeriod === "15min" + ? this.props.transmissionPower15minActions + : this.props.transmissionPower24hoursActions; + + const chartPagedData = this.getChartDataValues(properties.rows); + + const transmissionColumns: ColumnModel[] = [ + { property: "radio-signal-id", title: "Radio signal", type: ColumnType.text }, + { property: "scanner-id", title: "Scanner ID", type: ColumnType.text }, + { property: "time-stamp", title: "End Time", type: ColumnType.text, disableFilter: true }, + { + property: "suspect-interval-flag", title: "Suspect Interval", type: ColumnType.custom, customControl: ({ rowData }) => { + const suspectIntervalFlag = rowData["suspect-interval-flag"].toString(); + return
{suspectIntervalFlag}
+ } + } + ]; + + chartPagedData.datasets.forEach(ds => { + transmissionColumns.push(addColumnLabels(ds.name, ds.columnLabel)); + }); + + return ( + <> + {lineChart(chartPagedData)} + + + ); }; + + /** + * This function gets the performance values for TransmissionPower according on the chartjs dataset structure + * which is to be sent to the chart. + */ + + private getChartDataValues = (rows: TransmissionPowerDataType[]): IDataSetsObject => { + const _rows = [...rows]; + sortDataByTimeStamp(_rows); + + const datasets: IDataSet[] = [{ + name: "tx-level-min", + label: "tx-level-min", + borderColor: '#0e17f3de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Tx min" + }, { + name: "tx-level-avg", + label: "tx-level-avg", + borderColor: '#08edb6de', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Tx avg" + }, { + name: "tx-level-max", + label: "tx-level-max", + borderColor: '#b308edde', + bezierCurve: false, + lineTension: 0, + fill: false, + data: [], + columnLabel: "Tx max" + }]; + + _rows.forEach(row => { + datasets.forEach(ds => { + ds.data.push({ + x: row["time-stamp"], + y: row[ds.name as keyof TransmissionPowerDataType] as string + }); + }); + }); + return { + datasets: datasets + }; + } } -export const TransmissionPower = withRouter(connect(mapProps, mapDisp)(TransmissionPowerComponent)); +const TransmissionPower = withRouter(connect(mapProps, mapDisp)(TransmissionPowerComponent)); export default TransmissionPower; diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts index 2fd0ac8f1..415b073c9 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts @@ -5,10 +5,10 @@ import { LoadAllAvailableLtpsAction, } from '../actions/ltpAction'; -import { Ltp } from '../models/availableLtps'; +import { LtpIds } from '../models/availableLtps'; export interface IAvailableLtpsState { - distinctLtps: Ltp[]; + distinctLtps: LtpIds[]; busy: boolean; } diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/connectedNetworkElementsActionHandler.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/connectedNetworkElementsActionHandler.ts index 039ae5357..ad153f0ec 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/connectedNetworkElementsActionHandler.ts +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/connectedNetworkElementsActionHandler.ts @@ -1,19 +1,15 @@ import { IActionHandler } from '../../../../framework/src/flux/action'; -import { - AllConnectedNetworkElementsLoadedAction, - LoadAllConnectedNetworkElementsAction, -} from '../actions/connectedNetworkElementsActions'; - -import { ConnectedNetworkElements } from '../models/connectedNetworkElements'; +import { AllConnectedNetworkElementsLoadedAction, LoadAllConnectedNetworkElementsAction } from '../actions/connectedNetworkElementsActions'; +import { ConnectedNetworkElementIds } from '../models/connectedNetworkElements'; export interface IConnectedNetworkElementsState { - connectedNetworkElements: ConnectedNetworkElements[]; + connectedNetworkElementIds: ConnectedNetworkElementIds[]; busy: boolean; } const connectedNetworkElementsStateInit: IConnectedNetworkElementsState = { - connectedNetworkElements: [], + connectedNetworkElementIds: [], busy: false }; @@ -26,10 +22,10 @@ export const connectedNetworkElementsActionHandler: IActionHandler = (state = null, ac declare module '../../../../framework/src/store/applicationStore' { interface IApplicationStoreState { performanceHistory: IPerformanceHistoryStoreState; + connect: IConnectAppStoreState; } } @@ -75,9 +77,9 @@ const actionHandlers = { signalToInterference24hours: signalToInterference24hoursActionHandler, crossPolarDiscrimination15min: crossPolarDiscrimination15minActionHandler, crossPolarDiscrimination24hours: crossPolarDiscrimination24hoursActionHandler, - currentOpenPanel: currentOpenPanelHandler, + currentOpenPanel: currentOpenPanelHandler }; -export const performanceHistoryRootHandler = combineActionHandler(actionHandlers); +const performanceHistoryRootHandler = combineActionHandler(actionHandlers); export default performanceHistoryRootHandler; diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/temperature15minHandler.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/temperature15minHandler.ts new file mode 100644 index 000000000..20fb57035 --- /dev/null +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/temperature15minHandler.ts @@ -0,0 +1,29 @@ +import { createExternal, IExternalTableState } from '../../../../framework/src/components/material-table/utilities'; +import { createSearchDataHandler } from '../../../../framework/src/utilities/elasticSearch'; + + +import { TemperatureDataType, Temperature, TemperatureResult } from '../models/temperatureDataType'; + +export interface ITemperature15minState extends IExternalTableState { } + +/** + * Creates elastic search material data fetch handler for Temperature from historicalperformance15min database. + */ +const temperatureSearchHandler = createSearchDataHandler( + "sdnperformance/historicalperformance15min", + null, + (hit) => ({ + _id: hit._id, + ...hit._source, + ...hit._source["performance-data"] + }), + (name) => `${name}`); + +export const { + actionHandler: temperature15minActionHandler, + createActions: createTemperature15minActions, + createProperties: createTemperature15minProperties, + createPreActions: createTemperature15minPreActions, + reloadAction: temperature15minReloadAction, +} = createExternal(temperatureSearchHandler, appState => appState.performanceHistory.temperature15min); + diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/temperature15minHandler.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/temperature15minHandler.tsx deleted file mode 100644 index 20fb57035..000000000 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/temperature15minHandler.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { createExternal, IExternalTableState } from '../../../../framework/src/components/material-table/utilities'; -import { createSearchDataHandler } from '../../../../framework/src/utilities/elasticSearch'; - - -import { TemperatureDataType, Temperature, TemperatureResult } from '../models/temperatureDataType'; - -export interface ITemperature15minState extends IExternalTableState { } - -/** - * Creates elastic search material data fetch handler for Temperature from historicalperformance15min database. - */ -const temperatureSearchHandler = createSearchDataHandler( - "sdnperformance/historicalperformance15min", - null, - (hit) => ({ - _id: hit._id, - ...hit._source, - ...hit._source["performance-data"] - }), - (name) => `${name}`); - -export const { - actionHandler: temperature15minActionHandler, - createActions: createTemperature15minActions, - createProperties: createTemperature15minProperties, - createPreActions: createTemperature15minPreActions, - reloadAction: temperature15minReloadAction, -} = createExternal(temperatureSearchHandler, appState => appState.performanceHistory.temperature15min); - diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/transmissionPower15minHandler.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/transmissionPower15minHandler.ts new file mode 100644 index 000000000..e6ba90f10 --- /dev/null +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/transmissionPower15minHandler.ts @@ -0,0 +1,29 @@ +import { createExternal, IExternalTableState } from '../../../../framework/src/components/material-table/utilities'; +import { createSearchDataHandler } from '../../../../framework/src/utilities/elasticSearch'; + + +import { TransmissionPowerDataType, TransmissionPower, TransmissionPowerResult } from '../models/transmissionPowerDataType'; + +export interface ITransmissionPower15minState extends IExternalTableState { } + +/** + * Creates elastic search material data fetch handler for Transmission power from historicalperformance15min database. + */ +const transmissionPowerSearchHandler = createSearchDataHandler( + "sdnperformance/historicalperformance15min", + null, + (hit) => ({ + _id: hit._id, + ...hit._source, + ...hit._source["performance-data"] + }), + (name) => `${name}`); + +export const { + actionHandler: transmissionPower15minActionHandler, + createActions: createTransmissionPower15minActions, + createProperties: createTransmissionPower15minProperties, + createPreActions: createTransmissionPower15minPreActions, + reloadAction: transmissionPower15minReloadAction, +} = createExternal(transmissionPowerSearchHandler, appState => appState.performanceHistory.transmissionPower15min); + diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/transmissionPower15minHandler.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/transmissionPower15minHandler.tsx deleted file mode 100644 index e6ba90f10..000000000 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/transmissionPower15minHandler.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { createExternal, IExternalTableState } from '../../../../framework/src/components/material-table/utilities'; -import { createSearchDataHandler } from '../../../../framework/src/utilities/elasticSearch'; - - -import { TransmissionPowerDataType, TransmissionPower, TransmissionPowerResult } from '../models/transmissionPowerDataType'; - -export interface ITransmissionPower15minState extends IExternalTableState { } - -/** - * Creates elastic search material data fetch handler for Transmission power from historicalperformance15min database. - */ -const transmissionPowerSearchHandler = createSearchDataHandler( - "sdnperformance/historicalperformance15min", - null, - (hit) => ({ - _id: hit._id, - ...hit._source, - ...hit._source["performance-data"] - }), - (name) => `${name}`); - -export const { - actionHandler: transmissionPower15minActionHandler, - createActions: createTransmissionPower15minActions, - createProperties: createTransmissionPower15minProperties, - createPreActions: createTransmissionPower15minPreActions, - reloadAction: transmissionPower15minReloadAction, -} = createExternal(transmissionPowerSearchHandler, appState => appState.performanceHistory.transmissionPower15min); - diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/index.html b/sdnr/wt/odlux/apps/performanceHistoryApp/src/index.html index fce395d33..8cb775be2 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/index.html +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/index.html @@ -5,7 +5,7 @@ - + PM History Application @@ -15,7 +15,8 @@