From 29dadcc07fca347f6eb1f88dd43b807cbebe40be Mon Sep 17 00:00:00 2001 From: Maxim Mordasov Date: Mon, 29 Jan 2024 17:15:56 +0300 Subject: [PATCH] Show warning when edit AM-based resolve templates (#3764) # What this PR does show autoresolve template for ALL integrations when autoresolve is ON show modal on edit button click for alertmanager based integrations Screenshot 2024-01-29 at 13 37 08 ## Which issue(s) this PR fixes Frontend part of https://github.com/grafana/oncall-private/issues/2260 ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --------- Co-authored-by: Vadim Stepanov --- CHANGELOG.md | 1 + .../Integrations/IntegrationTemplateBlock.tsx | 27 +++++++--- .../components/WithConfirm/WithConfirm.tsx | 18 +++++-- .../IntegrationTemplatesList.tsx | 52 ++++++------------- 4 files changed, 52 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e981536f..bdf2b257 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Improved logging during plugin sync and install with Grafana @mderynck ([#3730](https://github.com/grafana/oncall/pull/3730)) +- Add a modal for autoresolve and grouping templates for Alertmanager-based integrations ([#3764](https://github.com/grafana/oncall/pull/3764)) ### Fixed diff --git a/grafana-plugin/src/components/Integrations/IntegrationTemplateBlock.tsx b/grafana-plugin/src/components/Integrations/IntegrationTemplateBlock.tsx index 889eb9d2..ff77ac4f 100644 --- a/grafana-plugin/src/components/Integrations/IntegrationTemplateBlock.tsx +++ b/grafana-plugin/src/components/Integrations/IntegrationTemplateBlock.tsx @@ -1,8 +1,9 @@ import React from 'react'; -import { Button, InlineLabel, LoadingPlaceholder, Tooltip } from '@grafana/ui'; +import { Button, InlineLabel, LoadingPlaceholder } from '@grafana/ui'; import cn from 'classnames/bind'; +import WithConfirm from 'components/WithConfirm/WithConfirm'; import { WithPermissionControlTooltip } from 'containers/WithPermissionControl/WithPermissionControlTooltip'; import { UserActions } from 'utils/authorization'; @@ -17,6 +18,7 @@ interface IntegrationTemplateBlockProps { renderInput: () => React.ReactNode; showHelp?: boolean; isLoading?: boolean; + warningOnEdit?: string; onEdit: (templateName) => void; onRemove?: () => void; @@ -31,6 +33,7 @@ const IntegrationTemplateBlock: React.FC = ({ onEdit, onRemove, isLoading, + warningOnEdit, }) => { let tooltip = labelTooltip; let inlineLabelProps = { tooltip }; @@ -48,14 +51,24 @@ const IntegrationTemplateBlock: React.FC = ({ {isTemplateEditable && ( <> - -