added sensorItem

This commit is contained in:
snoop 2017-07-25 13:49:25 +09:00
parent 69bc212984
commit 36889f23fc

View File

@ -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<Props, State> {
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<Props, State> {
<Table celled>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Header</Table.HeaderCell>
<Table.HeaderCell>Header</Table.HeaderCell>
<Table.HeaderCell>Header</Table.HeaderCell>
<Table.HeaderCell>No.</Table.HeaderCell>
<Table.HeaderCell>Tyte</Table.HeaderCell>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>Key</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
First
</Table.Cell>
<Table.Cell>Cell</Table.Cell>
<Table.Cell>Cell</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Cell</Table.Cell>
<Table.Cell>Cell</Table.Cell>
<Table.Cell>Cell</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Cell</Table.Cell>
<Table.Cell>Cell</Table.Cell>
<Table.Cell>Cell</Table.Cell>
</Table.Row>
{
this.state.sensorItemList.map((sensorItem: SensorItem, idx: number) => {
return (
<Table.Row>
<Table.Cell>{idx}</Table.Cell>
<Table.Cell>{sensorItem.item.metaSensorItemType.name}</Table.Cell>
<Table.Cell>{sensorItem.item.name}</Table.Cell>
<Table.Cell>{sensorItem.item.key}</Table.Cell>
</Table.Row>
);
})
}
</Table.Body>
</Table>
@ -65,3 +65,131 @@ export class SensorItems extends React.Component<Props, State> {
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,
}];