diff --git a/src/ts/Routes.tsx b/src/ts/Routes.tsx index 06fb75e..4ff8b6e 100644 --- a/src/ts/Routes.tsx +++ b/src/ts/Routes.tsx @@ -12,6 +12,8 @@ import { SensorConfig } from './containers/config/SensorConfig'; import { WaitForAuth } from './containers/agent/WaitForAuth'; import { MemberRegistResult } from './containers/member/RegistResult'; import { MemberEmailConfirm } from './containers/member/EmailConfirm'; +import { Agents } from './containers/agent/Agents'; +import { AgentDetail } from './containers/agent/AgentDetail'; export class Routes extends React.Component { render() { @@ -29,6 +31,8 @@ export class Routes extends React.Component {
  • SensorConfig
  • ProveDownload
  • +
  • Agents
  • +
  • AgentDetail
  • @@ -40,6 +44,9 @@ export class Routes extends React.Component { + + + diff --git a/src/ts/components/Rest.tsx b/src/ts/components/Rest.tsx index 9839101..0f65333 100644 --- a/src/ts/components/Rest.tsx +++ b/src/ts/components/Rest.tsx @@ -31,4 +31,5 @@ export class OFRest { }) } -} \ No newline at end of file +} + diff --git a/src/ts/containers/agent/AgentDetail.tsx b/src/ts/containers/agent/AgentDetail.tsx new file mode 100644 index 0000000..2434d56 --- /dev/null +++ b/src/ts/containers/agent/AgentDetail.tsx @@ -0,0 +1,156 @@ +import * as React from 'react'; +import { + Table, + TableBody, + TableHeader, + TableHeaderColumn, + TableFooter, + TableRow, + TableRowColumn, +} from 'material-ui/Table'; +import { Link, Route, Redirect } from 'react-router-dom'; +import Divider from 'material-ui/Divider'; +import { TargetSelector } from '../config/TargetSelector'; +import FloatingActionButton from 'material-ui/FloatingActionButton'; +import ContentAdd from 'material-ui/svg-icons/content/add'; +import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; +import { Tabs, Tab } from 'material-ui/Tabs'; +import TextField from 'material-ui/TextField'; +import SelectField from 'material-ui/SelectField'; +import MenuItem from 'material-ui/MenuItem'; + + +const styles = { + headline: { + fontSize: 24, + paddingTop: 16, + marginBottom: 12, + fontWeight: 400, + }, +} + +export class AgentDetail extends React.Component { + constructor(props: any, context: any) { + super(props, context) + this.state = { + targetAddOpen: false, + targetAddType: 'host', + hostToAdd : '', + appToAdd: 1, + addType : 'host' + } + + }; + + handleAddTarget = () => { + this.setState({ + targetAddOpen: true + }) + } + handleAddTargetPopupCancle = () => { + this.setState({ targetAddOpen: false }); + }; + + handleRowSelected = (selectedRows: number[] | string) => { + console.log(selectedRows); + } + + handleTargetTypeChange = (value: any) => { + this.setState({ + addType: value, + }); + }; + + handleAddTargetSubmit = (event: any) => { + if (this.state.addType == "host") { + alert(this.state.hostToAdd); + }else if (this.state.addType == "application") { + alert(this.state.appToAdd); + } + this.setState({targetAddOpen: false}) + }; + + handleIPChange = (event: any) => { + this.setState({ + hostToAdd : event.target.value + }) + }; + + handleApplicationChange = (event:any, index:any, value:any) => { + this.setState({ + appToAdd : value + }) + }; + + render() { + + const actions = [ + , + , + ]; + + return ( + +
    +
    + prove description area +
    + + +
    + + + +
    + +
    + discovery result + target area +
    + + + + + +
    +
    +
    +
    + +
    + + + + +
    +
    +
    + +
    > +
    + + ); + } + + +} \ No newline at end of file diff --git a/src/ts/containers/agent/Agents.tsx b/src/ts/containers/agent/Agents.tsx new file mode 100644 index 0000000..6784003 --- /dev/null +++ b/src/ts/containers/agent/Agents.tsx @@ -0,0 +1,134 @@ +import * as React from 'react'; +import { + Table, + TableBody, + TableHeader, + TableHeaderColumn, + TableFooter, + TableRow, + TableRowColumn, +} from 'material-ui/Table'; +import { Link, Route, Redirect } from 'react-router-dom'; +import { OFRest } from '../../components/Rest'; + +const styles = { + propContainer: { + width: 200, + overflow: 'hidden', + margin: '20px auto 0', + }, + propToggleHeader: { + margin: '20px auto 10px', + }, +}; + +const tableData = [ + { + agentId: '111', + desc: 'Agent 1', + status: 'Wait For Auth', + }, + { + agentId: 'wqekoekeeeeerw', + desc: 'Agent 2', + status: 'Wait For Auth', + }, + { + agentId: 'wqekoekeeeeerw', + desc: 'Agent 3', + status: 'Wait For Auth', + }, + { + agentId: 'wqekoekeeeeerw', + desc: 'Agent 4', + status: 'Wait For Auth', + }, + { + agentId: 'wqekoekeeeeerw', + desc: 'Agent 5', + status: 'Wait For Auth', + }, + { + agentId: 'wqekoekeeeeerw', + desc: 'Agent 6', + status: 'Wait For Auth', + }, + { + agentId: 'wqekoekeeeeerw', + desc: 'Agent 7', + status: 'Wait For Auth', + }, +]; + +export class Agents extends React.Component { + constructor(props: any, context: any) { + super(props, context) + this.state = { + agents: [] + }; + this.getAgents(); + }; + + getAgents = () => { + let output: string; + let obj: any; //new object declaration + obj = { + "phone": this.state.phone + }; + + let os: OFRest = new OFRest("Agent", "Regist", obj); + + os.Call().then(function (res) { + return res.json(); + }).then(function (json) { + console.log(json); + }).catch(function (err) { + console.log(err); + }); + } + + + handleRowSelected = (selectedRows: number[] | string) => { + this.props.history.push('/agent/agentDetail'); + } + + render() { + + return ( + +
    + + + + Agent Id + Description + Status + + + + {tableData.map((row: any, index: number) => ( + + {row.agentId} + {row.desc} + {row.status} + + ))}; + + +
    +
    + + ); + } + + +} \ No newline at end of file diff --git a/src/ts/containers/agent/WaitForAuth.tsx b/src/ts/containers/agent/WaitForAuth.tsx index d6af48e..fc63bb9 100644 --- a/src/ts/containers/agent/WaitForAuth.tsx +++ b/src/ts/containers/agent/WaitForAuth.tsx @@ -12,6 +12,7 @@ import { import Toggle from 'material-ui/Toggle'; import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; +import { OFRest } from '../../components/Rest'; const styles = { propContainer: { @@ -65,7 +66,7 @@ const tableData = [ export class WaitForAuth extends React.Component { constructor(props: any, context: any) { super(props, context) - + this.getList(); }; state = { @@ -79,6 +80,24 @@ export class WaitForAuth extends React.Component { sselectedRows: number[] | string; + getList = () => { + let output: string; + let obj: any; //new object declaration + obj = { + "authStatus": "ACCEPT" + }; + + let os: OFRest = new OFRest("NoauthAgent", "GetNoAuthList", obj); + + os.Call().then(function (res) { + return res.json(); + }).then(function (json) { + console.log(json); + }).catch(function (err) { + console.log(err); + }); + }; + // handleCellClick = (e: any, idx: number) => { // console.log(e) // } @@ -117,68 +136,68 @@ export class WaitForAuth extends React.Component { />, ] return ( - -
    - - - - - Super Header + +
    +
    + + + + Super Header + + + API Key + Name + Status + + + + {tableData.map((row: any, index: number) => ( + + {row.apiKey} + {row.name} + {row.status} - - API Key - Name - Status - - - - {tableData.map((row: any, index: number) => ( - - {row.apiKey} - {row.name} - {row.status} - - ))}; + ))}; - - < Dialog - title="Dialog With Actions" - actions={actions} - modal={true} - open={this.state.open} > - 선택한 Agent를 인증하시겠습니까? + + < Dialog + title="Dialog With Actions" + actions={actions} + modal={true} + open={this.state.open} > + 선택한 Agent를 인증하시겠습니까? - -
    - - -
    - + + + + + + ); } - + } \ No newline at end of file diff --git a/src/ts/containers/config/SensorConfig.tsx b/src/ts/containers/config/SensorConfig.tsx index 5e3fd0f..c63c1b1 100644 --- a/src/ts/containers/config/SensorConfig.tsx +++ b/src/ts/containers/config/SensorConfig.tsx @@ -10,7 +10,6 @@ import FlatButton from 'material-ui/FlatButton'; import { TargetSelector } from './TargetSelector'; import { CrawlerSelector } from './CrawlerSelector'; import { ItemSelector } from './ItemSelector'; -import Dialog from 'material-ui/Dialog'; export class SensorConfig extends React.Component {