diff --git a/public/app/features/alerting/unified/components/contact-points/ContactPoints.test.tsx b/public/app/features/alerting/unified/components/contact-points/ContactPoints.test.tsx
index fde20c0fadc..c6fd8c71ca7 100644
--- a/public/app/features/alerting/unified/components/contact-points/ContactPoints.test.tsx
+++ b/public/app/features/alerting/unified/components/contact-points/ContactPoints.test.tsx
@@ -127,6 +127,11 @@ describe('contact points', () => {
const deleteButton = await screen.queryByRole('menuitem', { name: 'delete' });
expect(deleteButton).toBeDisabled();
}
+
+ // check buttons in Notification Templates
+ const notificationTemplatesTab = screen.getByRole('tab', { name: 'Tab Notification Templates' });
+ await userEvent.click(notificationTemplatesTab);
+ expect(screen.getByRole('link', { name: 'Add notification template' })).toHaveAttribute('aria-disabled', 'true');
});
it('should call delete when clicked and not disabled', async () => {
@@ -326,6 +331,11 @@ describe('contact points', () => {
const viewProvisioned = screen.getByRole('link', { name: 'view-action' });
expect(viewProvisioned).toBeInTheDocument();
expect(viewProvisioned).not.toBeDisabled();
+
+ // check buttons in Notification Templates
+ const notificationTemplatesTab = screen.getByRole('tab', { name: 'Tab Notification Templates' });
+ await userEvent.click(notificationTemplatesTab);
+ expect(screen.queryByRole('link', { name: 'Add notification template' })).not.toBeInTheDocument();
});
});
});
diff --git a/public/app/features/alerting/unified/components/contact-points/ContactPoints.tsx b/public/app/features/alerting/unified/components/contact-points/ContactPoints.tsx
index e8bb3de0935..e9ff52e3f0f 100644
--- a/public/app/features/alerting/unified/components/contact-points/ContactPoints.tsx
+++ b/public/app/features/alerting/unified/components/contact-points/ContactPoints.tsx
@@ -81,6 +81,9 @@ const ContactPoints = () => {
const [exportContactPointsSupported, exportContactPointsAllowed] = useAlertmanagerAbility(
AlertmanagerAction.ExportContactPoint
);
+ const [createTemplateSupported, createTemplateAllowed] = useAlertmanagerAbility(
+ AlertmanagerAction.CreateNotificationTemplate
+ );
const [DeleteModal, showDeleteModal] = useDeleteContactPointModal(deleteTrigger, updateAlertmanagerState.isLoading);
const [ExportDrawer, showExportDrawer] = useExportContactPoint();
@@ -177,9 +180,16 @@ const ContactPoints = () => {
Create notification templates to customize your notifications.
-
- Add notification template
-
+ {createTemplateSupported && (
+
+ Add notification template
+
+ )}
>