aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx')
-rw-r--r--sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx80
1 files changed, 39 insertions, 41 deletions
diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx
index 8dc92b8ac..125cc6ee6 100644
--- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx
+++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/components/receiveLevel.tsx
@@ -15,37 +15,36 @@
* the License.
* ============LICENSE_END==========================================================================
*/
-import * as React from 'react';
+import React from 'react';
+import { RouteComponentProps, withRouter } from 'react-router-dom';
-import { withRouter, RouteComponentProps } from 'react-router-dom';
-
-import { MaterialTable, ColumnType, ColumnModel, MaterialTableCtorType } from '../../../../framework/src/components/material-table';
+import { ColumnModel, ColumnType, MaterialTable, MaterialTableCtorType } from '../../../../framework/src/components/material-table';
+import { connect, Connect, IDispatcher } from '../../../../framework/src/flux/connect';
import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
-import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect';
-import { ReceiveLevelDataType, ReceiveLevelDatabaseDataType } from '../models/receiveLevelDataType';
+import { SetFilterVisibility, SetSubViewAction } from '../actions/toggleActions';
+import { createReceiveLevelActions, createReceiveLevelProperties } from '../handlers/receiveLevelHandler';
import { IDataSet, IDataSetsObject } from '../models/chartTypes';
-import { createReceiveLevelProperties, createReceiveLevelActions } from '../handlers/receiveLevelHandler';
+import { ReceiveLevelDatabaseDataType, ReceiveLevelDataType } from '../models/receiveLevelDataType';
import { lineChart, sortDataByTimeStamp } from '../utils/chartUtils';
import { addColumnLabels } from '../utils/tableUtils';
-import { SetSubViewAction, SetFilterVisibility } from '../actions/toggleActions';
import ToggleContainer from './toggleContainer';
const mapProps = (state: IApplicationStoreState) => ({
receiveLevelProperties: createReceiveLevelProperties(state),
currentView: state.performanceHistory.subViews.receiveLevel.subView,
isFilterVisible: state.performanceHistory.subViews.receiveLevel.isFilterVisible,
- existingFilter: state.performanceHistory.receiveLevel.filter
+ existingFilter: state.performanceHistory.receiveLevel.filter,
});
const mapDisp = (dispatcher: IDispatcher) => ({
receiveLevelActions: createReceiveLevelActions(dispatcher.dispatch),
- setSubView: (value: "chart" | "table") => dispatcher.dispatch(new SetSubViewAction("receiveLevel", value)),
- toggleFilterButton: (value: boolean) => { dispatcher.dispatch(new SetFilterVisibility("receiveLevel", value)) },
+ setSubView: (value: 'chart' | 'table') => dispatcher.dispatch(new SetSubViewAction('receiveLevel', value)),
+ toggleFilterButton: (value: boolean) => { dispatcher.dispatch(new SetFilterVisibility('receiveLevel', value)); },
});
type ReceiveLevelComponentProps = RouteComponentProps & Connect<typeof mapProps, typeof mapDisp> & {
- selectedTimePeriod: string
+ selectedTimePeriod: string;
};
const ReceiveLevelTable = MaterialTable as MaterialTableCtorType<ReceiveLevelDataType>;
@@ -53,22 +52,21 @@ const ReceiveLevelTable = MaterialTable as MaterialTableCtorType<ReceiveLevelDat
/**
* The Component which gets the receiveLevel data from the database based on the selected time period.
*/
-class ReceiveLevelComponent extends React.Component<ReceiveLevelComponentProps>{
-
+class ReceiveLevelComponent extends React.Component<ReceiveLevelComponentProps> {
onToggleFilterButton = () => {
this.props.toggleFilterButton(!this.props.isFilterVisible);
- }
+ };
- onChange = (value: "chart" | "table") => {
+ onChange = (value: 'chart' | 'table') => {
this.props.setSubView(value);
- }
+ };
onFilterChanged = (property: string, filterTerm: string) => {
this.props.receiveLevelActions.onFilterChanged(property, filterTerm);
if (!this.props.receiveLevelProperties.showFilter)
this.props.receiveLevelActions.onToggleFilter(false);
- }
+ };
render(): JSX.Element {
const properties = this.props.receiveLevelProperties;
@@ -76,12 +74,12 @@ class ReceiveLevelComponent extends React.Component<ReceiveLevelComponentProps>{
const chartPagedData = this.getChartDataValues(properties.rows);
const receiveLevelColumns: ColumnModel<ReceiveLevelDataType>[] = [
- { property: "radioSignalId", title: "Radio signal", type: ColumnType.text },
- { property: "scannerId", title: "Scanner ID", type: ColumnType.text },
- { property: "timeStamp", title: "End Time", type: ColumnType.text },
+ { property: 'radioSignalId', title: 'Radio signal', type: ColumnType.text },
+ { property: 'scannerId', title: 'Scanner ID', type: ColumnType.text },
+ { property: 'timeStamp', title: 'End Time', type: ColumnType.text },
{
- property: "suspectIntervalFlag", title: "Suspect Interval", type: ColumnType.boolean
- }
+ property: 'suspectIntervalFlag', title: 'Suspect Interval', type: ColumnType.boolean,
+ },
];
chartPagedData.datasets.forEach(ds => {
@@ -92,64 +90,64 @@ class ReceiveLevelComponent extends React.Component<ReceiveLevelComponentProps>{
<>
<ToggleContainer onToggleFilterButton={this.onToggleFilterButton} showFilter={this.props.isFilterVisible} existingFilter={this.props.receiveLevelProperties.filter} onFilterChanged={this.onFilterChanged} selectedValue={this.props.currentView} onChange={this.onChange}>
{lineChart(chartPagedData)}
- <ReceiveLevelTable stickyHeader idProperty={"_id"} tableId="receive-level-table" columns={receiveLevelColumns} {...properties} {...actions} />
+ <ReceiveLevelTable stickyHeader idProperty={'_id'} tableId="receive-level-table" columns={receiveLevelColumns} {...properties} {...actions} />
</ToggleContainer>
</>
);
- };
+ }
/**
* 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 data_rows = [...rows];
+ sortDataByTimeStamp(data_rows);
const datasets: IDataSet[] = [{
- name: "rxLevelMin",
- label: "rx-level-min",
+ name: 'rxLevelMin',
+ label: 'rx-level-min',
borderColor: '#0e17f3de',
bezierCurve: false,
lineTension: 0,
fill: false,
data: [],
- columnLabel: "Rx min"
+ columnLabel: 'Rx min',
}, {
- name: "rxLevelAvg",
- label: "rx-level-avg",
+ name: 'rxLevelAvg',
+ label: 'rx-level-avg',
borderColor: '#08edb6de',
bezierCurve: false,
lineTension: 0,
fill: false,
data: [],
- columnLabel: "Rx avg"
+ columnLabel: 'Rx avg',
}, {
- name: "rxLevelMax",
- label: "rx-level-max",
+ name: 'rxLevelMax',
+ label: 'rx-level-max',
borderColor: '#b308edde',
bezierCurve: false,
lineTension: 0,
fill: false,
data: [],
- columnLabel: "Rx max"
+ columnLabel: 'Rx max',
}];
- _rows.forEach(row => {
+ data_rows.forEach(row => {
row.rxLevelMin = row.performanceData.rxLevelMin;
row.rxLevelAvg = row.performanceData.rxLevelAvg;
row.rxLevelMax = row.performanceData.rxLevelMax;
datasets.forEach(ds => {
ds.data.push({
- x: row["timeStamp" as keyof ReceiveLevelDataType] as string,
- y: row.performanceData[ds.name as keyof ReceiveLevelDatabaseDataType] as string
+ x: row['timeStamp' as keyof ReceiveLevelDataType] as string,
+ y: row.performanceData[ds.name as keyof ReceiveLevelDatabaseDataType] as string,
});
});
});
return {
- datasets: datasets
+ datasets: datasets,
};
- }
+ };
}
const ReceiveLevel = withRouter(connect(mapProps, mapDisp)(ReceiveLevelComponent));