You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by is...@apache.org on 2017/11/02 16:03:13 UTC
ambari git commit: AMBARI-21508. Lifecycle: Start,
Start All Visibility. (ishanbha)
Repository: ambari
Updated Branches:
refs/heads/trunk d03c24b9f -> a7f0f4552
AMBARI-21508. Lifecycle: Start,Start All Visibility. (ishanbha)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a7f0f455
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a7f0f455
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a7f0f455
Branch: refs/heads/trunk
Commit: a7f0f45521879d59efd1774b23711eb2d6fd27c2
Parents: d03c24b
Author: Ishan Bhatt <is...@gmail.com>
Authored: Thu Nov 2 09:02:32 2017 -0700
Committer: Ishan Bhatt <is...@gmail.com>
Committed: Thu Nov 2 09:02:32 2017 -0700
----------------------------------------------------------------------
.../app/controllers/global/update_controller.js | 2 +-
ambari-web/app/controllers/main/service/item.js | 13 +++++-
.../app/mappers/components_state_mapper.js | 1 +
ambari-web/app/models/client_component.js | 1 +
.../test/controllers/main/service/item_test.js | 49 +++++++++++++++-----
5 files changed, 51 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a7f0f455/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index d33c5f1..1d4dd86 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -537,7 +537,7 @@ App.UpdateController = Em.Controller.extend({
updateComponentsState: function (callback) {
var testUrl = '/data/services/HDP2/components_state.json';
var realUrl = '/components/?fields=ServiceComponentInfo/service_name,' +
- 'ServiceComponentInfo/category,ServiceComponentInfo/installed_count,ServiceComponentInfo/started_count,ServiceComponentInfo/init_count,ServiceComponentInfo/install_failed_count,ServiceComponentInfo/unknown_count,ServiceComponentInfo/total_count,ServiceComponentInfo/display_name,host_components/HostRoles/host_name&minimal_response=true';
+ 'ServiceComponentInfo/category,ServiceComponentInfo/installed_count,ServiceComponentInfo/installed_and_maintenance_off_count,ServiceComponentInfo/started_count,ServiceComponentInfo/init_count,ServiceComponentInfo/install_failed_count,ServiceComponentInfo/unknown_count,ServiceComponentInfo/total_count,ServiceComponentInfo/display_name,host_components/HostRoles/host_name&minimal_response=true';
var url = this.getUrl(testUrl, realUrl);
App.HttpClient.get(url, App.componentsStateMapper, {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a7f0f455/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index aff2743..fda0dda 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -988,10 +988,19 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
}
}.observes('App.router.backgroundOperationsController.serviceTimestamp'),
+ nonClientServiceComponents: function () {
+ return App.MasterComponent.find().toArray().concat(App.SlaveComponent.find().toArray()).filterProperty('service.serviceName', this.get('content.serviceName'));
+ }.property('content.serviceName'),
+
isStartDisabled: function () {
if(this.get('isPending')) return true;
- return !(this.get('content.healthStatus') == 'red');
- }.property('content.healthStatus','isPending'),
+
+ var isDisabled = true;
+ this.get('nonClientServiceComponents').forEach(function(component) {
+ isDisabled = isDisabled ? !(component.get('installedAndMaintenanceOffCount') > 0) : false;
+ });
+ return isDisabled;
+ }.property('isPending', 'nonClientServiceComponents'),
isStopDisabled: function () {
if(this.get('isPending')) return true;
http://git-wip-us.apache.org/repos/asf/ambari/blob/a7f0f455/ambari-web/app/mappers/components_state_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/components_state_mapper.js b/ambari-web/app/mappers/components_state_mapper.js
index a7e6d60..115568b 100644
--- a/ambari-web/app/mappers/components_state_mapper.js
+++ b/ambari-web/app/mappers/components_state_mapper.js
@@ -31,6 +31,7 @@ App.componentsStateMapper = App.QuickDataMapper.create({
display_name: 'ServiceComponentInfo.display_name',
service_name: 'ServiceComponentInfo.service_name',
installed_count: 'ServiceComponentInfo.installed_count',
+ installed_and_maintenance_off_count: 'ServiceComponentInfo.installed_and_maintenance_off_count',
install_failed_count: 'ServiceComponentInfo.install_failed_count',
init_count: 'ServiceComponentInfo.init_count',
unknown_count: 'ServiceComponentInfo.unknown_count',
http://git-wip-us.apache.org/repos/asf/ambari/blob/a7f0f455/ambari-web/app/models/client_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/client_component.js b/ambari-web/app/models/client_component.js
index b461b45..52144a6 100644
--- a/ambari-web/app/models/client_component.js
+++ b/ambari-web/app/models/client_component.js
@@ -24,6 +24,7 @@ App.ClientComponent = DS.Model.extend({
componentName: DS.attr('string'),
displayName: DS.attr('string'),
installedCount: DS.attr('number'),
+ installedAndMaintenanceOffCount: DS.attr('number'),
installFailedCount: DS.attr('number'),
initCount: DS.attr('number'),
unknownCount: DS.attr('number'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/a7f0f455/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 7f50620..6162603 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -878,33 +878,58 @@ describe('App.MainServiceItemController', function () {
describe("#isStartDisabled", function () {
var tests = [
{
- content: {
- healthStatus: 'red'
- },
+ nonClientServiceComponents: [
+ Em.Object.create({
+ installedAndMaintenanceOffCount: 0,
+ installedCount: 0,
+ componentName: 'C1',
+ })
+ ],
isPending: true,
disabled: true,
m: "disabled because of pending"
},
{
- content: {
- healthStatus: 'green'
- },
+ nonClientServiceComponents: [
+ Em.Object.create({
+ installedAndMaintenanceOffCount: 0,
+ installedCount: 0,
+ componentName: 'C2',
+ })
+ ],
isPending: false,
disabled: true,
- m: "disabled because healthStatus is not red"
+ m: "disabled because no components stopped"
},
{
- content: {
- healthStatus: 'red'
- },
+ nonClientServiceComponents: [
+ Em.Object.create({
+ installedAndMaintenanceOffCount: 0,
+ installedCount: 1,
+ componentName: 'C3',
+ })
+ ],
+ isPending: false,
+ disabled: true,
+ m: "disabled because although component stopped but in maintenance mode"
+ },
+ {
+ nonClientServiceComponents: [
+ Em.Object.create({
+ installedAndMaintenanceOffCount: 2,
+ installedCount: 3,
+ componentName: 'C4',
+ })
+ ],
isPending: false,
disabled: false,
- m: "enabled because healthStatus is red and pending is false"
+ m: "enabled because some components stopped which are not in maintenance mode"
}
];
+
tests.forEach(function (test) {
it(test.m, function () {
- var mainServiceItemController = App.MainServiceItemController.create({content: {healthStatus: test.content.healthStatus}, isPending: test.isPending});
+ var mainServiceItemController = App.MainServiceItemController.create({nonClientServiceComponents: test.nonClientServiceComponents, isPending: test.isPending});
expect(mainServiceItemController.get('isStartDisabled')).to.equal(test.disabled);
});
});