diff --git a/src/ts/containers/test/Components.tsx b/src/ts/containers/test/Components.tsx new file mode 100644 index 0000000..19d082e --- /dev/null +++ b/src/ts/containers/test/Components.tsx @@ -0,0 +1,67 @@ +import * as React from 'react'; +import { Button } from 'semantic-ui-react'; +import { Probes } from './Probes'; +import { NoauthProbes } from './NoauthProbes'; +import { SensorConfiguration } from './SensorConfiguration'; +import Tab, { TabProps } from 'semantic-ui-react/dist/commonjs/modules/Tab'; + +const panes = [ + { menuItem: 'Tab 1', render: () => Tab 1 Content }, + { menuItem: 'Tab 2', render: () => Tab 2 Content }, + { menuItem: 'Tab 3', render: () => Tab 3 Content }, +]; + + +export class Components extends React.Component { + + constructor(props: any, context: any) { + super(props, context); + this.state = { + no: 0, + }; + } + + handleButton(n: number): void { + this.setState({ + no: n, + }); + } + + showContent() { + switch(this.state.no) { + case 0: { + return ; + } + case 1: { + return ; + } + case 2: { + return ; + } + default: { + + } + } + } + + render() { + + return ( +
+ {/**/} + + + + + + +
+ {this.showContent()} +
+
+ ); + } +} + + + diff --git a/src/ts/containers/test/NoauthProbes.tsx b/src/ts/containers/test/NoauthProbes.tsx new file mode 100644 index 0000000..2ebb02b --- /dev/null +++ b/src/ts/containers/test/NoauthProbes.tsx @@ -0,0 +1,141 @@ +import * as React from 'react'; +import { Table, Checkbox, Button } from 'semantic-ui-react'; + + +export class NoauthProbes extends React.Component { + + private data: any; + private selectedIds: Array; + + constructor(props: any, context: any) { + super(props, context); + this.state = { + selected: [], + }; + this.selectedIds = new Array(); + } + + + componentWillMount() { + this.data = [ + { + "id": "11", + "MetaNoAuthProbeStatus": { + "name": "NORMAL" + }, + "hostName": "insanity's windows", + "macAddress": "14:fe:b5:9d:54:7e", + "ipAddress": "192.168.1.105", + "tempProbeKey": "45374d4egsdfw332", + "apiKey": "45374d4egsdfw332", + "domain": { + + }, + "probe": { + + }, + }, + { + "id": "22", + "MetaNoAuthProbeStatus": { + "name": "NORMAL" + }, + "hostName": "insanity's ubuntu", + "macAddress": "14:fe:b5:9d:54:7e", + "ipAddress": "192.168.1.105", + "tempProbeKey": "45374d4egsdfw332", + "apiKey": "45374d4egsdfw332", + "domain": { + + }, + "probe": { + + }, + }, + ]; + } + + handleSelect(id: string) { + let idx = this.selectedIds.indexOf(id); + if (idx === -1) { + this.selectedIds.push(id); + } else { + this.selectedIds.splice(idx, 1); + } + this.setState({ + selected: this.selectedIds, + }); + } + + checkExist(id: string): boolean { + if (this.state.selected.indexOf(id) === -1) { + return false; + } + return true; + } + + handleAccept() { + alert(this.state.selected); + } + + handleDeny() { + alert(this.state.selected); + } + + handleRowActive(id: string):boolean { + if (this.state.selected.indexOf(id) === -1) { + return false; + } + return true; + } + + render() { + + return ( +
+ + + + + No. + Host IP + Host Mac + Host Name + Created At + API Key + + + + + {this.data.map((probe: any, index: number) => ( + + + + + {index + 1} + {probe.ipAddress} + {probe.macAddress} + {probe.hostName} + + {probe.apiKey} + + ))} + + + + + + + + + + + +
+
+ ); + } +} + + + diff --git a/src/ts/containers/test/ProbeDetails.tsx b/src/ts/containers/test/ProbeDetails.tsx new file mode 100644 index 0000000..e4171b1 --- /dev/null +++ b/src/ts/containers/test/ProbeDetails.tsx @@ -0,0 +1,100 @@ +import * as React from 'react'; +import { Button, Table, Label } from 'semantic-ui-react'; +import { Targets } from './Targets'; + +export class ProbeDetails extends React.Component { + + constructor(props: any, context: any) { + super(props, context); + this.state = { + }; + } + + componentWillMount() { + + } + + handleStartStop(event: any, data: any) { + console.log(event); + } + handleDiscovery(event: any, data: any) { + alert('Discovery'); + } + + handleBack(event: any, data: any) { + console.log(data); + } + + + showStartStopBtn() { + if (this.props.probe.metaProbeStatus.name === 'STARTED') { + return + + + + + + ); + } +} + + +export class CrawlerSelector extends React.Component { + + private crawlers: object[]; + + constructor(props: any, context: any) { + super(props, context); + this.state = { + selected: null, + }; + } + + componentWillMount() { + //todo. getting MetaCrawler list + this.crawlers = [ + { + "id": "1", + "name": "WMI", + "description": "WMI DESCRIPTION" + }, + { + "id": "2", + "name": "SNMP", + "description": "SNMP DESCRIPTION" + }, + { + "id": "3", + "name": "JMX", + "description": "JMX DESCRIPTION" + }, + ]; + + let crawlerOptions = []; + let crawler: any; + for (crawler of this.crawlers) { + var option = { + key: crawler.id, + text: crawler.name, + value: crawler.name, + icon: 'windows', + }; + } + + } + + handleCrawlerSelection(e: any, data: any) { + this.setState({ + selected: data.value, + }); + } + + showCrawlerAuthInfo() { + if (this.state.selected === null) { + return null; + } + return
{this.state.selected} auth inputs
; + } + + render() { + + return ( +
+ + + + + Choose a Crawler type. +
+
+ + + {this.showCrawlerAuthInfo()} +
+
+
+ +
+ ); + } + +} + +export class SensorItemSelector extends React.Component { + + constructor(props: any, context: any) { + super(props, context); + this.state = { + }; + } + + render() { + return ( +
SensorItemSelector
+ ); + } + +} diff --git a/src/ts/containers/test/Targets.tsx b/src/ts/containers/test/Targets.tsx new file mode 100644 index 0000000..0f5e183 --- /dev/null +++ b/src/ts/containers/test/Targets.tsx @@ -0,0 +1,87 @@ +import * as React from 'react'; +import { Table } from 'semantic-ui-react'; + +export class Targets extends React.Component { + private data: any; + + constructor(props: any, context: any) { + super(props, context); + this.state = { + selected: null, + }; + } + handleSelect(selectedTarget: object) { + this.setState({ + selected: selectedTarget, + }); + } + + componentWillMount() { + this.data = [ + { + "id": "1", + "createDate": "", + "probe": { + "id": "1", + }, + "infra": { + "id": "1", + "metaInfraType": { + "id": "1", + "name": "OS", + "createDate": "424252" + }, + "childId": "1", + "createDate": "13345235" + }, + }, + { + "id": "2", + "createDate": "", + "probe": { + "id": "1", + }, + "infra": { + "id": "1", + "metaInfraType": { + "id": "1", + "name": "OS", + "createDate": "424252" + }, + "childId": "1", + "createDate": "13345235" + }, + }, + ]; + } + + render() { + + return ( + + + + No. + Type + Name + Created At + + + + + {this.data.map((target: any, index: number) => ( + + {index + 1} + {target.infra.metaInfraType.name} + {target.childId} + {target.createDate} + + ))} + +
+ ); + } +} + + +