From 2032c8104c60f45531947a0187421a66b54cfc35 Mon Sep 17 00:00:00 2001 From: snoop Date: Tue, 9 Jan 2018 19:30:09 +0900 Subject: [PATCH] sensor config fix --- src/ts/@overflow/infra/api/model/InfraHost.ts | 2 +- .../components/sensor_config_setting.tsx | 124 +++++++++++++++++- 2 files changed, 118 insertions(+), 8 deletions(-) diff --git a/src/ts/@overflow/infra/api/model/InfraHost.ts b/src/ts/@overflow/infra/api/model/InfraHost.ts index aab7e9c..54a39ba 100644 --- a/src/ts/@overflow/infra/api/model/InfraHost.ts +++ b/src/ts/@overflow/infra/api/model/InfraHost.ts @@ -1,7 +1,7 @@ import InfraOS from './InfraOS'; import Infra from './Infra'; -interface InfraHost extends Infra { +export interface InfraHost extends Infra { // id?: number; os?: InfraOS; ip?: number; diff --git a/src/ts/@overflow/sensor/react/components/sensor_config_setting.tsx b/src/ts/@overflow/sensor/react/components/sensor_config_setting.tsx index 84ebb34..15ab60c 100644 --- a/src/ts/@overflow/sensor/react/components/sensor_config_setting.tsx +++ b/src/ts/@overflow/sensor/react/components/sensor_config_setting.tsx @@ -4,9 +4,10 @@ import { List, Icon, Radio, CheckboxProps, InputOnChangeData, Input, Grid, } from 'semantic-ui-react'; -import {Infra} from '@overflow/infra/api/model/Infra'; - +import { Infra } from '@overflow/infra/api/model/Infra'; +import { InfraHost } from '@overflow/infra/api/model/InfraHost'; +import * as Utils from '@overflow/commons/util/Utils'; export interface StateProps { } @@ -160,7 +161,7 @@ export class SensorConfigSettingTargetInfo extends React.Component = this.state.testInfraList; - if(infraList === undefined || infraList.length <= 0) { + if (infraList === undefined || infraList.length <= 0) { return null; } @@ -168,7 +169,14 @@ export class SensorConfigSettingTargetInfo extends React.Component { - console.log(''); + if (infra.infraType.name === 'HOST') { + elems.push( + , + ); + } else if (infra.infraType.name === 'OS_SERVICE') { + // elems.push( + // ); + } }); return elems; @@ -186,6 +194,7 @@ export class SensorConfigSettingTargetInfo extends React.Component = new Array(); + + elems.push( + + + + +
os vendor
+
+ + {ih.os.vendor.name} + +
+ + +
meta info
+
+ + {ih.os.meta} + +
+ + +
IP
+
+ + {Utils.int2ip(ih.ip)} + +
+ + +
mac
+
+ + {Utils.intToMac(ih.mac)} + +
+
+
, + ); + + return elems; + } + public render(): JSX.Element { return ( + {this.renderInfraHost()} ); } @@ -228,7 +290,7 @@ export interface SensorItemInfoDispatchProps { export type SensorItemInfoProps = SensorItemInfoStateProps & SensorItemInfoDispatchProps; export interface SensorItemInfoState { - + testSensorItemList: Array; } export class SensorConfigSettingSensorItemInfo extends React.Component { @@ -237,13 +299,61 @@ export class SensorConfigSettingSensorItemInfo extends React.Component = new Array(); + + + this.state.testSensorItemList.map((data: any, idx: number) => { + elems.push( + + + {data.key} ({data.unit}) + + + {data.realKey} + + + [Add Notification] + + , + + + + + + + + + , + ); + }); + + return elems; } public render(): JSX.Element { return ( + + + {this.renderSensorItem()} + +
); } @@ -824,4 +934,4 @@ const testInfraDataList: any[] = [ 'ip': 3232235980, 'mac': 8796753988883, }, - ]; +];