Skip to content

Commit

Permalink
bug fix so that managed channels could be enabled (#1128)
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>

* 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 f05088d commit e3ebc65
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 e3ebc65

Please sign in to comment.