Browse Source

feat(alerts): Add page title to metric alert edit page (#33700)

Scott Cooper 2 years ago
parent
commit
7a07f9d92c
1 changed files with 14 additions and 0 deletions
  1. 14 0
      static/app/views/alerts/incidentRules/details.tsx

+ 14 - 0
static/app/views/alerts/incidentRules/details.tsx

@@ -5,6 +5,7 @@ import Alert from 'sentry/components/alert';
 import {t} from 'sentry/locale';
 import {Organization, Project} from 'sentry/types';
 import {metric} from 'sentry/utils/analytics';
+import routeTitleGen from 'sentry/utils/routeTitle';
 import RuleForm from 'sentry/views/alerts/incidentRules/ruleForm';
 import {IncidentRule} from 'sentry/views/alerts/incidentRules/types';
 import AsyncView from 'sentry/views/asyncView';
@@ -35,6 +36,19 @@ class IncidentRulesDetails extends AsyncView<Props, State> {
     };
   }
 
+  getTitle(): string {
+    const {organization, project} = this.props;
+    const {rule} = this.state;
+    const ruleName = rule?.name;
+
+    return routeTitleGen(
+      ruleName ? t('Alert %s', ruleName) : '',
+      organization.slug,
+      false,
+      project?.slug
+    );
+  }
+
   getEndpoints(): ReturnType<AsyncView['getEndpoints']> {
     const {orgId, ruleId} = this.props.params;