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> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Hello React!</title> <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> <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.0/es6-promise.auto.js"></script>
<![endif]--> <![endif]-->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css"></link> <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> <body>
<div id="react-placeholder"></div> <div id="react-placeholder"></div>
</body> </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 />]; let steps = [<CrawlerSelector />, <SensorItemSelector />, <ETCSelector />];
return ( 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) { if (this.state.currentStep === idx) {
return true; return true;
} }
return false; return false;
} }
handleCompleted(idx: number): boolean { public handleCompleted(idx: number): boolean {
if (this.state.currentStep > idx) { if (this.state.currentStep > idx) {
return true; return true;
} }
return false; return false;
} }
handlePrev(event: React.SyntheticEvent<HTMLAnchorElement>, data: object) { public handlePrev(event: React.SyntheticEvent<HTMLAnchorElement>, data: object): void {
let step: number = this.state.currentStep; let step: number = this.state.currentStep;
if (step <= 1) { if (step <= 1) {
step = 1; step = 1;
@ -56,7 +56,7 @@ export class ConfigStepper extends React.Component<any, any> {
currentStep: step, currentStep: step,
}); });
} }
handleNext(event: React.SyntheticEvent<HTMLAnchorElement>, data: object) { public handleNext(event: React.SyntheticEvent<HTMLAnchorElement>, data: object): void {
let step: number = this.state.currentStep; let step: number = this.state.currentStep;
if (step >= this.props.steps.length + 1) { if (step >= this.props.steps.length + 1) {
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, currentStep: step,
}); });
if (step === this.props.steps.length + 1) { 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]; return this.props.steps[this.state.currentStep - 1];
} }
checkPrevDisabled(): boolean { public checkPrevDisabled(): boolean {
if (this.state.currentStep <= 1) { if (this.state.currentStep <= 1) {
return true; return true;
} else { } 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) { if (this.state.currentStep === this.props.steps.length + 1) {
return true; return true;
} else { } else {
@ -91,7 +91,7 @@ export class ConfigStepper extends React.Component<any, any> {
} }
} }
render() { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
<Step.Group fluid> <Step.Group fluid>
@ -114,9 +114,11 @@ export class ConfigStepper extends React.Component<any, any> {
{this.showContent()} {this.showContent()}
<br /> <br />
<Button.Group floated='right'> {/* floated 사용시 레이아웃 깨지는 현상 */} <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.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> </Button.Group>
</Container> </Container>
); );
@ -136,38 +138,39 @@ export class CrawlerSelector extends React.Component<any, any> {
}; };
} }
componentWillMount() { public componentWillMount(): void {
super.componentWillMount();
this.getMetaCrawlers(); this.getMetaCrawlers();
} }
getMetaCrawlers() { public getMetaCrawlers(): void {
//todo. getting MetaCrawler list // todo. getting MetaCrawler list
let crawlers = [ let crawlers = [
{ {
"id": "1", 'id': '1',
"name": "WMI", 'name': 'WMI',
"description": "WMI DESCRIPTION" 'description': 'WMI DESCRIPTION',
}, },
{ {
"id": "2", 'id': '2',
"name": "SNMP", 'name': 'SNMP',
"description": "SNMP DESCRIPTION" 'description': 'SNMP DESCRIPTION',
}, },
{ {
"id": "3", 'id': '3',
"name": "JMX", 'name': 'JMX',
"description": "JMX DESCRIPTION" 'description': 'JMX DESCRIPTION',
}, },
]; ];
let crawlerOptions = []; let crawlerOptions = [];
let crawler: any; let crawler: any;
for (crawler of crawlers) { for (crawler of crawlers) {
var option = { let option = {
key: crawler.id, key: crawler.id,
text: crawler.name, text: crawler.name,
value: crawler.name, value: crawler.name,
icon: 'check', //or close? icon: 'check', // or close?
}; };
crawlerOptions.push(option); crawlerOptions.push(option);
} }
@ -175,14 +178,14 @@ export class CrawlerSelector extends React.Component<any, any> {
this.crawlers = crawlerOptions; this.crawlers = crawlerOptions;
} }
handleCrawlerSelection(e: any, data: any) { public handleCrawlerSelection(e: any, data: any): void {
this.setState({ this.setState({
selected: data.value, selected: data.value,
}); });
this.checkInstall(); this.checkInstall();
} }
checkInstall() { public checkInstall(): void {
this.setState({ this.setState({
isInstalling: true, isInstalling: true,
}); });
@ -194,7 +197,7 @@ export class CrawlerSelector extends React.Component<any, any> {
}, 1500); }, 1500);
} }
render() { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
@ -233,49 +236,48 @@ export class CrawlerAuthInputs extends React.Component<any, any> {
}; };
} }
componentWillMount() { public componentWillMount(): void {
this.data = [ this.data = [
{ {
"id": "1", 'id': '1',
"metaInputType": { 'metaInputType': {
"id": "1", 'id': '1',
"name": "Text", 'name': 'Text',
}, },
"name": "Community", 'name': 'Community',
"required": "true", 'required': 'true',
"defaultValue": "public", 'defaultValue': 'public',
"keyName": "Community", 'keyName': 'Community',
"keyValue": "", 'keyValue': '',
"pattern": "regex..." 'pattern': 'regex...',
}, },
{ {
"id": "2", 'id': '2',
"metaInputType": { 'metaInputType': {
"id": "2", 'id': '2',
"name": "Radio", 'name': 'Radio',
}, },
"name": "AuthType", 'name': 'AuthType',
"required": "true", 'required': 'true',
"defaultValue": "", 'defaultValue': '',
"keyName": "AuthType", 'keyName': 'AuthType',
"keyValue": "MD5|SHA", 'keyValue': 'MD5|SHA',
"pattern": "regex..." 'pattern': 'regex...',
}, },
]; ];
} }
handleVerify() { public handleVerify(): void {
this.setState({ this.setState({
isVerifying: true, isVerifying: true,
}); });
} }
renderRow(item: any, index: number) { public renderRow(item: any, index: number): JSX.Element {
let elem = new Array(); let elem = new Array();
if (item.metaInputType.name === 'Text') { if (item.metaInputType.name === 'Text') {
elem.push(<Input placeholder={item.defaultValue} key={0} />); 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 itemValues = item.keyValue.split('|');
let idx = 0; let idx = 0;
for (let itemValue of itemValues) { for (let itemValue of itemValues) {
@ -294,7 +296,7 @@ export class CrawlerAuthInputs extends React.Component<any, any> {
</Table.Row >; </Table.Row >;
} }
render() { public render(): JSX.Element {
if (this.props.crawler === null) { if (this.props.crawler === null) {
return null; return null;
} }
@ -337,7 +339,7 @@ export class SensorItemSelector extends React.Component<any, any> {
} }
render() { public render(): JSX.Element {
return ( return (
<Accordion exclusive={false} styled> <Accordion exclusive={false} styled>
<Accordion.Title> <Accordion.Title>
@ -370,9 +372,11 @@ export class ETCSelector extends React.Component<any, any> {
interval: 5, 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 ( return (
<Table celled={true}> <Table celled={true}>
<Table.Body> <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); console.log(event);
} }
public handleDiscovery = (event: any, data: any) => { public handleDiscovery(event: any, data: any): void {
alert('Discovery'); alert('Discovery');
} }
public handleBack = (event: any, data: any) => { public handleBack(event: any, data: any): void {
this.props.onBack(); this.props.onBack();
} }
public showStartStopBtn = () => { public showStartStopBtn(): JSX.Element {
if (this.props.probe.metaProbeStatus.name === 'STARTED') { if (this.props.probe.metaProbeStatus.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 {

View File

@ -14,7 +14,7 @@ export class Sensors extends React.Component<any, any> {
}; };
} }
public componentWillMount():void { public componentWillMount(): void {
super.componentWillMount(); super.componentWillMount();
this.data = [ 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({ this.setState({
selected: selectedSensor, selected: selectedSensor,
isDetail: true, isDetail: true,
}); });
} }
public 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;
} }
public showStartStopBtn = (status: any) => { public showStartStopBtn(status: any): JSX.Element {
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 {
@ -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); console.log(event);
} }
public handleAddSensor = () => { public handleAddSensor(): void {
console.log('adding a sensor'); 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'); console.log('handleBack');
} }
public handleRemoveTarget = () => { public handleRemoveTarget(): void {
alert('remove'); alert('remove');
} }
@ -46,7 +46,7 @@ export class TargetBasicInfo extends React.Component<any, any> {
}; };
} }
public handleRemoveTarget = () => { public handleRemoveTarget(): void {
alert('remove'); 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({ this.setState({
openAddTarget: true, openAddTarget: true,
}); });
@ -50,7 +50,7 @@ export class Targets extends React.Component<any, any> {
); );
} }
public componentWillMount():void { public componentWillMount(): void {
super.componentWillMount(); super.componentWillMount();
} }
} }
@ -66,13 +66,13 @@ export class TargetTable extends React.Component<any, any> {
list: [], list: [],
}; };
} }
public handleSelect = (selectedTarget: object) => { public handleSelect(selectedTarget: object): void {
this.setState({ this.setState({
selected: selectedTarget, 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 searchWord = data.value.toLowerCase();
let foundTarget = new Array(); let foundTarget = new Array();
for (let target of this.data) { 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(); super.componentWillMount();
this.data = [ this.data = [
{ {