From 6d1597672b9a6f3a3d020a5e5fb452f986ee6f5e Mon Sep 17 00:00:00 2001 From: snoop Date: Mon, 15 Jan 2018 19:32:30 +0900 Subject: [PATCH] fixed sensor config --- .../components/sensor_config_setting.tsx | 102 +++++++++++++----- 1 file changed, 76 insertions(+), 26 deletions(-) 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 15ab60c..cace4f3 100644 --- a/src/ts/@overflow/sensor/react/components/sensor_config_setting.tsx +++ b/src/ts/@overflow/sensor/react/components/sensor_config_setting.tsx @@ -2,11 +2,12 @@ import * as React from 'react'; import { Table, Header, Container, Form, Checkbox, Button, Rating, List, Icon, Radio, CheckboxProps, InputOnChangeData, Input, - Grid, + Grid, Segment, ButtonProps, } from 'semantic-ui-react'; import { Infra } from '@overflow/infra/api/model/Infra'; import { InfraHost } from '@overflow/infra/api/model/InfraHost'; +import * as _ from 'lodash'; import * as Utils from '@overflow/commons/util/Utils'; export interface StateProps { @@ -291,6 +292,7 @@ export type SensorItemInfoProps = SensorItemInfoStateProps & SensorItemInfoDispa export interface SensorItemInfoState { testSensorItemList: Array; + notiState: Map; } export class SensorConfigSettingSensorItemInfo extends React.Component { @@ -300,6 +302,7 @@ export class SensorConfigSettingSensorItemInfo extends React.Component = _.clone(this.state.notiState); + + newNotiStateMap[idx] = newNotiStateMap[idx] === undefined ? true : !newNotiStateMap[idx]; + + this.setState({ notiState: newNotiStateMap }); + } + + public renderAddNoitiInfo(idx: number): JSX.Element { + + if (this.state.notiState[idx]) { + + return ( + + + +
+ + + + + + + +
+
+
+
+ ); + } + + return null; + } + public renderSensorItem(): JSX.Element[] { let elems: Array = new Array(); @@ -320,27 +357,42 @@ export class SensorConfigSettingSensorItemInfo extends React.Component { elems.push( - - - {data.key} ({data.unit}) - - - {data.realKey} - - - [Add Notification] - - , - - - - - - - - - , + + + {data.key} ({data.unit}) + + + {data.realKey} + + + + {this.state.notiState[idx] ? + +