diff options
-rw-r--r-- | server/sonar-web/src/main/js/apps/permission-templates/components/Header.js | 17 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/permission-templates/views/CreateView.js | 4 |
2 files changed, 16 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Header.js b/server/sonar-web/src/main/js/apps/permission-templates/components/Header.js index b22b9387f3e..97590dc0ce3 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/Header.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Header.js @@ -28,6 +28,10 @@ export default class Header extends React.Component { refresh: CallbackType }; + static contextTypes = { + router: React.PropTypes.object + }; + componentWillMount () { this.handleCreateClick = this.handleCreateClick.bind(this); } @@ -35,9 +39,16 @@ export default class Header extends React.Component { handleCreateClick (e) { e.preventDefault(); - new CreateView({ - refresh: this.props.refresh - }).render(); + new CreateView() + .on('done', r => { + this.props.refresh().then(() => { + this.context.router.push({ + pathname: '/', + query: { id: r.permissionTemplate.id } + }) + }); + }) + .render(); } render () { diff --git a/server/sonar-web/src/main/js/apps/permission-templates/views/CreateView.js b/server/sonar-web/src/main/js/apps/permission-templates/views/CreateView.js index 516373a0aa9..bd6ad52409f 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/views/CreateView.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/views/CreateView.js @@ -34,8 +34,8 @@ export default FormView.extend({ // do not show global error 400: null } - }).done(function () { - that.options.refresh(); + }).done(function (r) { + that.trigger('done', r); that.destroy(); }).fail(function (jqXHR) { that.enableForm(); |