sensor config target ing

This commit is contained in:
snoop 2017-08-24 16:26:48 +09:00
parent e4437479c4
commit b823b54a98

View File

@ -1,6 +1,26 @@
import * as React from 'react';
import { Icon, Step, Button, Table, Radio, Form, Container, Checkbox } from 'semantic-ui-react';
import { Grid, Image, Label, Segment, Dropdown, Input, List, Accordion, Loader } from 'semantic-ui-react';
import {
Icon,
Step,
Button,
Table,
Radio,
Form,
Container,
Checkbox,
} from 'semantic-ui-react';
import {
Grid,
Image,
Label,
Segment,
Dropdown,
Input,
List,
Accordion,
Loader,
DropdownItemProps,
} from 'semantic-ui-react';
import MetaCrawler from '@overflow/meta/api/model/MetaCrawler';
import Infra from '@overflow/infra/api/model/Infra';
@ -17,7 +37,7 @@ export interface SensorConfigurationStateProps {
export interface SensorConfigurationDispatchProps {
onReadAllTargetByDomain?(domain: Domain): void;
onReadInfra?(infraId: number ): void;
onReadInfra?(infraId: number): void;
}
export interface SensorConfigurationState {
@ -36,8 +56,8 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
}
public componentWillMount(): void {
if(this.props.infraId === undefined) {
this.props.onReadAllTargetByDomain({id: 1});
if (this.props.infraId === undefined) {
this.props.onReadAllTargetByDomain({ id: 1 });
} else {
this.props.onReadInfra(this.props.infraId);
}
@ -55,7 +75,7 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
<Segment vertical><SensorItemTree crawlerId={this.state.selectedCrawlerId} /></Segment>, <ETCSelector />];
return (
<ConfigStepper steps={steps} infra={this.props.infra} infraList={this.props.infraList}/>
<ConfigStepper steps={steps} infra={this.props.infra} infraList={this.props.infraList} />
);
}
}
@ -73,6 +93,8 @@ export interface ConfigStepperState {
export class ConfigStepper extends React.Component<ConfigStepperProps, ConfigStepperState> {
private selectOptions: Array<DropdownItemProps>;
constructor(props: ConfigStepperProps, context: ConfigStepperState) {
super(props, context);
this.state = {
@ -80,6 +102,24 @@ export class ConfigStepper extends React.Component<ConfigStepperProps, ConfigSte
};
}
public convertInfraList(): void {
let selectionOptions: Array<DropdownItemProps> = new Array;
for (let infra of this.props.infraList) {
let option = {
// key: crawler.id,
text: infra.target.displayName,
value: infra.target.id,
icon: 'check', // or close?
};
selectionOptions.push(option);
}
this.selectOptions = selectionOptions;
}
public handleActive(idx: number): boolean {
if (this.state.currentStep === idx) {
return true;
@ -142,7 +182,7 @@ export class ConfigStepper extends React.Component<ConfigStepperProps, ConfigSte
public renderInfraList(): JSX.Element[] {
if(this.props.infraList === undefined) {
if (this.props.infraList === undefined) {
return null;
}