fixed lint

This commit is contained in:
snoop 2017-07-20 10:56:21 +09:00
parent 9fb16788fb
commit 94d737fc3a
6 changed files with 105 additions and 105 deletions

View File

@ -9,11 +9,11 @@ export class SensorItems extends React.Component<any, any> {
}; };
} }
componentWillMount() { public componentWillMount() {
console.log('componentWillMount');
} }
render() { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
<Header as='h3' dividing>Sensor Item</Header> <Header as='h3' dividing>Sensor Item</Header>

View File

@ -10,75 +10,75 @@ export class Sensors extends React.Component<any, any> {
super(props, context); super(props, context);
this.state = { this.state = {
selected: null, selected: null,
isDetail: false, //temp isDetail: false, // temp
}; };
} }
componentWillMount() { public componentWillMount = () => {
this.data = [ this.data = [
{ {
"id": "111", 'id': '111',
"metaSensorStatus": { 'metaSensorStatus': {
"name": "NORMAL" 'name': 'NORMAL',
}, },
"target": { 'target': {
"id": "1", 'id': '1',
}, },
"metaCrawler": { 'metaCrawler': {
"name": "WMI", 'name': 'WMI',
"description": "WMI description", 'description': 'WMI description',
}, },
"crawlerInputItems": "json value", 'crawlerInputItems': 'json value',
"description": "description1111111111", 'description': 'description1111111111',
}, },
{ {
"id": "222", 'id': '222',
"metaSensorStatus": { 'metaSensorStatus': {
"name": "NORMAL" 'name': 'NORMAL',
}, },
"target": { 'target': {
"id": "1", 'id': '1',
}, },
"metaCrawler": { 'metaCrawler': {
"name": "SNMP", 'name': 'SNMP',
"description": "SNMP description", 'description': 'SNMP description',
}, },
"crawlerInputItems": "json value", 'crawlerInputItems': 'json value',
"description": "description1111111111", 'description': 'description1111111111',
}, },
{ {
"id": "333", 'id': '333',
"metaSensorStatus": { 'metaSensorStatus': {
"name": "NORMAL" 'name': 'NORMAL',
}, },
"target": { 'target': {
"id": "1", 'id': '1',
}, },
"metaCrawler": { 'metaCrawler': {
"name": "JMX", 'name': 'JMX',
"description": "JMX description", 'description': 'JMX description',
}, },
"crawlerInputItems": "json value", 'crawlerInputItems': 'json value',
"description": "description1111111111", 'description': 'description1111111111',
}, },
]; ];
} }
handleSelect(selectedSensor: object) { public handleSelect = (selectedSensor: object) => {
this.setState({ this.setState({
selected: selectedSensor, selected: selectedSensor,
isDetail: true, isDetail: true,
}); });
} }
checkCellStatus(status: any): boolean { public checkCellStatus = (status: any): boolean => {
if (status.name === 'STOPPED') { if (status.name === 'STOPPED') {
return true; return true;
} }
return false; return false;
} }
showStartStopBtn(status: any) { public showStartStopBtn = (status: any) => {
if (status.name === 'STARTED') { if (status.name === 'STARTED') {
return <Button content='Stop' icon='stop' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />; return <Button content='Stop' icon='stop' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />;
} else { } else {
@ -86,17 +86,17 @@ export class Sensors extends React.Component<any, any> {
} }
} }
handleStartStop(event: any, data: any) { public handleStartStop = (event: any, data: any) => {
console.log(event); console.log(event);
} }
handleAddSensor() { public handleAddSensor = () => {
console.log('adding a sensor'); console.log('adding a sensor');
} }
render() { public render(): JSX.Element {
if (this.state.isDetail) { if (this.state.isDetail) {
return <SensorDetails sensor={this.state.selected} />; return <SensorDetails sensor={this.state.selected} />;
} }
return ( return (
<Container fluid> <Container fluid>
<Header as='h3' dividing>Sensors</Header> <Header as='h3' dividing>Sensors</Header>
@ -115,7 +115,9 @@ export class Sensors extends React.Component<any, any> {
{this.data.map((sensor: any, index: number) => ( {this.data.map((sensor: any, index: number) => (
<Table.Row key={index} onClick={this.handleSelect.bind(this, sensor)}> <Table.Row key={index} onClick={this.handleSelect.bind(this, sensor)}>
<Table.Cell textAlign={'center'}>{index + 1}</Table.Cell> <Table.Cell textAlign={'center'}>{index + 1}</Table.Cell>
<Table.Cell negative={this.checkCellStatus(sensor.metaSensorStatus)} textAlign={'center'}>{sensor.metaSensorStatus.name}</Table.Cell> <Table.Cell negative={this.checkCellStatus(sensor.metaSensorStatus)} textAlign={'center'}>
{sensor.metaSensorStatus.name}
</Table.Cell>
<Table.Cell>{sensor.metaCrawler.name}</Table.Cell> <Table.Cell>{sensor.metaCrawler.name}</Table.Cell>
<Table.Cell>{sensor.description}</Table.Cell> <Table.Cell>{sensor.description}</Table.Cell>
<Table.Cell>to do</Table.Cell> <Table.Cell>to do</Table.Cell>

View File

@ -22,8 +22,8 @@ export class TableExampleSortable extends React.Component<any, any> {
} }
handleSort = (clickedColumn:any) => () => { public handleSort = (clickedColumn: any) => () => {
const { column, data, direction } = this.state const { column, data, direction } = this.state;
if (column !== clickedColumn) { if (column !== clickedColumn) {
this.setState({ this.setState({
@ -32,16 +32,16 @@ export class TableExampleSortable extends React.Component<any, any> {
direction: 'ascending', direction: 'ascending',
}); });
return return;
} }
this.setState({ this.setState({
data: data.reverse(), data: data.reverse(),
direction: direction === 'ascending' ? 'descending' : 'ascending', direction: direction === 'ascending' ? 'descending' : 'ascending',
}) });
}; }
render() { public render(): JSX.Element {
const { column, data, direction } = this.state; const { column, data, direction } = this.state;
return ( return (
@ -69,6 +69,6 @@ export class TableExampleSortable extends React.Component<any, any> {
))} ))}
</Table.Body> </Table.Body>
</Table> </Table>
) );
} }
} }

View File

@ -3,7 +3,6 @@ import { Button, Table, Header, Container } from 'semantic-ui-react';
import { Sensors } from './Sensors'; import { Sensors } from './Sensors';
import { DetailContainer } from './commons/DetailContainer'; import { DetailContainer } from './commons/DetailContainer';
export class TargetDetails extends React.Component<any, any> { export class TargetDetails extends React.Component<any, any> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
@ -12,14 +11,15 @@ export class TargetDetails extends React.Component<any, any> {
}; };
} }
handleBack() { public handleBack = () => {
console.log('handleBack');
} }
handleRemoveTarget() { public handleRemoveTarget = () => {
alert('remove'); alert('remove');
} }
render() { public render(): JSX.Element {
const items = [ const items = [
{ name: 'Info', child: <TargetBasicInfo probe={this.props.probe} /> }, { name: 'Info', child: <TargetBasicInfo probe={this.props.probe} /> },
@ -46,11 +46,11 @@ export class TargetBasicInfo extends React.Component<any, any> {
}; };
} }
handleRemoveTarget() { public handleRemoveTarget = () => {
alert('remove'); alert('remove');
} }
render() { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
<Header as='h3' dividing>Target Info</Header> <Header as='h3' dividing>Target Info</Header>
@ -95,8 +95,7 @@ export class TargetBasicInfo extends React.Component<any, any> {
</Table.Body> </Table.Body>
</Table> </Table>
<Button primary floated={'right'} negative onClick={this.handleRemoveTarget}>Remove</Button> <Button primary floated={'right'} negative onClick={this.handleRemoveTarget}>Remove</Button>
</Container> </Container>
); );
} }
} }

