Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor alert bug fixes #4274

Merged
merged 2 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions client/app/pages/alert/AlertEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ import Query from './components/Query';

import HorizontalFormItem from './components/HorizontalFormItem';

const spinnerIcon = <i className="fa fa-spinner fa-pulse m-r-5" />;

export default class AlertEdit extends React.Component {
_isMounted = false;

state = {
saving: false,
canceling: false,
}

componentDidMount() {
Expand All @@ -43,25 +40,24 @@ export default class AlertEdit extends React.Component {
}

cancel = () => {
this.setState({ canceling: true });
this.props.cancel();
};

render() {
const { alert, queryResult, pendingRearm, onNotificationTemplateChange, menuButton } = this.props;
const { onQuerySelected, onNameChange, onRearmChange, onCriteriaChange } = this.props;
const { query, name, options } = alert;
const { saving, canceling } = this.state;
const { saving } = this.state;

return (
<>
<Title name={name} alert={alert} onChange={onNameChange} editMode>
<Button className="m-r-5" onClick={() => this.cancel()}>
{canceling ? spinnerIcon : <i className="fa fa-times m-r-5" />}
<i className="fa fa-times m-r-5" />
Cancel
</Button>
<Button type="primary" onClick={() => this.save()}>
{saving ? spinnerIcon : <i className="fa fa-check m-r-5" />}
{saving ? <i className="fa fa-spinner fa-pulse m-r-5" /> : <i className="fa fa-check m-r-5" />}
Save Changes
</Button>
{menuButton}
Expand Down Expand Up @@ -101,9 +97,11 @@ export default class AlertEdit extends React.Component {
</>
)}
</Form>
<HelpTrigger className="f-13" type="ALERT_SETUP">
Setup Instructions <i className="fa fa-question-circle" />
</HelpTrigger>
<div>
<HelpTrigger className="f-13" type="ALERT_SETUP">
Setup Instructions <i className="fa fa-question-circle" />
</HelpTrigger>
</div>
</div>
</div>
</>
Expand Down
9 changes: 2 additions & 7 deletions client/app/pages/alert/AlertView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Alert as AlertType } from '@/components/proptypes';

import Form from 'antd/lib/form';
import Button from 'antd/lib/button';
import Icon from 'antd/lib/icon';
import Tooltip from 'antd/lib/tooltip';

import Title from './components/Title';
Expand Down Expand Up @@ -46,6 +45,7 @@ AlertState.defaultProps = {
lastTriggered: null,
};

// eslint-disable-next-line react/prefer-stateless-function
export default class AlertView extends React.Component {
kravets-levko marked this conversation as resolved.
Show resolved Hide resolved
render() {
const { alert, queryResult, canEdit, onEdit, menuButton } = this.props;
Expand All @@ -66,13 +66,8 @@ export default class AlertView extends React.Component {
<AlertState state={alert.state} lastTriggered={alert.last_triggered_at} />
</HorizontalFormItem>
<HorizontalFormItem label="Query">
<Query query={query} queryResult={queryResult} onChange={this.onQuerySelected} />
<Query query={query} queryResult={queryResult} />
</HorizontalFormItem>
{query && !queryResult && (
<HorizontalFormItem className="m-t-30">
<Icon type="loading" className="m-r-5" /> Loading query data
</HorizontalFormItem>
)}
{queryResult && options && (
<>
<HorizontalFormItem label="Trigger when" className="alert-criteria">
Expand Down