diff --git a/src/ts/@overflow/history/react/components/HistoryList.tsx b/src/ts/@overflow/history/react/components/HistoryList.tsx index a9edbcd..d1afa4d 100644 --- a/src/ts/@overflow/history/react/components/HistoryList.tsx +++ b/src/ts/@overflow/history/react/components/HistoryList.tsx @@ -116,7 +116,7 @@ export class HistoryList extends React.Component { return metaType; } - public handlePaging = (pageNo: number) => { + private handlePaging = (pageNo: number) => { let probe: Probe = { id: Number(1), }; diff --git a/src/ts/@overflow/sensor/react/SensorList.tsx b/src/ts/@overflow/sensor/react/SensorList.tsx index 9d8e619..cfc0b10 100644 --- a/src/ts/@overflow/sensor/react/SensorList.tsx +++ b/src/ts/@overflow/sensor/react/SensorList.tsx @@ -7,8 +7,6 @@ import { DispatchProps as SensorListDispatchProps, } from './components/SensorList'; import State from '../redux/state/ReadAllByTarget'; - - import * as ReadAllByTargetActions from '../redux/action/read_all_by_target'; import * as ReadAllByProbeActions from '../redux/action/read_all_by_probe'; import * as ReadAllByDomainActions from '../redux/action/read_all_by_domain'; @@ -18,30 +16,30 @@ import Sensor from '@overflow/sensor/api/model/Sensor'; import Probe from '@overflow/probe/api/model/Probe'; import Domain from '@overflow/domain/api/model/Domain'; import Infra from '@overflow/infra/api/model/Infra'; +import PageParams from '@overflow/commons/api/model/PageParams'; import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest'; export function mapStateToProps(state: any, props: any): SensorListStateProps { return { - sensorList:state.SensorList, + sensorList: state.SensorList, infraId: props.params.id, }; } export function mapDispatchToProps(dispatch: Dispatch): SensorListDispatchProps { return { - onReadAllByTarget: (target: Target) => { - dispatch(asyncRequestActions.request('SensorService', 'readAllByTarget', ReadAllByTargetActions.REQUEST, JSON.stringify(target))); + onReadAllByInfra: (infraId: number, pageParams: PageParams) => { + dispatch(asyncRequestActions.request('SensorService', 'readAllByInfra', + ReadAllByInfraActions.REQUEST, infraId, JSON.stringify(pageParams))); }, - onReadAllByInfra: (infraId: number) => { - dispatch(asyncRequestActions.request('SensorService', 'readAllByInfra', ReadAllByInfraActions.REQUEST, infraId)); + onReadAllByDomain: (domain: Domain, pageParams: PageParams) => { + dispatch(asyncRequestActions.request('SensorService', 'readAllByDomain', + ReadAllByDomainActions.REQUEST, JSON.stringify(domain), JSON.stringify(pageParams))); }, onReadAllByProbe: (probe: Probe) => { dispatch(ReadAllByProbeActions.request(probe)); }, - onReadAllByDomain: (domain: Domain) => { - dispatch(asyncRequestActions.request('SensorService', 'readAllByDomain', ReadAllByDomainActions.REQUEST, JSON.stringify(domain))); - }, onSelectSensor: (id: number) => { dispatch(routerPush('/sensor/' + String(id))); }, diff --git a/src/ts/@overflow/sensor/react/components/SensorList.tsx b/src/ts/@overflow/sensor/react/components/SensorList.tsx index e70eee7..cc74cb3 100644 --- a/src/ts/@overflow/sensor/react/components/SensorList.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorList.tsx @@ -7,21 +7,25 @@ import Sensor from '@overflow/sensor/api/model/Sensor'; import Target from '@overflow/target/api/model/Target'; import Domain from '@overflow/domain/api/model/Domain'; import Infra from '@overflow/infra/api/model/Infra'; +import PageParams from '@overflow/commons/api/model/PageParams'; +import Page from '@overflow/commons/api/model/Page'; +import { Pager } from '@overflow/commons/react/component/Pager'; +import { SortTableHeaderRow } from '@overflow/commons/react/component/SortTableHeaderRow'; + export interface StateProps { probe?: Probe; target?: Target; - sensorList?: Sensor[]; + sensorList?: Page; infraId?: number; } export interface DispatchProps { - onReadAllByTarget?(target: Target): void; + onReadAllByDomain?(domain: Domain, pageParams: PageParams): void; + onReadAllByInfra?(infraId: number, pageParams: PageParams): void; onReadAllByProbe?(probe: Probe): void; - onReadAllByDomain?(domain: Domain): void; onSelectSensor?(id: number): void; onAddSensor?(infraId: string): void; - onReadAllByInfra?(infraId: number): void; } export type SensorListProps = StateProps & DispatchProps; @@ -33,7 +37,10 @@ export interface SensorListState { export class SensorList extends React.Component { - // private data: any; + private countPerPage: number = 10; + private sortCol: string = 'id'; + private sortDirection: string = 'descending'; + private pageNo: number = 0; constructor(props: SensorListProps, context: SensorListState) { super(props, context); @@ -43,16 +50,24 @@ export class SensorList extends React.Component = new Map(); + colsmap.set('No.', 'id'); + colsmap.set('Status', 'status.name'); + colsmap.set('Crawler', 'crawler.name'); + colsmap.set('Description', 'description'); + colsmap.set('Item count', 'itemCount'); + let sensorList: JSX.Element = ( - +
- + + {/* No. Status Crawler Description Item count - + */} - {this.props.sensorList ? this.props.sensorList.map((sensor: Sensor, index: number) => ( + {this.props.sensorList ? this.props.sensorList.content.map((sensor: Sensor, index: number) => ( {index + 1} @@ -114,6 +137,13 @@ export class SensorList extends React.Component )) : ''} + + + + + + +