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 2016/02/27 14:22:13 UTC
ambari git commit: AMBARI-15207. Settings button doesn't work if
cluster is not installed (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk afea5a578 -> a69b8cc8e
AMBARI-15207. Settings button doesn't work if cluster is not installed (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a69b8cc8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a69b8cc8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a69b8cc8
Branch: refs/heads/trunk
Commit: a69b8cc8e676c35cb0a8af8ca8e8fd0e6669233c
Parents: afea5a5
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Feb 26 20:43:55 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Sat Feb 27 15:20:48 2016 +0200
----------------------------------------------------------------------
.../global/user_settings_controller.js | 106 ++++++++++---------
ambari-web/app/messages.js | 2 +
ambari-web/app/templates/application.hbs | 2 +-
ambari-web/app/templates/common/settings.hbs | 4 +-
4 files changed, 60 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a69b8cc8/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 5aa64b0..8bcba75 100644
--- a/ambari-web/app/controllers/global/user_settings_controller.js
+++ b/ambari-web/app/controllers/global/user_settings_controller.js
@@ -260,74 +260,78 @@ App.UserSettingsController = Em.Controller.extend(App.UserPref, {
* @private
*/
_showSettingsPopup: function (response) {
- var curValue = null;
- var self = this;
var keys = this.get('userSettingsKeys');
- var timezonesFormatted = timezoneUtils.get('timezones');
- var initValue = JSON.parse(response[keys.show_bg.name]);
- var initTimezone = timezonesFormatted.findProperty('value', JSON.parse(response[keys.timezone.name]));
- return App.ModalPopup.show({
+ var curValue, self, timezonesFormatted, initValue, initTimezone;
+ if (response[keys.show_bg.name]) {
+ curValue = null;
+ self = this;
+ timezonesFormatted = timezoneUtils.get('timezones');
+ initValue = JSON.parse(response[keys.show_bg.name]);
+ initTimezone = timezonesFormatted.findProperty('value', JSON.parse(response[keys.timezone.name]));
+ return App.ModalPopup.show({
- header: Em.I18n.t('common.userSettings'),
+ header: Em.I18n.t('common.userSettings'),
- bodyClass: Em.View.extend({
+ bodyClass: Em.View.extend({
- templateName: require('templates/common/settings'),
+ templateName: require('templates/common/settings'),
- isNotShowBgChecked: !initValue,
+ isNotShowBgChecked: !initValue,
- updateValue: function () {
- curValue = !this.get('isNotShowBgChecked');
- }.observes('isNotShowBgChecked'),
+ updateValue: function () {
+ curValue = !this.get('isNotShowBgChecked');
+ }.observes('isNotShowBgChecked'),
- timezonesList: timezonesFormatted,
+ timezonesList: timezonesFormatted,
- privileges: self.get('privileges'),
+ privileges: self.get('privileges'),
- isAdmin: App.get('isAdmin'),
+ isAdmin: App.get('isAdmin'),
- noClusterPriv: self.get('noClusterPriv'),
+ noClusterPriv: self.get('noClusterPriv'),
- noViewPriv: self.get('noViewPriv'),
+ noViewPriv: self.get('noViewPriv'),
- hidePrivileges: self.get('hidePrivileges') || App.get('isAdmin')
- }),
+ hidePrivileges: self.get('hidePrivileges') || App.get('isAdmin')
+ }),
- /**
- * @type {string}
- */
- selectedTimezone: initTimezone,
+ /**
+ * @type {string}
+ */
+ selectedTimezone: initTimezone,
- primary: Em.I18n.t('common.save'),
+ primary: Em.I18n.t('common.save'),
- onPrimary: function() {
- if (Em.isNone(curValue)) {
- curValue = initValue;
- }
- var tz = this.get('selectedTimezone.value');
- var popup = this;
- if (!App.get('testMode')) {
- self.postUserPref('show_bg', curValue).always(function () {
- self.postUserPref('timezone', tz).always(function () {
- if (popup.needsPageRefresh()) {
- location.reload();
- }
+ onPrimary: function () {
+ if (Em.isNone(curValue)) {
+ curValue = initValue;
+ }
+ var tz = this.get('selectedTimezone.value');
+ var popup = this;
+ if (!App.get('testMode')) {
+ self.postUserPref('show_bg', curValue).always(function () {
+ self.postUserPref('timezone', tz).always(function () {
+ if (popup.needsPageRefresh()) {
+ location.reload();
+ }
+ });
});
- });
+ }
+ this._super();
+ },
+
+ /**
+ * Determines if page should be refreshed after user click "Save"
+ *
+ * @returns {boolean}
+ */
+ needsPageRefresh: function () {
+ return initTimezone !== this.get('selectedTimezone');
}
- this._super();
- },
-
- /**
- * Determines if page should be refreshed after user click "Save"
- *
- * @returns {boolean}
- */
- needsPageRefresh: function () {
- return initTimezone !== this.get('selectedTimezone');
- }
-
- })
+ });
+ } else {
+ App.showAlertPopup(Em.I18n.t('common.error'), Em.I18n.t('app.settings.noData'));
+ }
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a69b8cc8/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 1cefce2..d88b8e3 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -48,10 +48,12 @@ Em.I18n.translations = {
'app.settings.notShowBgOperations': 'Do not show this dialog again when starting a background operation',
'app.settings.categories.general': 'General',
'app.settings.categories.locale': 'Locale',
+ 'app.settings.noData': 'Unable to retrieve settings data',
'app.settings.no.view.privileges': 'No view privileges',
'app.settings.no.cluster.privileges': 'No cluster privileges',
'app.settings.admin.all.privileges': 'This user is an Ambari Admin and has all privileges.',
'app.settings.no.privileges': 'This user does not have any privileges.',
+ 'app.settings.viewPermissions': 'View Permissions',
'app.aboutAmbari.getInvolved': 'Get involved!',
'app.aboutAmbari.version': 'Version',
http://git-wip-us.apache.org/repos/asf/ambari/blob/a69b8cc8/ambari-web/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/application.hbs b/ambari-web/app/templates/application.hbs
index e67e952..293c9ae 100644
--- a/ambari-web/app/templates/application.hbs
+++ b/ambari-web/app/templates/application.hbs
@@ -78,7 +78,7 @@
{{/isAuthorized}}
{{/if}}
{{/if}}
- {{#if isClusterDataLoaded}}
+ {{#if isExistingClusterDataLoaded}}
{{#isAuthorized "CLUSTER.UPGRADE_DOWNGRADE_STACK"}}
<li><a href="" {{action showSettingsPopup target="App.router.userSettingsController"}}>{{t app.settings}}</a></li>
{{/isAuthorized}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a69b8cc8/ambari-web/app/templates/common/settings.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/settings.hbs b/ambari-web/app/templates/common/settings.hbs
index c938fa7..1669a99 100644
--- a/ambari-web/app/templates/common/settings.hbs
+++ b/ambari-web/app/templates/common/settings.hbs
@@ -70,8 +70,8 @@
</tbody>
<thead class="view-permission-header">
<tr>
- <th>View</th>
- <th>View Permissions</th>
+ <th>{{t common.view}}</th>
+ <th>{{t app.settings.viewPermissions}}</th>
</tr>
</thead>
<tbody>