Browse Source

fix(alerts): Consolidate delete alert modal copy (#54132)

Scott Cooper 1 year ago
parent
commit
3a5f086636

+ 4 - 4
static/app/views/alerts/list/rules/row.tsx

@@ -215,10 +215,10 @@ function RuleListRow({
       onAction: () => {
         openConfirmModal({
           onConfirm: () => onDelete(slug, rule),
-          header: t('Delete Alert Rule?'),
-          message: tct(
-            "Are you sure you want to delete [name]? You won't be able to view the history of this alert once it's deleted.",
-            {name: rule.name}
+          header: <h5>{t('Delete Alert Rule?')}</h5>,
+          message: t(
+            'Are you sure you want to delete "%s"? You won\'t be able to view the history of this alert once it\'s deleted.',
+            rule.name
           ),
           confirmText: t('Delete Rule'),
           priority: 'danger',

+ 1 - 1
static/app/views/alerts/rules/issue/index.spec.tsx

@@ -223,7 +223,7 @@ describe('IssueRuleEditor', function () {
       await userEvent.click(screen.getByLabelText('Delete Rule'));
 
       expect(
-        await screen.findByText('Are you sure you want to delete this rule?')
+        await screen.findByText(/Are you sure you want to delete "My alert rule"\?/)
       ).toBeInTheDocument();
       await userEvent.click(screen.getByTestId('confirm-button'));
 

+ 5 - 2
static/app/views/alerts/rules/issue/index.tsx

@@ -1189,8 +1189,11 @@ class IssueRuleEditor extends DeprecatedAsyncView<Props, State> {
                 priority="danger"
                 confirmText={t('Delete Rule')}
                 onConfirm={this.handleDeleteRule}
-                header={t('Delete Rule')}
-                message={t('Are you sure you want to delete this rule?')}
+                header={<h5>{t('Delete Alert Rule?')}</h5>}
+                message={t(
+                  'Are you sure you want to delete "%s"? You won\'t be able to view the history of this alert once it\'s deleted.',
+                  rule.name
+                )}
               >
                 <Button priority="danger">{t('Delete Rule')}</Button>
               </Confirm>

+ 5 - 2
static/app/views/alerts/rules/metric/ruleForm.tsx

@@ -984,8 +984,11 @@ class RuleFormContainer extends DeprecatedAsyncComponent<Props, State> {
             rule.id ? (
               <Confirm
                 disabled={formDisabled}
-                message={t('Are you sure you want to delete this alert rule?')}
-                header={t('Delete Alert Rule?')}
+                message={t(
+                  'Are you sure you want to delete "%s"? You won\'t be able to view the history of this alert once it\'s deleted.',
+                  rule.name
+                )}
+                header={<h5>{t('Delete Alert Rule?')}</h5>}
                 priority="danger"
                 confirmText={t('Delete Rule')}
                 onConfirm={this.handleDeleteRule}