From 16f89e544c63f7dd5223e9cf2cabcfeca4b251fb Mon Sep 17 00:00:00 2001 From: insanity Date: Mon, 10 Jul 2017 20:52:39 +0900 Subject: [PATCH] . --- src/ts/containers/test/Components.tsx | 7 +- .../containers/test/SensorConfiguration.tsx | 152 +++++++++++++++--- src/ts/containers/test/TargetDetails.tsx | 22 +++ 3 files changed, 158 insertions(+), 23 deletions(-) create mode 100644 src/ts/containers/test/TargetDetails.tsx diff --git a/src/ts/containers/test/Components.tsx b/src/ts/containers/test/Components.tsx index 19d082e..2ed62ea 100644 --- a/src/ts/containers/test/Components.tsx +++ b/src/ts/containers/test/Components.tsx @@ -3,6 +3,8 @@ import { Button } from 'semantic-ui-react'; import { Probes } from './Probes'; import { NoauthProbes } from './NoauthProbes'; import { SensorConfiguration } from './SensorConfiguration'; +import { Targets } from './Targets'; + import Tab, { TabProps } from 'semantic-ui-react/dist/commonjs/modules/Tab'; const panes = [ @@ -38,8 +40,10 @@ export class Components extends React.Component { case 2: { return ; } + case 3: { + return ; + } default: { - } } } @@ -54,6 +58,7 @@ export class Components extends React.Component { +
{this.showContent()} diff --git a/src/ts/containers/test/SensorConfiguration.tsx b/src/ts/containers/test/SensorConfiguration.tsx index 9ad0eb5..29af4e7 100644 --- a/src/ts/containers/test/SensorConfiguration.tsx +++ b/src/ts/containers/test/SensorConfiguration.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Icon, Step, Button } from 'semantic-ui-react'; +import { Icon, Step, Button, Table, Radio, Form } from 'semantic-ui-react'; import { Grid, Image, Label, Segment, Dropdown } from 'semantic-ui-react'; @@ -13,16 +13,16 @@ export class SensorConfiguration extends React.Component { render() { - let steps = [, ]; + let steps = [, , ]; return ( - + ); } } -export class Stepper extends React.Component { +export class ConfigStepper extends React.Component { constructor(props: any, context: any) { super(props, context); @@ -45,7 +45,7 @@ export class Stepper extends React.Component { return false; } - handlePrev(event: any, data: object) { + handlePrev(event: React.SyntheticEvent, data: object) { let step: number = this.state.currentStep; if (step <= 1) { step = 1; @@ -56,23 +56,41 @@ export class Stepper extends React.Component { currentStep: step, }); } - handleNext(event: any, data: object) { + handleNext(event: React.SyntheticEvent, data: object) { let step: number = this.state.currentStep; - if (step >= 4) { - step = 4; + if (step >= this.props.steps.length + 1) { + step = this.props.steps.length + 1; } else { step++; } this.setState({ currentStep: step, }); - console.log(this.state.currentStep); + if (step === this.props.steps.length + 1) { + console.log("Done"); + } } showContent() { return this.props.steps[this.state.currentStep - 1]; } + checkPrevDisabled(): boolean { + if (this.state.currentStep <= 1) { + return true; + } else { + return false; + } + } + + checkNextDisabled(): boolean { + if (this.state.currentStep === this.props.steps.length + 1) { + return true; + } else { + return false; + } + } + render() { return (
@@ -96,9 +114,9 @@ export class Stepper extends React.Component { {this.showContent()}
- + - +
@@ -110,7 +128,7 @@ export class Stepper extends React.Component { export class CrawlerSelector extends React.Component { private crawlers: object[]; - + constructor(props: any, context: any) { super(props, context); this.state = { @@ -119,6 +137,10 @@ export class CrawlerSelector extends React.Component { } componentWillMount() { + this.getMetaCrawlers(); + } + + getMetaCrawlers() { //todo. getting MetaCrawler list let crawlers = [ { @@ -151,7 +173,6 @@ export class CrawlerSelector extends React.Component { } this.crawlers = crawlerOptions; - } handleCrawlerSelection(e: any, data: any) { @@ -160,12 +181,6 @@ export class CrawlerSelector extends React.Component { }); } - showCrawlerAuthInfo() { - if (this.state.selected === null) { - return null; - } - return
{this.state.selected} auth inputs
; - } render() { @@ -181,7 +196,7 @@ export class CrawlerSelector extends React.Component { - {this.showCrawlerAuthInfo()} + @@ -189,9 +204,38 @@ export class CrawlerSelector extends React.Component {
); } - } +export class CrawlerAuthInputs extends React.Component { + + constructor(props: any, context: any) { + super(props, context); + this.state = { + }; + } + + componentWillMount() { + + } + + render() { + let elem = null; + if (this.props.crawler === null) { + elem = null; + } else { + elem = +
CrawlerAuthInputs
; + } + + return ( +
+ {elem} +
+ ); + } +} + + export class SensorItemSelector extends React.Component { constructor(props: any, context: any) { @@ -205,5 +249,69 @@ export class SensorItemSelector extends React.Component {
SensorItemSelector
); } - +} + +export class ETCSelector extends React.Component { + constructor(props: any, context: any) { + super(props, context); + this.state = { + interval: 5, + }; + } + handleIntervalChange = (e: any, { value }: any) => this.setState({ interval : value }); + + render() { + return ( + + + + + Interval + + + + + + + + + + + + + + + + Notification + + + + + + Warn Condition + + + + +
+ ); + } } diff --git a/src/ts/containers/test/TargetDetails.tsx b/src/ts/containers/test/TargetDetails.tsx new file mode 100644 index 0000000..2cf7d30 --- /dev/null +++ b/src/ts/containers/test/TargetDetails.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { Button, Table, Label } from 'semantic-ui-react'; + +export class TargetDetails extends React.Component { + + constructor(props: any, context: any) { + super(props, context); + this.state = { + }; + } + + render() { + return ( +
+ target details +
+ ); + } +} + + +