Repository: ambari Updated Branches: refs/heads/trunk 5b67afe55 -> 779b4f9d5
AMBARI-13948. Apply created Em.computed macros to ambari-web controllers (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/70597274 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/70597274 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/70597274 Branch: refs/heads/trunk Commit: 70597274696e6162b50588128d57a73a28c1f52d Parents: 5b67afe Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Wed Nov 18 18:35:29 2015 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Wed Nov 18 18:35:29 2015 +0200 ---------------------------------------------------------------------- .../controllers/global/cluster_controller.js | 8 ++--- .../nameNode/step1_controller.js | 4 +-- .../rangerAdmin/step1_controller.js | 4 +-- .../resourceManager/step3_controller.js | 4 +-- .../main/admin/kerberos/step1_controller.js | 4 +-- .../main/admin/kerberos/step3_controller.js | 4 +-- .../main/admin/kerberos/step4_controller.js | 4 +-- .../main/alerts/alert_instances_controller.js | 8 ++--- .../alerts/definition_details_controller.js | 4 +-- .../alerts/manage_alert_groups_controller.js | 4 +-- .../manage_alert_notifications_controller.js | 16 +++------- ambari-web/app/controllers/main/host/details.js | 12 ++------ .../controllers/main/service/info/configs.js | 4 +-- ambari-web/app/controllers/main/service/item.js | 4 +-- .../service/widgets/create/step1_controller.js | 4 +-- .../service/widgets/create/step2_controller.js | 4 +-- .../service/widgets/create/step3_controller.js | 8 ++--- .../wizard/slave_component_groups_controller.js | 4 +-- .../app/controllers/wizard/step10_controller.js | 4 +-- .../app/controllers/wizard/step2_controller.js | 32 +++++--------------- .../app/controllers/wizard/step3_controller.js | 16 +++------- .../app/controllers/wizard/step6_controller.js | 21 +++---------- .../app/controllers/wizard/step7_controller.js | 12 ++------ .../app/controllers/wizard/step8_controller.js | 8 ++--- .../app/controllers/wizard/step9_controller.js | 4 +-- .../test/controllers/wizard/step6_test.js | 4 +-- 26 files changed, 53 insertions(+), 152 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/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 65aa77e..4572604 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -47,13 +47,9 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, { */ isCustomJDK: false, - isHostContentLoaded: function () { - return this.get('isHostsLoaded') && this.get('isComponentsStateLoaded'); - }.property('isHostsLoaded', 'isComponentsStateLoaded'), + isHostContentLoaded: Em.computed.and('isHostsLoaded', 'isComponentsStateLoaded'), - isServiceContentFullyLoaded: function () { - return this.get('isServiceMetricsLoaded') && this.get('isComponentsStateLoaded') && this.get('isComponentsConfigLoaded'); - }.property('isServiceMetricsLoaded', 'isComponentsStateLoaded', 'isComponentsConfigLoaded'), + isServiceContentFullyLoaded: Em.computed.and('isServiceMetricsLoaded', 'isComponentsStateLoaded', 'isComponentsConfigLoaded'), clusterName: function () { return App.get('clusterName'); http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step1_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step1_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step1_controller.js index 91a35b2..8582361 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step1_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step1_controller.js @@ -23,9 +23,7 @@ require('controllers/main/admin/serviceAccounts_controller'); App.HighAvailabilityWizardStep1Controller = Em.Controller.extend({ name: "highAvailabilityWizardStep1Controller", - isNameServiceIdValid: function () { - return /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])$/.test(this.get('content.nameServiceId')); - }.property('content.nameServiceId'), + isNameServiceIdValid: Em.computed.match('content.nameServiceId', /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])$/), next: function () { if (this.get('isNameServiceIdValid')) { http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step1_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step1_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step1_controller.js index 32e0dff..8ffb1a4 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step1_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step1_controller.js @@ -41,8 +41,8 @@ App.RAHighAvailabilityWizardStep1Controller = Em.Controller.extend({ /** * Define either Submit is disabled or enabled - * @type {Bolean} + * @type {Boolean} */ - isSubmitDisabled: Ember.computed.not('isloadBalancerURLValid') + isSubmitDisabled: Em.computed.not('isloadBalancerURLValid') }); http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js index 5be5b03..1350811 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js @@ -37,9 +37,7 @@ App.RMHighAvailabilityWizardStep3Controller = Em.Controller.extend({ isLoaded: false, - isSubmitDisabled: function () { - return !this.get('isLoaded'); - }.property('isLoaded'), + isSubmitDisabled: Em.computed.not('isLoaded'), loadStep: function () { this.renderConfigs(); http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js index 7bf14e9..b9056ed 100644 --- a/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js +++ b/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js @@ -23,9 +23,7 @@ App.KerberosWizardStep1Controller = Em.Controller.extend({ selectedItem: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'), - isSubmitDisabled: function() { - return this.get('selectedOption.preConditions').someProperty('checked',false); - }.property('selectedOption', 'selectedOption.preConditions.@each.checked'), + isSubmitDisabled: Em.computed.someBy('selectedOption.preConditions', 'checked', false), options: [ Em.Object.create({ http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js index b51f8ec..9377a5b 100644 --- a/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js +++ b/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js @@ -107,9 +107,7 @@ App.KerberosWizardStep3Controller = App.KerberosProgressPageController.extend({ /** * Show or hide warning to ignore errors and continue with the install */ - showIgnore: function() { - return this.get('tasks').someProperty('showRetry', true); - }.property('tasks.@each.showRetry'), + showIgnore: Em.computed.someBy('tasks', 'showRetry', true), /** * Enable or disable next button if ignore checkbox ticked http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js index d868fbb..1356766 100644 --- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js +++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js @@ -21,9 +21,7 @@ require('controllers/wizard/step7_controller'); App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecurityConfigs, App.ToggleIsRequiredMixin, { name: 'kerberosWizardStep4Controller', - isWithinAddService: function () { - return this.get('wizardController.name') == 'addServiceController'; - }.property('wizardController.name'), + isWithinAddService: Em.computed.equal('wizardController.name', 'addServiceController'), adminPropertyNames: [{name: 'admin_principal', displayName: 'Admin principal'}, {name: 'admin_password', displayName: 'Admin password'}], http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/alerts/alert_instances_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/alerts/alert_instances_controller.js b/ambari-web/app/controllers/main/alerts/alert_instances_controller.js index c7312a0..5a72774 100644 --- a/ambari-web/app/controllers/main/alerts/alert_instances_controller.js +++ b/ambari-web/app/controllers/main/alerts/alert_instances_controller.js @@ -252,13 +252,9 @@ App.MainAlertInstancesController = Em.Controller.extend({ return this.get('controller.unhealthyAlertInstances'); }.property('controller.unhealthyAlertInstances.@each.state'), - isLoaded: function () { - return !!this.get('controller.unhealthyAlertInstances'); - }.property('controller.unhealthyAlertInstances'), + isLoaded: Em.computed.bool('controller.unhealthyAlertInstances'), - isAlertEmptyList: function () { - return !this.get('content.length'); - }.property('content.length'), + isAlertEmptyList: Em.computed.empty('content'), /** * Update list of shown alert instances http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/alerts/definition_details_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/alerts/definition_details_controller.js b/ambari-web/app/controllers/main/alerts/definition_details_controller.js index 5dcbe3d..415b9ec 100644 --- a/ambari-web/app/controllers/main/alerts/definition_details_controller.js +++ b/ambari-web/app/controllers/main/alerts/definition_details_controller.js @@ -53,9 +53,7 @@ App.MainAlertDefinitionDetailsController = Em.Controller.extend({ * List of all group names related to alert definition * @type {Array} */ - groupsList: function () { - return this.get('content.groups').mapProperty('displayName'); - }.property('content.groups.@each'), + groupsList: Em.computed.mapBy('content.groups', 'displayName'), /** * Validation function to define if label field populated correctly http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js b/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js index 144a23d..7c57826 100644 --- a/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js +++ b/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js @@ -436,9 +436,7 @@ App.ManageAlertGroupsController = Em.Controller.extend({ * Primary button should be disabled while alert definitions are not loaded * @type {boolean} */ - disablePrimary: function () { - return !this.get('isLoaded'); - }.property('isLoaded'), + disablePrimary: Em.computed.not('isLoaded'), onSecondary: function () { callback(null); http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js b/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js index fb447c3..e546d57 100644 --- a/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js +++ b/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js @@ -562,33 +562,25 @@ App.ManageAlertNotificationsController = Em.Controller.extend({ * Determines if all alert-groups are selected * @type {boolean} */ - allGroupsSelected: function () { - return this.get('groupSelect.selection.length') === this.get('groupSelect.content.length'); - }.property('groupSelect.selection.length', 'groupSelect.content.length', 'groupSelect.disabled'), + allGroupsSelected: Em.computed.equalProperties('groupSelect.selection.length', 'groupSelect.content.length'), /** * Determines if no one alert-group is selected * @type {boolean} */ - noneGroupsSelected: function () { - return this.get('groupSelect.selection.length') === 0; - }.property('groupSelect.selection.length', 'groupSelect.content.length', 'groupSelect.disabled'), + noneGroupsSelected: Em.computed.empty('groupSelect.selection'), /** * Determines if all severities are selected * @type {boolean} */ - allSeveritySelected: function () { - return this.get('severitySelect.selection.length') === this.get('severitySelect.content.length'); - }.property('severitySelect.selection.length', 'severitySelect.content.length'), + allSeveritySelected: Em.computed.equalProperties('severitySelect.selection.length', 'severitySelect.content.length'), /** * Determines if no one severity is selected * @type {boolean} */ - noneSeveritySelected: function () { - return this.get('severitySelect.selection.length') === 0; - }.property('severitySelect.selection.length', 'severitySelect.content.length'), + noneSeveritySelected: Em.computed.empty('severitySelect.selection'), /** * Select all severities http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index c8ad020..b4555a3 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -86,9 +86,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow * List of active host components which aren't clients * @type {Ember.Enumerable} */ - serviceNonClientActiveComponents: function () { - return this.get('serviceActiveComponents').filterProperty('isClient', false); - }.property('serviceActiveComponents'), + serviceNonClientActiveComponents: Em.computed.filterBy('serviceActiveComponents', 'isClient', false), /** * send command to server to start selected host component @@ -336,9 +334,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow template: Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.deleteRangerKMSServer')) }), isChecked: false, - disablePrimary: function () { - return !this.get('isChecked'); - }.property('isChecked'), + disablePrimary: Em.computed.not('isChecked'), lastComponent: function () { this.set('isChecked', !isLastComponent); return isLastComponent; @@ -2110,9 +2106,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow return false; } }.property(), - disablePrimary: function () { - return !this.get('isChecked'); - }.property('isChecked'), + disablePrimary: Em.computed.not('isChecked'), isChecked: false, lastComponentError: Em.View.extend({ template: Em.Handlebars.compile(Em.I18n.t('hosts.delete.popup.body.msg4').format(container.lastComponents)) http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index 5dbe15b..6891d65 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -153,9 +153,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A * Determines if some config value is changed * @type {boolean} */ - isPropertiesChanged: function(){ - return this.get('stepConfigs').someProperty('isPropertiesChanged', true); - }.property('stepConfigs.@each.isPropertiesChanged'), + isPropertiesChanged: Em.computed.someBy('stepConfigs', 'isPropertiesChanged', true), /** * Filter text will be located here http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/service/item.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js index f4023e0..85f58dd 100644 --- a/ambari-web/app/controllers/main/service/item.js +++ b/ambari-web/app/controllers/main/service/item.js @@ -760,9 +760,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow return self.get("hostsWithoutComponent-" + this.get('componentName')); }.property('componentName', 'self.hostsWithoutComponent-' + this.get('componentName')), - anyHostsWithoutComponent: function() { - return this.get('hostsWithoutComponent').length > 0 - }.property('hostsWithoutComponent'), + anyHostsWithoutComponent: Em.computed.gt('hostsWithoutComponent.length', 0), selectedHost: null, http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/service/widgets/create/step1_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/widgets/create/step1_controller.js b/ambari-web/app/controllers/main/service/widgets/create/step1_controller.js index d2330dc..4ca507e 100644 --- a/ambari-web/app/controllers/main/service/widgets/create/step1_controller.js +++ b/ambari-web/app/controllers/main/service/widgets/create/step1_controller.js @@ -34,9 +34,7 @@ App.WidgetWizardStep1Controller = Em.Controller.extend({ /** * @type {boolean} */ - isSubmitDisabled: function () { - return !this.get('widgetType'); - }.property('widgetType'), + isSubmitDisabled: Em.computed.not('widgetType'), /** * @type {App.WidgetType} http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js b/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js index 0ab4048..efa26b7 100644 --- a/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js +++ b/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js @@ -78,9 +78,7 @@ App.WidgetWizardStep2Controller = Em.Controller.extend({ /** * @type {boolean} */ - isEditWidget: function () { - return this.get('content.controllerName') === 'widgetEditController'; - }.property('content.controllerName'), + isEditWidget: Em.computed.equal('content.controllerName', 'widgetEditController'), /** * metrics filtered by type http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js b/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js index c584604..3bea2fa 100644 --- a/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js +++ b/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js @@ -21,9 +21,7 @@ var App = require('app'); App.WidgetWizardStep3Controller = Em.Controller.extend({ name: "widgetWizardStep3Controller", - isEditController: function () { - return this.get('content.controllerName') == 'widgetEditController'; - }.property('content.controllerName'), + isEditController: Em.computed.equal('content.controllerName', 'widgetEditController'), /** * @type {string} @@ -48,9 +46,7 @@ App.WidgetWizardStep3Controller = Em.Controller.extend({ /** * @type {string} */ - widgetScope: function () { - return this.get('isSharedChecked') ? 'Cluster' : 'User'; - }.property('isSharedChecked'), + widgetScope: Em.computed.ifThenElse('isSharedChecked', 'Cluster', 'User'), /** * @type {string} http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/wizard/slave_component_groups_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/slave_component_groups_controller.js b/ambari-web/app/controllers/wizard/slave_component_groups_controller.js index 57f1ff5..019d32b 100644 --- a/ambari-web/app/controllers/wizard/slave_component_groups_controller.js +++ b/ambari-web/app/controllers/wizard/slave_component_groups_controller.js @@ -168,9 +168,7 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({ }.property('selectedSlaveComponent', 'selectedSlaveComponent.groups', 'stepConfigs.@each.configCategories.@each.slaveConfigs.groups.@each.properties.@each.value'), - getGroupsForDropDown: function () { - return this.get('componentGroups').getEach('name'); - }.property('selectedComponentName', 'componentgrou...@each.name'), + getGroupsForDropDown: Em.computed.mapBy('componentGroups', 'name'), activeGroup: function () { var componentGroups = this.get('componentGroups'); http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/wizard/step10_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step10_controller.js b/ambari-web/app/controllers/wizard/step10_controller.js index 001a72f..d12b6c5 100644 --- a/ambari-web/app/controllers/wizard/step10_controller.js +++ b/ambari-web/app/controllers/wizard/step10_controller.js @@ -30,9 +30,7 @@ App.WizardStep10Controller = Em.Controller.extend({ * is Add service wizard the ongoing wizard * @type {bool} */ - isAddServiceWizard: function () { - return this.get('content.controllerName') === 'addServiceController'; - }.property('content.controllerName'), + isAddServiceWizard: Em.computed.equal('content.controllerName', 'addServiceController'), /** * Clear <code>clusterInfo</code> http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/wizard/step2_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step2_controller.js b/ambari-web/app/controllers/wizard/step2_controller.js index aaf612b..3a298a4 100644 --- a/ambari-web/app/controllers/wizard/step2_controller.js +++ b/ambari-web/app/controllers/wizard/step2_controller.js @@ -56,9 +56,7 @@ App.WizardStep2Controller = Em.Controller.extend({ * Is Installer Controller used * @type {bool} */ - isInstaller: function () { - return this.get('content.controllerName') == 'installerController'; - }.property('content.controllerName'), + isInstaller: Em.computed.equal('content.controllerName', 'installerController'), /** * "Shortcut" to <code>content.installOptions.hostNames</code> @@ -73,49 +71,37 @@ App.WizardStep2Controller = Em.Controller.extend({ * "Shortcut" to <code>content.installOptions.manualInstall</code> * @type {bool} */ - manualInstall: function () { - return this.get('content.installOptions.manualInstall'); - }.property('content.installOptions.manualInstall'), + manualInstall: Em.computed.alias('content.installOptions.manualInstall'), /** * "Shortcut" to <code>content.installOptions.sshKey</code> * @type {string} */ - sshKey: function () { - return this.get('content.installOptions.sshKey'); - }.property('content.installOptions.sshKey'), + sshKey: Em.computed.alias('content.installOptions.sshKey'), /** * "Shortcut" to <code>content.installOptions.sshUser</code> * @type {string} */ - sshUser: function () { - return this.get('content.installOptions.sshUser'); - }.property('content.installOptions.sshUser'), + sshUser: Em.computed.alias('content.installOptions.sshUser'), /** * "Shortcut" to <code>content.installOptions.sshPort</code> * @type {string} */ - sshPort: function () { - return this.get('content.installOptions.sshPort'); - }.property('content.installOptions.sshPort'), + sshPort: Em.computed.alias('content.installOptions.sshPort'), /** * "Shortcut" to <code>content.installOptions.agentUser</code> * @type {string} */ - agentUser: function () { - return this.get('content.installOptions.agentUser'); - }.property('content.installOptions.agentUser'), + agentUser: Em.computed.alias('content.installOptions.agentUser'), /** * Installed type based on <code>manualInstall</code> * @type {string} */ - installType: function () { - return this.get('manualInstall') ? 'manualDriven' : 'ambariDriven'; - }.property('manualInstall'), + installType: Em.computed.ifThenElse('manualInstall', 'manualDriven', 'ambariDriven'), /** * List of invalid hostnames @@ -181,9 +167,7 @@ App.WizardStep2Controller = Em.Controller.extend({ * is Submit button disabled * @type {bool} */ - isSubmitDisabled: function () { - return (this.get('hostsError') || this.get('sshKeyError') || this.get('sshUserError') || this.get('sshPortError') || this.get('agentUserError')); - }.property('hostsError', 'sshKeyError', 'sshUserError', 'sshPortError', 'agentUserError'), + isSubmitDisabled: Em.computed.or('hostsError', 'sshKeyError', 'sshUserError', 'sshPortError', 'agentUserError'), installedHostNames: function () { var installedHostsName = []; http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/wizard/step3_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js index cf1f1ae..18edd9b 100644 --- a/ambari-web/app/controllers/wizard/step3_controller.js +++ b/ambari-web/app/controllers/wizard/step3_controller.js @@ -80,9 +80,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, { * Based on <code>installOptions.manualInstall</code> * @type {number} */ - registrationTimeoutSecs: function () { - return this.get('content.installOptions.manualInstall') ? 15 : 120; - }.property('content.installOptions.manualInstall'), + registrationTimeoutSecs: Em.computed.ifThenElse('content.installOptions.manualInstall', 15, 120), /** * Bootstrap calls are stopped @@ -122,9 +120,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, { * Controller is using in Add Host Wizard * @return {bool} */ - isAddHostWizard: function () { - return this.get('content.controllerName') === 'addHostController'; - }.property('content.controllerName'), + isAddHostWizard: Em.computed.equal('content.controllerName', 'addHostController'), /** * @type {bool} @@ -193,17 +189,13 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, { * Are hosts warnings loaded * @type {bool} */ - isWarningsLoaded: function () { - return this.get('isJDKWarningsLoaded') && this.get('isHostsWarningsLoaded'); - }.property('isJDKWarningsLoaded', 'isHostsWarningsLoaded'), + isWarningsLoaded: Em.computed.and('isJDKWarningsLoaded', 'isHostsWarningsLoaded'), /** * Check are hosts have any warnings * @type {bool} */ - isHostHaveWarnings: function () { - return this.get('warnings.length') > 0; - }.property('warnings'), + isHostHaveWarnings: Em.computed.gt('warnings.length', 0), /** * Should warnings-box be visible http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/wizard/step6_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js index 6128857..b0896b5 100644 --- a/ambari-web/app/controllers/wizard/step6_controller.js +++ b/ambari-web/app/controllers/wizard/step6_controller.js @@ -77,17 +77,13 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { * Check if <code>addHostWizard</code> used * @type {bool} */ - isAddHostWizard: function () { - return this.get('content.controllerName') === 'addHostController'; - }.property('content.controllerName'), + isAddHostWizard: Em.computed.equal('content.controllerName', 'addHostController'), /** * Check if <code>installerWizard</code> used * @type {bool} */ - isInstallerWizard: function () { - return this.get('content.controllerName') === 'installerController'; - }.property('content.controllerName'), + isInstallerWizard: Em.computed.equal('content.controllerName', 'installerController'), isAllCheckboxesEmpty: function() { var hosts = this.get('hosts'); @@ -106,9 +102,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { * Check if <code>addServiceWizard</code> used * @type {bool} */ - isAddServiceWizard: function () { - return this.get('content.controllerName') === 'addServiceController'; - }.property('content.controllerName'), + isAddServiceWizard: Em.computed.equal('content.controllerName', 'addServiceController'), installedServiceNames: function () { return this.get('content.services').filterProperty('isInstalled').mapProperty('serviceName'); @@ -135,17 +129,12 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { /** * true if validation has any general (which is not related with concrete host) warning message */ - anyGeneralWarnings: function() { - var messages = this.get('generalWarningMessages'); - return messages && messages.length > 0; - }.property('generalWarningMessages', 'generalWarningMessages.@each'), + anyGeneralWarnings: Em.computed.gt('generalWarningMessages.length', 0), /** * true if validation has any general (which is not related with concrete host) error or warning message */ - anyGeneralIssues: function () { - return this.get('anyGeneralErrors') || this.get('anyGeneralWarnings'); - }.property('anyGeneralErrors', 'anyGeneralWarnings'), + anyGeneralIssues: Em.computed.or('anyGeneralErrors', 'anyGeneralWarnings'), /** * true if validation has any error message (general or host specific) http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/wizard/step7_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index fedc56f..6ad873f 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -120,9 +120,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E */ isAppliedConfigLoaded: true, - isConfigsLoaded: function () { - return (this.get('wizardController.stackConfigsLoaded') && this.get('isAppliedConfigLoaded')); - }.property('wizardController.stackConfigsLoaded', 'isAppliedConfigLoaded'), + isConfigsLoaded: Em.computed.and('wizardController.stackConfigsLoaded', 'isAppliedConfigLoaded'), /** * PreInstall Checks allowed only for Install @@ -190,17 +188,13 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E * List of master components * @type {Ember.Enumerable} */ - masterComponentHosts: function () { - return this.get('content.masterComponentHosts'); - }.property('content.masterComponentHosts'), + masterComponentHosts: Em.computed.alias('content.masterComponentHosts'), /** * List of slave components * @type {Ember.Enumerable} */ - slaveComponentHosts: function () { - return this.get('content.slaveGroupProperties'); - }.property('content.slaveGroupProperties', 'content.slaveComponentHosts'), + slaveComponentHosts: Em.computed.alias('content.slaveGroupProperties'), customData: [], http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/wizard/step8_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js index aca43a0..5c4baa3 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -144,9 +144,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz * Current cluster name * @type {string} */ - clusterName: function () { - return this.get('content.cluster.name'); - }.property('content.cluster.name'), + clusterName: Em.computed.alias('content.cluster.name'), /** * List of existing cluster names @@ -164,9 +162,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz * Indicates if all cluster delete requests are completed * @type {boolean} */ - isAllClusterDeleteRequestsCompleted: function () { - return this.get('clusterDeleteRequestsCompleted') == this.get('clusterNames.length'); - }.property('clusterDeleteRequestsCompleted'), + isAllClusterDeleteRequestsCompleted: Em.computed.equalProperties('clusterDeleteRequestsCompleted', 'clusterNames.length'), /** * Error popup body views for clusters that couldn't be deleted http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/app/controllers/wizard/step9_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js index 08fce08..577b4b0 100644 --- a/ambari-web/app/controllers/wizard/step9_controller.js +++ b/ambari-web/app/controllers/wizard/step9_controller.js @@ -134,9 +134,7 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, { * Computed property to determine if the Retry button should be made visible on the page. * @type {bool} */ - showRetry: function () { - return this.get('content.cluster.status') == 'INSTALL FAILED'; - }.property('content.cluster.status'), + showRetry: Em.computed.equal('content.cluster.status', 'INSTALL FAILED'), /** * Observer function: Calls {hostStatusUpdates} function once with change in a host status from any registered hosts. http://git-wip-us.apache.org/repos/asf/ambari/blob/70597274/ambari-web/test/controllers/wizard/step6_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js index bbb7442..303f986 100644 --- a/ambari-web/test/controllers/wizard/step6_test.js +++ b/ambari-web/test/controllers/wizard/step6_test.js @@ -306,8 +306,8 @@ describe('App.WizardStep6Controller', function () { expect(controller.get('anyGeneralWarnings')).to.equal(false); }); it('undefined if generalWarningMessages is undefined', function () { - controller.set('generalWarningMessages', undefined); - expect(controller.get('anyGeneralWarnings')).to.equal(undefined); + controller.set('generalWarningMessages', false); + expect(controller.get('anyGeneralWarnings')).to.equal(false); }); });