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 2017/06/13 13:26:34 UTC
ambari git commit: AMBARI-21233. ambari-web hits JS error in dev mode
(alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk fc00b2caf -> f80c6ee45
AMBARI-21233. ambari-web hits JS error in dev mode (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f80c6ee4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f80c6ee4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f80c6ee4
Branch: refs/heads/trunk
Commit: f80c6ee45b5c6708aa9db98b9afe7ebbeba2afe7
Parents: fc00b2c
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Jun 13 15:33:14 2017 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Jun 13 15:33:14 2017 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/global/cluster_controller.js | 2 +-
ambari-web/app/controllers/global/user_settings_controller.js | 3 +++
ambari-web/app/mappers/repository_version_mapper.js | 2 +-
ambari-web/app/utils/ajax/ajax.js | 2 +-
ambari-web/app/views/main/dashboard/widgets.js | 2 +-
ambari-web/test/controllers/wizard/step8_test.js | 4 ++--
ambari-web/test/views/main/dashboard/widgets_test.js | 4 ++--
7 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f80c6ee4/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index 29c979e..e68f281 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -144,7 +144,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
setServerClock: function (data) {
var clientClock = new Date().getTime();
- var serverClock = (data.RootServiceComponents.server_clock).toString();
+ var serverClock = (Em.getWithDefault(data, 'RootServiceComponents.server_clock', '')).toString();
serverClock = serverClock.length < 13 ? serverClock + '000' : serverClock;
App.set('clockDistance', serverClock - clientClock);
App.set('currentServerTime', parseInt(serverClock));
http://git-wip-us.apache.org/repos/asf/ambari/blob/f80c6ee4/ambari-web/app/controllers/global/user_settings_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/user_settings_controller.js b/ambari-web/app/controllers/global/user_settings_controller.js
index 68d7e65..f2542bd 100644
--- a/ambari-web/app/controllers/global/user_settings_controller.js
+++ b/ambari-web/app/controllers/global/user_settings_controller.js
@@ -119,6 +119,9 @@ App.UserSettingsController = Em.Controller.extend(App.Persist, {
var userSettings = {};
var self = this;
this.dataLoading().done(function (json) {
+ if (!json) {
+ return;
+ }
Object.keys(userSettingsKeys).forEach(function (k) {
var value = userSettingsKeys[k].defaultValue;
if (undefined === json[userSettingsKeys[k].name]) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/f80c6ee4/ambari-web/app/mappers/repository_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/repository_version_mapper.js b/ambari-web/app/mappers/repository_version_mapper.js
index 8ef50db..f4858ba 100644
--- a/ambari-web/app/mappers/repository_version_mapper.js
+++ b/ambari-web/app/mappers/repository_version_mapper.js
@@ -145,7 +145,7 @@ App.repoVersionMapper = App.QuickDataMapper.create({
resultService.push(this.parseIt(serviceObj, this.get('modelService')));
}, this);
}
- repo.use_redhat_satellite = item.operating_systems[0].OperatingSystems.ambari_managed_repositories === false;
+ repo.use_redhat_satellite = Em.get(item, 'operating_systems.0.OperatingSystems.ambari_managed_repositories') === false;
repo.operating_systems = osArray;
repo.stack_services = serviceArray;
resultRepoVersion.push(this.parseIt(repo, this.modelRepoVersion(isCurrentStackOnly)));
http://git-wip-us.apache.org/repos/asf/ambari/blob/f80c6ee4/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index c595181..5919091 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -3101,7 +3101,7 @@ var ajax = Em.Object.extend({
MAX_GET_URL_LENGTH: 2048,
consoleMsg: function(name, url) {
- return Em.I18n.t('app.logger.ajax').format(name, url.substr(7, 100));
+ return Em.I18n.t('app.logger.ajax').format(name, url ? url.substr(7, 100) : '');
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/f80c6ee4/ambari-web/app/views/main/dashboard/widgets.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets.js b/ambari-web/app/views/main/dashboard/widgets.js
index 2850200..ec10eae 100644
--- a/ambari-web/app/views/main/dashboard/widgets.js
+++ b/ambari-web/app/views/main/dashboard/widgets.js
@@ -157,7 +157,7 @@ App.MainDashboardWidgetsView = Em.View.extend(App.Persist, App.LocalStorage, App
},
resolveConfigDependencies: function(widgetsDefinition) {
- var clusterEnv = App.router.get('clusterController.clusterEnv').properties;
+ var clusterEnv = App.router.get('clusterController.clusterEnv.properties') || {};
if (clusterEnv.hide_yarn_memory_widget === 'true') {
widgetsDefinition.findProperty('id', 20).isHiddenByDefault = true;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f80c6ee4/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index 92668ff..29e6ae4 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -2342,7 +2342,7 @@ describe('App.WizardStep8Controller', function () {
describe('#generateBlueprint', function () {
beforeEach(function () {
- var configs = Em.A([
+ var configsForTest = Em.A([
Em.Object.create({filename: 'cluster-env.xml', name: 'p0', value: 'v0'}),
Em.Object.create({filename: 'site1.xml', name: 'p11', value: 'v11'}),
Em.Object.create({filename: 'site1.xml', name: 'p12', value: 'v12'}),
@@ -2376,7 +2376,7 @@ describe('App.WizardStep8Controller', function () {
]);
installerStep8Controller = getController();
- installerStep8Controller.set('configs', configs);
+ installerStep8Controller.set('configs', configsForTest);
installerStep8Controller.set('allHosts', hosts);
installerStep8Controller.set('content.services', services.filterProperty('isSelected'));
installerStep8Controller.set('content.hosts', hosts);
http://git-wip-us.apache.org/repos/asf/ambari/blob/f80c6ee4/ambari-web/test/views/main/dashboard/widgets_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js
index 6e8a6eb..08269b5 100644
--- a/ambari-web/test/views/main/dashboard/widgets_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets_test.js
@@ -211,14 +211,14 @@ describe('App.MainDashboardWidgetsView', function () {
it('isHiddenByDefault should be undefined', function() {
var widgets = [{id: 20}];
- this.mock.returns({properties: {'hide_yarn_memory_widget': 'false'}});
+ this.mock.returns({'hide_yarn_memory_widget': 'false'});
view.resolveConfigDependencies(widgets);
expect(widgets[0].isHiddenByDefault).to.be.undefined;
});
it('isHiddenByDefault should be true', function() {
var widgets = [{id: 20}];
- this.mock.returns({properties: {'hide_yarn_memory_widget': 'true'}});
+ this.mock.returns({'hide_yarn_memory_widget': 'true'});
view.resolveConfigDependencies(widgets);
expect(widgets[0].isHiddenByDefault).to.be.true;
});