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 (
<Container fluid>
<Header as='h3' dividing>Sensor Item</Header>

View File

@ -10,75 +10,75 @@ export class Sensors extends React.Component<any, any> {
super(props, context);
this.state = {
selected: null,
isDetail: false, //temp
isDetail: false, // temp
};
}
componentWillMount() {
public componentWillMount = () => {
this.data = [
{
"id": "111",
"metaSensorStatus": {
"name": "NORMAL"
'id': '111',
'metaSensorStatus': {
'name': 'NORMAL',
},
"target": {
"id": "1",
'target': {
'id': '1',
},
"metaCrawler": {
"name": "WMI",
"description": "WMI description",
'metaCrawler': {
'name': 'WMI',
'description': 'WMI description',
},
"crawlerInputItems": "json value",
"description": "description1111111111",
'crawlerInputItems': 'json value',
'description': 'description1111111111',
},
{
"id": "222",
"metaSensorStatus": {
"name": "NORMAL"
'id': '222',
'metaSensorStatus': {
'name': 'NORMAL',
},
"target": {
"id": "1",
'target': {
'id': '1',
},
"metaCrawler": {
"name": "SNMP",
"description": "SNMP description",
'metaCrawler': {
'name': 'SNMP',
'description': 'SNMP description',
},
"crawlerInputItems": "json value",
"description": "description1111111111",
'crawlerInputItems': 'json value',
'description': 'description1111111111',
},
{
"id": "333",
"metaSensorStatus": {
"name": "NORMAL"
'id': '333',
'metaSensorStatus': {
'name': 'NORMAL',
},
"target": {
"id": "1",
'target': {
'id': '1',
},
"metaCrawler": {
"name": "JMX",
"description": "JMX description",
'metaCrawler': {
'name': 'JMX',
'description': 'JMX description',
},
"crawlerInputItems": "json value",
"description": "description1111111111",
'crawlerInputItems': 'json value',
'description': 'description1111111111',
},
];
}
handleSelect(selectedSensor: object) {
public handleSelect = (selectedSensor: object) => {
this.setState({
selected: selectedSensor,
isDetail: true,
});
}
checkCellStatus(status: any): boolean {
public checkCellStatus = (status: any): boolean => {
if (status.name === 'STOPPED') {
return true;
}
return false;
}
showStartStopBtn(status: any) {
public showStartStopBtn = (status: any) => {
if (status.name === 'STARTED') {
return <Button content='Stop' icon='stop' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />;
} 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);
}
handleAddSensor() {
public handleAddSensor = () => {
console.log('adding a sensor');
}
render() {
public render(): JSX.Element {
if (this.state.isDetail) {
return <SensorDetails sensor={this.state.selected} />;
}
}
return (
<Container fluid>
<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) => (
<Table.Row key={index} onClick={this.handleSelect.bind(this, sensor)}>
<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.description}</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) => () => {
const { column, data, direction } = this.state
public handleSort = (clickedColumn: any) => () => {
const { column, data, direction } = this.state;
if (column !== clickedColumn) {
this.setState({
@ -32,16 +32,16 @@ export class TableExampleSortable extends React.Component<any, any> {
direction: 'ascending',
});
return
return;
}
this.setState({
data: data.reverse(),
direction: direction === 'ascending' ? 'descending' : 'ascending',
})
};
});
}
render() {
public render(): JSX.Element {
const { column, data, direction } = this.state;
return (
@ -69,6 +69,6 @@ export class TableExampleSortable extends React.Component<any, any> {
))}
</Table.Body>
</Table>
)
);
}
}
}

View File

@ -3,7 +3,6 @@ import { Button, Table, Header, Container } from 'semantic-ui-react';
import { Sensors } from './Sensors';
import { DetailContainer } from './commons/DetailContainer';
export class TargetDetails extends React.Component<any, 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');
}
render() {
public render(): JSX.Element {
const items = [
{ 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');
}
render() {
public render(): JSX.Element {
return (
<Container fluid>
<Header as='h3' dividing>Target Info</Header>
@ -95,8 +95,7 @@ export class TargetBasicInfo extends React.Component<any, any> {
</Table.Body>
</Table>
<Button primary floated={'right'} negative onClick={this.handleRemoveTarget}>Remove</Button>
</Container>
);
}
}
}

View File

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

View File

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