Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E19C518D8A for ; Sat, 27 Feb 2016 13:22:13 +0000 (UTC) Received: (qmail 50179 invoked by uid 500); 27 Feb 2016 13:22:13 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 50150 invoked by uid 500); 27 Feb 2016 13:22:13 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 50141 invoked by uid 99); 27 Feb 2016 13:22:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Feb 2016 13:22:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3113FE02A1; Sat, 27 Feb 2016 13:22:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akovalenko@apache.org To: commits@ambari.apache.org Message-Id: <5e887af2b8824f73ab701c0736f57290@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-15207. Settings button doesn't work if cluster is not installed (akovalenko) Date: Sat, 27 Feb 2016 13:22:13 +0000 (UTC) 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 Authored: Fri Feb 26 20:43:55 2016 +0200 Committer: Aleksandr Kovalenko 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"}}
  • {{t app.settings}}
  • {{/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 @@ - View - View Permissions + {{t common.view}} + {{t app.settings.viewPermissions}}