Przeglądaj źródła

AMBARI-8389. Alerts UI: Clicking on host of alert-instance in alert-details pages should go to host's alerts page (srimanth)

Srimanth Gunturi 10 lat temu
rodzic
commit
7414a35faa

+ 1 - 1
ambari-web/app/config.js

@@ -59,7 +59,7 @@ App.enableExperimental = false;
 App.supports = {
   stackUpgrade: false,
   autoRollbackHA: false,
-  alerts: false,
+  alerts: true,
   alwaysEnableManagedMySQLForHive: false
 };
 

+ 4 - 2
ambari-web/app/controllers/main/alerts/definition_details_controller.js

@@ -137,7 +137,9 @@ App.MainAlertDefinitionDetailsController = Em.Controller.extend({
    * Router transition to host level alerts page
    * @param event
    */
-  goToHostDetails: function (event) {
-    // todo: provide transition to host level alert details
+  goToHostAlerts: function (event) {
+    if (event && event.context) {
+      App.router.transitionTo('main.hosts.hostDetails.alerts', event.context);
+    }
   }
 });

+ 1 - 1
ambari-web/app/templates/main/alerts/definition_details.hbs

@@ -140,7 +140,7 @@
           {{#each instance in view.pageContent}}
             <tr>
               <td class="first">{{instance.state}}</td>
-              <td><a {{action goToHostDetails instance.hostName target="view"}}>{{instance.host.hostName}}</a></td>
+              <td><a {{action goToHostAlerts instance.host target="controller"}} href="#">{{instance.host.hostName}}</a></td>
               <td>{{instance.lastTriggered}}</td>
               <td>10</td>
               <td class="last">Admins</td>

+ 1 - 1
ambari-web/test/controllers/global/update_controller_test.js

@@ -62,7 +62,7 @@ describe('App.UpdateController', function () {
 
     it('isWorking = true', function () {
       controller.set('isWorking', true);
-      expect(App.updater.run.callCount).to.equal(7);
+      expect(App.updater.run.callCount).to.equal(9);
     });
   });
 

+ 21 - 0
ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js

@@ -93,5 +93,26 @@ describe('App.MainAlertDefinitionDetailsController', function () {
     });
 
   });
+  
+  describe("#goToHostAlerts()", function() {
+    beforeEach(function() {
+      sinon.stub(App.get('router'), 'transitionTo', Em.K);
+    });
+    afterEach(function() {
+     App.get('router').transitionTo.restore();
+    });
+    it("not route to host - no event", function() {
+      controller.goToHostAlerts(null);
+      expect(App.get('router').transitionTo.notCalled).to.be.true;
+    });
+    it("not route to host - no event context", function() {
+      controller.goToHostAlerts({});
+      expect(App.get('router').transitionTo.notCalled).to.be.true;
+    });
+    it("routes to host", function() {
+      controller.goToHostAlerts({"context": "hostname"});
+      expect(App.get('router').transitionTo.calledOnce).to.be.true;
+    });
+  });
 
 });