Rearranged rule message UI
Dropdown is at the top, so less likely to push down the pagepull/1016/head
parent
b42c121fc5
commit
9a3377d19a
|
@ -61,6 +61,29 @@ export const RuleMessage = React.createClass({
|
||||||
<div className="kapacitor-rule-section">
|
<div className="kapacitor-rule-section">
|
||||||
<h3 className="rule-section-heading">Alert Message</h3>
|
<h3 className="rule-section-heading">Alert Message</h3>
|
||||||
<div className="rule-section-body">
|
<div className="rule-section-body">
|
||||||
|
<div className="rule-section--item alert-message--endpoint">
|
||||||
|
<div>
|
||||||
|
<p>Send this Alert to:</p>
|
||||||
|
<Dropdown className="dropdown-kapacitor size-136" selected={selectedAlert || 'Choose an output'} items={alerts} onChoose={this.handleChooseAlert} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<RuleMessageAlertConfig
|
||||||
|
updateAlertNodes={actions.updateAlertNodes}
|
||||||
|
alert={selectedAlert}
|
||||||
|
rule={rule}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
selectedAlert === 'smtp' ?
|
||||||
|
<div className="alert-message--email-body">
|
||||||
|
<textarea
|
||||||
|
className="alert-text details"
|
||||||
|
placeholder="Email body text goes here"
|
||||||
|
ref={(r) => this.details = r}
|
||||||
|
onChange={() => actions.updateDetails(rule.id, this.details.value)}
|
||||||
|
value={rule.details}
|
||||||
|
/>
|
||||||
|
</div> : null
|
||||||
|
}
|
||||||
<textarea
|
<textarea
|
||||||
className="alert-text message"
|
className="alert-text message"
|
||||||
ref={(r) => this.message = r}
|
ref={(r) => this.message = r}
|
||||||
|
@ -83,27 +106,6 @@ export const RuleMessage = React.createClass({
|
||||||
}
|
}
|
||||||
<ReactTooltip effect="solid" html={true} offset={{top: -4}} class="influx-tooltip kapacitor-tooltip" />
|
<ReactTooltip effect="solid" html={true} offset={{top: -4}} class="influx-tooltip kapacitor-tooltip" />
|
||||||
</div>
|
</div>
|
||||||
{
|
|
||||||
selectedAlert === 'smtp' ?
|
|
||||||
<textarea
|
|
||||||
className="alert-text details"
|
|
||||||
placeholder="Put email body text here"
|
|
||||||
ref={(r) => this.details = r}
|
|
||||||
onChange={() => actions.updateDetails(rule.id, this.details.value)}
|
|
||||||
value={rule.details}
|
|
||||||
/> : null
|
|
||||||
}
|
|
||||||
<div className="rule-section--item bottom alert-message--endpoint">
|
|
||||||
<div>
|
|
||||||
<p>Send this Alert to:</p>
|
|
||||||
<Dropdown className="dropdown-kapacitor size-136" selected={selectedAlert || 'Choose an output'} items={alerts} onChoose={this.handleChooseAlert} />
|
|
||||||
</div>
|
|
||||||
<RuleMessageAlertConfig
|
|
||||||
updateAlertNodes={actions.updateAlertNodes}
|
|
||||||
alert={selectedAlert}
|
|
||||||
rule={rule}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React, {PropTypes} from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DEFAULT_ALERT_PLACEHOLDERS,
|
DEFAULT_ALERT_PLACEHOLDERS,
|
||||||
|
DEFAULT_ALERT_LABELS,
|
||||||
ALERT_NODES_ACCESSORS,
|
ALERT_NODES_ACCESSORS,
|
||||||
} from '../constants';
|
} from '../constants';
|
||||||
|
|
||||||
|
@ -13,23 +14,22 @@ const RuleMessageAlertConfig = ({
|
||||||
if (!Object.keys(DEFAULT_ALERT_PLACEHOLDERS).find((a) => a === alert)) {
|
if (!Object.keys(DEFAULT_ALERT_PLACEHOLDERS).find((a) => a === alert)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (!Object.keys(DEFAULT_ALERT_LABELS).find((a) => a === alert)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<form className="form-group col-xs-12" style={{marginTop: '8px'}}>
|
<div className="rule-section--item alert-message--config">
|
||||||
<div>
|
<p>{DEFAULT_ALERT_LABELS[alert]}</p>
|
||||||
<label htmlFor="alert-input">{DEFAULT_ALERT_PLACEHOLDERS[alert]}</label>
|
<input
|
||||||
</div>
|
id="alert-input"
|
||||||
<div>
|
className="form-control size-486"
|
||||||
<input
|
type="text"
|
||||||
id="alert-input"
|
placeholder={DEFAULT_ALERT_PLACEHOLDERS[alert]}
|
||||||
className="form-control"
|
name="alertProperty"
|
||||||
type="text"
|
onChange={(evt) => updateAlertNodes(rule.id, alert, evt.target.form.alertProperty.value)}
|
||||||
placeholder={DEFAULT_ALERT_PLACEHOLDERS[alert]}
|
value={ALERT_NODES_ACCESSORS[alert](rule)}
|
||||||
name="alertProperty"
|
/>
|
||||||
onChange={(evt) => updateAlertNodes(rule.id, alert, evt.target.form.alertProperty.value)}
|
</div>
|
||||||
value={ALERT_NODES_ACCESSORS[alert](rule)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,20 @@ export const RULE_MESSAGE_TEMPLATES = {
|
||||||
|
|
||||||
export const DEFAULT_ALERTS = ['http', 'tcp', 'exec'];
|
export const DEFAULT_ALERTS = ['http', 'tcp', 'exec'];
|
||||||
|
|
||||||
|
|
||||||
|
export const DEFAULT_ALERT_LABELS = {
|
||||||
|
http: 'URL:',
|
||||||
|
tcp: 'Address:',
|
||||||
|
exec: 'Add Command (Arguments separated by Spaces):',
|
||||||
|
smtp: 'Email Addresses (Separated by Spaces):',
|
||||||
|
alerta: 'Paste Alerta TICKscript:',
|
||||||
|
};
|
||||||
export const DEFAULT_ALERT_PLACEHOLDERS = {
|
export const DEFAULT_ALERT_PLACEHOLDERS = {
|
||||||
http: 'URL',
|
http: 'http://',
|
||||||
tcp: 'Address',
|
tcp: 'Address:',
|
||||||
exec: 'Add command with arguments separated by spaces',
|
exec: 'Ex: woogie boogie',
|
||||||
smtp: 'Add email addresses separated by spaces',
|
smtp: 'Ex: benedict@domain.com delaney@domain.com susan@domain.com',
|
||||||
alerta: 'Paste Alerta tick script here',
|
alerta: 'alerta()',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ALERT_NODES_ACCESSORS = {
|
export const ALERT_NODES_ACCESSORS = {
|
||||||
|
|
|
@ -401,8 +401,9 @@ div.qeditor.kapacitor-metric-selector {
|
||||||
font-size: $kapacitor-font-sm;
|
font-size: $kapacitor-font-sm;
|
||||||
line-height: 17px;
|
line-height: 17px;
|
||||||
transition:
|
transition:
|
||||||
color 0.25s ease,
|
color 0.25s ease,
|
||||||
border-color 0.25s ease;
|
border-color 0.25s ease;
|
||||||
|
border-radius: 0;
|
||||||
|
|
||||||
@include custom-scrollbar($kapacitor-graphic-color,$kapacitor-accent);
|
@include custom-scrollbar($kapacitor-graphic-color,$kapacitor-accent);
|
||||||
|
|
||||||
|
@ -418,19 +419,12 @@ div.qeditor.kapacitor-metric-selector {
|
||||||
&::-moz-placeholder { color: $g9-mountain; }
|
&::-moz-placeholder { color: $g9-mountain; }
|
||||||
&:-ms-input-placeholder { color: $g9-mountain; }
|
&:-ms-input-placeholder { color: $g9-mountain; }
|
||||||
&:-moz-placeholder { color: $g9-mountain; }
|
&:-moz-placeholder { color: $g9-mountain; }
|
||||||
|
|
||||||
&.message {
|
|
||||||
border-radius: $kap-radius-lg $kap-radius-lg 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.details {
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.alert-message--endpoint {
|
.alert-message--endpoint {
|
||||||
width: auto;
|
width: auto;
|
||||||
border-top: 2px solid $kapacitor-divider-color;
|
border-radius: $kap-radius-lg $kap-radius-lg 0 0;
|
||||||
|
border-bottom: 2px solid $kapacitor-divider-color;
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -447,6 +441,7 @@ div.qeditor.kapacitor-metric-selector {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
border-top: 2px solid $kapacitor-divider-color;
|
border-top: 2px solid $kapacitor-divider-color;
|
||||||
|
border-radius: 0 0 $kap-radius-lg $kap-radius-lg;
|
||||||
|
|
||||||
> p {
|
> p {
|
||||||
margin: 0 ($kap-padding-sm - 2px) 0 0;
|
margin: 0 ($kap-padding-sm - 2px) 0 0;
|
||||||
|
@ -476,6 +471,20 @@ div.qeditor.kapacitor-metric-selector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.alert-message--config {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
border-bottom: 2px solid $kapacitor-divider-color;
|
||||||
|
|
||||||
|
& > p {
|
||||||
|
margin-right: ($kap-padding-sm - 2px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.alert-message--email-body {
|
||||||
|
border-bottom: 2px solid $kapacitor-divider-color;
|
||||||
|
}
|
||||||
|
|
||||||
.rule-section--item {
|
.rule-section--item {
|
||||||
background-color: $kapacitor-graphic-color;
|
background-color: $kapacitor-graphic-color;
|
||||||
|
@ -617,6 +626,14 @@ div.qeditor.kapacitor-metric-selector {
|
||||||
color: $c-honeydew !important;
|
color: $c-honeydew !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.size-486 {
|
||||||
|
width: 486px;
|
||||||
|
}
|
||||||
|
.size-384 {
|
||||||
|
width: 384px;
|
||||||
|
}
|
||||||
.size-256 {
|
.size-256 {
|
||||||
width: 256px;
|
width: 256px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,8 @@ button.btn.btn-sm > span.icon {
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn.disabled,
|
.btn.disabled,
|
||||||
.btn[disabled="true"] {
|
.btn[disabled="true"],
|
||||||
|
.btn[disabled] {
|
||||||
&.btn-success,
|
&.btn-success,
|
||||||
&.btn-success:hover,
|
&.btn-success:hover,
|
||||||
&.btn-success:focus,
|
&.btn-success:focus,
|
||||||
|
|
Loading…
Reference in New Issue