]> source.dussan.org Git - sonarqube.git/commitdiff
open permission template after its creation
authorStas Vilchik <vilchiks@gmail.com>
Wed, 20 Jul 2016 12:08:42 +0000 (14:08 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 20 Jul 2016 12:08:42 +0000 (14:08 +0200)
server/sonar-web/src/main/js/apps/permission-templates/components/Header.js
server/sonar-web/src/main/js/apps/permission-templates/views/CreateView.js

index b22b9387f3eb5c5e55b794030d4bcbc421f9b078..97590dc0ce313870efc96c952423f8b268233d40 100644 (file)
@@ -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 () {
index 516373a0aa944049314d512354272d8e3bc58402..bd6ad52409fd30522bd39facf56519f25d4e0dfd 100644 (file)
@@ -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();