You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/03/03 18:40:40 UTC
[1/2] ambari git commit: AMBARI-9900. Incorrect navigation when
closing Add Service wizard on Stack And Versions page (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 57251f4b3 -> 2cb028c55
AMBARI-9900. Incorrect navigation when closing Add Service wizard on Stack And Versions page (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2cb028c5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2cb028c5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2cb028c5
Branch: refs/heads/trunk
Commit: 2cb028c555fa14f028f263ee21413b5007c8bca2
Parents: 52bcd9f
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Mar 3 20:25:40 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Mar 3 21:40:00 2015 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/main/admin/kerberos.js | 1 +
ambari-web/app/controllers/main/service.js | 1 +
ambari-web/app/routes/add_kerberos_routes.js | 3 ++-
ambari-web/app/routes/add_service_routes.js | 3 ++-
.../app/views/main/admin/stack_upgrade/services_view.js | 2 ++
.../views/main/admin/stack_upgrade/services_view_test.js | 9 ++++++---
6 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2cb028c5/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index 70e2051..fd4c3b2 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -161,6 +161,7 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
startKerberosWizard: function () {
this.setAddSecurityWizardStatus('RUNNING');
+ App.router.get('kerberosWizardController').setDBProperty('onClosePath', 'main.admin.adminKerberos.index');
App.router.transitionTo('adminKerberos.adminAddKerberos');
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/2cb028c5/ambari-web/app/controllers/main/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service.js b/ambari-web/app/controllers/main/service.js
index c487931..bc3c2fb 100644
--- a/ambari-web/app/controllers/main/service.js
+++ b/ambari-web/app/controllers/main/service.js
@@ -191,6 +191,7 @@ App.MainServiceController = Em.ArrayController.extend({
if (this.get('isAllServicesInstalled')) {
return;
}
+ App.router.get('addServiceController').setDBProperty('onClosePath', 'main.services.index');
App.router.transitionTo('main.serviceAdd');
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2cb028c5/ambari-web/app/routes/add_kerberos_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_kerberos_routes.js b/ambari-web/app/routes/add_kerberos_routes.js
index 2cd87ea..52c6958 100644
--- a/ambari-web/app/routes/add_kerberos_routes.js
+++ b/ambari-web/app/routes/add_kerberos_routes.js
@@ -70,6 +70,7 @@ module.exports = App.WizardRoute.extend({
var self = this;
var kerberosProgressPageController = App.router.get('kerberosProgressPageController');
var controller = App.router.get('kerberosWizardController');
+ var exitPath = controller.getDBProperty('onClosePath') || 'adminKerberos.index';
controller.clearTasksData();
controller.finish();
App.get('router.updateController').set('isWorking', true);
@@ -84,7 +85,7 @@ module.exports = App.WizardRoute.extend({
}, {
alwaysCallback: function () {
self.hide();
- App.get('router').transitionTo('adminKerberos.index');
+ App.get('router').transitionTo(exitPath);
location.reload();
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2cb028c5/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 568b6cb..48a553d 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -49,12 +49,13 @@ module.exports = App.WizardRoute.extend({
App.router.get('updateController').updateServices(function(){
App.router.get('updateController').updateServiceMetric();
});
+ var exitPath = addServiceController.getDBProperty('onClosePath') || 'main.services.index';
addServiceController.finish();
// We need to do recovery based on whether we are in Add Host or Installer wizard
App.clusterStatus.setClusterStatus({
clusterName: App.router.get('content.cluster.name'),
clusterState: 'DEFAULT'
- }, {alwaysCallback: function() {self.hide();App.router.transitionTo('main.services.index');location.reload();}});
+ }, {alwaysCallback: function() {self.hide();App.router.transitionTo(exitPath);location.reload();}});
},
didInsertElement: function(){
http://git-wip-us.apache.org/repos/asf/ambari/blob/2cb028c5/ambari-web/app/views/main/admin/stack_upgrade/services_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/services_view.js b/ambari-web/app/views/main/admin/stack_upgrade/services_view.js
index b36e5f3..db38a4c 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/services_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/services_view.js
@@ -46,8 +46,10 @@ App.MainAdminStackServicesView = Em.View.extend({
goToAddService: function (event) {
if (event.context == "KERBEROS") {
App.router.get('mainAdminKerberosController').checkAndStartKerberosWizard();
+ App.router.get('kerberosWizardController').setDBProperty('onClosePath', 'main.admin.stackAndUpgrade.services');
} else {
App.router.get('addServiceController').set('serviceToInstall', event.context);
+ App.router.get('addServiceController').setDBProperty('onClosePath', 'main.admin.stackAndUpgrade.services');
App.get('router').transitionTo('main.serviceAdd');
}
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/2cb028c5/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
index 153d5c7..8e1f116 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
@@ -42,13 +42,14 @@ describe('App.MainAdminStackServicesView', function () {
expect(view.get('services')).to.eql([
Em.Object.create({serviceName: 'S1', isInstalled: true}),
Em.Object.create({serviceName: 'S2', isInstalled: false})
- ])
+ ]);
});
});
describe("#goToAddService()" , function() {
var mock = Em.Object.create({
- checkAndStartKerberosWizard: Em.K
+ checkAndStartKerberosWizard: Em.K,
+ setDBProperty: sinon.spy()
});
beforeEach(function() {
sinon.stub(App.get('router'), 'transitionTo', Em.K);
@@ -60,13 +61,15 @@ describe('App.MainAdminStackServicesView', function () {
App.router.get.restore();
mock.checkAndStartKerberosWizard.restore();
});
- it("routes to Add Service Wizard", function() {
+ it("routes to Add Service Wizard and set redirect path on wizard close", function() {
view.goToAddService({context: "serviceName"});
+ expect(App.router.get.calledWith('addServiceController') && mock.setDBProperty.calledWith('onClosePath', 'main.admin.stackAndUpgrade.services')).to.be.true;
expect(App.get('router').transitionTo.calledWith('main.serviceAdd')).to.be.true;
expect(mock.get('serviceToInstall')).to.be.equal("serviceName");
});
it("routes to Security Wizard", function() {
view.goToAddService({context: "KERBEROS"});
+ expect(App.router.get.calledWith('kerberosWizardController') && mock.setDBProperty.calledWith('onClosePath', 'main.admin.stackAndUpgrade.services')).to.be.true;
expect(mock.checkAndStartKerberosWizard.calledOnce).to.be.true;
});
});
[2/2] ambari git commit: AMBARI-9898. Memory Usage widget shows wrong
value (alexantonenko)
Posted by al...@apache.org.
AMBARI-9898. Memory Usage widget shows wrong value (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/52bcd9f0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/52bcd9f0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/52bcd9f0
Branch: refs/heads/trunk
Commit: 52bcd9f06356febfe09a04df8a2717f3161a4026
Parents: 57251f4
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Mar 3 19:41:24 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Mar 3 21:40:00 2015 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
.../main/dashboard/cluster_metrics/memory.js | 13 +-
.../dashboard/cluster_metrics/memory_test.js | 223 +++++++++++++++++++
3 files changed, 236 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/52bcd9f0/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 ce137ea..78ea459 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -183,6 +183,7 @@ var files = ['test/init_model_test',
'test/views/main/dashboard/config_history_view_test',
'test/views/main/dashboard/widget_test',
'test/views/main/dashboard/widgets_test',
+ 'test/views/main/dashboard/cluster_metrics/memory_test',
'test/views/main/dashboard/widgets/text_widget_test',
'test/views/main/dashboard/widgets/uptime_text_widget_test',
'test/views/main/dashboard/widgets/node_managers_live_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/52bcd9f0/ambari-web/app/views/main/dashboard/cluster_metrics/memory.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/cluster_metrics/memory.js b/ambari-web/app/views/main/dashboard/cluster_metrics/memory.js
index fd96bc4..393f12f 100644
--- a/ambari-web/app/views/main/dashboard/cluster_metrics/memory.js
+++ b/ambari-web/app/views/main/dashboard/cluster_metrics/memory.js
@@ -38,11 +38,22 @@ App.ChartClusterMetricsMemory = App.ChartLinearTimeView.extend({
transformToSeries: function (jsonData) {
var seriesArray = [];
if (jsonData && jsonData.metrics && jsonData.metrics.memory) {
+ var isAmbariMetricsAvailable = App.StackService.find().someProperty('serviceName', 'AMBARI_METRICS');
+ var isAmbariMetricsInstalled = App.Service.find().someProperty('serviceName', 'AMBARI_METRICS');
+ var isGangliaInstalled = App.Service.find().someProperty('serviceName', 'GANGLIA');
+ var shouldConvertToBytes = isAmbariMetricsInstalled || isAmbariMetricsAvailable && !isGangliaInstalled;
+ var KB = Math.pow(2, 10);
for ( var name in jsonData.metrics.memory) {
var displayName = name;
var seriesData = jsonData.metrics.memory[name];
if (seriesData) {
- seriesArray.push(this.transformData(seriesData, displayName));
+ var s = this.transformData(seriesData, displayName);
+ if (shouldConvertToBytes) {
+ for (var i = 0; i < s.data.length; i++) {
+ s.data[i].y *= KB;
+ }
+ }
+ seriesArray.push(s);
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/52bcd9f0/ambari-web/test/views/main/dashboard/cluster_metrics/memory_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/cluster_metrics/memory_test.js b/ambari-web/test/views/main/dashboard/cluster_metrics/memory_test.js
new file mode 100644
index 0000000..2512166
--- /dev/null
+++ b/ambari-web/test/views/main/dashboard/cluster_metrics/memory_test.js
@@ -0,0 +1,223 @@
+/**
+ * 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');
+
+require('views/main/dashboard/cluster_metrics/memory');
+
+describe('App.ChartClusterMetricsMemory', function () {
+
+ var view;
+
+ beforeEach(function () {
+ view = App.ChartClusterMetricsMemory.create();
+ });
+
+ describe('#transformToSeries', function () {
+
+ var cases = [
+ {
+ isAmbariMetricsInstalled: true,
+ seriesData: [
+ [
+ {
+ x: 1000000000,
+ y: 262144
+ },
+ {
+ x: 1000001000,
+ y: 524288
+ }
+ ],
+ [
+ {
+ x: 1100000000,
+ y: 1048576
+ },
+ {
+ x: 1100001000,
+ y: 2097152
+ }
+ ]
+ ],
+ title: 'Ambari Metrics is installed'
+ },
+ {
+ isAmbariMetricsInstalled: false,
+ isAmbariMetricsAvailable: true,
+ isGangliaInstalled: false,
+ seriesData: [
+ [
+ {
+ x: 1000000000,
+ y: 262144
+ },
+ {
+ x: 1000001000,
+ y: 524288
+ }
+ ],
+ [
+ {
+ x: 1100000000,
+ y: 1048576
+ },
+ {
+ x: 1100001000,
+ y: 2097152
+ }
+ ]
+ ],
+ title: 'Ganglia is not installed, Ambari Metrics is available'
+ },
+ {
+ isAmbariMetricsInstalled: false,
+ isAmbariMetricsAvailable: true,
+ isGangliaInstalled: true,
+ seriesData: [
+ [
+ {
+ x: 1000000000,
+ y: 256
+ },
+ {
+ x: 1000001000,
+ y: 512
+ }
+ ],
+ [
+ {
+ x: 1100000000,
+ y: 1024
+ },
+ {
+ x: 1100001000,
+ y: 2048
+ }
+ ]
+ ],
+ title: 'Ganglia is installed, Ambari Metrics is available'
+ },
+ {
+ isAmbariMetricsInstalled: false,
+ isAmbariMetricsAvailable: false,
+ isGangliaInstalled: true,
+ seriesData: [
+ [
+ {
+ x: 1000000000,
+ y: 256
+ },
+ {
+ x: 1000001000,
+ y: 512
+ }
+ ],
+ [
+ {
+ x: 1100000000,
+ y: 1024
+ },
+ {
+ x: 1100001000,
+ y: 2048
+ }
+ ]
+ ],
+ title: 'Ganglia is installed, Ambari Metrics is not available'
+ },
+ {
+ isAmbariMetricsInstalled: false,
+ isAmbariMetricsAvailable: false,
+ isGangliaInstalled: false,
+ seriesData: [
+ [
+ {
+ x: 1000000000,
+ y: 256
+ },
+ {
+ x: 1000001000,
+ y: 512
+ }
+ ],
+ [
+ {
+ x: 1100000000,
+ y: 1024
+ },
+ {
+ x: 1100001000,
+ y: 2048
+ }
+ ]
+ ],
+ title: 'Ganglia is not installed, Ambari Metrics is not available'
+ }
+ ],
+ jsonData = {
+ metrics: {
+ memory: {
+ Buffer: [
+ [256, 1000000000],
+ [512, 1000001000]
+ ],
+ Total: [
+ [1024, 1100000000],
+ [2048, 1100001000]
+ ]
+ }
+ }
+ },
+ names = ['Buffer', 'Total'];
+
+ afterEach(function () {
+ App.StackService.find.restore();
+ App.Service.find.restore();
+ });
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ var stackServices = [],
+ services = [];
+ if (item.isAmbariMetricsAvailable) {
+ stackServices.push({
+ serviceName: 'AMBARI_METRICS'
+ });
+ }
+ if (item.isAmbariMetricsInstalled) {
+ services.push({
+ serviceName: 'AMBARI_METRICS'
+ });
+ }
+ if (item.isGangliaInstalled) {
+ services.push({
+ serviceName: 'GANGLIA'
+ });
+ }
+ sinon.stub(App.StackService, 'find').returns(stackServices);
+ sinon.stub(App.Service, 'find').returns(services);
+ var series = view.transformToSeries(jsonData);
+ expect(series.mapProperty('name')).to.eql(names);
+ expect(series.mapProperty('data')).to.eql(item.seriesData);
+ });
+ });
+
+ });
+
+});