Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 0 additions & 10 deletions x-pack/plugins/alerting/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,6 @@ export class AlertingPlugin {
muteAlertInstanceRoute(router, this.licenseState);
unmuteAlertInstanceRoute(router, this.licenseState);

alertTypeRegistry.register({
id: 'test',
actionGroups: [{ id: 'default', name: 'Default' }],
defaultActionGroupId: 'default',
name: 'Test',
executor: async options => {
return { status: 'ok' };
},
});

return {
registerType: alertTypeRegistry.register.bind(alertTypeRegistry),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ describe('alerts_list component with items', () => {
alertTypeRegistry: alertTypeRegistry as any,
};

alertTypeRegistry.has.mockReturnValue(true);

wrapper = mountWithIntl(
<AppContextProvider appDeps={deps}>
<AlertsList />
Expand All @@ -257,11 +259,15 @@ describe('alerts_list component with items', () => {
expect(loadActionTypes).toHaveBeenCalled();
}

it('renders table of connectors', async () => {
it('renders table of alerts', async () => {
await setup();
expect(wrapper.find('EuiBasicTable')).toHaveLength(1);
expect(wrapper.find('EuiTableRow')).toHaveLength(2);
});
it('renders edit button for registered alert types', async () => {
await setup();
expect(wrapper.find('[data-test-subj="alertsTableCell-editLink"]').length).toBeGreaterThan(0);
});
});

describe('alerts_list component empty with show only capability', () => {
Expand Down Expand Up @@ -455,6 +461,8 @@ describe('alerts_list with show only capability', () => {
alertTypeRegistry: alertTypeRegistry as any,
};

alertTypeRegistry.has.mockReturnValue(false);

wrapper = mountWithIntl(
<AppContextProvider appDeps={deps}>
<AlertsList />
Expand All @@ -473,4 +481,8 @@ describe('alerts_list with show only capability', () => {
expect(wrapper.find('EuiTableRow')).toHaveLength(2);
// TODO: check delete button
});
it('not renders edit button for non registered alert types', async () => {
await setup();
expect(wrapper.find('[data-test-subj="alertsTableCell-editLink"]').length).toBe(0);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export const AlertsList: React.FunctionComponent = () => {
? [
{
render: (item: AlertTableItem) => {
return (
return alertTypeRegistry.has(item.alertTypeId) ? (
<EuiLink
data-test-subj="alertsTableCell-editLink"
color="primary"
Expand All @@ -236,6 +236,8 @@ export const AlertsList: React.FunctionComponent = () => {
id="xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.editLinkTitle"
/>
</EuiLink>
) : (
<></>
);
},
},
Expand Down