Skip to content

Commit 1bf55bf

Browse files
billyvgNisanthan Nanthakumar
authored and
Nisanthan Nanthakumar
committed
fix(ui): Fix redirect after creating/editing Metric Alert rules (#16342)
Also makes sure that the index redirects to combined alert listing view.
1 parent 35a3b82 commit 1bf55bf

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/sentry/static/sentry/app/routes.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ function routes() {
287287
/>
288288

289289
<Route path="issue-rules/" component={null}>
290+
<IndexRedirect to="/settings/:orgId/projects/:projectId/alerts-v2/" />
290291
<Route
291292
path="new/"
292293
name="New Alert Rule"
@@ -306,6 +307,7 @@ function routes() {
306307
</Route>
307308

308309
<Route path="metric-rules/" component={null}>
310+
<IndexRedirect to="/settings/:orgId/projects/:projectId/alerts-v2/" />
309311
<Route
310312
name="New Incident Rule"
311313
path="new/"

src/sentry/static/sentry/app/views/settings/incidentRules/create.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class IncidentRulesCreate extends React.Component<Props> {
2525
handleSubmitSuccess = () => {
2626
const {params, routes, router, location} = this.props;
2727

28-
router.push(recreateRoute('metric-rules/', {params, routes, location, stepBack: -1}));
28+
router.push(recreateRoute('', {params, routes, location, stepBack: -1}));
2929
};
3030

3131
render() {

src/sentry/static/sentry/app/views/settings/incidentRules/details.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {addErrorMessage} from 'app/actionCreators/indicator';
77
import {t} from 'app/locale';
88
import AsyncView from 'app/views/asyncView';
99
import RuleForm from 'app/views/settings/incidentRules/ruleForm';
10+
import recreateRoute from 'app/utils/recreateRoute';
1011
import withOrganization from 'app/utils/withOrganization';
1112

1213
type RouteParams = {
@@ -43,6 +44,12 @@ class IncidentRulesDetails extends AsyncView<Props, State> {
4344
];
4445
}
4546

47+
handleSubmitSuccess = () => {
48+
const {params, routes, router, location} = this.props;
49+
50+
router.push(recreateRoute('', {params, routes, location, stepBack: -2}));
51+
};
52+
4653
// XXX(billy): This is temporary, ideally we want actions fetched with triggers?
4754
onRequestSuccess = async ({data}) => {
4855
const {orgId, incidentRuleId} = this.props.params;
@@ -91,6 +98,7 @@ class IncidentRulesDetails extends AsyncView<Props, State> {
9198
{...this.props}
9299
incidentRuleId={incidentRuleId}
93100
rule={this.getActions(rule, this.state.actions)}
101+
onSubmitSuccess={this.handleSubmitSuccess}
94102
/>
95103
);
96104
}

0 commit comments

Comments
 (0)