fixed lint

This commit is contained in:
snoop 2017-07-20 12:13:02 +09:00
parent 75b7a6e27e
commit 6a51403af1
6 changed files with 89 additions and 78 deletions

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
@ -7,9 +8,15 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.0/es6-promise.auto.js"></script>
<![endif]-->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css"></link>
<style type="text/css">
.fullHeight {
height: 100%;
}
</style>
</head>
</head>
<body>
<div id="react-placeholder"></div>
</body>
</html>
</html>

View File

@ -12,7 +12,7 @@ export class SensorConfiguration extends React.Component<any, any> {
}
render() {
public render(): JSX.Element {
let steps = [<CrawlerSelector />, <SensorItemSelector />, <ETCSelector />];
return (
@ -31,21 +31,21 @@ export class ConfigStepper extends React.Component<any, any> {
};
}
handleActive(idx: number): boolean {
public handleActive(idx: number): boolean {
if (this.state.currentStep === idx) {
return true;
}
return false;
}
handleCompleted(idx: number): boolean {
public handleCompleted(idx: number): boolean {
if (this.state.currentStep > idx) {
return true;
}
return false;
}
handlePrev(event: React.SyntheticEvent<HTMLAnchorElement>, data: object) {
public handlePrev(event: React.SyntheticEvent<HTMLAnchorElement>, data: object): void {
let step: number = this.state.currentStep;
if (step <= 1) {
step = 1;
@ -56,7 +56,7 @@ export class ConfigStepper extends React.Component<any, any> {
currentStep: step,
});
}
handleNext(event: React.SyntheticEvent<HTMLAnchorElement>, data: object) {
public handleNext(event: React.SyntheticEvent<HTMLAnchorElement>, data: object): void {
let step: number = this.state.currentStep;
if (step >= this.props.steps.length + 1) {
step = this.props.steps.length + 1;
@ -67,15 +67,15 @@ export class ConfigStepper extends React.Component<any, any> {
currentStep: step,
});
if (step === this.props.steps.length + 1) {
console.log("Done");
console.log('Done');
}
}
showContent() {
public showContent(): any {
return this.props.steps[this.state.currentStep - 1];
}
checkPrevDisabled(): boolean {
public checkPrevDisabled(): boolean {
if (this.state.currentStep <= 1) {
return true;
} else {
@ -83,7 +83,7 @@ export class ConfigStepper extends React.Component<any, any> {
}
}
checkNextDisabled(): boolean {
public checkNextDisabled(): boolean {
if (this.state.currentStep === this.props.steps.length + 1) {
return true;
} else {
@ -91,7 +91,7 @@ export class ConfigStepper extends React.Component<any, any> {
}
}
render() {
public render(): JSX.Element {
return (
<Container fluid>
<Step.Group fluid>
@ -114,9 +114,11 @@ export class ConfigStepper extends React.Component<any, any> {
{this.showContent()}
<br />
<Button.Group floated='right'> {/* floated 사용시 레이아웃 깨지는 현상 */}
<Button content='Prev' icon='left arrow' labelPosition='left' onClick={this.handlePrev.bind(this)} disabled={this.checkPrevDisabled()} />
<Button content='Prev' icon='left arrow' labelPosition='left'
onClick={this.handlePrev.bind(this)} disabled={this.checkPrevDisabled()} />
<Button.Or />
<Button content='Next' icon='right arrow' labelPosition='right' positive onClick={this.handleNext.bind(this)} disabled={this.checkNextDisabled()} />
<Button content='Next' icon='right arrow' labelPosition='right' positive
onClick={this.handleNext.bind(this)} disabled={this.checkNextDisabled()} />
</Button.Group>
</Container>
);
@ -136,38 +138,39 @@ export class CrawlerSelector extends React.Component<any, any> {
};
}
componentWillMount() {
public componentWillMount(): void {
super.componentWillMount();
this.getMetaCrawlers();
}
getMetaCrawlers() {
//todo. getting MetaCrawler list
public getMetaCrawlers(): void {
// todo. getting MetaCrawler list
let crawlers = [
{
"id": "1",
"name": "WMI",
"description": "WMI DESCRIPTION"
'id': '1',
'name': 'WMI',
'description': 'WMI DESCRIPTION',
},
{
"id": "2",
"name": "SNMP",
"description": "SNMP DESCRIPTION"
'id': '2',
'name': 'SNMP',
'description': 'SNMP DESCRIPTION',
},
{
"id": "3",
"name": "JMX",
"description": "JMX DESCRIPTION"
'id': '3',
'name': 'JMX',
'description': 'JMX DESCRIPTION',
},
];
let crawlerOptions = [];
let crawler: any;
for (crawler of crawlers) {
var option = {
let option = {
key: crawler.id,
text: crawler.name,
value: crawler.name,
icon: 'check', //or close?
icon: 'check', // or close?
};
crawlerOptions.push(option);
}
@ -175,14 +178,14 @@ export class CrawlerSelector extends React.Component<any, any> {
this.crawlers = crawlerOptions;
}
handleCrawlerSelection(e: any, data: any) {
public handleCrawlerSelection(e: any, data: any): void {
this.setState({
selected: data.value,
});
this.checkInstall();
}
checkInstall() {
public checkInstall(): void {
this.setState({
isInstalling: true,
});
@ -194,7 +197,7 @@ export class CrawlerSelector extends React.Component<any, any> {
}, 1500);
}
render() {
public render(): JSX.Element {
return (
<Container fluid>
@ -233,49 +236,48 @@ export class CrawlerAuthInputs extends React.Component<any, any> {
};
}
componentWillMount() {
public componentWillMount(): void {
this.data = [
{
"id": "1",
"metaInputType": {
"id": "1",
"name": "Text",
'id': '1',
'metaInputType': {
'id': '1',
'name': 'Text',
},
"name": "Community",
"required": "true",
"defaultValue": "public",
"keyName": "Community",
"keyValue": "",
"pattern": "regex..."
'name': 'Community',
'required': 'true',
'defaultValue': 'public',
'keyName': 'Community',
'keyValue': '',
'pattern': 'regex...',
},
{
"id": "2",
"metaInputType": {
"id": "2",
"name": "Radio",
'id': '2',
'metaInputType': {
'id': '2',
'name': 'Radio',
},
"name": "AuthType",
"required": "true",
"defaultValue": "",
"keyName": "AuthType",
"keyValue": "MD5|SHA",
"pattern": "regex..."
'name': 'AuthType',
'required': 'true',
'defaultValue': '',
'keyName': 'AuthType',
'keyValue': 'MD5|SHA',
'pattern': 'regex...',
},
];
}
handleVerify() {
public handleVerify(): void {
this.setState({
isVerifying: true,
});
}
renderRow(item: any, index: number) {
public renderRow(item: any, index: number): JSX.Element {
let elem = new Array();
if (item.metaInputType.name === 'Text') {
elem.push(<Input placeholder={item.defaultValue} key={0} />);
}
else if (item.metaInputType.name === 'Radio') {
} else if (item.metaInputType.name === 'Radio') {
let itemValues = item.keyValue.split('|');
let idx = 0;
for (let itemValue of itemValues) {
@ -294,7 +296,7 @@ export class CrawlerAuthInputs extends React.Component<any, any> {
</Table.Row >;
}
render() {
public render(): JSX.Element {
if (this.props.crawler === null) {
return null;
}
@ -337,7 +339,7 @@ export class SensorItemSelector extends React.Component<any, any> {
}
render() {
public render(): JSX.Element {
return (
<Accordion exclusive={false} styled>
<Accordion.Title>
@ -370,9 +372,11 @@ export class ETCSelector extends React.Component<any, any> {
interval: 5,
};
}
handleIntervalChange = (e: any, { value }: any) => this.setState({ interval: value });
public handleIntervalChange(e: any, { value }: any): void {
this.setState({ interval: value });
}
render() {
public render(): JSX.Element {
return (
<Table celled={true}>
<Table.Body>

View File

@ -35,19 +35,19 @@ export class SensorBasicInfo extends React.Component<any, any> {
};
}
public handleStartStop = (event: any, data: any) => {
public handleStartStop(event: any, data: any): void {
console.log(event);
}
public handleDiscovery = (event: any, data: any) => {
public handleDiscovery(event: any, data: any): void {
alert('Discovery');
}
public handleBack = (event: any, data: any) => {
public handleBack(event: any, data: any): void {
this.props.onBack();
}
public showStartStopBtn = () => {
public showStartStopBtn(): JSX.Element {
if (this.props.probe.metaProbeStatus.name === 'STARTED') {
return <Button content='Stop' icon='stop' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />;
} else {

View File

@ -14,7 +14,7 @@ export class Sensors extends React.Component<any, any> {
};
}
public componentWillMount():void {
public componentWillMount(): void {
super.componentWillMount();
this.data = [
{
@ -65,21 +65,21 @@ export class Sensors extends React.Component<any, any> {
];
}
public handleSelect = (selectedSensor: object) => {
public handleSelect(selectedSensor: object): void {
this.setState({
selected: selectedSensor,
isDetail: true,
});
}
public checkCellStatus = (status: any): boolean => {
public checkCellStatus(status: any): boolean {
if (status.name === 'STOPPED') {
return true;
}
return false;
}
public showStartStopBtn = (status: any) => {
public showStartStopBtn(status: any): JSX.Element {
if (status.name === 'STARTED') {
return <Button content='Stop' icon='stop' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />;
} else {
@ -87,10 +87,10 @@ export class Sensors extends React.Component<any, any> {
}
}
public handleStartStop = (event: any, data: any) => {
public handleStartStop(event: any, data: any): void {
console.log(event);
}
public handleAddSensor = () => {
public handleAddSensor(): void {
console.log('adding a sensor');
}

View File

@ -11,11 +11,11 @@ export class TargetDetails extends React.Component<any, any> {
};
}
public handleBack = () => {
public handleBack(): void {
console.log('handleBack');
}
public handleRemoveTarget = () => {
public handleRemoveTarget(): void {
alert('remove');
}
@ -46,7 +46,7 @@ export class TargetBasicInfo extends React.Component<any, any> {
};
}
public handleRemoveTarget = () => {
public handleRemoveTarget(): void {
alert('remove');
}

View File

@ -11,7 +11,7 @@ export class Targets extends React.Component<any, any> {
};
}
public handleAddTarget = (event: React.MouseEvent<HTMLButtonElement>, data: ButtonProps) => {
public handleAddTarget(event: React.MouseEvent<HTMLButtonElement>, data: ButtonProps): void {
this.setState({
openAddTarget: true,
});
@ -50,7 +50,7 @@ export class Targets extends React.Component<any, any> {
);
}
public componentWillMount():void {
public componentWillMount(): void {
super.componentWillMount();
}
}
@ -66,13 +66,13 @@ export class TargetTable extends React.Component<any, any> {
list: [],
};
}
public handleSelect = (selectedTarget: object) => {
public handleSelect(selectedTarget: object): void {
this.setState({
selected: selectedTarget,
});
}
public handleSearch = (event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
public handleSearch(event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData): void {
let searchWord = data.value.toLowerCase();
let foundTarget = new Array();
for (let target of this.data) {
@ -116,7 +116,7 @@ export class TargetTable extends React.Component<any, any> {
);
}
public componentWillMount():void {
public componentWillMount(): void {
super.componentWillMount();
this.data = [
{