ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [06/35] ambari git commit: AMBARI-21095 - Enable opening views in a new tab (Anita Jebaraj via sangeetar)
Date Thu, 25 May 2017 17:24:16 GMT
AMBARI-21095 - Enable opening views in a new tab (Anita Jebaraj via sangeetar)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/42be8ce7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/42be8ce7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/42be8ce7

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 42be8ce798172757b8b0967b309baf73fe0a5212
Parents: 56f0190
Author: Sangeeta Ravindran <sangeetar@apache.org>
Authored: Wed May 24 15:51:55 2017 -0700
Committer: Sangeeta Ravindran <sangeetar@apache.org>
Committed: Wed May 24 15:51:55 2017 -0700

----------------------------------------------------------------------
 .../src/main/resources/ui/admin-web/app/index.html    |  2 +-
 .../ui/admin-web/app/views/ambariViews/edit.html      |  2 +-
 ambari-web/app/controllers/main/views_controller.js   |  4 ++--
 ambari-web/app/models/view_instance.js                |  6 +++---
 .../test/controllers/main/views_controller_test.js    | 14 ++++++++++----
 ambari-web/test/models/view_instance_test.js          |  6 +++---
 6 files changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-admin/src/main/resources/ui/admin-web/app/index.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/index.html b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
index 32f9ba7..52e41f6 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/index.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
@@ -55,7 +55,7 @@
             <div class="btn-group navbar-views-dropdown" dropdown is-open="viewsdropdown.isopen"
ng-mouseover="viewsdropdown.isopen=true" ng-mouseout="viewsdropdown.isopen=false">
               <a href="{{fromSiteRoot('/#/main/views')}}" ng-click="gotoViewsDashboard()"
class="dropdown-toggle"><i class="fa fa-th"></i></a>
               <ul class="dropdown-menu" role="menu">
-                <li ng-repeat="instance in viewInstances"><a href="{{fromSiteRoot('/#/main/views/'
+ instance.viewUrl)}}" ng-click="about()">{{instance.label}}</a></li>
+                <li ng-repeat="instance in viewInstances"><a href="{{fromSiteRoot('/#/main/views/'
+ instance.viewUrl)}}" target="_blank">{{instance.label}}</a></li>
                 <li ng-show="!viewInstances.length" class="disabled"><a>{{'common.noViews'
| translate}}</a></li>
               </ul>
             </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
index b6ec61d..f91862d 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
@@ -20,7 +20,7 @@
     <li><a href="#/views">{{'common.views' | translate}}</a></li>
     <li class="active">{{instance.ViewInstanceInfo.label}}
       <a class="gotoinstance" ng-show="instance.ViewInstanceInfo.visible"
-         href="{{fromSiteRoot('/#/main/views/' + viewUrl)}}">
+         href="{{fromSiteRoot('/#/main/views/' + viewUrl)}}" target="_blank">
         {{'views.goToInstance' | translate}}
       </a>
     </li>

http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-web/app/controllers/main/views_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/views_controller.js b/ambari-web/app/controllers/main/views_controller.js
index 398cdd8..b746cf1 100644
--- a/ambari-web/app/controllers/main/views_controller.js
+++ b/ambari-web/app/controllers/main/views_controller.js
@@ -109,7 +109,7 @@ App.MainViewsController = Em.Controller.extend({
 
   setView: function (event) {
     if (event.context) {
-      App.router.route(event.context.get('internalAmbariUrl'));
+      window.open(event.context.get('internalAmbariUrl'));
     }
   }
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-web/app/models/view_instance.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/view_instance.js b/ambari-web/app/models/view_instance.js
index d438640..2ee3005 100644
--- a/ambari-web/app/models/view_instance.js
+++ b/ambari-web/app/models/view_instance.js
@@ -74,8 +74,8 @@ App.ViewInstance = Em.Object.extend({
     var version = this.get('version');
     var instanceName = this.get('instanceName');
     if(shortUrl) {
-      return 'main/view/' + viewName + '/' + shortUrl;
+      return '#/main/view/' + viewName + '/' + shortUrl;
     }
-    return 'main/views/' + viewName + '/' + version + '/' + instanceName;
+    return '#/main/views/' + viewName + '/' + version + '/' + instanceName;
   }.property('shortUrl', 'viewName', 'version', 'instanceName')
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-web/test/controllers/main/views_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/views_controller_test.js b/ambari-web/test/controllers/main/views_controller_test.js
index 0ab7654..af5c61b 100644
--- a/ambari-web/test/controllers/main/views_controller_test.js
+++ b/ambari-web/test/controllers/main/views_controller_test.js
@@ -143,17 +143,23 @@ describe('MainViewsController', function () {
   });
 
   describe("#setView", function () {
+    var mock = {
+      document: {
+        write: Em.K
+      },
+      focus: Em.K
+    };
 
     beforeEach(function () {
-      sinon.stub(App.router, 'route');
+      sinon.stub(window, 'open').returns(mock);
     });
     afterEach(function () {
-      App.router.route.restore();
+      window.open.restore();
     });
 
     it("no context", function () {
       mainViewsController.setView({});
-      expect(App.router.route.called).to.be.false;
+      expect(window.open.called).to.be.false;
     });
 
     it("context exist", function () {
@@ -164,7 +170,7 @@ describe('MainViewsController', function () {
           instanceName: 'instance1'
         })
       });
-      expect(App.router.route.calledWith('main/views/view1/1/instance1')).to.be.true;
+      expect(window.open.called).to.be.true;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-web/test/models/view_instance_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/view_instance_test.js b/ambari-web/test/models/view_instance_test.js
index 0e977e3..c6892c3 100644
--- a/ambari-web/test/models/view_instance_test.js
+++ b/ambari-web/test/models/view_instance_test.js
@@ -34,7 +34,7 @@ describe('App.ViewInstance', function () {
           version: '1.0.0',
           instanceName: 'AUTO_CS_INSTANCE'
         },
-        e: 'main/views/CAPACITY-SCHEDULER/1.0.0/AUTO_CS_INSTANCE',
+        e: '#/main/views/CAPACITY-SCHEDULER/1.0.0/AUTO_CS_INSTANCE',
         m: '`shortUrl` does not exist'
       },
       {
@@ -44,7 +44,7 @@ describe('App.ViewInstance', function () {
           version: '1.0.0',
           instanceName: 'AUTO_CS_INSTANCE'
         },
-        e: 'main/view/CAPACITY-SCHEDULER/auto_cs_instance',
+        e: '#/main/view/CAPACITY-SCHEDULER/auto_cs_instance',
         m: '`shortUrl` exists'
       }
     ].forEach(function (test) {
@@ -56,4 +56,4 @@ describe('App.ViewInstance', function () {
 
   });
 
-});
\ No newline at end of file
+});


Mime
View raw message