Skip to content

Commit

Permalink
Update branch with new linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
121watts committed Sep 7, 2017
1 parent 43311dc commit df57189
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
7 changes: 6 additions & 1 deletion ui/src/kapacitor/components/KapacitorRulesTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const KapacitorRulesTable = ({rules, source, onDelete, onChangeRuleStatus}) =>
</table>
</div>

const handleDelete = (rule, onDelete) => onDelete(rule)

const RuleRow = ({rule, source, onDelete, onChangeRuleStatus}) =>
<tr key={rule.id}>
<td style={{width: colName}} className="monotype">
Expand Down Expand Up @@ -81,7 +83,10 @@ const RuleRow = ({rule, source, onDelete, onChangeRuleStatus}) =>
>
Edit TICKscript
</Link>
<button className="btn btn-danger btn-xs" onClick={() => onDelete(rule)}>
<button
className="btn btn-danger btn-xs"
onClick={handleDelete(rule, onDelete)}
>
Delete
</button>
</td>
Expand Down
8 changes: 2 additions & 6 deletions ui/src/kapacitor/components/TickscriptEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TickscriptEditor extends Component {
super(props)
}

updateCode(script) {
updateCode = script => {
this.props.onChangeScript(script)
}

Expand All @@ -20,11 +20,7 @@ class TickscriptEditor extends Component {
}

return (
<CodeMirror
value={script}
onChange={::this.updateCode}
options={options}
/>
<CodeMirror value={script} onChange={this.updateCode} options={options} />
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/kapacitor/components/TickscriptID.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TickscriptNewID extends Component {
}
}

handleChangeID(e) {
handleChangeID = e => {
const tickscriptID = e.target.value
this.setState({tickscriptID})
}
Expand All @@ -28,7 +28,7 @@ class TickscriptNewID extends Component {
className="page-header--editing kapacitor-theme"
autoFocus={true}
value={tickscriptID}
onChange={::this.handleChangeID}
onChange={this.handleChangeID}
placeholder="Name your tickscript"
spellCheck={false}
autoComplete={false}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/kapacitor/containers/KapacitorRulesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class KapacitorRulesPage extends Component {
rules={rules}
hasKapacitor={hasKapacitor}
loading={loading}
onDelete={::this.handleDeleteRule}
onChangeRuleStatus={::this.handleRuleStatus}
onDelete={this.handleDeleteRule}
onChangeRuleStatus={this.handleRuleStatus}
/>
)
}
Expand Down
24 changes: 12 additions & 12 deletions ui/src/kapacitor/containers/TickscriptPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TickscriptPage extends Component {
this.setState({kapacitor})
}

async handleSave() {
handleSave = async () => {
const {kapacitor, task} = this.state
const {
source,
Expand All @@ -72,23 +72,23 @@ class TickscriptPage extends Component {
router.push(`/sources/${source.id}/alert-rules`)
}

handleChangeScript(script) {
handleChangeScript = script => {
this.setState({task: {...this.state.task, script}})
}

handleSelectDbrps(dbrps) {
handleSelectDbrps = dbrps => {
this.setState({task: {...this.state.task, dbrps}})
}

handleChangeType(type) {
handleChangeType = type => {
return () => this.setState({task: {...this.state.task, type}})
}

handleStartEditID() {
handleStartEditID = () => {
this.setState({isEditingID: true})
}

handleStopEditID() {
handleStopEditID = () => {
this.setState({isEditingID: false})
}

Expand All @@ -103,12 +103,12 @@ class TickscriptPage extends Component {
validation={validation}
isEditingID={isEditingID}
isNewTickscript={!this._isEditing()}
onSave={::this.handleSave}
onStartEditID={::this.handleStartEditID}
onStopEditID={::this.handleStopEditID}
onSelectDbrps={::this.handleSelectDbrps}
onChangeScript={::this.handleChangeScript}
onChangeType={::this.handleChangeType}
onSave={this.handleSave}
onStartEditID={this.handleStartEditID}
onStopEditID={this.handleStopEditID}
onSelectDbrps={this.handleSelectDbrps}
onChangeScript={this.handleChangeScript}
onChangeType={this.handleChangeType}
/>
)
}
Expand Down

0 comments on commit df57189

Please sign in to comment.