View File

@ -1,5 +1,5 @@
import * as React from 'react'; import * as React from 'react';
import { Table, Button, Modal, Input, Header, Container } from 'semantic-ui-react'; import { Table, Button, Modal, Input, Header, Container, InputOnChangeData, ButtonProps } from 'semantic-ui-react';
import { TargetDetails } from './TargetDetails'; import { TargetDetails } from './TargetDetails';
export class Targets extends React.Component<any, any> { export class Targets extends React.Component<any, any> {
@ -11,17 +11,17 @@ export class Targets extends React.Component<any, any> {
}; };
} }
componentWillMount() { public componentWillMount = ():void => {
console.log('componentWillMount');
} }
handleAddTarget() { public handleAddTarget = (event: React.MouseEvent<HTMLButtonElement>, data: ButtonProps) => {
this.setState({ this.setState({
openAddTarget: true, openAddTarget: true,
}); });
} }
render() { public render(): JSX.Element {
const options = [ const options = [
{ key: 'm', text: 'Male', value: 'male' }, { key: 'm', text: 'Male', value: 'male' },
{ key: 'f', text: 'Female', value: 'female' }, { key: 'f', text: 'Female', value: 'female' },
@ -66,18 +66,18 @@ export class TargetTable extends React.Component<any, any> {
list: [], list: [],
}; };
} }
handleSelect(selectedTarget: object) { public handleSelect = (selectedTarget: object) => {
this.setState({ this.setState({
selected: selectedTarget, selected: selectedTarget,
}); });
} }
handleSearch(e: any, data: any) { public handleSearch = (event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
let searchWord = data.value.toLowerCase(); let searchWord = data.value.toLowerCase();
let foundTarget = new Array(); let foundTarget = new Array();
for(let target of this.data) { for (let target of this.data) {
let typeName = target.infra.metaInfraType.name.toLowerCase(); let typeName = target.infra.metaInfraType.name.toLowerCase();
if(typeName.indexOf(searchWord) !== -1) { if (typeName.indexOf(searchWord) !== -1) {
foundTarget.push(target); foundTarget.push(target);
} }
} }
@ -86,40 +86,40 @@ export class TargetTable extends React.Component<any, any> {
}); });
} }
componentWillMount() { public componentWillMount = () => {
this.data = [ this.data = [
{ {
"id": "1", 'id': '1',
"createDate": "", 'createDate': '',
"probe": { 'probe': {
"id": "1", 'id': '1',
}, },
"infra": { 'infra': {
"id": "1", 'id': '1',
"metaInfraType": { 'metaInfraType': {
"id": "1", 'id': '1',
"name": "OS", 'name': 'OS',
"createDate": "424252" 'createDate': '424252',
}, },
"childId": "1", 'childId': '1',
"createDate": "13345235" 'createDate': '13345235',
}, },
}, },
{ {
"id": "2", 'id': '2',
"createDate": "", 'createDate': '',
"probe": { 'probe': {
"id": "1", 'id': '1',
}, },
"infra": { 'infra': {
"id": "1", 'id': '1',
"metaInfraType": { 'metaInfraType': {
"id": "1", 'id': '1',
"name": "Host", 'name': 'Host',
"createDate": "424252" 'createDate': '424252',
}, },
"childId": "1", 'childId': '1',
"createDate": "13345235" 'createDate': '13345235',
}, },
}, },
]; ];
@ -128,7 +128,7 @@ export class TargetTable extends React.Component<any, any> {
}); });
} }
render() { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
<Header as='h3' dividing>Targets</Header> <Header as='h3' dividing>Targets</Header>

View File

@ -1,9 +1,9 @@
import *as React from 'react' import *as React from 'react';
import { import {
Dropdown, Icon, Menu, Label, Dropdown, Icon, Menu, Label,
Sidebar, Segment, Button, Image, Header, Sidebar, Segment, Button, Image, Header,
} from 'semantic-ui-react' } from 'semantic-ui-react';
import { Link, Route } from 'react-router-dom'; import { Link, Route } from 'react-router-dom';
import * as History from 'history'; import * as History from 'history';
@ -27,7 +27,7 @@ const options = [
{ key: 'ruby', text: 'Ruby', value: 'ruby' }, { key: 'ruby', text: 'Ruby', value: 'ruby' },
{ key: 'ui', text: 'UI Design', value: 'ui' }, { key: 'ui', text: 'UI Design', value: 'ui' },
{ key: 'ux', text: 'User Experience', value: 'ux' }, { key: 'ux', text: 'User Experience', value: 'ux' },
] ];
@ -43,9 +43,8 @@ export class TopBar extends React.Component<any, any> {
} }
render() { public render(): JSX.Element {
{/*<h1>React Redux sample</h1> {/*<h1>React Redux sample</h1>
<li><Link to='/test' >TopBar</Link></li> <li><Link to='/test' >TopBar</Link></li>
<li><Link to='/test2' >Signup</Link></li> <li><Link to='/test2' >Signup</Link></li>
<li><Link to='/test3' >SignIn</Link></li> <li><Link to='/test3' >SignIn</Link></li>
@ -57,14 +56,14 @@ export class TopBar extends React.Component<any, any> {
return ( return (
<div> <div>
<Menu inverted borderless size='tiny'> <Menu inverted borderless size='tiny'>
<Menu.Item> overFlow </Menu.Item> <Menu.Item> overFlow </Menu.Item>
<Menu.Item href='/' > Home </Menu.Item> <Menu.Item href='/' > Home </Menu.Item>
<Dropdown text='Monitoring' pointing className='link item'> <Dropdown text='Monitoring' pointing className='link item'>
<Dropdown.Menu> <Dropdown.Menu>
<Dropdown.Header icon='angle right' content='Probe'/> <Dropdown.Header icon='angle right' content='Probe' />
<Dropdown.Divider /> <Dropdown.Divider />
<Dropdown.Item href='#/test14'> Probe List </Dropdown.Item> <Dropdown.Item href='#/test14'> Probe List </Dropdown.Item>
<Dropdown.Item href='#/test14'> Noauth Probes </Dropdown.Item> <Dropdown.Item href='#/test14'> Noauth Probes </Dropdown.Item>
@ -73,7 +72,7 @@ export class TopBar extends React.Component<any, any> {
<Dropdown.Item href='#/test21'>Sensors</Dropdown.Item> <Dropdown.Item href='#/test21'>Sensors</Dropdown.Item>
</Dropdown.Menu> </Dropdown.Menu>
</Dropdown> </Dropdown>
<Dropdown text='Infrastructure' pointing className='link item'> <Dropdown text='Infrastructure' pointing className='link item'>
<Dropdown.Menu> <Dropdown.Menu>
<Dropdown.Item> Maps </Dropdown.Item> <Dropdown.Item> Maps </Dropdown.Item>
@ -95,7 +94,7 @@ export class TopBar extends React.Component<any, any> {
<Dropdown.Item href='#/test7'>Tree</Dropdown.Item> <Dropdown.Item href='#/test7'>Tree</Dropdown.Item>
</Dropdown.Menu> </Dropdown.Menu>
</Dropdown> </Dropdown>
<Menu.Item position='right' link> <Menu.Item position='right' link>
<Icon name='setting' size='large' /> <Icon name='setting' size='large' />