From 36889f23fcf2f98758a93ed88851ef0757ef44e4 Mon Sep 17 00:00:00 2001 From: snoop Date: Tue, 25 Jul 2017 13:49:25 +0900 Subject: [PATCH] added sensorItem --- .../sensor/react/components/SensorItems.tsx | 170 +++++++++++++++--- 1 file changed, 149 insertions(+), 21 deletions(-) diff --git a/src/ts/@overflow/sensor/react/components/SensorItems.tsx b/src/ts/@overflow/sensor/react/components/SensorItems.tsx index bb375f3..3a7d2e4 100644 --- a/src/ts/@overflow/sensor/react/components/SensorItems.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorItems.tsx @@ -2,13 +2,14 @@ import * as React from 'react'; import { Table, Button, Header, Container } from 'semantic-ui-react'; import Sensor from '@overflow/sensor/api/model/Sensor'; +import SensorItem from '@overflow/sensor/api/model/SensorItem'; export interface Props { sensor?: Sensor; } export interface State { - + sensorItemList: SensorItem[]; } @@ -17,7 +18,10 @@ export class SensorItems extends React.Component { constructor(props: Props, context: State) { super(props, context); this.state = { + sensorItemList: SensorItemJson, }; + + } public componentWillMount(): void { @@ -31,30 +35,26 @@ export class SensorItems extends React.Component { - Header - Header - Header + No. + Tyte + Name + Key - - - First - - Cell - Cell - - - Cell - Cell - Cell - - - Cell - Cell - Cell - + { + this.state.sensorItemList.map((sensorItem: SensorItem, idx: number) => { + return ( + + {idx} + {sensorItem.item.metaSensorItemType.name} + {sensorItem.item.name} + {sensorItem.item.key} + + ); + }) + }
@@ -65,3 +65,131 @@ export class SensorItems extends React.Component { +const SensorItemJson: any = [{ + 'id': 1, + 'sensor': { + 'id': 1, + 'createDate': 1498475947009, + 'description': 'My sensor', + 'status': { + 'id': 1, + 'name': 'RUNNING', + }, + 'target': { + 'id': 1, + 'createDate': 1498448242854, + 'probe': { + 'id': 1, + 'status': { + 'id': 1, + 'name': 'INITIAL', + }, + 'description': 'snoop probe', + 'createDate': 1498448699813, + 'lastPollingDate': null, + 'nextPollingDate': null, + 'domain': { + 'id': 1, + 'name': 'overFlow\'s domain', + 'createDate': 1498443944866, + }, + 'probeKey': 'a1e1710557de11e78799080027658d13', + 'encryptionKey': '9c8d41ab57de11e7a2c9080027658d13', + }, + 'infra': { + 'id': 1, + 'type': { + 'id': 1, + 'name': 'MACHINE', + 'createDate': 1498379502770, + }, + 'childId': 0, + 'createDate': 1498446731809, + }, + }, + 'crawler': { + 'id': 1, + 'createDate': 1498794968791, + 'name': 'ACTIVEDIRECTORY_CRAWLER', + 'description': 'ACTIVEDIRECTORY', + }, + 'crawlerInputItems': null, + }, + 'item': { + 'id': 1, + 'metaSensorItemType': { + 'id': 1, + 'name': 'CPU', + 'description': 'CPU blah blah blah', + 'createDate': 1498474179690, + }, + 'key': 'cpu.usage', + 'name': 'CPU USAGE', + 'createDate': 1498475408269, + }, + 'createDate': 1498476076626, +}, +{ + 'id': 2, + 'sensor': { + 'id': 1, + 'createDate': 1498475947009, + 'description': 'My sensor', + 'status': { + 'id': 1, + 'name': 'RUNNING', + }, + 'target': { + 'id': 1, + 'createDate': 1498448242854, + 'probe': { + 'id': 1, + 'status': { + 'id': 1, + 'name': 'INITIAL', + }, + 'description': 'snoop probe', + 'createDate': 1498448699813, + 'lastPollingDate': null, + 'nextPollingDate': null, + 'domain': { + 'id': 1, + 'name': 'overFlow\'s domain', + 'createDate': 1498443944866, + }, + 'probeKey': 'a1e1710557de11e78799080027658d13', + 'encryptionKey': '9c8d41ab57de11e7a2c9080027658d13', + }, + 'infra': { + 'id': 1, + 'type': { + 'id': 1, + 'name': 'MACHINE', + 'createDate': 1498379502770, + }, + 'childId': 0, + 'createDate': 1498446731809, + }, + }, + 'crawler': { + 'id': 1, + 'createDate': 1498794968791, + 'name': 'ACTIVEDIRECTORY_CRAWLER', + 'description': 'ACTIVEDIRECTORY', + }, + 'crawlerInputItems': null, + }, + 'item': { + 'id': 2, + 'metaSensorItemType': { + 'id': 1, + 'name': 'CPU', + 'description': 'CPU blah blah blah', + 'createDate': 1498474179690, + }, + 'key': 'cpu.free', + 'name': 'CPU FREE', + 'createDate': 1498475408361, + }, + 'createDate': 1498476110988, +}];