aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-07-20 14:08:42 +0200
committerStas Vilchik <vilchiks@gmail.com>2016-07-20 14:08:42 +0200
commitf17516585b4a09b68e8165f3a186d9550c945259 (patch)
treeca0d6dd59509e24f7f16a1ba9eea525446d71c8c /server
parentdeb971fda70db26fc00932db6cb0cfdad95d3299 (diff)
downloadsonarqube-f17516585b4a09b68e8165f3a186d9550c945259.tar.gz
sonarqube-f17516585b4a09b68e8165f3a186d9550c945259.zip
open permission template after its creation
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/Header.js17
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/views/CreateView.js4
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();