Polish alert rules table
parent
94f24c1fcb
commit
15feae2184
|
@ -63,8 +63,8 @@ const KapacitorRules = ({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const PageContents = ({children, source, tickscript, onCloseTickscript}) => (
|
const PageContents = ({children, source, tickscript, onCloseTickscript}) =>
|
||||||
<div>
|
<div className="page">
|
||||||
<div className="page-header">
|
<div className="page-header">
|
||||||
<div className="page-header__container">
|
<div className="page-header__container">
|
||||||
<div className="page-header__left">
|
<div className="page-header__left">
|
||||||
|
@ -93,7 +93,6 @@ const PageContents = ({children, source, tickscript, onCloseTickscript}) => (
|
||||||
/>
|
/>
|
||||||
: null}
|
: null}
|
||||||
</div>
|
</div>
|
||||||
)
|
|
||||||
|
|
||||||
const {arrayOf, bool, func, node, shape, string} = PropTypes
|
const {arrayOf, bool, func, node, shape, string} = PropTypes
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,33 @@
|
||||||
import React, {PropTypes} from 'react'
|
import React, {PropTypes} from 'react'
|
||||||
import {Link} from 'react-router'
|
import {Link} from 'react-router'
|
||||||
|
|
||||||
|
import {KAPACITOR_RULES_TABLE} from 'src/kapacitor/constants/tableSizing'
|
||||||
|
const {
|
||||||
|
colName,
|
||||||
|
colType,
|
||||||
|
colMessage,
|
||||||
|
colAlerts,
|
||||||
|
colEnabled,
|
||||||
|
colActions,
|
||||||
|
} = KAPACITOR_RULES_TABLE
|
||||||
|
|
||||||
const KapacitorRulesTable = ({
|
const KapacitorRulesTable = ({
|
||||||
rules,
|
rules,
|
||||||
source,
|
source,
|
||||||
onDelete,
|
onDelete,
|
||||||
onReadTickscript,
|
onReadTickscript,
|
||||||
onChangeRuleStatus,
|
onChangeRuleStatus,
|
||||||
}) => (
|
}) =>
|
||||||
<div className="panel-body">
|
<div className="panel-body">
|
||||||
<table className="table v-center">
|
<table className="table v-center">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th style={{width: colName}}>Name</th>
|
||||||
<th>Rule Type</th>
|
<th style={{width: colType}}>Rule Type</th>
|
||||||
<th>Message</th>
|
<th style={{width: colMessage}}>Message</th>
|
||||||
<th>Alerts</th>
|
<th style={{width: colAlerts}}>Alerts</th>
|
||||||
<th className="text-center">Enabled</th>
|
<th style={{width: colEnabled}} className="text-center">Enabled</th>
|
||||||
<th />
|
<th style={{width: colActions}} />
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -36,17 +46,25 @@ const KapacitorRulesTable = ({
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
)
|
|
||||||
|
|
||||||
const RuleRow = ({rule, source, onRead, onDelete, onChangeRuleStatus}) => (
|
const RuleRow = ({rule, source, onRead, onDelete, onChangeRuleStatus}) =>
|
||||||
<tr key={rule.id}>
|
<tr key={rule.id}>
|
||||||
<td className="monotype">
|
<td style={{width: colName}} className="monotype">
|
||||||
<RuleTitle rule={rule} source={source} />
|
<RuleTitle rule={rule} source={source} />
|
||||||
</td>
|
</td>
|
||||||
<td className="monotype">{rule.trigger}</td>
|
<td style={{width: colType}} className="monotype">{rule.trigger}</td>
|
||||||
<td className="monotype">{rule.message}</td>
|
<td className="monotype">
|
||||||
<td className="monotype">{rule.alerts.join(', ')}</td>
|
<span
|
||||||
<td className="monotype text-center">
|
className="table-cell-nowrap"
|
||||||
|
style={{display: 'inline-block', maxWidth: colMessage}}
|
||||||
|
>
|
||||||
|
{rule.message}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td style={{width: colAlerts}} className="monotype">
|
||||||
|
{rule.alerts.join(', ')}
|
||||||
|
</td>
|
||||||
|
<td style={{width: colEnabled}} className="monotype text-center">
|
||||||
<div className="dark-checkbox">
|
<div className="dark-checkbox">
|
||||||
<input
|
<input
|
||||||
id={`kapacitor-enabled ${rule.id}`}
|
id={`kapacitor-enabled ${rule.id}`}
|
||||||
|
@ -58,7 +76,7 @@ const RuleRow = ({rule, source, onRead, onDelete, onChangeRuleStatus}) => (
|
||||||
<label htmlFor={`kapacitor-enabled ${rule.id}`} />
|
<label htmlFor={`kapacitor-enabled ${rule.id}`} />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="text-right" style={{display: 'flex'}}>
|
<td style={{width: colActions}} className="text-right table-cell-nowrap">
|
||||||
<button className="btn btn-info btn-xs" onClick={() => onRead(rule)}>
|
<button className="btn btn-info btn-xs" onClick={() => onRead(rule)}>
|
||||||
View TICKscript
|
View TICKscript
|
||||||
</button>
|
</button>
|
||||||
|
@ -67,7 +85,6 @@ const RuleRow = ({rule, source, onRead, onDelete, onChangeRuleStatus}) => (
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)
|
|
||||||
|
|
||||||
const RuleTitle = ({rule: {id, name, query}, source}) => {
|
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
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
export const KAPACITOR_RULES_TABLE = {
|
||||||
|
colName: '200px',
|
||||||
|
colType: '90px',
|
||||||
|
colMessage: '460px',
|
||||||
|
colAlerts: '120px',
|
||||||
|
colEnabled: '64px',
|
||||||
|
colActions: '176px',
|
||||||
|
}
|
|
@ -55,7 +55,6 @@ class KapacitorRulesPage extends Component {
|
||||||
const {hasKapacitor, loading, tickscript} = this.state
|
const {hasKapacitor, loading, tickscript} = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
|
||||||
<KapacitorRules
|
<KapacitorRules
|
||||||
source={source}
|
source={source}
|
||||||
rules={rules}
|
rules={rules}
|
||||||
|
@ -67,7 +66,6 @@ class KapacitorRulesPage extends Component {
|
||||||
tickscript={tickscript}
|
tickscript={tickscript}
|
||||||
onCloseTickscript={this.handleCloseTickscript}
|
onCloseTickscript={this.handleCloseTickscript}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,3 +261,14 @@ $table-tab-scrollbar-height: 6px;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
No Wrap Cells
|
||||||
|
----------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
table .table-cell-nowrap {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue