You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2015/06/01 22:22:36 UTC
ambari git commit: AMBARI-11591. Alerts: server alert missing
service. (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 994f6ccdc -> fd1baecfd
AMBARI-11591. Alerts: server alert missing service. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fd1baecf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fd1baecf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fd1baecf
Branch: refs/heads/trunk
Commit: fd1baecfd30a3a0ff4388d9585fee3bf7b2824c3
Parents: 994f6cc
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Jun 1 22:19:38 2015 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Mon Jun 1 23:22:16 2015 +0300
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
.../main/alerts/alert_instances_controller.js | 2 +-
.../alerts/definition_details_controller.js | 22 --------
.../common/modal_popups/alerts_popup.hbs | 11 +---
.../main/alerts/definition_details.hbs | 29 ++++-------
.../main/alerts/instance_service_host.hbs | 32 ++++++++++++
.../main/alerts/definition_details_view.js | 42 ++++++++++++++++
.../definitions_details_controller_test.js | 21 --------
.../main/alerts/definition_details_view_test.js | 53 ++++++++++++++++++++
9 files changed, 141 insertions(+), 72 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1baecf/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 3a09f10..177d871 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -197,6 +197,7 @@ var files = ['test/init_model_test',
'test/views/main/alert_definitions_view_test',
'test/views/main/alerts/manage_alert_groups_view_test',
'test/views/main/alerts/manage_alert_notifications_view_test',
+ 'test/views/main/alerts/definition_details_view_test',
'test/views/main/admin/stack_upgrade/upgrade_version_box_view_test',
'test/views/main/admin/stack_upgrade/upgrade_group_view_test',
'test/views/main/admin/stack_upgrade/upgrade_task_view_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1baecf/ambari-web/app/controllers/main/alerts/alert_instances_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/alert_instances_controller.js b/ambari-web/app/controllers/main/alerts/alert_instances_controller.js
index 9bf91d5..a55298f 100644
--- a/ambari-web/app/controllers/main/alerts/alert_instances_controller.js
+++ b/ambari-web/app/controllers/main/alerts/alert_instances_controller.js
@@ -323,7 +323,7 @@ App.MainAlertInstancesController = Em.Controller.extend({
* Router transition to service summary page
* @param event
*/
- gotoService: function (event) {
+ goToService: function (event) {
if (event && event.context) {
this.get('parentView').hide();
App.router.transitionTo('main.services.service.summary', event.context);
http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1baecf/ambari-web/app/controllers/main/alerts/definition_details_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/definition_details_controller.js b/ambari-web/app/controllers/main/alerts/definition_details_controller.js
index 9fbbefa..9be220e 100644
--- a/ambari-web/app/controllers/main/alerts/definition_details_controller.js
+++ b/ambari-web/app/controllers/main/alerts/definition_details_controller.js
@@ -264,28 +264,6 @@ App.MainAlertDefinitionDetailsController = Em.Controller.extend({
},
/**
- * Router transition to service page
- * @param event
- */
- goToService: function (event) {
- if (event && event.context) {
- App.router.transitionTo('main.services.service.summary', event.context);
- }
- },
-
- /**
- * Router transition to host level alerts page
- * @param {object} event
- * @method goToHostAlerts
- */
- goToHostAlerts: function (event) {
- if (event && event.context) {
- App.router.get('mainHostDetailsController').set('referer', App.router.location.lastSetURL);
- App.router.transitionTo('main.hosts.hostDetails.alerts', event.context);
- }
- },
-
- /**
* Define if label or configs are in edit mode
* @type {Boolean}
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1baecf/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs b/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
index 2da35ec..2e57a50 100644
--- a/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
+++ b/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
@@ -31,15 +31,8 @@
{{#each alertInstance in view.pageContent}}
<div class="alert-list-wrap">
<div class="alert-list-line-cursor">
- <div class="service-text"><a href="#" {{action "gotoService" alertInstance.service target="view"}}>{{alertInstance.service.displayName}}</a>
- {{#if alertInstance.hostName}}
- {{#if alertInstance.service.displayName}}
- /
- {{/if}}
- <a {{action "goToHostAlerts" alertInstance.host target="view"}} href="#">
- {{alertInstance.hostName}}
- </a>
- {{/if}}
+ <div class="service-text">
+ {{view App.AlertInstanceServiceHostView instanceBinding="alertInstance"}}
</div>
<div class="name-text">
<div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1baecf/ambari-web/app/templates/main/alerts/definition_details.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/definition_details.hbs b/ambari-web/app/templates/main/alerts/definition_details.hbs
index ac0652d..fb7f884 100644
--- a/ambari-web/app/templates/main/alerts/definition_details.hbs
+++ b/ambari-web/app/templates/main/alerts/definition_details.hbs
@@ -187,25 +187,16 @@
{{#if view.pageContent}}
{{#each instance in view.pageContent}}
{{#view view.instanceTableRow}}
- <td class="first">
- <a {{action goToService instance.service target="controller"}}
- href="#">{{instance.service.displayName}}</a>
- {{#if instance.hostName}}
- {{#if instance.service.displayName}}
- /
- {{/if}}
- <a {{action goToHostAlerts instance.host target="controller"}} href="#">
- {{instance.hostName}}
- </a>
- {{/if}}
- </td>
- <td>{{{instance.status}}}
- <time class="timeago"
- rel="tooltip" {{bindAttr data-original-title="instance.statusChangedAndLastCheckedFormatted"}}>{{instance.lastTriggeredForFormatted}}</time>
- </td>
- <td>{{view view.parentView.lastDayCount hostNameBinding="instance.hostName"}}</td>
- <td><span class="alert-text" rel="tooltip" {{bindAttr data-original-title="instance.text"}}
- class="alert-text">{{instance.text}}</span></td>
+ <td class="first">
+ {{view App.AlertInstanceServiceHostView instanceBinding="instance"}}
+ </td>
+ <td>{{{instance.status}}}
+ <time class="timeago"
+ rel="tooltip" {{bindAttr data-original-title="instance.statusChangedAndLastCheckedFormatted"}}>{{instance.lastTriggeredForFormatted}}</time>
+ </td>
+ <td>{{view view.parentView.lastDayCount hostNameBinding="instance.hostName"}}</td>
+ <td><span class="alert-text" rel="tooltip" {{bindAttr data-original-title="instance.text"}}
+ class="alert-text">{{instance.text}}</span></td>
{{/view}}
{{/each}}
{{else}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1baecf/ambari-web/app/templates/main/alerts/instance_service_host.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/instance_service_host.hbs b/ambari-web/app/templates/main/alerts/instance_service_host.hbs
new file mode 100644
index 0000000..cff614c
--- /dev/null
+++ b/ambari-web/app/templates/main/alerts/instance_service_host.hbs
@@ -0,0 +1,32 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+{{#if view.instance.serviceDisplayName}}
+ {{#if view.serviceIsLink}}
+ <a {{action goToService view.instance.service target="view.parentView"}} href="#">{{view.instance.serviceDisplayName}}</a>
+ {{else}}
+ {{view.instance.serviceDisplayName}}
+ {{/if}}
+{{/if}}
+{{#if view.showSeparator}}
+ /
+{{/if}}
+{{#if view.instance.hostName}}
+ <a {{action goToHostAlerts view.instance.host target="view.parentView"}} href="#">
+ {{view.instance.hostName}}
+ </a>
+{{/if}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1baecf/ambari-web/app/views/main/alerts/definition_details_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/definition_details_view.js b/ambari-web/app/views/main/alerts/definition_details_view.js
index a5e717a..880e74f 100644
--- a/ambari-web/app/views/main/alerts/definition_details_view.js
+++ b/ambari-web/app/views/main/alerts/definition_details_view.js
@@ -100,6 +100,28 @@ App.MainAlertDefinitionDetailsView = App.TableView.extend({
tagName: 'tr',
didInsertElement: function () {
App.tooltip($("[rel=tooltip]"));
+ },
+
+ /**
+ * Router transition to service page
+ * @param event
+ */
+ goToService: function (event) {
+ if (event && event.context) {
+ App.router.transitionTo('main.services.service.summary', event.context);
+ }
+ },
+
+ /**
+ * Router transition to host level alerts page
+ * @param {object} event
+ * @method goToHostAlerts
+ */
+ goToHostAlerts: function (event) {
+ if (event && event.context) {
+ App.router.get('mainHostDetailsController').set('referer', App.router.location.lastSetURL);
+ App.router.transitionTo('main.hosts.hostDetails.alerts', event.context);
+ }
}
}),
@@ -142,3 +164,23 @@ App.MainAlertDefinitionDetailsView = App.TableView.extend({
}
});
+
+
+App.AlertInstanceServiceHostView = Em.View.extend({
+
+ templateName: require('templates/main/alerts/instance_service_host'),
+
+ /**
+ * Define whether show link for transition to service page
+ */
+ serviceIsLink: function () {
+ return App.Service.find().someProperty('serviceName', this.get('instance.service.serviceName'));
+ }.property('instance.service.serviceName'),
+
+ /**
+ * Define whether show separator between service and hosts labels
+ */
+ showSeparator: function () {
+ return this.get('instance.serviceDisplayName') && this.get('instance.hostName');
+ }.property('instance.serviceDisplayName', 'instance.hostName')
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1baecf/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
index 4838532..dea1f2a 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
@@ -90,27 +90,6 @@ 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;
- });
- });
-
describe("#deleteAlertDefinition()", function () {
beforeEach(function () {
sinon.stub(App.get('router'), 'transitionTo', Em.K);
http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1baecf/ambari-web/test/views/main/alerts/definition_details_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/alerts/definition_details_view_test.js b/ambari-web/test/views/main/alerts/definition_details_view_test.js
new file mode 100644
index 0000000..331474d
--- /dev/null
+++ b/ambari-web/test/views/main/alerts/definition_details_view_test.js
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+var view;
+
+describe('App.MainAlertDefinitionDetailsView', function () {
+
+ beforeEach(function () {
+
+ view = App.MainAlertDefinitionDetailsView.create();
+
+ instanceTableRow = view.get('instanceTableRow').create();
+
+ });
+
+ 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 () {
+ instanceTableRow.goToHostAlerts(null);
+ expect(App.get('router').transitionTo.notCalled).to.be.true;
+ });
+ it("not route to host - no event context", function () {
+ instanceTableRow.goToHostAlerts({});
+ expect(App.get('router').transitionTo.notCalled).to.be.true;
+ });
+ it("routes to host", function () {
+ instanceTableRow.goToHostAlerts({"context": "hostname"});
+ expect(App.get('router').transitionTo.calledOnce).to.be.true;
+ });
+ });
+});