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
* bug fix so that managed channels could be enabled

Signed-off-by: Riya Saxena <riysaxen@amazon.com>

* bug fix so that managed channels could be enabled

Signed-off-by: Riya Saxena <riysaxen@amazon.com>

---------

Signed-off-by: Riya Saxena <riysaxen@amazon.com>
  • Loading branch information
riysaxen-amzn authored Oct 17, 2024
1 parent 62eac78 commit abd7944
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 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 @@ -578,7 +578,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
2 changes: 1 addition & 1 deletion public/pages/Main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Main extends Component {

handleDataSourceChange = ([dataSource]) => {
const dataSourceId = dataSource?.id;
const dataSourceLabel = dataSource?.label
const dataSourceLabel = dataSource?.label;
if (this.props.dataSourceEnabled && dataSourceId === undefined) {
getNotifications().toasts.addDanger('Unable to set data source.');
} else if (this.state.selectedDataSourceId != dataSourceId) {
Expand Down

0 comments on commit abd7944

Please sign in to comment.