Skip to content

Commit

Permalink
MDS Bug fix when configuring a Trigger Action in Create Monitor (#1127)…
Browse files Browse the repository at this point in the history
… (#1129)

* bug fix so that managed channels could be enabled



* bug fix so that managed channels could be enabled



---------


(cherry picked from commit abd7944)

Signed-off-by: Riya Saxena <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 7c3ff55 commit 42e8906
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { EuiSmallButton, EuiSmallButtonEmpty, EuiEmptyPrompt, EuiText } from '@e
import { APP_PATH } from '../../../../utils/constants';
import { MONITORS_NAV_ID } from '../../../../../utils/constants';
import { getUseUpdatedUx } from '../../../../services';
import { getURL } from '../../../utils/helpers';

const createMonitorText =
'There are no existing alerts. Create a monitor to add triggers and actions. Once an alarm is triggered, the state will show in this table.';
Expand All @@ -18,10 +19,13 @@ const createTriggerText =
const editTriggerConditionsText =
'There are no existing alerts. Adjust trigger conditions to start alerting. Once an alarm is triggered, the state will show in this table.';

const getCreateMonitorButton = () => (
const getCreateMonitorButton = (landingDataSourceId) => (
<EuiSmallButton
fill
href={`${getUseUpdatedUx() ? MONITORS_NAV_ID : ''}#${APP_PATH.CREATE_MONITOR}`}
href={getURL(
`${getUseUpdatedUx() ? MONITORS_NAV_ID : ''}#${APP_PATH.CREATE_MONITOR}`,
landingDataSourceId
)}
>
Create monitor
</EuiSmallButton>
Expand All @@ -30,7 +34,7 @@ const editMonitorButton = (onCreateTrigger) => (
<EuiSmallButtonEmpty onClick={onCreateTrigger}>Edit monitor</EuiSmallButtonEmpty>
);

const DashboardEmptyPrompt = ({ onCreateTrigger, isModal = false }) => {
const DashboardEmptyPrompt = ({ onCreateTrigger, landingDataSourceId, isModal = false }) => {
const inMonitorDetails = typeof onCreateTrigger === 'function';
const displayText = isModal
? editTriggerConditionsText
Expand All @@ -41,7 +45,7 @@ const DashboardEmptyPrompt = ({ onCreateTrigger, isModal = false }) => {
? undefined
: isModal
? editMonitorButton(onCreateTrigger)
: getCreateMonitorButton();
: getCreateMonitorButton(landingDataSourceId);
return (
<EuiEmptyPrompt
style={{ maxWidth: '45em' }}
Expand All @@ -57,6 +61,7 @@ const DashboardEmptyPrompt = ({ onCreateTrigger, isModal = false }) => {

DashboardEmptyPrompt.propTypes = {
onCreateTrigger: PropTypes.func,
landingDataSourceId: PropTypes.string
};

export default DashboardEmptyPrompt;
7 changes: 6 additions & 1 deletion public/pages/Dashboard/containers/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,12 @@ export default class Dashboard extends Component {
isSelectable={true}
selection={selection}
onChange={this.onTableChange}
noItemsMessage={<DashboardEmptyPrompt onCreateTrigger={onCreateTrigger} />}
noItemsMessage={
<DashboardEmptyPrompt
onCreateTrigger={onCreateTrigger}
landingDataSourceId={this.props.landingDataSourceId}
/>
}
data-test-subj={'alertsDashboard_table'}
/>

Expand Down

0 comments on commit 42e8906

Please sign in to comment.