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/10/19 14:47:43 UTC
ambari git commit: AMBARI-13472. KDC Credentials: Retrieve storage
type along with Security Status.
Repository: ambari
Updated Branches:
refs/heads/branch-2.1 202254bb8 -> 94b630733
AMBARI-13472. KDC Credentials: Retrieve storage type along with Security Status.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/94b63073
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/94b63073
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/94b63073
Branch: refs/heads/branch-2.1
Commit: 94b630733c3feb42a8609b05d8f2cf9076552fc1
Parents: 202254b
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Oct 19 15:39:30 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Oct 19 15:47:36 2015 +0300
----------------------------------------------------------------------
.../controllers/global/cluster_controller.js | 1 +
.../main/admin/kerberos/step2_controller.js | 4 ---
.../main/admin/kerberos/wizard_controller.js | 9 +------
ambari-web/app/mappers/cluster_mapper.js | 4 +--
.../common/kdc_credentials_controller_mixin.js | 5 ++--
ambari-web/app/models/cluster.js | 10 +++++--
.../app/views/common/chart/linear_time.js | 8 +++---
.../common/form/manage_credentials_form_view.js | 9 +++----
.../common/modal_popups/invalid_KDC_popup.js | 15 +++--------
.../test/mappers/configs/themes_mapper_test.js | 6 +++--
.../kdc_credentials_controller_mixin_test.js | 28 --------------------
.../form/manage_kdc_credentials_form_test.js | 6 ++---
12 files changed, 31 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/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 f411d37..b80d6c2 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -187,6 +187,7 @@ App.ClusterController = Em.Controller.extend({
App.HttpClient.get(clusterUrl, App.clusterMapper, {
complete: function (jqXHR, textStatus) {
+ App.set('isCredentialStorePersistent', Em.getWithDefault(App.Cluster.find().findProperty('clusterName', App.get('clusterName')), 'isCredentialStorePersistent', false));
}
}, function (jqXHR, textStatus) {
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
index af135c6..9b291b9 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
@@ -36,10 +36,6 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend(App.KDCCred
addMiscTabToPage: false,
- isStorePersisted: function() {
- return this.get('wizardController.content.secureStoragePersisted');
- }.property('wizardController.content.secureStoragePersisted'),
-
/**
* @type {boolean} true if test connection to hosts is in progress
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
index 71095da..72591ea 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
@@ -59,8 +59,7 @@ App.KerberosWizardController = App.WizardController.extend(App.InstallComponent,
services: [],
advancedServiceConfig: null,
serviceConfigProperties: [],
- failedTask: null,
- secureStoragePersisted: null
+ failedTask: null
}),
/**
@@ -236,13 +235,7 @@ App.KerberosWizardController = App.WizardController.extend(App.InstallComponent,
{
type: 'sync',
callback: function () {
- var self = this;
this.loadKerberosOption();
- if (App.get('supports.storeKDCCredentials')) {
- credentialsUtils.isStorePersisted(App.get('clusterName')).then(function(isPersisted) {
- self.set('content.secureStoragePersisted', isPersisted);
- });
- }
}
}
],
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/app/mappers/cluster_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/cluster_mapper.js b/ambari-web/app/mappers/cluster_mapper.js
index 4604aaf..5689867 100644
--- a/ambari-web/app/mappers/cluster_mapper.js
+++ b/ambari-web/app/mappers/cluster_mapper.js
@@ -25,7 +25,6 @@ App.clusterMapper = App.QuickDataMapper.create({
var result = json;
result = this.parseIt(result, this.config);
App.store.load(this.get('model'), result);
-
var cluster = App.Cluster.find(result.id);
var clusterDesiredConfigs = [];
// Create desired_configs_array
@@ -57,6 +56,7 @@ App.clusterMapper = App.QuickDataMapper.create({
stack_name: 'Clusters.stack_name',
version: 'Clusters.version',
security_type: 'Clusters.security_type',
- total_hosts: 'Clusters.total_hosts'
+ total_hosts: 'Clusters.total_hosts',
+ credential_store_properties: 'Clusters.credential_store_properties'
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js b/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js
index 070ea35..a634ef9 100644
--- a/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js
+++ b/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js
@@ -30,13 +30,12 @@ App.KDCCredentialsControllerMixin = Em.Mixin.create({
/**
* Returns <code>true</code> if persisted secure storage available.
- * Should be implemented as computed property.
*
* @type {boolean}
*/
isStorePersisted: function() {
- Em.assert("Should be implemented", false);
- }.property(),
+ return App.get('isCredentialStorePersistent');
+ }.property('App.isCredentialStorePersistent'),
/**
* List of required UI-only properties needed for storing KDC credentials
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/app/models/cluster.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster.js b/ambari-web/app/models/cluster.js
index b4a2010..18ad1ce 100644
--- a/ambari-web/app/models/cluster.js
+++ b/ambari-web/app/models/cluster.js
@@ -18,6 +18,7 @@
var App = require('app');
+var credentialUtils = require('utils/credentials');
App.Cluster = DS.Model.extend({
clusterName: DS.attr('string'),
@@ -25,6 +26,7 @@ App.Cluster = DS.Model.extend({
version: DS.attr('string'),
totalHosts:DS.attr('number'),
securityType: DS.attr('string'),
+ credentialStoreProperties: DS.attr('object', {defaultValue: {}}),
/**
* Array containing desired configs. New array
* should be set by instances of class.
@@ -33,7 +35,11 @@ App.Cluster = DS.Model.extend({
isKerberosEnabled: function() {
return this.get('securityType') === 'KERBEROS';
- }.property('securityType')
+ }.property('securityType'),
+
+ isCredentialStorePersistent: function() {
+ return this.get('credentialStoreProperties')[credentialUtils.STORE_TYPES.PERSISTENT_PATH] === "true";
+ }.property('credentialStoreProperties')
});
-App.Cluster.FIXTURES = [];
\ No newline at end of file
+App.Cluster.FIXTURES = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/app/views/common/chart/linear_time.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/chart/linear_time.js b/ambari-web/app/views/common/chart/linear_time.js
index 18f80c3..f6e71a3 100644
--- a/ambari-web/app/views/common/chart/linear_time.js
+++ b/ambari-web/app/views/common/chart/linear_time.js
@@ -511,8 +511,12 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, {
var avg = 0;
var min = Number.MAX_VALUE;
var max = Number.MIN_VALUE;
+ var numberOfNotNullValues = 0;
for (var i = 0; i < series.data.length; i++) {
avg += series.data[i]['y'];
+ if (series.data[i]['y'] !== null) {
+ numberOfNotNullValues++;
+ }
if (!Em.isNone(series.data[i]['y'])) {
if (series.data[i]['y'] < min) {
min = series.data[i]['y'];
@@ -522,13 +526,11 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, {
max = series.data[i]['y'];
}
}
-
-
series.name = string_utils.pad(series.name.length > 36 ? series.name.substr(0, 36) + '...' : series.name, 40, ' ', 2) + '| ' +
string_utils.pad('min', 5, ' ', 3) +
string_utils.pad(self.get('yAxisFormatter')(min), 12, ' ', 3) +
string_utils.pad('avg', 5, ' ', 3) +
- string_utils.pad(self.get('yAxisFormatter')(avg / series.data.compact().length), 12, ' ', 3) +
+ string_utils.pad(self.get('yAxisFormatter')(avg / numberOfNotNullValues), 12, ' ', 3) +
string_utils.pad('max', 12, ' ', 3) +
string_utils.pad(self.get('yAxisFormatter')(max), 5, ' ', 3);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/app/views/common/form/manage_credentials_form_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/form/manage_credentials_form_view.js b/ambari-web/app/views/common/form/manage_credentials_form_view.js
index c71021c..2bc27ee 100644
--- a/ambari-web/app/views/common/form/manage_credentials_form_view.js
+++ b/ambari-web/app/views/common/form/manage_credentials_form_view.js
@@ -36,7 +36,9 @@ App.ManageCredentialsFormView = Em.View.extend({
* Status of persistent storage. Returns <code>true</code> if persistent storage is available.
* @type {boolean}
*/
- storePersisted: false,
+ storePersisted: function() {
+ return App.get('isCredentialStorePersistent');
+ }.property('App.isCredentialStorePersistent'),
/**
* Disable checkbox if persistent storage not available
@@ -120,11 +122,6 @@ App.ManageCredentialsFormView = Em.View.extend({
prepareContent: function() {
var self = this;
- credentialsUtils.isStorePersisted(App.get('clusterName')).then(function(isPersisted) {
- Em.run.next(function() {
- self.set('storePersisted', isPersisted);
- });
- });
credentialsUtils.credentials(App.get('clusterName'), function(credentials) {
Em.run.next(function() {
self.set('isRemovable', credentialsUtils.isKDCCredentialsPersisted(credentials));
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js b/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js
index ca5de7d..9de8537b 100644
--- a/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js
+++ b/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js
@@ -42,7 +42,9 @@ App.showInvalidKDCPopup = function (ajaxOpt, message) {
* Status of persistent storage. Returns <code>true</code> if persistent storage is available.
* @type {boolean}
*/
- storePersisted: false,
+ storePersisted: function() {
+ return App.get('isCredentialStorePersistent');
+ }.property('App.isCredentialStorePersistent'),
/**
* Disable checkbox if persistent storage not available
@@ -76,17 +78,6 @@ App.showInvalidKDCPopup = function (ajaxOpt, message) {
templateName: require('templates/common/modal_popups/invalid_KDC_popup')
}),
- willInsertElement: function() {
- if (App.get('supports.storeKDCCredentials')) {
- var self = this;
- credentialsUtils.isStorePersisted(App.get('clusterName')).then(function(isPersisted) {
- Em.run.next(function() {
- self.set('storePersisted', isPersisted);
- });
- });
- }
- },
-
didInsertElement: function() {
this._super();
App.tooltip(this.$('[rel="tooltip"]'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/test/mappers/configs/themes_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/configs/themes_mapper_test.js b/ambari-web/test/mappers/configs/themes_mapper_test.js
index 8d21104..f68d78e 100644
--- a/ambari-web/test/mappers/configs/themes_mapper_test.js
+++ b/ambari-web/test/mappers/configs/themes_mapper_test.js
@@ -162,7 +162,8 @@ describe('App.themeMapper', function () {
is_advanced: false,
service_name: 'HDFS',
is_advanced_hidden: false,
- is_rendered: false
+ is_rendered: false,
+ is_configs_prepared: false
});
//checking section
@@ -224,7 +225,8 @@ describe('App.themeMapper', function () {
"is_advanced": true,
"service_name": "HDFS",
"is_advanced_hidden": false,
- is_rendered: false
+ is_rendered: false,
+ is_configs_prepared: false
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js b/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
index a584979..2553397 100644
--- a/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
+++ b/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
@@ -33,34 +33,6 @@ describe('App.KDCCredentialsControllerMixin', function() {
mixedObject.destroy();
});
- describe('#isStorePersisted', function() {
- it('should throw error if not overrided in mixed object', function() {
- var errorThrown = false;
- try {
- mixedObject.get('isStorePersisted');
- } catch (e) {
- errorThrown = true;
- } finally {
- expect(errorThrown).to.be.true;
- }
- });
- it('should not throw error if overrided in mixed object', function() {
- var errorThrown = false;
- mixedObject.reopen({
- isStorePersisted: function() {
- return true;
- }.property()
- });
- try {
- mixedObject.get('isStorePersisted');
- } catch (e) {
- errorThrown = true;
- } finally {
- expect(errorThrown).to.be.false;
- }
- });
- });
-
describe('#initilizeKDCStoreProperties', function() {
[
{
http://git-wip-us.apache.org/repos/asf/ambari/blob/94b63073/ambari-web/test/views/common/form/manage_kdc_credentials_form_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/form/manage_kdc_credentials_form_test.js b/ambari-web/test/views/common/form/manage_kdc_credentials_form_test.js
index ca5e4d0..0d8c9af 100644
--- a/ambari-web/test/views/common/form/manage_kdc_credentials_form_test.js
+++ b/ambari-web/test/views/common/form/manage_kdc_credentials_form_test.js
@@ -69,16 +69,14 @@ describe('#App.ManageCredentialsFormView', function() {
sinon.stub(credentialUtils, 'credentials', function(clusterName, callback) {
callback(test.credentials);
});
- sinon.stub(credentialUtils, 'isStorePersisted', function() {
- return $.Deferred().resolve(test.isStorePersistent).promise();
- });
+ sinon.stub(App, 'get').withArgs('isCredentialStorePersistent').returns(test.e.storePersisted);
view.prepareContent();
Em.run.next(function() {
assert.equal(view.get('isRemovable'), test.e.isRemovable, '#isRemovable property validation');
assert.equal(view.get('isRemoveDisabled'), test.e.isRemoveDisabled, '#isRemoveDisabled property validation');
assert.equal(view.get('storePersisted'), test.e.storePersisted, '#storePersisted property validation');
credentialUtils.credentials.restore();
- credentialUtils.isStorePersisted.restore();
+ App.get.restore();
done();
});
});