Fix link
parent
acd5425ddb
commit
315ca27b67
|
@ -1,7 +1,7 @@
|
||||||
import React, {PropTypes} from 'react'
|
import React, {PropTypes} from 'react'
|
||||||
import {Link} from 'react-router'
|
import {Link} from 'react-router'
|
||||||
|
|
||||||
const KapacitorRulesTable = ({rules, onDelete, onChangeRuleStatus}) => (
|
const KapacitorRulesTable = ({rules, source, onDelete, onChangeRuleStatus}) => (
|
||||||
<div className="panel-body">
|
<div className="panel-body">
|
||||||
<table className="table v-center">
|
<table className="table v-center">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -20,6 +20,7 @@ const KapacitorRulesTable = ({rules, onDelete, onChangeRuleStatus}) => (
|
||||||
<RuleRow
|
<RuleRow
|
||||||
key={rule.id}
|
key={rule.id}
|
||||||
rule={rule}
|
rule={rule}
|
||||||
|
source={source}
|
||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
onChangeRuleStatus={onChangeRuleStatus}
|
onChangeRuleStatus={onChangeRuleStatus}
|
||||||
/>
|
/>
|
||||||
|
@ -30,10 +31,10 @@ const KapacitorRulesTable = ({rules, onDelete, onChangeRuleStatus}) => (
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const RuleRow = ({rule, onDelete, onChangeRuleStatus}) => (
|
const RuleRow = ({rule, source, onDelete, onChangeRuleStatus}) => (
|
||||||
<tr key={rule.id}>
|
<tr key={rule.id}>
|
||||||
<td className="monotype">
|
<td className="monotype">
|
||||||
<RuleTitle rule={rule} />
|
<RuleTitle rule={rule} source={source} />
|
||||||
</td>
|
</td>
|
||||||
<td className="monotype">{rule.trigger}</td>
|
<td className="monotype">{rule.trigger}</td>
|
||||||
<td className="monotype">{rule.message}</td>
|
<td className="monotype">{rule.message}</td>
|
||||||
|
@ -58,13 +59,13 @@ const RuleRow = ({rule, onDelete, onChangeRuleStatus}) => (
|
||||||
</tr>
|
</tr>
|
||||||
)
|
)
|
||||||
|
|
||||||
const RuleTitle = ({rule: {name, links, query}}) => {
|
const RuleTitle = ({rule: {id, name, query}, source}) => {
|
||||||
// no queryConfig means the rule was manually created outside of Chronograf
|
// no queryConfig means the rule was manually created outside of Chronograf
|
||||||
if (!query) {
|
if (!query) {
|
||||||
return <i>{name}</i>
|
return <i>{name}</i>
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Link to={links.self}>{name}</Link>
|
return <Link to={`/sources/${source.id}/alert-rules/${id}`}>{name}</Link>
|
||||||
}
|
}
|
||||||
|
|
||||||
const {arrayOf, func, shape, string} = PropTypes
|
const {arrayOf, func, shape, string} = PropTypes
|
||||||
|
@ -73,6 +74,9 @@ KapacitorRulesTable.propTypes = {
|
||||||
rules: arrayOf(shape()),
|
rules: arrayOf(shape()),
|
||||||
onChangeRuleStatus: func,
|
onChangeRuleStatus: func,
|
||||||
onDelete: func,
|
onDelete: func,
|
||||||
|
source: shape({
|
||||||
|
id: string.isRequired,
|
||||||
|
}).isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
RuleRow.propTypes = {
|
RuleRow.propTypes = {
|
||||||
|
@ -90,6 +94,9 @@ RuleTitle.propTypes = {
|
||||||
self: string.isRequired,
|
self: string.isRequired,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
}),
|
}),
|
||||||
|
source: shape({
|
||||||
|
id: string.isRequired,
|
||||||
|
}).isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default KapacitorRulesTable
|
export default KapacitorRulesTable
|
||||||
|
|
Loading…
Reference in New Issue