Skip to content

Commit

Permalink
fix: redirect routes when closing modals (#1280)
Browse files Browse the repository at this point in the history
  • Loading branch information
minghay authored Dec 5, 2024
1 parent 32b0e3a commit bdd6687
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
21 changes: 16 additions & 5 deletions app/components/pipeline/modal/confirm-action/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,22 @@ export default class PipelineModalConfirmActionComponent extends Component {
.fetchFromApi('post', '/events', data)
.then(event => {
this.args.closeModal();
this.router.transitionTo('v2.pipeline.events.show', {
event,
reloadEventRail: true,
id: event.id
});

if (this.router.currentRouteName === 'v2.pipeline.events.show') {
this.router.transitionTo('v2.pipeline.events.show', {
event,
reloadEventRail: true,
id: event.id
});
} else if (this.router.currentRouteName === 'v2.pipeline.pulls.show') {
this.router.transitionTo('v2.pipeline.pulls.show', {
event,
reloadEventRail: true,
id: event.prNum,
pull_request_number: event.prNum,
sha: event.sha
});
}
})
.catch(err => {
this.wasActionSuccessful = false;
Expand Down
21 changes: 16 additions & 5 deletions app/components/pipeline/modal/start-event/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,22 @@ export default class PipelineModalStartEventComponent extends Component {
.fetchFromApi('post', '/events', data)
.then(event => {
this.args.closeModal();
this.router.transitionTo('v2.pipeline.events.show', {
event,
reloadEventRail: true,
id: event.id
});

if (this.router.currentRouteName === 'v2.pipeline.events.show') {
this.router.transitionTo('v2.pipeline.events.show', {
event,
reloadEventRail: true,
id: event.id
});
} else if (this.router.currentRouteName === 'v2.pipeline.pulls.show') {
this.router.transitionTo('v2.pipeline.pulls.show', {
event,
reloadEventRail: true,
id: event.prNum,
pull_request_number: event.prNum,
sha: event.sha
});
}
})
.catch(err => {
this.wasActionSuccessful = false;
Expand Down

0 comments on commit bdd6687

Please sign in to comment.