You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/11/18 17:41:12 UTC
[1/4] ambari git commit: AMBARI-13948. Apply created Em.computed
macros to ambari-web controllers (onechiporenko)
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 <on...@apache.org>
Authored: Wed Nov 18 18:35:29 2015 +0200
Committer: Oleg Nechiporenko <on...@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', 'componentGroups.@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);
});
});
[2/4] ambari git commit: AMBARI-13949. Apply created Em.computed
macros to ambari-web views (onechiporenko)
Posted by on...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/services/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/hdfs.js b/ambari-web/app/views/main/service/services/hdfs.js
index f53e345..e95ea26 100644
--- a/ambari-web/app/views/main/service/services/hdfs.js
+++ b/ambari-web/app/views/main/service/services/hdfs.js
@@ -71,21 +71,15 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
$("[rel='tooltip']").tooltip('destroy');
},
- dataNodesDead: function () {
- return this.get('service.dataNodesInstalled');
- }.property('service.dataNodesInstalled'),
+ dataNodesDead: Em.computed.alias('service.dataNodesInstalled'),
- showJournalNodes: function () {
- return this.get('service.journalNodes.length') > 0;
- }.property('service.journalNodes.length'),
+ showJournalNodes: Em.computed.gt('service.journalNodes.length', 0),
journalNodesLive: function () {
return this.get('service.journalNodes').filterProperty("workStatus", "STARTED").get("length");
}.property("service.journalNodes.@each.workStatus"),
- journalNodesTotal: function () {
- return this.get('service.journalNodes').get("length");
- }.property("service.journalNodes.length"),
+ journalNodesTotal: Em.computed.alias('service.journalNodes.length'),
dfsTotalBlocks: function(){
return this.formatUnavailable(this.get('service.dfsTotalBlocks'));
@@ -189,9 +183,7 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
return App.StackServiceComponent.find().someProperty('componentName', 'NFS_GATEWAY');
}.property(),
- journalNodeComponent: function () {
- return this.get('service.journalNodes').objectAt(0);
- }.property(),
+ journalNodeComponent: Em.computed.alias('service.journalNodes.firstObject'),
safeModeStatus: function () {
var safeMode = this.get('service.safeModeStatus');
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/services/storm.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/storm.js b/ambari-web/app/views/main/service/services/storm.js
index 6cd17ac..237fdca 100644
--- a/ambari-web/app/views/main/service/services/storm.js
+++ b/ambari-web/app/views/main/service/services/storm.js
@@ -35,13 +35,9 @@ App.MainDashboardServiceStormView = App.MainDashboardServiceView.extend({
return Math.round(this.get('service.freeSlots')/this.get('service.totalSlots')*100);
}.property('service.freeSlots', 'service.totalSlots'),
- superVisorsLive: function () {
- return this.get('service.superVisorsStarted');
- }.property('service.superVisorsStarted'),
+ superVisorsLive: Em.computed.alias('service.superVisorsStarted'),
- superVisorsTotal: function() {
- return this.get('service.superVisorsTotal');
- }.property('service.superVisorsTotal'),
+ superVisorsTotal: Em.computed.alias('service.superVisorsTotal'),
nimbusUptimeFormatted: function() {
return this.get('service.nimbusUptime') || Em.I18n.t('services.service.summary.notRunning');
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/services/yarn.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/yarn.js b/ambari-web/app/views/main/service/services/yarn.js
index b80fb76..66665c0 100644
--- a/ambari-web/app/views/main/service/services/yarn.js
+++ b/ambari-web/app/views/main/service/services/yarn.js
@@ -54,9 +54,7 @@ App.MainDashboardServiceYARNView = App.MainDashboardServiceView.extend({
//return this.get('service.hostComponents').findProperty('componentName', 'YARN_CLIENT');
}.property(),
- hasManyYarnClients: function () {
- return (this.get('service.installedClients') > 1);
- }.property('service.installedClients'),
+ hasManyYarnClients: Em.computed.gt('service.installedClients', 1),
nodeUptime: function () {
var uptime = this.get('service').get('resourceManagerStartTime');
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js b/ambari-web/app/views/wizard/step1_view.js
index 76174a0..ff9dd68 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -17,6 +17,8 @@
var App = require('app');
+require('models/repository');
+
App.WizardStep1View = Em.View.extend({
templateName: require('templates/wizard/step1'),
@@ -69,17 +71,13 @@ App.WizardStep1View = Em.View.extend({
* Verify if some repo has empty base-url
* @type {bool}
*/
- invalidFormatUrlExist: function () {
- return this.get('allRepositories').someProperty('invalidFormatError', true);
- }.property('allRepositories.@each.invalidFormatError'),
+ invalidFormatUrlExist: Em.computed.someBy('allRepositories', 'invalidFormatError', true),
/**
* Disable submit button flag
* @type {bool}
*/
- isSubmitDisabled: function () {
- return this.get('invalidFormatUrlExist') || this.get('isNoOsChecked') || this.get('invalidUrlExist') || this.get('controller.content.isCheckInProgress');
- }.property('invalidFormatUrlExist', 'isNoOsChecked', 'invalidUrlExist', 'controller.content.isCheckInProgress'),
+ isSubmitDisabled: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked', 'invalidUrlExist', 'controller.content.isCheckInProgress'),
/**
* Enable error count badge
@@ -93,17 +91,13 @@ App.WizardStep1View = Em.View.extend({
* Verify if some invalid repo-urls exist
* @type {bool}
*/
- invalidUrlExist: function () {
- return this.get('allRepositories').someProperty('validation', App.Repository.validation['INVALID']);
- }.property('allRepositories.@each.validation'),
+ invalidUrlExist: Em.computed.someBy('allRepositories', 'validation', App.Repository.validation['INVALID']),
/**
* If all repo links are unchecked
* @type {bool}
*/
- isNoOsChecked: function () {
- return this.get('operatingSystems').everyProperty('isSelected', false);
- }.property('operatingSystems.@each.isSelected'),
+ isNoOsChecked: Em.computed.everyBy('operatingSystems', 'isSelected', false),
/**
* Overall errors count
@@ -128,9 +122,7 @@ App.WizardStep1View = Em.View.extend({
stackRadioButton: Em.Checkbox.extend({
tagName: 'input',
attributeBindings: [ 'type', 'checked' ],
- checked: function () {
- return this.get('content.isSelected');
- }.property('content.isSelected'),
+ checked: Em.computed.alias('content.isSelected'),
type: 'radio',
click: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/wizard/step2_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step2_view.js b/ambari-web/app/views/wizard/step2_view.js
index e83b593..1988f4e 100644
--- a/ambari-web/app/views/wizard/step2_view.js
+++ b/ambari-web/app/views/wizard/step2_view.js
@@ -61,9 +61,7 @@ App.WizardStep2View = Em.View.extend({
* Is manualInstall selected
* @type {bool}
*/
- sshKeyState: function () {
- return this.get("controller.content.installOptions.manualInstall");
- }.property("controller.content.installOptions.manualInstall"),
+ sshKeyState: Em.computed.alias('controller.content.installOptions.manualInstall'),
/**
* Is File API available
@@ -88,9 +86,7 @@ App.WizardStep2View = Em.View.extend({
classNames: ['radio-btn-provide-ssh-key'],
- checked: function () {
- return this.get('controller.content.installOptions.useSsh');
- }.property('controller.content.installOptions.useSsh'),
+ checked: Em.computed.alias('controller.content.installOptions.useSsh'),
type: 'radio',
@@ -113,9 +109,7 @@ App.WizardStep2View = Em.View.extend({
type: 'radio',
- checked: function () {
- return this.get('controller.content.installOptions.manualInstall');
- }.property('controller.content.installOptions.manualInstall'),
+ checked: Em.computed.alias('controller.content.installOptions.manualInstall'),
click: function () {
this.set('controller.content.installOptions.manualInstall', true);
@@ -133,9 +127,7 @@ App.WizardStep2View = Em.View.extend({
* Is textfield disabled
* @type {bool}
*/
- disabled: function () {
- return !this.get('isEnabled');
- }.property('isEnabled')
+ disabled: Em.computed.not('isEnabled')
})
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/wizard/step3/hostLogPopupBody_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3/hostLogPopupBody_view.js b/ambari-web/app/views/wizard/step3/hostLogPopupBody_view.js
index c3e0bed..c33599a 100644
--- a/ambari-web/app/views/wizard/step3/hostLogPopupBody_view.js
+++ b/ambari-web/app/views/wizard/step3/hostLogPopupBody_view.js
@@ -26,9 +26,7 @@ App.WizardStep3HostLogPopupBody = Em.View.extend({
* Host's boot log
* @type {string}
*/
- bootLog: function() {
- return this.get('parentView.host.bootLog');
- }.property('parentView.host.bootLog'),
+ bootLog: Em.computed.alias('parentView.host.bootLog'),
/**
* Is textarea view active
@@ -61,9 +59,7 @@ App.WizardStep3HostLogPopupBody = Em.View.extend({
* <code>parentView.bootLog</code>
* @type {string}
*/
- value: function () {
- return this.get('content');
- }.property('content')
+ value: Em.computed.alias('content')
}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js b/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
index 9c6454e..531f94b 100644
--- a/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
+++ b/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
@@ -109,18 +109,14 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
* Same to <code>bodyController.warningsByHost</code>
* @type {Ember.Enumerable}
*/
- warningsByHost: function () {
- return this.get('bodyController.warningsByHost');
- }.property('bodyController.warningsByHost'),
+ warningsByHost: Em.computed.alias('bodyController.warningsByHost'),
/**
* List of all warnings
* Same to <code>bodyController.warnings</code>
* @type {Ember.Enumerable}
*/
- warnings: function () {
- return this.get('bodyController.warnings');
- }.property('bodyController.warnings'),
+ warnings: Em.computed.alias('bodyController.warnings'),
/**
* Selected category
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/wizard/step3_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3_view.js b/ambari-web/app/views/wizard/step3_view.js
index 6ecfb41..d107357 100644
--- a/ambari-web/app/views/wizard/step3_view.js
+++ b/ambari-web/app/views/wizard/step3_view.js
@@ -54,9 +54,7 @@ App.WizardStep3View = App.TableView.extend({
* Active category
* @type {string}
*/
- selectedCategory: function() {
- return this.get('categories').findProperty('isActive');
- }.property('categories.@each.isActive'),
+ selectedCategory: Em.computed.findBy('categories', 'isActive', true),
/**
* Message about other registered hosts (not included in current registration)
@@ -86,9 +84,7 @@ App.WizardStep3View = App.TableView.extend({
return "%@ (%@)".fmt(this.get('value'), this.get('hostsCount'));
}.property('value', 'hostsCount'),
isActive: false,
- itemClass: function () {
- return this.get('isActive') ? 'active' : '';
- }.property('isActive')
+ itemClass: Em.computed.ifThenElse('isActive', 'active', '')
}),
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/wizard/step5_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step5_view.js b/ambari-web/app/views/wizard/step5_view.js
index d20f874..a3f57b5 100644
--- a/ambari-web/app/views/wizard/step5_view.js
+++ b/ambari-web/app/views/wizard/step5_view.js
@@ -21,12 +21,9 @@ var stringUtils = require('utils/string_utils');
App.WizardStep5View = App.AssignMasterComponentsView.extend({
- title: function () {
- if (this.get('controller.content.controllerName') === 'reassignMasterController') {
- return Em.I18n.t('installer.step5.reassign.header');
- }
- return Em.I18n.t('installer.step5.header');
- }.property('controller.content.controllerName'),
+ isReassignWizard: Em.computed.equal('controller.content.controllerName', 'reassignMasterController'),
+
+ title: Em.computed.ifThenElse('isReassignWizard', Em.I18n.t('installer.step5.reassign.header'), Em.I18n.t('installer.step5.header')),
alertMessage: function () {
var result = Em.I18n.t('installer.step5.body');
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/wizard/step6_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step6_view.js b/ambari-web/app/views/wizard/step6_view.js
index e038d18..e8ae176 100644
--- a/ambari-web/app/views/wizard/step6_view.js
+++ b/ambari-web/app/views/wizard/step6_view.js
@@ -41,9 +41,7 @@ App.WizardStep6View = App.TableView.extend({
* Synonym to <code>content</code> in this <code>App.TableView</code>
* @type {object[]}
*/
- filteredContent: function () {
- return this.get('content');
- }.property('content'),
+ filteredContent: Em.computed.alias('content'),
/**
* Set <code>label</code> and do <code>loadStep</code>
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js b/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js
index f9e6e94..e309b4c 100644
--- a/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js
+++ b/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js
@@ -27,17 +27,13 @@ App.WizardStep9HostLogPopupBodyView = Em.View.extend({
* Does host lost heartbeat
* @type {bool}
*/
- isHeartbeatLost: function() {
- return (this.get('parentView.host.status') === 'heartbeat_lost');
- }.property('parentView.host.status'),
+ isHeartbeatLost: Em.computed.equal('parentView.host.status', 'heartbeat_lost'),
/**
* Does host doesn't have scheduled tasks for install
* @type {bool}
*/
- isNoTasksScheduled: function() {
- return this.get('parentView.host.isNoTasksForInstall');
- }.property('parentView.host.isNoTasksForInstall'),
+ isNoTasksScheduled: Em.computed.alias('parentView.host.isNoTasksForInstall'),
/**
* Is log-box hidden
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/wizard/step9_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step9_view.js b/ambari-web/app/views/wizard/step9_view.js
index b5091c8..620f26b 100644
--- a/ambari-web/app/views/wizard/step9_view.js
+++ b/ambari-web/app/views/wizard/step9_view.js
@@ -45,9 +45,7 @@ App.WizardStep9View = App.TableView.extend({
* When progress is 100, step is completed
* @type {bool}
*/
- isStepCompleted: function() {
- return (this.get('controller.progress') === '100');
- }.property('controller.progress'),
+ isStepCompleted: Em.computed.equal('controller.progress', '100'),
/**
* Number of visible hosts
@@ -67,9 +65,7 @@ App.WizardStep9View = App.TableView.extend({
* Active category
* @type {Ember.Object}
*/
- selectedCategory: function() {
- return this.get('categories').findProperty('isActive');
- }.property('categories.@each.isActive'),
+ selectedCategory: Em.computed.findBy('categories', 'isActive', true),
/**
* Ember Object category. This object also contains
@@ -88,9 +84,7 @@ App.WizardStep9View = App.TableView.extend({
return "%@ (%@)".fmt(this.get('value'), this.get('hostsCount'));
}.property('value', 'hostsCount'),
isActive: false,
- itemClass: function () {
- return this.get('isActive') ? 'active' : '';
- }.property('isActive')
+ itemClass: Em.computed.ifThenElse('isActive', 'active', '')
}),
/**
@@ -111,9 +105,7 @@ App.WizardStep9View = App.TableView.extend({
* True if <code>controller.hostsWithHeartbeatLost</code> contains some values
* @type {bool}
*/
- isHostHeartbeatLost: function () {
- return (this.get('controller.hostsWithHeartbeatLost').length > 0);
- }.property('controller.hostsWithHeartbeatLost.@each'),
+ isHostHeartbeatLost: Em.computed.bool('controller.hostsWithHeartbeatLost.length'),
/**
* Css-string to overall progress-bar width-property
[4/4] ambari git commit: AMBARI-13950. Apply created Em.computed
macros to ambari-web models/mixins (onechiporenko)
Posted by on...@apache.org.
AMBARI-13950. Apply created Em.computed macros to ambari-web models/mixins (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/779b4f9d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/779b4f9d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/779b4f9d
Branch: refs/heads/trunk
Commit: 779b4f9d51fe3a0e523e5577477209e05f84b52d
Parents: 177a91f
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Nov 18 18:38:44 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Nov 18 18:38:44 2015 +0200
----------------------------------------------------------------------
.../mixins/common/table_server_view_mixin.js | 16 ++-----
.../app/mixins/common/widgets/widget_mixin.js | 4 +-
.../details/host_components/decommissionable.js | 4 +-
.../main/service/configs/config_overridable.js | 8 +---
.../mixins/wizard/assign_master_components.js | 4 +-
.../wizard/wizardProgressPageController.js | 4 +-
.../app/mixins/wizard/wizardProgressPageView.js | 8 +---
ambari-web/app/models/alerts/alert_config.js | 4 +-
.../app/models/alerts/alert_definition.js | 35 ++++++--------
ambari-web/app/models/alerts/alert_group.js | 5 +-
ambari-web/app/models/alerts/alert_instance.js | 4 +-
ambari-web/app/models/authentication.js | 13 ++----
ambari-web/app/models/cluster.js | 4 +-
.../app/models/configs/config_property.js | 20 ++------
.../configs/objects/service_config_category.js | 4 +-
.../configs/objects/service_config_property.js | 4 +-
.../models/configs/service_config_version.js | 4 +-
.../app/models/configs/stack_config_property.js | 4 +-
ambari-web/app/models/configs/theme/section.js | 10 ++--
.../app/models/configs/theme/sub_section.js | 22 +++------
ambari-web/app/models/configs/theme/tab.js | 4 +-
ambari-web/app/models/form.js | 12 ++---
ambari-web/app/models/host.js | 12 ++---
ambari-web/app/models/host_component.js | 4 +-
ambari-web/app/models/host_stack_version.js | 15 ++----
ambari-web/app/models/repository.js | 13 ++----
ambari-web/app/models/service.js | 13 ++----
ambari-web/app/models/service/yarn.js | 4 +-
ambari-web/app/models/stack_service.js | 43 ++++-------------
.../app/models/stack_service_component.js | 49 +++++---------------
.../models/stack_version/repository_version.js | 12 ++---
ambari-web/app/models/stack_version/version.js | 16 ++-----
ambari-web/app/models/upgrade_entity.js | 8 +---
ambari-web/app/models/user.js | 8 +---
.../test/models/alerts/alert_definition_test.js | 34 ++++++++++++++
35 files changed, 142 insertions(+), 286 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/mixins/common/table_server_view_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/table_server_view_mixin.js b/ambari-web/app/mixins/common/table_server_view_mixin.js
index b1dabb2..674042f 100644
--- a/ambari-web/app/mixins/common/table_server_view_mixin.js
+++ b/ambari-web/app/mixins/common/table_server_view_mixin.js
@@ -32,29 +32,21 @@ App.TableServerViewMixin = Em.Mixin.create({
/**
* count of filtered items
*/
- filteredCount: function () {
- return this.get('controller.filteredCount');
- }.property('controller.filteredCount'),
+ filteredCount: Em.computed.alias('controller.filteredCount'),
/**
* total count of items
*/
- totalCount: function () {
- return this.get('controller.totalCount');
- }.property('controller.totalCount'),
+ totalCount: Em.computed.alias('controller.totalCount'),
/**
* data requested from server
*/
- content: function () {
- return this.get('controller.content');
- }.property('controller.content'),
+ content: Em.computed.alias('controller.content'),
/**
* content already filtered on server-side
*/
- filteredContent: function () {
- return this.get('content');
- }.property('content'),
+ filteredContent: Em.computed.alias('content'),
/**
* sort and slice recieved content by pagination parameters
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/mixins/common/widgets/widget_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/widgets/widget_mixin.js b/ambari-web/app/mixins/common/widgets/widget_mixin.js
index c2c7f47..8c920f7 100644
--- a/ambari-web/app/mixins/common/widgets/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/widget_mixin.js
@@ -81,9 +81,7 @@ App.WidgetMixin = Ember.Mixin.create({
* color of content calculated by thresholds
* @type {string}
*/
- contentColor: function () {
- return this.get('value') ? 'green' : 'grey';
- }.property('value'),
+ contentColor: Em.computed.ifThenElse('value', 'green', 'grey'),
beforeRender: function () {
this.get('metrics').clear();
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/mixins/main/host/details/host_components/decommissionable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/host/details/host_components/decommissionable.js b/ambari-web/app/mixins/main/host/details/host_components/decommissionable.js
index b99cea7..9febc51 100644
--- a/ambari-web/app/mixins/main/host/details/host_components/decommissionable.js
+++ b/ambari-web/app/mixins/main/host/details/host_components/decommissionable.js
@@ -309,9 +309,7 @@ App.Decommissionable = Em.Mixin.create({
templateName: require('templates/main/host/decommission'),
- text: function () {
- return this.get('parentView.isComponentDecommissionAvailable') ? Em.I18n.t('common.decommission') : Em.I18n.t('common.recommission');
- }.property('parentView.isComponentDecommissionAvailable'),
+ text: Em.computed.ifThenElse('parentView.isComponentDecommissionAvailable', Em.I18n.t('common.decommission'), Em.I18n.t('common.recommission')),
didInsertElement: function () {
this._super();
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/mixins/main/service/configs/config_overridable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/configs/config_overridable.js b/ambari-web/app/mixins/main/service/configs/config_overridable.js
index 4de6d0c..fdfa356 100644
--- a/ambari-web/app/mixins/main/service/configs/config_overridable.js
+++ b/ambari-web/app/mixins/main/service/configs/config_overridable.js
@@ -112,12 +112,8 @@ App.ConfigOverridable = Em.Mixin.create({
warningMessage: ' ',
isWarning: false,
optionSelectConfigGroup: true,
- optionCreateConfigGroup: function () {
- return !this.get('optionSelectConfigGroup');
- }.property('optionSelectConfigGroup'),
- hasExistedGroups: function () {
- return !!this.get('availableConfigGroups').length;
- }.property('availableConfigGroups'),
+ optionCreateConfigGroup: Em.computed.not('optionSelectConfigGroup'),
+ hasExistedGroups: Em.computed.bool('availableConfigGroups.length'),
availableConfigGroups: availableConfigGroups,
selectedConfigGroup: selectedConfigGroup,
newConfigGroupName: '',
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/mixins/wizard/assign_master_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/assign_master_components.js b/ambari-web/app/mixins/wizard/assign_master_components.js
index 4d091c3..c22a2db 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -131,9 +131,7 @@ App.AssignMasterComponents = Em.Mixin.create({
* 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'),
/**
* Master components which could be assigned to multiple hosts
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/mixins/wizard/wizardProgressPageController.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageController.js b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
index f2af630..d9c5747 100644
--- a/ambari-web/app/mixins/wizard/wizardProgressPageController.js
+++ b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
@@ -43,9 +43,7 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create(App.InstallComponent, {
completedStatuses: ['COMPLETED', 'FAILED', 'TIMEDOUT', 'ABORTED'],
currentPageRequestId: null,
isSingleRequestPage: false,
- isCommandLevelRetry: function () {
- return !this.get('isSingleRequestPage');
- }.property('isSingleRequestPage'),
+ isCommandLevelRetry: Em.computed.not('isSingleRequestPage'),
showRetry: false,
/**
* Show whether tasks data was loaded
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/mixins/wizard/wizardProgressPageView.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageView.js b/ambari-web/app/mixins/wizard/wizardProgressPageView.js
index bc278b9..e3a321c 100644
--- a/ambari-web/app/mixins/wizard/wizardProgressPageView.js
+++ b/ambari-web/app/mixins/wizard/wizardProgressPageView.js
@@ -43,9 +43,7 @@ App.wizardProgressPageViewMixin = Em.Mixin.create({
noticeCompleted: Em.I18n.t('wizard.progressPage.notice.completed'),
- noticeFailed: function() {
- return (this.get('controller.isSingleRequestPage') ? Em.I18n.t('wizard.singleRequest.progressPage.notice.failed') : Em.I18n.t('wizard.progressPage.notice.failed'))
- }.property('controller.isSingleRequestPage'),
+ noticeFailed: Em.computed.ifThenElse('controller.isSingleRequestPage', Em.I18n.t('wizard.singleRequest.progressPage.notice.failed'), Em.I18n.t('wizard.progressPage.notice.failed')),
/**
* @noticeInProgress: Following computed property needs to be overridden to show the label text while the commands
@@ -119,9 +117,7 @@ App.wizardProgressPageViewMixin = Em.Mixin.create({
}
}.observes('content.status', 'content.hosts.length','content.requestIds'),
- showProgressBar: function () {
- return this.get('content.status') === "IN_PROGRESS";
- }.property('content.status')
+ showProgressBar: Em.computed.equal('content.status', 'IN_PROGRESS')
})
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/alerts/alert_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_config.js b/ambari-web/app/models/alerts/alert_config.js
index 07a9453..3e3325f 100644
--- a/ambari-web/app/models/alerts/alert_config.js
+++ b/ambari-web/app/models/alerts/alert_config.js
@@ -115,9 +115,7 @@ App.AlertConfigProperty = Ember.Object.extend({
* should be defined in child class
* @type {*}
*/
- apiFormattedValue: function () {
- return this.get('value');
- }.property('value'),
+ apiFormattedValue: Em.computed.alias('value'),
/**
* define if property was changed by user
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/alerts/alert_definition.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_definition.js b/ambari-web/app/models/alerts/alert_definition.js
index e33324b..ec5797e 100644
--- a/ambari-web/app/models/alerts/alert_definition.js
+++ b/ambari-web/app/models/alerts/alert_definition.js
@@ -19,6 +19,13 @@
var App = require('app');
var dateUtils = require('utils/date/date');
+function computedOnSummaryState(state) {
+ return Em.computed('summary.' + state, 'summary.' + state + '.count', 'summary.' + state + '.maintenanceCount', function () {
+ var summary = Em.get(this, 'summary');
+ return !!summary[state] && !!(summary[state].count || summary[state].maintenanceCount);
+ });
+}
+
App.AlertDefinition = DS.Model.extend({
name: DS.attr('string'),
@@ -207,44 +214,28 @@ App.AlertDefinition = DS.Model.extend({
}.property('summary'),
/**
- * if this definition is in state: CRIT
+ * if this definition is in state: CRITICAL
* @type {boolean}
*/
- isCritical: function () {
- var summary = this.get('summary');
- var state = 'CRITICAL';
- return !!summary[state] && !!(summary[state].count || summary[state].maintenanceCount);
- }.property('summary'),
+ isCritical: computedOnSummaryState('CRITICAL'),
/**
* if this definition is in state: WARNING
* @type {boolean}
*/
- isWarning: function () {
- var summary = this.get('summary');
- var state = 'WARNING';
- return !!summary[state] && !!(summary[state].count || summary[state].maintenanceCount);
- }.property('summary'),
+ isWarning: computedOnSummaryState('WARNING'),
/**
* if this definition is in state: OK
* @type {boolean}
*/
- isOK: function () {
- var summary = this.get('summary');
- var state = 'OK';
- return !!summary[state] && !!(summary[state].count || summary[state].maintenanceCount);
- }.property('summary'),
+ isOK: computedOnSummaryState('OK'),
/**
- * if this definition is in state: OK
+ * if this definition is in state: UNKNOWN
* @type {boolean}
*/
- isUnknown: function () {
- var summary = this.get('summary');
- var state = 'UNKNOWN';
- return !!summary[state] && !!(summary[state].count || summary[state].maintenanceCount);
- }.property('summary'),
+ isUnknown: computedOnSummaryState('UNKNOWN'),
/**
* For alerts we will have processes which are not typical
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/alerts/alert_group.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_group.js b/ambari-web/app/models/alerts/alert_group.js
index e914ed5..d8d297b 100644
--- a/ambari-web/app/models/alerts/alert_group.js
+++ b/ambari-web/app/models/alerts/alert_group.js
@@ -70,9 +70,8 @@ App.AlertGroup = DS.Model.extend({
return this.get('displayName') + ' (' + this.get('definitions.length') + ')';
}.property('displayName', 'definitions.length'),
- isAddDefinitionsDisabled: function () {
- return this.get('default');
- }.property('default')
+ isAddDefinitionsDisabled: Em.computed.alias('default')
+
});
App.AlertGroup.FIXTURES = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/alerts/alert_instance.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_instance.js b/ambari-web/app/models/alerts/alert_instance.js
index 60a2723..bec2148 100644
--- a/ambari-web/app/models/alerts/alert_instance.js
+++ b/ambari-web/app/models/alerts/alert_instance.js
@@ -149,9 +149,7 @@ App.AlertInstance = DS.Model.extend({
* Used in some logic in templates to distinguish definitions with Ambari serviceName
* @returns {boolean}
*/
- isAmbariServiceName: function () {
- return this.get('serviceName') === 'AMBARI';
- }.property('serviceName'),
+ isAmbariServiceName: Em.computed.equal('serviceName', 'AMBARI'),
shortState: {
'CRITICAL': 'CRIT',
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/authentication.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/authentication.js b/ambari-web/app/models/authentication.js
index 47ea775..436c184 100644
--- a/ambari-web/app/models/authentication.js
+++ b/ambari-web/app/models/authentication.js
@@ -97,11 +97,8 @@ App.AuthenticationForm = App.Form.extend({
this.set('testResult', parseInt(Math.random() * 2));
return true;
},
- testConfigurationMessage:function () {
- return this.get('testResult') ? Em.I18n.t('admin.authentication.form.test.success') : Em.I18n.t('admin.authentication.form.test.fail');
- }.property('testResult'),
- testConfigurationClass:function () {
- return this.get('testResult') ? "text-success" : "text-error";
- }.property('testConfigurationMessage')
-})
-;
\ No newline at end of file
+ testConfigurationMessage: Em.computed.ifThenElse('testResult', Em.I18n.t('admin.authentication.form.test.success'), Em.I18n.t('admin.authentication.form.test.fail')),
+
+ testConfigurationClass: Em.computed.ifThenElse('testResult', 'text-success', 'text-error')
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/cluster.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster.js b/ambari-web/app/models/cluster.js
index 18ad1ce..a571a28 100644
--- a/ambari-web/app/models/cluster.js
+++ b/ambari-web/app/models/cluster.js
@@ -33,9 +33,7 @@ App.Cluster = DS.Model.extend({
*/
desiredConfigs: null,
- isKerberosEnabled: function() {
- return this.get('securityType') === 'KERBEROS';
- }.property('securityType'),
+ isKerberosEnabled: Em.computed.equal('securityType', 'KERBEROS'),
isCredentialStorePersistent: function() {
return this.get('credentialStoreProperties')[credentialUtils.STORE_TYPES.PERSISTENT_PATH] === "true";
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/configs/config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/config_property.js b/ambari-web/app/models/configs/config_property.js
index 31ba3f6..bede126 100644
--- a/ambari-web/app/models/configs/config_property.js
+++ b/ambari-web/app/models/configs/config_property.js
@@ -179,26 +179,20 @@ App.ConfigProperty = DS.Model.extend({
* defines if property has errors
* @type {boolean}
*/
- hasErrors: function() {
- return this.get('errorMessage') !== '';
- }.property('errorMessage'),
+ hasErrors: Em.computed.notEqual('errorMessage', ''),
/**
* defines if property has warnings
* @type {boolean}
*/
- hasWarnings: function() {
- return this.get('warnMessage') !== '';
- }.property('warnMessage'),
+ hasWarnings: Em.computed.notEqual('warnMessage', ''),
/**
* defines if property belongs to default config group
* if true it's config group is default
* @type {boolean}
*/
- isOriginalSCP: function() {
- return this.get('configVersion.isDefault');
- }.property('configVersion.isDefault'),
+ isOriginalSCP: Em.computed.alias('configVersion.isDefault'),
/**
* defines if property is added by user
@@ -213,17 +207,13 @@ App.ConfigProperty = DS.Model.extend({
* with which we make comparison
* @property {boolean}
*/
- isForCompare: function() {
- return this.get('configVersion.isForCompare');
- }.property('configVersion.isForCompare'),
+ isForCompare: Em.computed.alias('configVersion.isForCompare'),
/**
* if this property can be final
* @property {boolean}
*/
- supportsFinal: function () {
- return this.get('stackConfigProperty.supportsFinal') || this.get('isUserProperty');
- }.property('stackConfigProperty.supportsFinal', 'isUserProperty'),
+ supportsFinal: Em.computed.or('stackConfigProperty.supportsFinal', 'isUserProperty'),
/**
* Indicates when value is not the default value.
* Returns false when there is no default value.
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/configs/objects/service_config_category.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_category.js b/ambari-web/app/models/configs/objects/service_config_category.js
index d54241e..bac0be8 100644
--- a/ambari-web/app/models/configs/objects/service_config_category.js
+++ b/ambari-web/app/models/configs/objects/service_config_category.js
@@ -78,9 +78,7 @@ App.ServiceConfigCategory = Ember.Object.extend({
return length;
}.property('slaveConfigs.groups.@each.errorCount'),
- errorCount: function () {
- return this.get('slaveErrorCount') + this.get('nonSlaveErrorCount');
- }.property('slaveErrorCount', 'nonSlaveErrorCount'),
+ errorCount: Em.computed.sumProperties('slaveErrorCount', 'nonSlaveErrorCount'),
isAdvanced : function(){
var name = this.get('name');
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js
index c078a9e..9bfb9cf 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -280,9 +280,7 @@ App.ServiceConfigProperty = Em.Object.extend({
return ["componentHost", "componentHosts", "radio button"].contains(this.get('displayType'));
}.property('displayType'),
- isValid: function () {
- return this.get('errorMessage') === '';
- }.property('errorMessage'),
+ isValid: Em.computed.equal('errorMessage', ''),
viewClass: function () {
switch (this.get('displayType')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/configs/service_config_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/service_config_version.js b/ambari-web/app/models/configs/service_config_version.js
index 6020fe6..02aeb92 100644
--- a/ambari-web/app/models/configs/service_config_version.js
+++ b/ambari-web/app/models/configs/service_config_version.js
@@ -42,9 +42,7 @@ App.ServiceConfigVersion = DS.Model.extend({
canBeMadeCurrent: function () {
return this.get('isCompatible') && !this.get('isCurrent');
}.property('isCurrent', 'isCompatible'),
- isDefault: function() {
- return this.get('groupName') === 'default';
- }.property('groupName'),
+ isDefault: Em.computed.equal('groupName', 'default'),
currentTooltip: function () {
return Em.I18n.t('dashboard.configHistory.table.current.tooltip').format(this.get('displayName'), this.get('configGroupName'));
}.property('displayName', 'configGroupName'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/configs/stack_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/stack_config_property.js b/ambari-web/app/models/configs/stack_config_property.js
index 8451fcf..1083b3f 100644
--- a/ambari-web/app/models/configs/stack_config_property.js
+++ b/ambari-web/app/models/configs/stack_config_property.js
@@ -47,9 +47,7 @@ App.StackConfigProperty = DS.Model.extend({
* same as fileName
* @property {string}
*/
- filename: function() {
- return this.get('fileName');
- }.property('fileName'),
+ filename: Em.computed.alias('fileName'),
/**
* description of config property meaning
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/configs/theme/section.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/theme/section.js b/ambari-web/app/models/configs/theme/section.js
index c04665e..4df0e2e 100644
--- a/ambari-web/app/models/configs/theme/section.js
+++ b/ambari-web/app/models/configs/theme/section.js
@@ -82,11 +82,9 @@ App.Section = DS.Model.extend({
}.property('subSections.@each.errorsCount', 'subSections.@each.isSectionVisible'),
/**
- * @type {boolean}
+ * @type {boolean}/
*/
- isFirstRow: function () {
- return this.get('rowIndex') == 0;
- }.property('rowIndex'),
+ isFirstRow: Em.computed.equal('rowIndex', 0),
/**
* @type {boolean}
@@ -105,9 +103,7 @@ App.Section = DS.Model.extend({
/**
* @type {boolean}
*/
- isFirstColumn: function () {
- return this.get('columnIndex') == 0;
- }.property('columnIndex'),
+ isFirstColumn: Em.computed.equal('columnIndex', 0),
/**
* @type {boolean}
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/configs/theme/sub_section.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/theme/sub_section.js b/ambari-web/app/models/configs/theme/sub_section.js
index eea3802..f813b4e 100644
--- a/ambari-web/app/models/configs/theme/sub_section.js
+++ b/ambari-web/app/models/configs/theme/sub_section.js
@@ -88,13 +88,11 @@ App.SubSection = DS.Model.extend({
/**
* @type {boolean}
*/
- hasTabs: function() {
- return this.get('subSectionTabs.length');
- }.property('subSectionTabs.length'),
+ hasTabs: Em.computed.bool('subSectionTabs.length'),
- showTabs: function() {
- return this.get('hasTabs') && this.get('subSectionTabs').someProperty('isVisible');
- }.property('hasTabs','subSectionTabs.@each.isVisible'),
+ someSubSectionTabIsVisible: Em.computed.someBy('subSectionTabs', 'isVisible', true),
+
+ showTabs: Em.computed.and('hasTabs', 'someSubSectionTabIsVisible'),
/**
* Number of the errors in all configs
@@ -118,9 +116,7 @@ App.SubSection = DS.Model.extend({
/**
* @type {boolean}
*/
- addRightVerticalSplitter: function() {
- return !this.get('isLastColumn');
- }.property('isLastColumn'),
+ addRightVerticalSplitter: Em.computed.not('isLastColumn'),
/**
* @type {boolean}
@@ -132,9 +128,7 @@ App.SubSection = DS.Model.extend({
/**
* @type {boolean}
*/
- isFirstRow: function () {
- return this.get('rowIndex') == 0;
- }.property('rowIndex'),
+ isFirstRow: Em.computed.equal('rowIndex', 0),
/**
* @type {boolean}
@@ -153,9 +147,7 @@ App.SubSection = DS.Model.extend({
/**
* @type {boolean}
*/
- isFirstColumn: function () {
- return this.get('columnIndex') == 0;
- }.property('columnIndex'),
+ isFirstColumn: Em.computed.equal('columnIndex', 0),
/**
* @type {boolean}
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/configs/theme/tab.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/theme/tab.js b/ambari-web/app/models/configs/theme/tab.js
index cb7aeae..54ae579 100644
--- a/ambari-web/app/models/configs/theme/tab.js
+++ b/ambari-web/app/models/configs/theme/tab.js
@@ -59,9 +59,7 @@ App.Tab = DS.Model.extend({
* for now used when tab is disabled
* @type {String}
*/
- tooltipMsg: function() {
- return this.get('isHiddenByFilter') ? Em.I18n.t('services.service.config.nothing.to.display') : '';
- }.property('isHiddenByFilter'),
+ tooltipMsg: Em.computed.ifThenElse('isHiddenByFilter', Em.I18n.t('services.service.config.nothing.to.display') , ''),
/**
* Determines if tab is filtered out (all it's sections should be hidden)
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/form.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/form.js b/ambari-web/app/models/form.js
index c45c6cb..09a620a 100644
--- a/ambari-web/app/models/form.js
+++ b/ambari-web/app/models/form.js
@@ -92,9 +92,7 @@ App.Form = Em.View.extend({
}, this);
},
- visibleFields:function () {
- return this.get('fields').filterProperty('isHiddenField', false);
- }.property('fields'),
+ visibleFields:Em.computed.filterBy('fields', 'isHiddenField', false),
resultText:function () {
var text = "";
@@ -126,9 +124,7 @@ App.FormField = Em.Object.extend({ // try to realize this as view
unit:'',
value:'',
- isValid:function () {
- return this.get('errorMessage') === '';
- }.property('errorMessage'),
+ isValid:Em.computed.equal('errorMessage', ''),
viewClass:function () {
var options = {};
@@ -178,7 +174,5 @@ App.FormField = Em.Object.extend({ // try to realize this as view
}
},
- isHiddenField:function () {
- return this.get('displayType') == 'hidden';
- }.property('type')
+ isHiddenField: Em.computed.equal('displayType', 'hidden')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host.js b/ambari-web/app/models/host.js
index c268d44..1c6da8d 100644
--- a/ambari-web/app/models/host.js
+++ b/ambari-web/app/models/host.js
@@ -90,25 +90,19 @@ App.Host = DS.Model.extend({
/**
* @type {number}
*/
- componentsInPassiveStateCount: function() {
- return this.get('componentsInPassiveState').length;
- }.property('componentsInPassiveState.length'),
+ componentsInPassiveStateCount: Em.computed.alias('componentsInPassiveState.length'),
/**
* Get count of host components with stale configs
* @returns {Number}
*/
- componentsWithStaleConfigsCount: function() {
- return this.get('componentsWithStaleConfigs.length');
- }.property('componentsWithStaleConfigs.length'),
+ componentsWithStaleConfigsCount: Em.computed.alias('componentsWithStaleConfigs.length'),
/**
* Count of mounted on host disks
* @returns {Number}
*/
- disksMounted: function() {
- return this.get('diskInfo.length');
- }.property('diskInfo.length'),
+ disksMounted: Em.computed.alias('diskInfo.length'),
coresFormatted: function() {
return this.get('cpu') + ' (' + this.get('cpuPhysical') + ')';
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index 1ef23db..203eff2 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -107,9 +107,7 @@ App.HostComponent = DS.Model.extend({
* User friendly host component status
* @returns {String}
*/
- isActive: function () {
- return (this.get('passiveState') == 'OFF');
- }.property('passiveState'),
+ isActive: Em.computed.equal('passiveState', 'OFF'),
passiveTooltip: function () {
if (!this.get('isActive')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/host_stack_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_stack_version.js b/ambari-web/app/models/host_stack_version.js
index 2d49a76..8962552 100644
--- a/ambari-web/app/models/host_stack_version.js
+++ b/ambari-web/app/models/host_stack_version.js
@@ -36,23 +36,17 @@ App.HostStackVersion = DS.Model.extend({
/**
* @type {boolean}
*/
- isCurrent: function () {
- return this.get('status') === 'CURRENT'
- }.property('status'),
+ isCurrent: Em.computed.equal('status', 'CURRENT'),
/**
* @type {boolean}
*/
- isInstalling: function () {
- return this.get('status') === 'INSTALLING';
- }.property('status'),
+ isInstalling: Em.computed.equal('status', 'INSTALLING'),
/**
* @type {boolean}
*/
- isOutOfSync: function () {
- return this.get('status') === 'OUT_OF_SYNC';
- }.property('status'),
+ isOutOfSync: Em.computed.equal('status', 'OUT_OF_SYNC'),
/**
* @type {string}
*/
@@ -66,7 +60,8 @@ App.HostStackVersion = DS.Model.extend({
installEnabled: function () {
return ['OUT_OF_SYNC', 'INSTALL_FAILED'].contains(this.get('status'));
}.property('status'),
- installDisabled: Ember.computed.not('installEnabled')
+
+ installDisabled: Em.computed.not('installEnabled')
});
App.HostStackVersion.FIXTURES = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/repository.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/repository.js b/ambari-web/app/models/repository.js
index 66c22bf..8ad20ce 100644
--- a/ambari-web/app/models/repository.js
+++ b/ambari-web/app/models/repository.js
@@ -36,9 +36,7 @@ App.Repository = DS.Model.extend({
errorContent: DS.attr('string', {defaultValue: ''}),
errorTitle: DS.attr('string', {defaultValue: ''}),
- isSelected: function() {
- return this.get('operatingSystem.isSelected');
- }.property('id','operatingSystem.isSelected'),
+ isSelected: Em.computed.alias('operatingSystem.isSelected'),
invalidFormatError: function() {
return !validator.isValidBaseUrl(this.get('baseUrl'));
@@ -48,13 +46,10 @@ App.Repository = DS.Model.extend({
return this.get('validation') == App.Repository.validation['INVALID'];
}.property('validation'),
- undo: function() {
- return this.get('baseUrl') != this.get('latestBaseUrl');
- }.property('baseUrl','latestBaseUrl'),
+ undo: Em.computed.notEqualProperties('baseUrl', 'latestBaseUrl'),
+
+ clearAll: Em.computed.alias('baseUrl')
- clearAll: function() {
- return this.get('baseUrl')
- }.property('baseUrl')
});
App.Repository.validation = {
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index 250f810..ddec4f9 100644
--- a/ambari-web/app/models/service.js
+++ b/ambari-web/app/models/service.js
@@ -45,9 +45,7 @@ App.Service = DS.Model.extend({
/**
* @type {bool}
*/
- isInPassive: function() {
- return this.get('passiveState') === "ON";
- }.property('passiveState'),
+ isInPassive: Em.computed.equal('passiveState', 'ON'),
serviceComponents: function() {
var clientComponents = this.get('clientComponents').mapProperty('componentName');
@@ -77,12 +75,9 @@ App.Service = DS.Model.extend({
return 'yellow';
}
}.property('workStatus'),
- isStopped: function () {
- return this.get('workStatus') === 'INSTALLED';
- }.property('workStatus'),
- isStarted: function () {
- return this.get('workStatus') === 'STARTED';
- }.property('workStatus'),
+ isStopped: Em.computed.equal('workStatus', 'INSTALLED'),
+
+ isStarted: Em.computed.equal('workStatus', 'STARTED'),
/**
* Service Tagging by their type.
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/service/yarn.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/yarn.js b/ambari-web/app/models/service/yarn.js
index c8967e6..ef44f19 100644
--- a/ambari-web/app/models/service/yarn.js
+++ b/ambari-web/app/models/service/yarn.js
@@ -67,9 +67,7 @@ App.YARNService = App.Service.extend({
allQueueNames: [],
childQueueNames: [],
- maxMemory: function() {
- return this.get('allocatedMemory') + this.get('availableMemory');
- }.property('allocatedMemory','availableMemory'),
+ maxMemory: Em.computed.sumProperties('allocatedMemory', 'availableMemory'),
/**
* Provides a flat array of queue names.
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index 1926b9c..bdcf303 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -62,9 +62,7 @@ App.StackService = DS.Model.extend({
// Primary DFS. used if there is more than one DFS in a stack.
// Only one service in the stack should be tagged as primary DFS.
- isPrimaryDFS: function () {
- return this.get('serviceName') === 'HDFS';
- }.property('serviceName'),
+ isPrimaryDFS: Em.computed.equal('serviceName', 'HDFS'),
configTypesRendered: function () {
var configTypes = this.get('configTypes');
@@ -105,22 +103,13 @@ App.StackService = DS.Model.extend({
}.property('serviceName'),
// Is the service required for monitoring of other hadoop ecosystem services
- isMonitoringService: function () {
- var services = ['GANGLIA'];
- return services.contains(this.get('serviceName'));
- }.property('serviceName'),
+ isMonitoringService: Em.computed.existsIn('serviceName', ['GANGLIA']),
// Is the service required for reporting host metrics
- isHostMetricsService: function () {
- var services = ['GANGLIA', 'AMBARI_METRICS'];
- return services.contains(this.get('serviceName'));
- }.property('serviceName'),
+ isHostMetricsService: Em.computed.existsIn('serviceName', ['GANGLIA', 'AMBARI_METRICS']),
// Is the service required for reporting hadoop service metrics
- isServiceMetricsService: function () {
- var services = ['GANGLIA'];
- return services.contains(this.get('serviceName'));
- }.property('serviceName'),
+ isServiceMetricsService: Em.computed.existsIn('serviceName', ['GANGLIA']),
coSelectedServices: function () {
var coSelectedServices = App.StackService.coSelected[this.get('serviceName')];
@@ -131,30 +120,18 @@ App.StackService = DS.Model.extend({
}
}.property('serviceName'),
- hasClient: function () {
- var serviceComponents = this.get('serviceComponents');
- return serviceComponents.someProperty('isClient');
- }.property('serviceName'),
+ hasClient: Em.computed.someBy('serviceComponents', 'isClient', true),
- hasMaster: function () {
- var serviceComponents = this.get('serviceComponents');
- return serviceComponents.someProperty('isMaster');
- }.property('serviceName'),
+ hasMaster: Em.computed.someBy('serviceComponents', 'isMaster', true),
- hasSlave: function () {
- var serviceComponents = this.get('serviceComponents');
- return serviceComponents.someProperty('isSlave');
- }.property('serviceName'),
+ hasSlave: Em.computed.someBy('serviceComponents', 'isSlave', true),
hasNonMastersWithCustomAssignment: function () {
var serviceComponents = this.get('serviceComponents');
return serviceComponents.rejectProperty('isMaster').rejectProperty('cardinality', 'ALL').length > 0;
}.property('serviceName'),
- isClientOnlyService: function () {
- var serviceComponents = this.get('serviceComponents');
- return serviceComponents.everyProperty('isClient');
- }.property('serviceName'),
+ isClientOnlyService: Em.computed.everyBy('serviceComponents', 'isClient', true),
isNoConfigTypes: function () {
var configTypes = this.get('configTypes');
@@ -165,9 +142,7 @@ App.StackService = DS.Model.extend({
return App.StackService.reviewPageHandlers[this.get('serviceName')];
}.property('serviceName'),
- hasHeatmapSection: function() {
- return ['HDFS', 'YARN', 'HBASE'].contains(this.get('serviceName'));
- }.property('serviceName'),
+ hasHeatmapSection: Em.computed.existsIn('serviceName', ['HDFS', 'YARN', 'HBASE']),
/**
* configCategories are fetched from App.StackService.configCategories.
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/stack_service_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service_component.js b/ambari-web/app/models/stack_service_component.js
index b51ed1f..1321d11 100644
--- a/ambari-web/app/models/stack_service_component.js
+++ b/ambari-web/app/models/stack_service_component.js
@@ -56,29 +56,19 @@ App.StackServiceComponent = DS.Model.extend({
}.property('cardinality'),
/** @property {Boolean} isRequired - component required to install **/
- isRequired: function() {
- return this.get('minToInstall') > 0;
- }.property('cardinality'),
+ isRequired: Em.computed.gt('minToInstall', 0),
/** @property {Boolean} isMultipleAllowed - component can be assigned for more than one host **/
- isMultipleAllowed: function() {
- return this.get('maxToInstall') > 1;
- }.property('cardinality'),
+ isMultipleAllowed: Em.computed.gt('maxToInstall', 1),
/** @property {Boolean} isSlave **/
- isSlave: function() {
- return this.get('componentCategory') === 'SLAVE';
- }.property('componentCategory'),
+ isSlave: Em.computed.equal('componentCategory', 'SLAVE'),
/** @property {Boolean} isRestartable - component supports restart action **/
- isRestartable: function() {
- return !this.get('isClient');
- }.property('isClient'),
+ isRestartable: Em.computed.not('isClient'),
/** @property {Boolean} isReassignable - component supports reassign action **/
- isReassignable: function() {
- return ['NAMENODE', 'SECONDARY_NAMENODE', 'JOBTRACKER', 'RESOURCEMANAGER', 'APP_TIMELINE_SERVER', 'OOZIE_SERVER', 'WEBHCAT_SERVER', 'HIVE_SERVER', 'HIVE_METASTORE', 'MYSQL_SERVER', 'METRICS_COLLECTOR'].contains(this.get('componentName'));
- }.property('componentName'),
+ isReassignable: Em.computed.existsIn('componentName', ['NAMENODE', 'SECONDARY_NAMENODE', 'JOBTRACKER', 'RESOURCEMANAGER', 'APP_TIMELINE_SERVER', 'OOZIE_SERVER', 'WEBHCAT_SERVER', 'HIVE_SERVER', 'HIVE_METASTORE', 'MYSQL_SERVER', 'METRICS_COLLECTOR']),
/** @property {Boolean} isRollinRestartAllowed - component supports rolling restart action **/
isRollinRestartAllowed: function() {
@@ -86,14 +76,10 @@ App.StackServiceComponent = DS.Model.extend({
}.property('componentName'),
/** @property {Boolean} isDecommissionAllowed - component supports decommission action **/
- isDecommissionAllowed: function() {
- return ["DATANODE", "TASKTRACKER", "NODEMANAGER", "HBASE_REGIONSERVER"].contains(this.get('componentName'));
- }.property('componentName'),
+ isDecommissionAllowed: Em.computed.existsIn('componentName', ['DATANODE', 'TASKTRACKER', 'NODEMANAGER', 'HBASE_REGIONSERVER']),
/** @property {Boolean} isRefreshConfigsAllowed - component supports refresh configs action **/
- isRefreshConfigsAllowed: function() {
- return ["FLUME_HANDLER"].contains(this.get('componentName'));
- }.property('componentName'),
+ isRefreshConfigsAllowed: Em.computed.existsIn('componentName', ['FLUME_HANDLER']),
/** @property {Boolean} isAddableToHost - component can be added on host details page **/
isAddableToHost: function() {
@@ -150,20 +136,13 @@ App.StackServiceComponent = DS.Model.extend({
* New instances of these components are added in appropriate HA wizards
* @property {Boolean} isMasterAddableOnlyOnHA
*/
- isMasterAddableOnlyOnHA: function () {
- return ['NAMENODE', 'RESOURCEMANAGER', 'RANGER_ADMIN'].contains(this.get('componentName'));
- }.property('componentName'),
+ isMasterAddableOnlyOnHA: Em.computed.existsIn('componentName', ['NAMENODE', 'RESOURCEMANAGER', 'RANGER_ADMIN']),
/** @property {Boolean} isHAComponentOnly - Components that can be installed only if HA enabled **/
- isHAComponentOnly: function() {
- var HAComponentNames = ['ZKFC','JOURNALNODE'];
- return HAComponentNames.contains(this.get('componentName'));
- }.property('componentName'),
+ isHAComponentOnly: Em.computed.existsIn('componentName', ['ZKFC','JOURNALNODE']),
/** @property {Boolean} isRequiredOnAllHosts - Is It require to install the components on all hosts. used in step-6 wizard controller **/
- isRequiredOnAllHosts: function() {
- return this.get('minToInstall') == Infinity;
- }.property('stackService','isSlave'),
+ isRequiredOnAllHosts: Em.computed.equal('minToInstall', Infinity),
/** @property {Number} defaultNoOfMasterHosts - default number of master hosts on Assign Master page: **/
defaultNoOfMasterHosts: function() {
@@ -185,9 +164,7 @@ App.StackServiceComponent = DS.Model.extend({
}.property('componentName'),
/** @property {Boolean} isOtherComponentCoHosted - Is any other component co-hosted with this component **/
- isOtherComponentCoHosted: function() {
- return !!this.get('coHostedComponents').length;
- }.property('coHostedComponents'),
+ isOtherComponentCoHosted: Em.computed.bool('coHostedComponents.length'),
/** @property {Boolean} isCoHostedComponent - Is this component co-hosted with other component **/
isCoHostedComponent: function() {
@@ -196,9 +173,7 @@ App.StackServiceComponent = DS.Model.extend({
}.property('componentName'),
/** @property {Boolean} isNotAddableOnlyInInstall - is this component addable, except Install and Add Service Wizards **/
- isNotAddableOnlyInInstall: function() {
- return ['HIVE_METASTORE', 'HIVE_SERVER', 'RANGER_KMS_SERVER', 'OOZIE_SERVER'].contains(this.get('componentName'));
- }.property('componentName')
+ isNotAddableOnlyInInstall: Em.computed.existsIn('componentName', ['HIVE_METASTORE', 'HIVE_SERVER', 'RANGER_KMS_SERVER', 'OOZIE_SERVER'])
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/stack_version/repository_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_version/repository_version.js b/ambari-web/app/models/stack_version/repository_version.js
index 01806cb..9dc1bc6 100644
--- a/ambari-web/app/models/stack_version/repository_version.js
+++ b/ambari-web/app/models/stack_version/repository_version.js
@@ -88,23 +88,17 @@ App.RepositoryVersion = DS.Model.extend({
/**
* @type {string}
*/
- noInitHostsTooltip: function () {
- return (this.get('noInitHosts')) ? Em.I18n.t('admin.stackVersions.version.emptyHostsTooltip') : Em.I18n.t('admin.stackVersions.version.hostsTooltip');
- }.property('noInitHosts'),
+ noInitHostsTooltip: Em.computed.ifThenElse('noInitHosts', Em.I18n.t('admin.stackVersions.version.emptyHostsTooltip'), Em.I18n.t('admin.stackVersions.version.hostsTooltip')),
/**
* @type {string}
*/
- noCurrentHostsTooltip: function () {
- return (this.get('noCurrentHosts')) ? Em.I18n.t('admin.stackVersions.version.emptyHostsTooltip') : Em.I18n.t('admin.stackVersions.version.hostsTooltip');
- }.property('noCurrentHosts'),
+ noCurrentHostsTooltip: Em.computed.ifThenElse('noCurrentHosts', Em.I18n.t('admin.stackVersions.version.emptyHostsTooltip'), Em.I18n.t('admin.stackVersions.version.hostsTooltip')),
/**
* @type {string}
*/
- noInstalledHostsTooltip: function () {
- return (this.get('noInstalledHosts')) ? Em.I18n.t('admin.stackVersions.version.emptyHostsTooltip') : Em.I18n.t('admin.stackVersions.version.hostsTooltip');
- }.property('noInstalledHosts'),
+ noInstalledHostsTooltip: Em.computed.ifThenElse('noInstalledHosts', Em.I18n.t('admin.stackVersions.version.emptyHostsTooltip'), Em.I18n.t('admin.stackVersions.version.hostsTooltip')),
/**
* @type {boolean}
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/stack_version/version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_version/version.js b/ambari-web/app/models/stack_version/version.js
index 7fd4134..9b1167d 100644
--- a/ambari-web/app/models/stack_version/version.js
+++ b/ambari-web/app/models/stack_version/version.js
@@ -37,21 +37,13 @@ App.StackVersion = DS.Model.extend({
upgradeFailedHosts: DS.attr('array'),
currentHosts: DS.attr('array'),
- noInstalledHosts: function() {
- return this.get('installedHosts.length') == 0;
- }.property('installedHosts.length'),
+ noInstalledHosts: Em.computed.empty('installedHosts'),
- noCurrentHosts: function() {
- return this.get('currentHosts.length') == 0;
- }.property('currentHosts.length'),
+ noCurrentHosts: Em.computed.empty('currentHosts'),
- noInitHosts: function() {
- return this.get('notInstalledHosts.length') == 0;
- }.property('notInstalledHosts.length'),
+ noInitHosts: Em.computed.empty('notInstalledHosts'),
- isCurrent: function() {
- return this.get('state') === 'CURRENT';
- }.property('state')
+ isCurrent: Em.computed.equal('state', 'CURRENT')
});
App.StackVersion.FIXTURES = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/upgrade_entity.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/upgrade_entity.js b/ambari-web/app/models/upgrade_entity.js
index ab9806a..953f1eb 100644
--- a/ambari-web/app/models/upgrade_entity.js
+++ b/ambari-web/app/models/upgrade_entity.js
@@ -42,9 +42,7 @@ App.upgradeEntity = Em.Object.extend({
/**
* @type {boolean}
*/
- isVisible: function () {
- return this.get('status') !== 'PENDING';
- }.property('status'),
+ isVisible: Em.computed.notEqual('status', 'PENDING'),
/**
* status of tasks/items/groups which should be grayed out and disabled
@@ -55,9 +53,7 @@ App.upgradeEntity = Em.Object.extend({
/**
* @type {boolean}
*/
- isRunning: function () {
- return ['IN_PROGRESS'].contains(this.get('status'));
- }.property('status'),
+ isRunning: Em.computed.existsIn('status', ['IN_PROGRESS']),
/**
* @type {number}
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/app/models/user.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/user.js b/ambari-web/app/models/user.js
index 1b8359a..776de50 100644
--- a/ambari-web/app/models/user.js
+++ b/ambari-web/app/models/user.js
@@ -21,9 +21,7 @@ var validator = require('utils/validator');
App.User = DS.Model.extend({
userName:DS.attr('string'),
- id:function(){
- return this.get('userName');
- }.property('userName'),
+ id: Em.computed.alias('userName'),
userType: DS.attr('string'),
auditItems:DS.hasMany('App.ServiceAudit'),
admin: DS.attr('boolean'),
@@ -42,9 +40,7 @@ App.User = DS.Model.extend({
/**
* @type {Boolean}
*/
- isLdap: function() {
- return this.get('userType') === 'LDAP';
- }.property('userType')
+ isLdap: Em.computed.equal('userType', 'LDAP')
});
App.EditUserForm = App.Form.extend({
http://git-wip-us.apache.org/repos/asf/ambari/blob/779b4f9d/ambari-web/test/models/alerts/alert_definition_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/alerts/alert_definition_test.js b/ambari-web/test/models/alerts/alert_definition_test.js
index 0e8cc79..1aeea49 100644
--- a/ambari-web/test/models/alerts/alert_definition_test.js
+++ b/ambari-web/test/models/alerts/alert_definition_test.js
@@ -125,6 +125,40 @@ describe('App.AlertDefinition', function () {
});
+ describe('#isOK', function () {
+
+ Em.A([
+ {summary: {CRITICAL: {count: 1, maintenanceCount: 0}}, e: false},
+ {summary: {WARNING: {count: 1, maintenanceCount: 0}}, e: false},
+ {summary: {OK: {count: 1, maintenanceCount: 0}}, e: true},
+ {summary: {UNKNOWN: {count: 1, maintenanceCount: 0}}, e: false},
+ {summary: {}, e: false}
+ ]).forEach(function (test, i) {
+ it('test ' + (i + 1), function () {
+ model.set('summary', test.summary);
+ expect(model.get('isOK')).to.equal(test.e);
+ });
+ });
+
+ });
+
+ describe('#isUnknown', function () {
+
+ Em.A([
+ {summary: {CRITICAL: {count: 1, maintenanceCount: 0}}, e: false},
+ {summary: {WARNING: {count: 1, maintenanceCount: 0}}, e: false},
+ {summary: {OK: {count: 1, maintenanceCount: 0}}, e: false},
+ {summary: {UNKNOWN: {count: 1, maintenanceCount: 0}}, e: true},
+ {summary: {}, e: false}
+ ]).forEach(function (test, i) {
+ it('test ' + (i + 1), function () {
+ model.set('summary', test.summary);
+ expect(model.get('isUnknown')).to.equal(test.e);
+ });
+ });
+
+ });
+
describe('#lastTriggeredAgoFormatted', function () {
it('should be empty', function () {
[3/4] ambari git commit: AMBARI-13949. Apply created Em.computed
macros to ambari-web views (onechiporenko)
Posted by on...@apache.org.
AMBARI-13949. Apply created Em.computed macros to ambari-web views (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/177a91f4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/177a91f4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/177a91f4
Branch: refs/heads/trunk
Commit: 177a91f405b2cfd74bfa740c38fc643bde56049e
Parents: 7059727
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Nov 18 18:37:05 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Nov 18 18:37:05 2015 +0200
----------------------------------------------------------------------
.../common/ajax_default_error_popup_body.js | 4 +---
.../common/assign_master_components_view.js | 4 +---
.../views/common/configs/config_history_flow.js | 17 ++++---------
.../app/views/common/configs/controls_view.js | 16 ++++---------
.../notification_configs_view.js | 4 +---
.../configs/service_config_layout_tab_view.js | 4 +---
.../views/common/configs/service_config_view.js | 4 +---
.../configs/widgets/config_widget_view.js | 8 ++-----
.../widgets/directory_config_widget_view.js | 4 +---
.../configs/widgets/plain_config_text_field.js | 4 +---
.../widgets/test_db_connection_widget_view.js | 4 +---
.../app/views/common/filter_combo_cleanable.js | 8 ++-----
ambari-web/app/views/common/filter_combobox.js | 4 +---
.../common/form/manage_credentials_form_view.js | 14 +++--------
ambari-web/app/views/common/grid.js | 8 ++-----
.../common/host_progress_popup_body_view.js | 4 +---
ambari-web/app/views/common/metric.js | 16 ++++---------
.../common/modal_popups/invalid_KDC_popup.js | 12 +++-------
.../manage_kdc_credentials_popup.js | 4 +---
.../common/modal_popups/select_groups_popup.js | 4 +---
.../app/views/common/rolling_restart_view.js | 9 +++----
ambari-web/app/views/common/table_view.js | 12 +++-------
.../views/common/widget/gauge_widget_view.js | 12 +++-------
.../views/common/widget/graph_widget_view.js | 20 ++++------------
ambari-web/app/views/main/admin.js | 4 +---
.../app/views/main/admin/authentication.js | 9 +++----
.../nameNode/rollbackHA/step1_view.js | 8 ++-----
.../highAvailability/nameNode/step3_view.js | 5 ++--
.../highAvailability/nameNode/step4_view.js | 6 +----
.../admin/stack_upgrade/upgrade_task_view.js | 4 +---
.../stack_upgrade/upgrade_version_box_view.js | 4 +---
.../admin/stack_upgrade/upgrade_wizard_view.js | 8 ++-----
.../app/views/main/alert_definitions_view.js | 4 +---
.../main/alerts/manage_alert_groups_view.js | 5 +---
.../alerts/manage_alert_notifications_view.js | 8 ++-----
ambari-web/app/views/main/dashboard.js | 4 +---
.../main/dashboard/widgets/flume_agent_live.js | 4 +---
.../dashboard/widgets/hbase_average_load.js | 13 ++++------
.../views/main/dashboard/widgets/hbase_links.js | 12 +++-------
.../widgets/hbase_regions_in_transition.js | 12 +++-------
.../main/dashboard/widgets/namenode_rpc.js | 8 ++-----
.../dashboard/widgets/node_managers_live.js | 4 +---
.../main/dashboard/widgets/pie_chart_widget.js | 8 ++-----
.../main/dashboard/widgets/supervisor_live.js | 12 +++-------
.../views/main/dashboard/widgets/text_widget.js | 8 ++-----
ambari-web/app/views/main/host.js | 20 ++++------------
ambari-web/app/views/main/host/configs.js | 4 +---
ambari-web/app/views/main/host/details.js | 8 ++-----
.../main/host/details/host_component_view.js | 25 +++++---------------
.../app/views/main/host/host_alerts_view.js | 4 +---
.../app/views/main/host/stack_versions_view.js | 4 +---
ambari-web/app/views/main/host/summary.js | 4 +---
ambari-web/app/views/main/menu.js | 12 +++-------
.../info/metrics/flume/flume_metric_graph.js | 4 +---
.../app/views/main/service/info/summary.js | 20 ++++------------
ambari-web/app/views/main/service/item.js | 12 +++-------
ambari-web/app/views/main/service/menu.js | 24 +++++--------------
.../views/main/service/reassign/step3_view.js | 8 ++-----
.../views/main/service/reassign/step4_view.js | 8 +------
.../views/main/service/reassign/step7_view.js | 16 ++++---------
.../app/views/main/service/reconfigure.js | 9 +++----
ambari-web/app/views/main/service/service.js | 16 ++++---------
.../app/views/main/service/services/hbase.js | 16 ++++---------
.../app/views/main/service/services/hdfs.js | 16 ++++---------
.../app/views/main/service/services/storm.js | 8 ++-----
.../app/views/main/service/services/yarn.js | 4 +---
ambari-web/app/views/wizard/step1_view.js | 22 ++++++-----------
ambari-web/app/views/wizard/step2_view.js | 16 ++++---------
.../views/wizard/step3/hostLogPopupBody_view.js | 8 ++-----
.../wizard/step3/hostWarningPopupBody_view.js | 8 ++-----
ambari-web/app/views/wizard/step3_view.js | 8 ++-----
ambari-web/app/views/wizard/step5_view.js | 9 +++----
ambari-web/app/views/wizard/step6_view.js | 4 +---
.../views/wizard/step9/hostLogPopupBody_view.js | 8 ++-----
ambari-web/app/views/wizard/step9_view.js | 16 ++++---------
75 files changed, 176 insertions(+), 515 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/ajax_default_error_popup_body.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/ajax_default_error_popup_body.js b/ambari-web/app/views/common/ajax_default_error_popup_body.js
index 616e69e..60bff17 100644
--- a/ambari-web/app/views/common/ajax_default_error_popup_body.js
+++ b/ambari-web/app/views/common/ajax_default_error_popup_body.js
@@ -59,9 +59,7 @@ App.AjaxDefaultErrorPopupBodyView = Em.View.extend({
* Indicates if error message should be displayed
* @type {boolean}
*/
- showMessage: function () {
- return !!this.get('message');
- }.property('message'),
+ showMessage: Em.computed.bool('message'),
/**
* HTTP response error description
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/assign_master_components_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/assign_master_components_view.js b/ambari-web/app/views/common/assign_master_components_view.js
index f2c0ab0..7e97128 100644
--- a/ambari-web/app/views/common/assign_master_components_view.js
+++ b/ambari-web/app/views/common/assign_master_components_view.js
@@ -39,9 +39,7 @@ App.AssignMasterComponentsView = Em.View.extend({
* Otherwise - App.SelectHostView
* @type {bool}
*/
- shouldUseInputs: function() {
- return this.get('controller.hosts.length') > 25;
- }.property('controller.hosts.length'),
+ shouldUseInputs: Em.computed.gt('controller.hosts.length', 25),
didInsertElement: function () {
this.get('controller').loadStep();
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/configs/config_history_flow.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_history_flow.js b/ambari-web/app/views/common/configs/config_history_flow.js
index da748af..89f0c03 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -27,12 +27,8 @@ App.ConfigHistoryFlowView = Em.View.extend({
startIndex: 0,
showLeftArrow: false,
showRightArrow: false,
- leftArrowTooltip: function () {
- return this.get('showLeftArrow') ? Em.I18n.t('services.service.config.configHistory.leftArrow.tooltip') : null;
- }.property('showLeftArrow'),
- rightArrowTooltip: function () {
- return this.get('showRightArrow') ? Em.I18n.t('services.service.config.configHistory.rightArrow.tooltip') : null;
- }.property('showRightArrow'),
+ leftArrowTooltip: Em.computed.ifThenElse('showLeftArrow', Em.I18n.t('services.service.config.configHistory.leftArrow.tooltip'), null),
+ rightArrowTooltip: Em.computed.ifThenElse('showRightArrow', Em.I18n.t('services.service.config.configHistory.rightArrow.tooltip'), null),
VERSIONS_IN_FLOW: 6,
VERSIONS_IN_DROPDOWN: 6,
/**
@@ -77,9 +73,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
return (this.get('controller.isSubmitDisabled') || !this.get('controller.versionLoaded') || !this.get('controller.isPropertiesChanged')) ;
}.property('controller.isSubmitDisabled', 'controller.versionLoaded', 'controller.isPropertiesChanged'),
- serviceName: function () {
- return this.get('controller.selectedService.serviceName');
- }.property('controller.selectedService.serviceName'),
+ serviceName: Em.computed.alias('controller.selectedService.serviceName'),
displayedServiceVersion: function () {
return this.get('serviceVersions').findProperty('isDisplayed');
@@ -87,10 +81,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
/**
* identify whether to show link that open whole content of notes
*/
- showMoreLink: function () {
- //100 is number of symbols that fit into label
- return (this.get('displayedServiceVersion.notes.length') > 100);
- }.property('displayedServiceVersion.notes.length'),
+ showMoreLink: Em.computed.gt('displayedServiceVersion.notes.length', 100),
/**
* formatted notes ready to display
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/configs/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/controls_view.js b/ambari-web/app/views/common/configs/controls_view.js
index 21965a6..8096f64 100644
--- a/ambari-web/app/views/common/configs/controls_view.js
+++ b/ambari-web/app/views/common/configs/controls_view.js
@@ -33,25 +33,17 @@ App.ControlsView = Ember.View.extend({
return !this.get('serviceConfigProperty.isEditable') && this.get('serviceConfigProperty.group');
}.property('showActions', 'serviceConfigProperty.group'),
- showIsFinal: function() {
- return this.get('serviceConfigProperty.supportsFinal');
- }.property('serviceConfigProperty.supportsFinal'),
+ showIsFinal: Em.computed.alias('serviceConfigProperty.supportsFinal'),
- showRemove: function() {
- return this.get('showActions') && this.get('serviceConfigProperty.isRemovable');
- }.property('showActions', 'serviceConfigProperty.isRemovable'),
+ showRemove: Em.computed.and('showActions', 'serviceConfigProperty.isRemovable'),
- showOverride: function() {
- return this.get('showActions') && this.get('serviceConfigProperty.isPropertyOverridable');
- }.property('showActions', 'serviceConfigProperty.isPropertyOverridable'),
+ showOverride: Em.computed.and('showActions', 'serviceConfigProperty.isPropertyOverridable'),
showUndo: function() {
return this.get('showActions') && !this.get('serviceConfigProperty.cantBeUndone') && this.get('serviceConfigProperty.isNotDefaultValue');
}.property('showActions', 'serviceConfigProperty.cantBeUndone', 'serviceConfigProperty.isNotDefaultValue'),
- showSetRecommended: function() {
- return this.get('showActions') && this.get('serviceConfigProperty.recommendedValueExists');
- }.property('showActions', 'serviceConfigProperty.recommendedValueExists')
+ showSetRecommended: Em.computed.and('showActions', 'serviceConfigProperty.recommendedValueExists')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js b/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js
index b8b50a5..9b8bb5f 100644
--- a/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js
+++ b/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js
@@ -34,9 +34,7 @@ App.NotificationsConfigsView = App.ServiceConfigsByCategoryView.extend({
*/
createNotification: 'no',
- categoryConfigsAll: function () {
- return this.get('serviceConfigs').filterProperty('filename', 'alert_notification');
- }.property('serviceConfigs.@each').cacheable(),
+ categoryConfigsAll: Em.computed.filterBy('serviceConfigs', 'filename', 'alert_notification'),
/**
* @type {string} "tls|ssl"
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
index a2d768f..def75d1 100644
--- a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
+++ b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
@@ -39,9 +39,7 @@ App.ServiceConfigLayoutTabView = Em.View.extend(App.ConfigOverridable, {
/**
* @type {App.Service}
*/
- service: function () {
- return this.get('controller.selectedService');
- }.property('controller.selectedService'),
+ service: Em.computed.alias('controller.selectedService'),
templateName: require('templates/common/configs/service_config_layout_tab'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/configs/service_config_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_view.js b/ambari-web/app/views/common/configs/service_config_view.js
index 0ef2112..1c12217 100644
--- a/ambari-web/app/views/common/configs/service_config_view.js
+++ b/ambari-web/app/views/common/configs/service_config_view.js
@@ -62,9 +62,7 @@ App.ServiceConfigView = Em.View.extend({
* Determines if user is on the service configs page
* @type {boolean}
*/
- isOnTheServicePage: function () {
- return this.get('controller.name') === 'mainServiceInfoConfigsController';
- }.property('controller.name'),
+ isOnTheServicePage: Em.computed.equal('controller.name', 'mainServiceInfoConfigsController'),
classNameBindings: ['isOnTheServicePage:serviceConfigs'],
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/configs/widgets/config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/config_widget_view.js b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
index f0499db..ec492af 100644
--- a/ambari-web/app/views/common/configs/widgets/config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
@@ -63,18 +63,14 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
* if not, text-field with config value or label "Undefined" should be shown
* @type {boolean}
*/
- doNotShowWidget: function() {
- return this.get('isPropertyUndefined') || this.get('config.showAsTextBox');
- }.property('isPropertyUndefined', 'config.showAsTextBox'),
+ doNotShowWidget: Em.computed.or('isPropertyUndefined', 'config.showAsTextBox'),
/**
* defines if property in not defined in selected version
* in this case "Undefined" should be shown instead of widget
* @type {boolean}
*/
- isPropertyUndefined: function() {
- return this.get('config.value') === "Undefined";
- }.property('config.value'),
+ isPropertyUndefined: Em.computed.equal('config.value', 'Undefined'),
/**
* Tab where current widget placed
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/configs/widgets/directory_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/directory_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/directory_config_widget_view.js
index 04af5ff..c698e03 100644
--- a/ambari-web/app/views/common/configs/widgets/directory_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/directory_config_widget_view.js
@@ -24,9 +24,7 @@ App.DirectoryConfigWidgetView = App.ConfigWidgetView.extend({
templateName: require('templates/common/configs/widgets/directory_config_widget'),
classNames: ['widget-config', 'directory-widget'],
- disabled: function() {
- return !this.get('config.isEditable');
- }.property('config.isEditable'),
+ disabled: Em.computed.not('config.isEditable'),
/**
* Control to edit value.
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
index 4d41b86..a6388e8 100644
--- a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
+++ b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
@@ -30,9 +30,7 @@ App.PlainConfigTextField = Ember.View.extend(App.SupportsDependentConfigs, App.W
classNames: ['widget-config-plain-text-field'],
placeholderBinding: 'config.savedValue',
- disabled: function() {
- return !this.get('config.isEditable');
- }.property('config.isEditable'),
+ disabled: Em.computed.not('config.isEditable'),
configLabel: function() {
return this.get('config.stackConfigProperty.displayName') || this.get('config.displayName') || this.get('config.name');
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js b/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
index 199aac6..5105e9a 100644
--- a/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
@@ -25,9 +25,7 @@ App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
classNames: ['widget'],
/** @property {string} btnCaption - text for button **/
- btnCaption: function () {
- return this.get('config.stackConfigProperty.widget.display-name');
- }.property('config.stackConfigProperty.widget.display-name'),
+ btnCaption: Em.computed.alias('config.stackConfigProperty.widget.display-name'),
/** @property {string} responseCaption - text for status link **/
responseCaption: null,
/** @property {boolean} isConnecting - is request to server activated **/
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/filter_combo_cleanable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/filter_combo_cleanable.js b/ambari-web/app/views/common/filter_combo_cleanable.js
index 6f26ca5..b686000 100644
--- a/ambari-web/app/views/common/filter_combo_cleanable.js
+++ b/ambari-web/app/views/common/filter_combo_cleanable.js
@@ -52,18 +52,14 @@ App.FilterComboCleanableView = Ember.View.extend({
column.set('selected', !column.get('selected'));
},
- filterNotEmpty: function(target){
- return (this.get('filter').length > 0);
- }.property('filter'),
+ filterNotEmpty: Em.computed.gt('filter.length', 0),
/**
* true if any of filter columns is selected
* in this case clear filter row should be shown
* @type {boolean}
*/
- showClearFilter: function() {
- return this.get('columns').someProperty('selected');
- }.property('columns.@each.selected'),
+ showClearFilter: Em.computed.someBy('columns', 'selected', true),
/**
* clears all filter columns.
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/filter_combobox.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/filter_combobox.js b/ambari-web/app/views/common/filter_combobox.js
index 47a8485..897d65b 100644
--- a/ambari-web/app/views/common/filter_combobox.js
+++ b/ambari-web/app/views/common/filter_combobox.js
@@ -31,9 +31,7 @@ App.FilterComboboxView = Ember.View.extend({
//filter: '', binding outside
//columns: [], binding outside
- placeHolder: function(){
- return this.t('common.combobox.placeholder');
- }.property(),
+ placeHolder: Em.I18n.t('common.combobox.placeholder'),
/**
* Onclick handler for dropdown menu
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/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 685051d..237b94d 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
@@ -45,7 +45,7 @@ App.ManageCredentialsFormView = Em.View.extend({
*
* @type {boolean}
*/
- checkboxDisabled: Ember.computed.not('storePersisted'),
+ checkboxDisabled: Em.computed.not('storePersisted'),
/**
* Credentials can be removed, in case when they stored to persistent secure storage.
@@ -133,22 +133,14 @@ App.ManageCredentialsFormView = Em.View.extend({
return credentialsUtils.STORE_TYPES.PERSISTENT;
}.property('storeCredentials'),
- formHeader: function() {
- return this.get('isRemovable') ?
- Em.I18n.t('admin.kerberos.credentials.form.header.stored') :
- Em.I18n.t('admin.kerberos.credentials.form.header.not.stored');
- }.property('isRemovable'),
+ formHeader: Em.computed.ifThenElse('isRemovable', Em.I18n.t('admin.kerberos.credentials.form.header.stored'), Em.I18n.t('admin.kerberos.credentials.form.header.not.stored')),
/**
* Message to display in tooltip regarding persistent storage state.
*
* @type {string}
*/
- hintMessage: function() {
- return this.get('storePersisted') ?
- Em.I18n.t('admin.kerberos.credentials.store.hint.supported') :
- Em.I18n.t('admin.kerberos.credentials.store.hint.not.supported');
- }.property('storePersisted'),
+ hintMessage: Em.computed.ifThenElse('storePersisted', Em.I18n.t('admin.kerberos.credentials.store.hint.supported'), Em.I18n.t('admin.kerberos.credentials.store.hint.not.supported')),
/**
* Observe changes for principal and password.
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/grid.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/grid.js b/ambari-web/app/views/common/grid.js
index 39a738c..4a35770 100644
--- a/ambari-web/app/views/common/grid.js
+++ b/ambari-web/app/views/common/grid.js
@@ -31,9 +31,7 @@ App.GridFilter = Em.View.extend({
getHeader:function () {
return this.get('header')
},
- filters:function () {
- return this.get('header._filters');
- }.property('header._filters')
+ filters:Em.computed.alias('header._filters')
});
App.GridHeader = Em.View.extend({
@@ -108,9 +106,7 @@ App.GridRow = Em.View.extend({
});
App.GridPage = Em.Object.extend({
- activeClass:function () {
- return this.get('active') ? "active" : "";
- }.property('active'),
+ activeClass:Em.computed.ifThenElse('active', 'active', ''),
active:function () {
return parseInt(this.get('number')) == parseInt(this.get('pager.grid.currentPage'));
}.property('pager.grid.currentPage')
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/host_progress_popup_body_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/host_progress_popup_body_view.js b/ambari-web/app/views/common/host_progress_popup_body_view.js
index 86e1fc8..840e678 100644
--- a/ambari-web/app/views/common/host_progress_popup_body_view.js
+++ b/ambari-web/app/views/common/host_progress_popup_body_view.js
@@ -197,9 +197,7 @@ App.HostProgressPopupBodyView = App.TableView.extend({
/**
* @type {boolean}
*/
- isHostEmptyList: function () {
- return !this.get('pageContent.length');
- }.property('pageContent.length'),
+ isHostEmptyList: Em.computed.empty('pageContent'),
/**
* @type {wrappedHost}
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/metric.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/metric.js b/ambari-web/app/views/common/metric.js
index affe619..bee836b 100644
--- a/ambari-web/app/views/common/metric.js
+++ b/ambari-web/app/views/common/metric.js
@@ -108,23 +108,15 @@ App.MetricFilteringWidget = Em.View.extend({
itemView:Em.View.extend({
tagName:'li',
classNameBindings:['disabled'],
- disabled:function () {
- return this.get('isActive') ? "disabled" : false;
- }.property('isActive'),
- isActive:function () {
- return this.get('metric.value') == this.get('widget.chosenMetric');
- }.property('widget.chosenMetric'),
- label:function () {
- return this.get('metric.label');
- }.property('metric.label'),
+ disabled:Em.computed.ifThenElse('isActive', 'disabled', false),
+ isActive:Em.computed.equalProperties('metric.value', 'widget.chosenMetric'),
+ label:Em.computed.alias('metric.label'),
template:Em.Handlebars.compile('<a {{action activate view.metric.value target="view.widget" href="#" }}>{{unbound view.label}}</a>')
}),
moreItemView:function () {
return this.get('itemView').extend({
- label:function () {
- return this.get('metric.value');
- }.property('metric.value')
+ label:Em.computed.alias('metric.value')
});
}.property(),
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/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 9de8537b..5309bf4 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
@@ -51,27 +51,21 @@ App.showInvalidKDCPopup = function (ajaxOpt, message) {
*
* @type {boolean}
*/
- checkboxDisabled: Ember.computed.not('storePersisted'),
+ checkboxDisabled: Em.computed.not('storePersisted'),
/**
* Returns storage type used to save credentials e.g. <b>persistent</b>, <b>temporary</b> (default)
*
* @type {string}
*/
- storageType: function() {
- return this.get('storeCredentials') ? credentialsUtils.STORE_TYPES.PERSISTENT : credentialsUtils.STORE_TYPES.TEMPORARY;
- }.property('storeCredentials'),
+ storageType: Em.computed.ifThenElse('storeCredentials', credentialsUtils.STORE_TYPES.PERSISTENT, credentialsUtils.STORE_TYPES.TEMPORARY),
/**
* Message to display in tooltip regarding persistent storage state.
*
* @type {string}
*/
- hintMessage: function() {
- return this.get('storePersisted') ?
- Em.I18n.t('admin.kerberos.credentials.store.hint.supported') :
- Em.I18n.t('admin.kerberos.credentials.store.hint.not.supported');
- }.property('storePersisted'),
+ hintMessage: Em.computed.ifThenElse('storePersisted', Em.I18n.t('admin.kerberos.credentials.store.hint.supported'), Em.I18n.t('admin.kerberos.credentials.store.hint.not.supported')),
bodyClass: Em.View.extend({
warningMsg: message + Em.I18n.t('popup.invalid.KDC.msg'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/modal_popups/manage_kdc_credentials_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/manage_kdc_credentials_popup.js b/ambari-web/app/views/common/modal_popups/manage_kdc_credentials_popup.js
index 87592aa..2839a7d 100644
--- a/ambari-web/app/views/common/modal_popups/manage_kdc_credentials_popup.js
+++ b/ambari-web/app/views/common/modal_popups/manage_kdc_credentials_popup.js
@@ -36,9 +36,7 @@ App.showManageCredentialsPopup = function () {
isCredentialsRemoved: false,
- disablePrimary: function() {
- return this.get('formView.isSubmitDisabled');
- }.property('formView.isSubmitDisabled'),
+ disablePrimary: Em.computed.alias('formView.isSubmitDisabled'),
formView: function() {
return this.get('childViews').findProperty('viewName', 'manageCredentialsForm');
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/modal_popups/select_groups_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/select_groups_popup.js b/ambari-web/app/views/common/modal_popups/select_groups_popup.js
index 42251a9..264d7b1 100644
--- a/ambari-web/app/views/common/modal_popups/select_groups_popup.js
+++ b/ambari-web/app/views/common/modal_popups/select_groups_popup.js
@@ -45,9 +45,7 @@ App.showSelectGroupsPopup = function (selectedServiceName, selectedConfigGroup,
didInsertElement: function() {
this.set('selectedGroup', this.get('parentView.parentView.selectedConfigGroup.dependentConfigGroups')[this.get('serviceName')]);
},
- serviceName: function() {
- return this.get('content').get('serviceName');
- }.property('content'),
+ serviceName: Em.computed.alias('content.serviceName'),
selectedGroup: null,
updateGroup: function() {
var dependentGroups = $.extend({},this.get('parentView.parentView.selectedConfigGroup.dependentConfigGroups'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/rolling_restart_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/rolling_restart_view.js b/ambari-web/app/views/common/rolling_restart_view.js
index d84f9c6..16477ea 100644
--- a/ambari-web/app/views/common/rolling_restart_view.js
+++ b/ambari-web/app/views/common/rolling_restart_view.js
@@ -174,17 +174,14 @@ App.RollingRestartView = Em.View.extend({
* List of host components without components in out-of-service state
* @type {Array}
*/
- nonMaintainanceHostComponents : function() {
- return this.get('allHostComponents').filterProperty('passiveState', 'OFF')
- }.property('allHostComponents', 'allHostComponents.@each.passiveState'),
+ nonMaintainanceHostComponents : Em.computed.filterBy('allHostComponents', 'passiveState', 'OFF'),
/**
* List of host components with host in Maintenance mode
* @type {Array}
*/
- componentsWithMaintenanceHost: function() {
- return this.get('allHostComponents').filterProperty('hostPassiveState', 'ON');
- }.property('allHostComponents', 'allHostComponents.@each.hostPassiveState'),
+ componentsWithMaintenanceHost: Em.computed.filterBy('allHostComponents', 'hostPassiveState', 'ON'),
+
/**
* List of host components without components in out-of-service state
* If <code>staleConfigsOnly</code> is true, components with <code>staleConfigs</code> = false are also filtered
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/table_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js
index fe433f6..cf0d761 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -62,16 +62,12 @@ App.TableView = Em.View.extend(App.UserPref, {
/**
* number of items in table after applying filters
*/
- filteredCount: function () {
- return this.get('filteredContent.length');
- }.property('filteredContent.length'),
+ filteredCount: Em.computed.alias('filteredContent.length'),
/**
* total number of items in table before applying filters
*/
- totalCount: function () {
- return this.get('content.length');
- }.property('content.length'),
+ totalCount: Em.computed.alias('content.length'),
/**
* Do filtering, using saved in the local storage filter conditions
@@ -408,9 +404,7 @@ App.TableView = Em.View.extend(App.UserPref, {
* Determine if <code>filteredContent</code> is empty or not
* @type {Boolean}
*/
- hasFilteredItems: function() {
- return !!this.get('filteredCount');
- }.property('filteredCount'),
+ hasFilteredItems: Em.computed.bool('filteredCount'),
/**
* Contains content to show on the current page of data page view
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/widget/gauge_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/widget/gauge_widget_view.js b/ambari-web/app/views/common/widget/gauge_widget_view.js
index 60d636d..4a9ab25 100644
--- a/ambari-web/app/views/common/widget/gauge_widget_view.js
+++ b/ambari-web/app/views/common/widget/gauge_widget_view.js
@@ -77,22 +77,16 @@ App.GaugeWidgetView = Em.View.extend(App.WidgetMixin, {
*/
MAX_VALUE: 100,
- warningThreshold: function(){
- return this.get('parentView.content.properties.warning_threshold');
- }.property('parentView.content.properties.warning_threshold'),
+ warningThreshold: Em.computed.alias('parentView.content.properties.warning_threshold'),
- errorThreshold: function(){
- return this.get('parentView.content.properties.error_threshold');
- }.property('parentView.content.properties.error_threshold'),
+ errorThreshold: Em.computed.alias('parentView.content.properties.error_threshold'),
id: function() {
return 'gauge-widget-' + this.get('parentView.content.id');
}.property('parentView.content.id'),
existCenterText: true,
- centerTextColor: function () {
- return this.get('contentColor');
- }.property('contentColor'),
+ centerTextColor: Em.computed.alias('contentColor'),
palette: new Rickshaw.Color.Palette({
scheme: [ '#FFFFFF', '#D6DDDF'].reverse()
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/common/widget/graph_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/widget/graph_widget_view.js b/ambari-web/app/views/common/widget/graph_widget_view.js
index 7fc4e76..4c8b72d 100644
--- a/ambari-web/app/views/common/widget/graph_widget_view.js
+++ b/ambari-web/app/views/common/widget/graph_widget_view.js
@@ -71,9 +71,7 @@ App.GraphWidgetView = Em.View.extend(App.WidgetMixin, App.ExportMetricsMixin, {
*/
data: [],
- exportTargetView: function () {
- return this.get('childViews.lastObject');
- }.property(),
+ exportTargetView: Em.computed.alias('childViews.lastObject'),
drawWidget: function () {
if (this.get('isLoaded')) {
@@ -222,15 +220,9 @@ App.GraphWidgetView = Em.View.extend(App.WidgetMixin, App.ExportMetricsMixin, {
noTitleUnderGraph: true,
inWidget: true,
- description: function () {
- return this.get('parentView.content.description');
- }.property('parentView.content.description'),
- isPreview: function () {
- return this.get('parentView.isPreview');
- }.property('parentView.isPreview'),
- displayUnit: function () {
- return this.get('parentView.content.properties.display_unit');
- }.property('parentView.content.properties.display_unit'),
+ description: Em.computed.alias('parentView.content.description'),
+ isPreview: Em.computed.alias('parentView.isPreview'),
+ displayUnit: Em.computed.alias('parentView.content.properties.display_unit'),
setYAxisFormatter: function () {
var displayUnit = this.get('displayUnit');
if (displayUnit) {
@@ -271,9 +263,7 @@ App.GraphWidgetView = Em.View.extend(App.WidgetMixin, App.ExportMetricsMixin, {
return this.get('parentView.content.properties.graph_type') === 'STACK' ? 'area' : 'line';
}.property('parentView.content.properties.graph_type'),
- title: function () {
- return this.get('parentView.content.widgetName');
- }.property('parentView.content.widgetName'),
+ title: Em.computed.alias('parentView.content.widgetName'),
transformToSeries: function (seriesData) {
var seriesArray = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/admin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin.js b/ambari-web/app/views/main/admin.js
index 089d593..fb1c046 100644
--- a/ambari-web/app/views/main/admin.js
+++ b/ambari-web/app/views/main/admin.js
@@ -46,9 +46,7 @@ App.MainAdminView = Em.View.extend({
NavItemView: Ember.View.extend({
tagName: 'li',
classNameBindings: 'isActive:active'.w(),
- isActive: function () {
- return this.get('item') === this.get('parentView.selected');
- }.property('item', 'parentView.selected')
+ isActive: Em.computed.equalProperties('item', 'parentView.selected')
}),
willDestroyElement: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/admin/authentication.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/authentication.js b/ambari-web/app/views/main/admin/authentication.js
index c0a1d1e..28604d0 100644
--- a/ambari-web/app/views/main/admin/authentication.js
+++ b/ambari-web/app/views/main/admin/authentication.js
@@ -31,11 +31,8 @@ App.MainAdminAuthenticationView = Em.View.extend({
this.pushAuthenticationToForm();
},
- ldapChecked:function () {
- return this.get('form.field.method.value');
- }.property('form.field.method.value'),
+ ldapChecked: Em.computed.alias('form.field.method.value'),
+
+ useCredentials: Em.computed.alias('form.field.bindMethod.value')
- useCredentials:function () {
- return this.get('form.field.bindMethod.value');
- }.property('form.field.bindMethod.value')
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/admin/highAvailability/nameNode/rollbackHA/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/nameNode/rollbackHA/step1_view.js b/ambari-web/app/views/main/admin/highAvailability/nameNode/rollbackHA/step1_view.js
index a3c01ef..485f815 100644
--- a/ambari-web/app/views/main/admin/highAvailability/nameNode/rollbackHA/step1_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/nameNode/rollbackHA/step1_view.js
@@ -64,13 +64,9 @@ App.RollbackHighAvailabilityWizardStep1View = Em.View.extend({
this.loadHostsName();
},
- tipAddNNHost: function () {
- return this.get('controller.content.addNNHost');
- }.property('controller.content.addNNHost'),
+ tipAddNNHost: Em.computed.alias('controller.content.addNNHost'),
- tipSNNHost: function () {
- return this.get('controller.content.sNNHost');
- }.property('controller.content.sNNHost'),
+ tipSNNHost: Em.computed.alias('controller.content.sNNHost'),
done: function () {
this.get('controller.content').set('selectedSNNHost', this.get('selectedSNNHost'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/admin/highAvailability/nameNode/step3_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/nameNode/step3_view.js b/ambari-web/app/views/main/admin/highAvailability/nameNode/step3_view.js
index fdbea28..736ab00 100644
--- a/ambari-web/app/views/main/admin/highAvailability/nameNode/step3_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/nameNode/step3_view.js
@@ -34,8 +34,7 @@ App.HighAvailabilityWizardStep3View = Em.View.extend({
secondaryNameNode: function () {
return this.get('controller.content.masterComponentHosts').findProperty('component', "SECONDARY_NAMENODE").hostName;
}.property('controller.content.masterComponentHosts'),
- journalNodes: function () {
- return this.get('controller.content.masterComponentHosts').filterProperty('component', "JOURNALNODE");
- }.property('controller.content.masterComponentHosts')
+
+ journalNodes: Em.computed.filterBy('controller.content.masterComponentHosts', 'component', 'JOURNALNODE')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/admin/highAvailability/nameNode/step4_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/nameNode/step4_view.js b/ambari-web/app/views/main/admin/highAvailability/nameNode/step4_view.js
index f23e420..ba261f0 100644
--- a/ambari-web/app/views/main/admin/highAvailability/nameNode/step4_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/nameNode/step4_view.js
@@ -32,10 +32,6 @@ App.HighAvailabilityWizardStep4View = Em.View.extend({
return Em.I18n.t('admin.highAvailability.wizard.step4.body').format(this.get('controller.content.hdfsUser'), nN.hostName);
}.property('controller.content.masterComponentHosts'),
- nnCheckPointText: function () {
- return (this.get('controller.isNextEnabled')) ?
- Em.I18n.t('admin.highAvailability.wizard.step4.ckCreated') :
- Em.I18n.t('admin.highAvailability.wizard.step4.ckNotCreated');
- }.property('controller.isNextEnabled')
+ nnCheckPointText: Em.computed.ifThenElse('controller.isNextEnabled', Em.I18n.t('admin.highAvailability.wizard.step4.ckCreated'), Em.I18n.t('admin.highAvailability.wizard.step4.ckNotCreated'))
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
index b289ce1..2e4e45c 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
@@ -31,9 +31,7 @@ App.upgradeTaskView = Em.View.extend({
/**
* @type {boolean}
*/
- showContent: function () {
- return this.get('outsideView') || this.get('content.isExpanded');
- }.property('content.isExpanded', 'outsideView'),
+ showContent: Em.computed.or('outsideView', 'content.isExpanded'),
/**
* @type {boolean}
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
index 9699fdf..0f60337 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
@@ -68,9 +68,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
/**
* @type {boolean}
*/
- isOutOfSync: function () {
- return this.get('content.status') === 'OUT_OF_SYNC';
- }.property('content.status'),
+ isOutOfSync: Em.computed.equal('content.status', 'OUT_OF_SYNC'),
/**
* map containing version (id, label)
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
index 73b13fd..8ebfff3 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
@@ -194,17 +194,13 @@ App.upgradeWizardView = Em.View.extend({
* manualItem: indicate whether the step is "Service check failures", a dialog with instructions will show up for manual steps
* @type {boolean}
*/
- isServiceCheckFailuresItem: function () {
- return this.get('manualItem.context') === this.get("controller.serviceCheckFailuresContext");
- }.property('manualItem.context'),
+ isServiceCheckFailuresItem: Em.computed.equalProperties('manualItem.context', 'controller.serviceCheckFailuresContext'),
/**
* manualItem: indicate whether the step is Finalize
* @type {boolean}
*/
- isFinalizeItem: function () {
- return this.get('manualItem.context') === this.get('controller.finalizeContext');
- }.property('manualItem.context'),
+ isFinalizeItem: Em.computed.equalProperties('manualItem.context', 'controller.finalizeContext'),
/**
* label of Upgrade status
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/alert_definitions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alert_definitions_view.js b/ambari-web/app/views/main/alert_definitions_view.js
index 6b5e751..64c6f9b 100644
--- a/ambari-web/app/views/main/alert_definitions_view.js
+++ b/ambari-web/app/views/main/alert_definitions_view.js
@@ -75,9 +75,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
/**
* @type {number}
*/
- totalCount: function () {
- return this.get('content.length');
- }.property('content.length'),
+ totalCount: Em.computed.alias('content.length'),
colPropAssoc: ['', 'label', 'summary', 'serviceName', 'type', 'lastTriggered', 'enabled', 'groups'],
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/alerts/manage_alert_groups_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/manage_alert_groups_view.js b/ambari-web/app/views/main/alerts/manage_alert_groups_view.js
index 069d531..1872ad1 100644
--- a/ambari-web/app/views/main/alerts/manage_alert_groups_view.js
+++ b/ambari-web/app/views/main/alerts/manage_alert_groups_view.js
@@ -99,10 +99,7 @@ App.MainAlertsManageAlertGroupView = Em.View.extend({
* Tooltip for "Remove group"-button
* @type {string}
*/
- removeButtonTooltip: function () {
- return this.get('controller.isRemoveButtonDisabled') ? Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButtonDisabled') :
- Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButton');
- }.property('controller.isRemoveButtonDisabled'),
+ removeButtonTooltip: Em.computed.ifThenElse('controller.isRemoveButtonDisabled', Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButtonDisabled'), Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButton')),
/**
* Tooltip for "Rename"-button
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js b/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
index 4672662..e6e2403 100644
--- a/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
+++ b/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
@@ -43,17 +43,13 @@ App.ManageAlertNotificationsView = Em.View.extend({
* Show EMAIL information if selected alert notification has type EMAIL
* @type {boolean}
*/
- showEmailDetails: function () {
- return this.get('controller.selectedAlertNotification.type') === 'EMAIL';
- }.property('controller.selectedAlertNotification.type'),
+ showEmailDetails: Em.computed.equal('controller.selectedAlertNotification.type', 'EMAIL'),
/**
* Show SNMP information if selected alert notification has type SNMP
* @type {boolean}
*/
- showSNMPDetails: function () {
- return this.get('controller.selectedAlertNotification.type') === 'SNMP';
- }.property('controller.selectedAlertNotification.type'),
+ showSNMPDetails: Em.computed.equal('controller.selectedAlertNotification.type', 'SNMP'),
email: function () {
return this.get('controller.selectedAlertNotification.properties')['ambari.dispatch.recipients'];
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard.js b/ambari-web/app/views/main/dashboard.js
index 8448e2b..9694774 100644
--- a/ambari-web/app/views/main/dashboard.js
+++ b/ambari-web/app/views/main/dashboard.js
@@ -45,9 +45,7 @@ App.MainDashboardView = Em.View.extend({
NavItemView: Ember.View.extend({
tagName: 'li',
classNameBindings: 'isActive:active'.w(),
- isActive: function () {
- return this.get('item') === this.get('parentView.selected');
- }.property('item', 'parentView.selected'),
+ isActive: Em.computed.equalProperties('item', 'parentView.selected'),
elementId: Ember.computed(function(){
var label = Em.get(this, 'templateData.keywords.category.label');
return label ? 'dashboard-view-tab-' + label.toLowerCase().replace(/\s/g, '-') : "";
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js b/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js
index c775a7b..df4f62d 100644
--- a/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js
@@ -40,9 +40,7 @@ App.FlumeAgentUpView = App.TextDashboardWidgetView.extend({
thresh2: 70,
maxValue: 100,
- flumeAgentComponents: function() {
- return this.get('model.hostComponents').filterProperty('componentName', 'FLUME_HANDLER');
- }.property('model.hostComponents.length'),
+ flumeAgentComponents: Em.computed.filterBy('model.hostComponents', 'componentName', 'FLUME_HANDLER'),
/**
* @type {Array}
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js b/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js
index f58e0bf..5f8d8aa 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js
@@ -34,12 +34,9 @@ App.HBaseAverageLoadView = App.TextDashboardWidgetView.extend({
return result;
}.property("model.averageLoad"),
- isGreen: function () {
- return this.get('data') <= this.get('thresh1');
- }.property('data','thresh1','thresh2'),
- isRed: function () {
- return this.get('data') > this.get('thresh2');
- }.property('data','thresh1','thresh2'),
+ isGreen: Em.computed.lteProperties('data', 'thresh1'),
+ isRed: Em.computed.gtProperties('data', 'thresh2'),
+
isNA: function (){
return this.get('data') === null || isNaN(this.get('data'));
}.property('data'),
@@ -48,9 +45,7 @@ App.HBaseAverageLoadView = App.TextDashboardWidgetView.extend({
thresh2: 2,
maxValue: 'infinity',
- data: function () {
- return this.get('model.averageLoad');
- }.property("model.averageLoad"),
+ data: Em.computed.alias('model.averageLoad'),
content: function (){
if(this.get('data') || this.get('data') == 0){
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard/widgets/hbase_links.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hbase_links.js b/ambari-web/app/views/main/dashboard/widgets/hbase_links.js
index e0079b6..53ad59c 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hbase_links.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hbase_links.js
@@ -33,21 +33,15 @@ App.HBaseLinksView = App.LinkDashboardWidgetView.extend({
/**
* All master components
*/
- masters: function () {
- return this.get('model.hostComponents').filterProperty('isMaster', true);
- }.property('model.hostComponents.@each'),
+ masters: Em.computed.filterBy('model.hostComponents', 'isMaster', true),
/**
* Passive master components
*/
- passiveMasters: function () {
- return this.get('masters').filterProperty('haStatus', 'false');
- }.property('masters'),
+ passiveMasters: Em.computed.filterBy('masters', 'haStatus', 'false'),
/**
* One(!) active master component
*/
- activeMaster: function () {
- return this.get('masters').findProperty('haStatus', 'true');
- }.property('masters'),
+ activeMaster: Em.computed.findBy('masters', 'haStatus', 'true'),
activeMasterTitle: function(){
return this.t('service.hbase.activeMaster');
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js b/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js
index debbb1d..ec91ab6 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js
@@ -32,15 +32,11 @@ App.HBaseRegionsInTransitionView = App.TextDashboardWidgetView.extend({
}.property("model.regionsInTransition"),
classNameBindings: ['isRed', 'isOrange', 'isGreen', 'isNA'],
- isGreen: function () {
- return this.get('data') <= this.get('thresh1');
- }.property('data','thresh1'),
+ isGreen: Em.computed.lteProperties('data', 'thresh1'),
isOrange: function () {
return (this.get('data') <= this.get('thresh2') && this.get('data') > this.get('thresh1') );
}.property('data','thresh1','thresh2'),
- isRed: function () {
- return this.get('data') > this.get('thresh2');
- }.property('data','thresh2'),
+ isRed: Em.computed.gtProperties('data', 'thresh2'),
isNA: function () {
return this.get('data') === null;
}.property('data'),
@@ -49,9 +45,7 @@ App.HBaseRegionsInTransitionView = App.TextDashboardWidgetView.extend({
thresh2: 2,
maxValue: 'infinity',
- data: function () {
- return this.get('model.regionsInTransition');
- }.property("model.regionsInTransition"),
+ data: Em.computed.alias('model.regionsInTransition'),
content: function (){
return this.get('data') + "";
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js b/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
index 798e828..4826050 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
@@ -35,13 +35,9 @@ App.NameNodeRpcView = App.TextDashboardWidgetView.extend({
thresh2: 2,
maxValue: 'infinity',
- isGreen: function () {
- return (this.get('data') <= this.get('thresh1'));
- }.property('data','thresh1'),
+ isGreen: Em.computed.lteProperties('data', 'thresh1'),
- isRed: function () {
- return (this.get('data') > this.get('thresh2'));
- }.property('data','thresh2'),
+ isRed: Em.computed.gtProperties('data', 'thresh2'),
data: function () {
if (this.get('model.nameNodeRpc')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js b/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
index 9b12abf..0817f27 100644
--- a/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
@@ -50,9 +50,7 @@ App.NodeManagersLiveView = App.TextDashboardWidgetView.extend({
return !this.get('model.metricsNotAvailable') && App.get('router.clusterController.isComponentsStateLoaded');
}.property('App.router.clusterController.isComponentsStateLoaded'),
- nodeManagersLive: function () {
- return this.get('model.nodeManagersCountActive');
- }.property('model.nodeManagersCountActive'),
+ nodeManagersLive: Em.computed.alias('model.nodeManagersCountActive'),
data: function () {
var nodeManagers = this.get('model.nodeManagersTotal');
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js b/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
index 83fc0f5..801dc6c 100644
--- a/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
+++ b/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
@@ -83,18 +83,14 @@ App.PieChartDashboardWidgetView = App.DashboardWidgetView.extend({
content: App.ChartPieView.extend({
model: null, //data bind here
- id: function() {
- return this.get('parentView.widgetHtmlId');
- }.property('parentView.widgetHtmlId'), // html id
+ id: Em.computed.alias('parentView.widgetHtmlId'), // html id
stroke: '#D6DDDF', //light grey
thresh1: null, //bind from parent
thresh2: null,
innerR: 25,
existCenterText: true,
- centerTextColor: function () {
- return this.get('contentColor');
- }.property('contentColor'),
+ centerTextColor: Em.computed.alias('contentColor'),
palette: new Rickshaw.Color.Palette({
scheme: [ '#FFFFFF', '#D6DDDF'].reverse()
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js b/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js
index 4f33242..3b9e928 100644
--- a/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js
@@ -40,17 +40,11 @@ App.SuperVisorUpView = App.TextDashboardWidgetView.extend({
thresh2: 70,
maxValue: 100,
- superVisorsLive: function () {
- return this.get('model.superVisorsStarted');
- }.property('model.superVisorsStarted'),
+ superVisorsLive: Em.computed.alias('model.superVisorsStarted'),
- superVisorsDead: function () {
- return this.get('model.superVisorsInstalled');
- }.property('model.superVisorsInstalled'),
+ superVisorsDead: Em.computed.alias('model.superVisorsInstalled'),
- superVisorsTotal: function() {
- return this.get('model.superVisorsTotal');
- }.property('model.superVisorsTotal'),
+ superVisorsTotal: Em.computed.alias('model.superVisorsTotal'),
data: function () {
if ( !this.get('superVisorsTotal') || Em.isNone(this.get('superVisorsLive'))) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/dashboard/widgets/text_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/text_widget.js b/ambari-web/app/views/main/dashboard/widgets/text_widget.js
index b51ca6e..dc5f484 100644
--- a/ambari-web/app/views/main/dashboard/widgets/text_widget.js
+++ b/ambari-web/app/views/main/dashboard/widgets/text_widget.js
@@ -25,17 +25,13 @@ App.TextDashboardWidgetView = App.DashboardWidgetView.extend({
classNameBindings: ['isRed', 'isOrange', 'isGreen', 'isNA'],
- isRed: function () {
- return (this.get('data') <= this.get('thresh1'));
- }.property('data','thresh1'),
+ isRed: Em.computed.lteProperties('data', 'thresh1'),
isOrange: function () {
return (this.get('data') <= this.get('thresh2') && this.get('data') > this.get('thresh1'));
}.property('data','thresh1','thresh2'),
- isGreen: function () {
- return (this.get('data') > this.get('thresh2'));
- }.property('data','thresh2'),
+ isGreen: Em.computed.gtProperties('data', 'thresh2'),
isNA: function () {
return this.get('data') === null;
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js
index 6f1f04b..f8e98f6 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -64,9 +64,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
/**
* flag to toggle displaying selected hosts counter
*/
- showSelectedFilter: function () {
- return this.get('selectedHosts.length') > 0;
- }.property('selectedHosts'),
+ showSelectedFilter: Em.computed.bool('selectedHosts.length'),
/**
* return filtered number of all content number information displayed on the page footer bar
@@ -434,9 +432,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
* true if host has no components
* @returns {Boolean}
*/
- hasNoComponents: function() {
- return !this.get('content.hostComponents.length');
- }.property('content.hostComponents.length'),
+ hasNoComponents: Em.computed.empty('content.hostComponents'),
/**
@@ -554,9 +550,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
* Add "active" class for category span-wrapper if current category is selected
* @type {String}
*/
- itemClass: function() {
- return this.get('isActive') ? 'active' : '';
- }.property('isActive'),
+ itemClass: Em.computed.ifThenElse('isActive', 'active', ''),
/**
* Text shown on the right of category icon
@@ -583,9 +577,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
/**
* Category for <code>selected</code> property of each App.Host
*/
- selectedCategory: function() {
- return this.get('categories').findProperty('selected', true);
- }.property('categories.@each.selected'),
+ selectedCategory: Em.computed.findBy('categories', 'selected', true),
statusFilter: Em.View.extend({
column: 0,
@@ -978,9 +970,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
* associations between host property and column index
* @type {Array}
*/
- colPropAssoc: function () {
- return this.get('controller.colPropAssoc');
- }.property('controller.colPropAssoc'),
+ colPropAssoc: Em.computed.alias('controller.colPropAssoc'),
/**
* Run <code>clearFilter</code> in the each child filterView
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/host/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/configs.js b/ambari-web/app/views/main/host/configs.js
index 6a6803f..c9779a9 100644
--- a/ambari-web/app/views/main/host/configs.js
+++ b/ambari-web/app/views/main/host/configs.js
@@ -26,8 +26,6 @@ App.MainHostConfigsView = Em.View.extend({
return App.router.get('mainHostDetailsController.content');
}.property('App.router.mainHostDetailsController.content'),
- isConfigAvailable: function () {
- return !!this.get('content.hostComponents.length');
- }.property('content.hostComponents.length')
+ isConfigAvailable: Em.computed.bool('content.hostComponents.length')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details.js b/ambari-web/app/views/main/host/details.js
index 838502f..53e4f94 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -31,9 +31,7 @@ App.MainHostDetailsView = Em.View.extend({
return App.router.get('mainHostDetailsController.content');
}.property('App.router.mainHostDetailsController.content'),
- clients: function () {
- return this.get('content.hostComponents').filterProperty('isClient');
- }.property('content.hostComponents.@each'),
+ clients: Em.computed.filterBy('content.hostComponents', 'isClient', true),
clientsWithConfigs: function() {
return this.get('content.hostComponents').filterProperty('isClient').filter(function(client) {
@@ -41,9 +39,7 @@ App.MainHostDetailsView = Em.View.extend({
});
}.property('content.hostComponents.@each'),
- isActive: function() {
- return this.get('controller.content.passiveState') === "OFF";
- }.property('controller.content.passiveState'),
+ isActive: Em.computed.equal('controller.content.passiveState', 'OFF'),
maintenance: function(){
var onOff = this.get('isActive') ? "On" : "Off";
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/host/details/host_component_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details/host_component_view.js b/ambari-web/app/views/main/host/details/host_component_view.js
index eba1691..cec9da4 100644
--- a/ambari-web/app/views/main/host/details/host_component_view.js
+++ b/ambari-web/app/views/main/host/details/host_component_view.js
@@ -130,33 +130,25 @@ App.HostComponentView = Em.View.extend({
* For Started and Starting states
* @type {bool}
*/
- isStart: function () {
- return [App.HostComponentStatus.started, App.HostComponentStatus.starting].contains(this.get('workStatus'));
- }.property('workStatus'),
+ isStart: Em.computed.existsIn('workStatus', [App.HostComponentStatus.started, App.HostComponentStatus.starting]),
/**
* For Installed state
* @type {bool}
*/
- isStop: function () {
- return (this.get('workStatus') == App.HostComponentStatus.stopped);
- }.property('workStatus'),
+ isStop: Em.computed.equal('workStatus', App.HostComponentStatus.stopped),
/**
* For Installing state
* @type {bool}
*/
- isInstalling: function () {
- return (this.get('workStatus') == App.HostComponentStatus.installing);
- }.property('workStatus'),
+ isInstalling: Em.computed.equal('workStatus', App.HostComponentStatus.installing),
/**
* For Init state
* @type {bool}
*/
- isInit: function() {
- return this.get('workStatus') == App.HostComponentStatus.init;
- }.property('workStatus'),
+ isInit: Em.computed.equal('workStatus', App.HostComponentStatus.init),
/**
* No action available while component is starting/stopping/unknown
@@ -172,18 +164,13 @@ App.HostComponentView = Em.View.extend({
* For Stopping or Starting states
* @type {bool}
*/
- isInProgress: function () {
- return (this.get('workStatus') === App.HostComponentStatus.stopping ||
- this.get('workStatus') === App.HostComponentStatus.starting);
- }.property('workStatus'),
+ isInProgress: Em.computed.existsIn('workStatus', [App.HostComponentStatus.stopping, App.HostComponentStatus.starting]),
/**
* For OFF <code>passiveState</code> of host component
* @type {bool}
*/
- isActive: function () {
- return (this.get('content.passiveState') == "OFF");
- }.property('content.passiveState'),
+ isActive: Em.computed.equal('content.passiveState', 'OFF'),
/**
* Shows whether we need to show Delete button
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/host/host_alerts_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/host_alerts_view.js b/ambari-web/app/views/main/host/host_alerts_view.js
index 656787b..731212f 100644
--- a/ambari-web/app/views/main/host/host_alerts_view.js
+++ b/ambari-web/app/views/main/host/host_alerts_view.js
@@ -61,9 +61,7 @@ App.MainHostAlertsView = App.TableView.extend({
/**
* @type {number}
*/
- totalCount: function () {
- return this.get('content.length');
- }.property('content.length'),
+ totalCount: Em.computed.alias('content.length'),
colPropAssoc: ['', 'serviceName', 'label', 'latestTimestamp', 'state', 'text'],
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/host/stack_versions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/stack_versions_view.js b/ambari-web/app/views/main/host/stack_versions_view.js
index df1e38f..94dd2f9 100644
--- a/ambari-web/app/views/main/host/stack_versions_view.js
+++ b/ambari-web/app/views/main/host/stack_versions_view.js
@@ -34,9 +34,7 @@ App.MainHostStackVersionsView = App.TableView.extend({
/**
* @type {Ember.Array}
*/
- content: function () {
- return this.get('host.stackVersions').filterProperty('isVisible', true);
- }.property('host.stackVersions.length'),
+ content: Em.computed.filterBy('host.stackVersions', 'isVisible', true),
/**
* return filtered number of all content number information displayed on the page footer bar
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index 6ce3529..dd5adab 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -230,9 +230,7 @@ App.MainHostSummaryView = Em.View.extend(App.TimeRangeMixin, {
* If host lost heartbeat, components can't be added on it
* @type {bool}
*/
- isAddComponent: function () {
- return this.get('content.healthClass') !== 'health-status-DEAD-YELLOW';
- }.property('content.healthClass'),
+ isAddComponent: Em.computed.notEqual('content.healthClass', 'health-status-DEAD-YELLOW'),
/**
* Disable "Add" button if components can't be added to the current host
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js
index 115d839..d01aa67 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -94,12 +94,8 @@ App.MainMenuView = Em.CollectionView.extend({
var itemsWithDropdown = ['services', 'admin', 'views'];
return itemsWithDropdown.contains(item);
}.property(''),
- isAdminItem: function () {
- return this.get('content').routing == 'admin';
- }.property(''),
- isServicesItem: function () {
- return this.get('content').routing == 'services';
- }.property(''),
+ isAdminItem: Em.computed.equal('content.routing', 'admin'),
+ isServicesItem: Em.computed.equal('content.routing', 'services'),
isViewsItem: function () {
return this.get('content').routing.contains('views');
}.property(''),
@@ -147,9 +143,7 @@ App.MainMenuView = Em.CollectionView.extend({
AdminDropdownItemView: Ember.View.extend({
tagName: 'li',
classNameBindings: 'isActive:active'.w(),
- isActive: function () {
- return this.get('item') === this.get('parentView.selectedAdminItem');
- }.property('item', 'parentView.selectedAdminItem'),
+ isActive: Em.computed.equalProperties('item', 'parentView.selectedAdminItem'),
goToCategory: function (event) {
var itemName = this.get('parentView').get('content').routing;
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graph.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graph.js b/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graph.js
index 43a9b51..0d9b382 100644
--- a/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graph.js
+++ b/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graph.js
@@ -39,9 +39,7 @@ App.ChartServiceFlumeMetricGraph = App.ChartLinearTimeView.extend({
return "service-metrics-flume-metric-graph-" + this.get('metricType') + '-' + this.get('metricName');
}.property('metricType', 'metricName'),
- title: function(){
- return this.get('metricName');
- }.property('metricName'),
+ title: Em.computed.alias('metricName'),
ajaxIndex: 'host.host_component.flume.metrics.timeseries',
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index e1ea6ac..4cda6a2 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -88,9 +88,7 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, App.TimeRangeMixin
return App.get('services.hasClient');
}.property('App.services.hasClient'),
- hasManyServers: function () {
- return this.get('servers').length > 1;
- }.property('servers'),
+ hasManyServers: Em.computed.gt('servers.length', 1),
clientsHostText: function () {
if (this.get('controller.content.installedClients').length == 0) {
@@ -102,9 +100,7 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, App.TimeRangeMixin
}
}.property("hasManyClients"),
- hasManyClients: function () {
- return this.get('controller.content.installedClients').length > 1;
- }.property('service.installedClients'),
+ hasManyClients: Em.computed.gt('controller.content.installedClients.length', 1),
servers: function () {
var result = [];
@@ -274,9 +270,7 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, App.TimeRangeMixin
href:'javascript:void(null)'
}),
- serviceName:function () {
- return this.get('service.serviceName');
- }.property('service'),
+ serviceName: Em.computed.alias('service.serviceName'),
oldServiceName:'',
@@ -286,13 +280,9 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, App.TimeRangeMixin
componentsCount: null,
hostsCount: null,
- alertsCount: function () {
- return this.get('controller.content.alertsCount');
- }.property('controller.content.alertsCount'),
+ alertsCount: Em.computed.alias('controller.content.alertsCount'),
- hasCriticalAlerts: function () {
- return this.get('controller.content.hasCriticalAlerts');
- }.property('controller.content.alertsCount'),
+ hasCriticalAlerts: Em.computed.alias('controller.content.hasCriticalAlerts'),
/**
* Define if service has alert definitions defined
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index d87e16b..edc5d59 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -21,17 +21,11 @@ var App = require('app');
App.MainServiceItemView = Em.View.extend({
templateName: require('templates/main/service/item'),
- serviceName: function() {
- return this.get('controller.content.serviceName');
- }.property('controller.content.serviceName'),
+ serviceName: Em.computed.alias('controller.content.serviceName'),
- displayName: function() {
- return this.get('controller.content.displayName');
- }.property('controller.content.displayName'),
+ displayName: Em.computed.alias('controller.content.displayName'),
- isPassive: function() {
- return this.get('controller.content.passiveState') === 'ON';
- }.property('controller.content.passiveState'),
+ isPassive: Em.computed.equal('controller.content.passiveState', 'ON'),
/**
* Some custom commands need custom logic to be executed
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/menu.js b/ambari-web/app/views/main/service/menu.js
index a462ac1..524fde3 100644
--- a/ambari-web/app/views/main/service/menu.js
+++ b/ambari-web/app/views/main/service/menu.js
@@ -66,21 +66,15 @@ App.MainServiceMenuView = Em.CollectionView.extend({
templateName:require('templates/main/service/menu_item'),
restartRequiredMessage: null,
- shouldBeRestarted: function() {
- return this.get('content.hostComponents').someProperty('staleConfigs', true);
- }.property('content.hostComponents.@each.staleConfigs'),
+ shouldBeRestarted: Em.computed.someBy('content.hostComponents', 'staleConfigs', true),
active:function () {
return this.get('content.id') == this.get('parentView.activeServiceId') ? 'active' : '';
}.property('parentView.activeServiceId'),
- alertsCount: function () {
- return this.get('content.alertsCount');
- }.property('content.alertsCount'),
+ alertsCount: Em.computed.alias('content.alertsCount'),
- hasCriticalAlerts: function () {
- return this.get('content.hasCriticalAlerts');
- }.property('content.hasCriticalAlerts'),
+ hasCriticalAlerts: Em.computed.alias('content.hasCriticalAlerts'),
isConfigurable: function () {
return !App.get('services.noConfigTypes').contains(this.get('content.serviceName'));
@@ -173,21 +167,15 @@ App.TopNavServiceMenuView = Em.CollectionView.extend({
templateName:require('templates/main/service/menu_item'),
restartRequiredMessage: null,
- shouldBeRestarted: function() {
- return this.get('content.hostComponents').someProperty('staleConfigs', true);
- }.property('content.hostComponents.@each.staleConfigs'),
+ shouldBeRestarted: Em.computed.someBy('content.hostComponents', 'staleConfigs', true),
active:function () {
return this.get('content.id') == this.get('parentView.activeServiceId') ? 'active' : '';
}.property('parentView.activeServiceId'),
- alertsCount: function () {
- return this.get('content.alertsCount');
- }.property('content.alertsCount'),
+ alertsCount: Em.computed.alias('content.alertsCount'),
- hasCriticalAlerts: function () {
- return this.get('content.hasCriticalAlerts');
- }.property('content.hasCriticalAlerts'),
+ hasCriticalAlerts: Em.computed.alias('content.hasCriticalAlerts'),
isConfigurable: function () {
return !App.get('services.noConfigTypes').contains(this.get('content.serviceName'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/reassign/step3_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/reassign/step3_view.js b/ambari-web/app/views/main/service/reassign/step3_view.js
index 90fc834..20d08d8 100644
--- a/ambari-web/app/views/main/service/reassign/step3_view.js
+++ b/ambari-web/app/views/main/service/reassign/step3_view.js
@@ -23,13 +23,9 @@ App.ReassignMasterWizardStep3View = Em.View.extend({
templateName: require('templates/main/service/reassign/step3'),
- sourceHost: function(){
- return this.get('controller.content.reassignHosts.source');
- }.property('controller.content.reassignHosts.source'),
+ sourceHost: Em.computed.alias('controller.content.reassignHosts.source'),
- targetHost: function(){
- return this.get('controller.content.reassignHosts.target');
- }.property('controller.content.reassignHosts.target'),
+ targetHost: Em.computed.alias('controller.content.reassignHosts.target'),
printReview: function () {
$("#step8-info").jqprint();
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/reassign/step4_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/reassign/step4_view.js b/ambari-web/app/views/main/service/reassign/step4_view.js
index 132c29e..bd5950a 100644
--- a/ambari-web/app/views/main/service/reassign/step4_view.js
+++ b/ambari-web/app/views/main/service/reassign/step4_view.js
@@ -39,13 +39,7 @@ App.ReassignMasterWizardStep4View = App.HighAvailabilityProgressPageView.extend(
}
}.property('controller.content.reassign.component_name','controller.content.reassignHosts.source','controller.content.reassignHosts.target'),
- submitButtonText: function () {
- if (this.get('controller.content.hasManualSteps')) {
- return Em.I18n.t('common.next') + ' →';
- } else {
- return Em.I18n.t('common.complete');
- }
- }.property('controller.content.hasManualSteps'),
+ submitButtonText: Em.computed.ifThenElse('controller.content.hasManualSteps', Em.I18n.t('common.next') + ' →', Em.I18n.t('common.complete')),
templateName: require('templates/main/service/reassign/step4'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/reassign/step7_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/reassign/step7_view.js b/ambari-web/app/views/main/service/reassign/step7_view.js
index 0eacb0c..60b357a 100644
--- a/ambari-web/app/views/main/service/reassign/step7_view.js
+++ b/ambari-web/app/views/main/service/reassign/step7_view.js
@@ -23,21 +23,13 @@ App.ReassignMasterWizardStep7View = App.HighAvailabilityProgressPageView.extend(
headerTitle: Em.I18n.t('services.reassign.step7.header'),
- noticeInProgress: function () {
- return Em.I18n.t('services.reassign.step7.info');
- }.property(),
+ noticeInProgress: Em.I18n.t('services.reassign.step7.info'),
- noticeFailed: function () {
- return Em.I18n.t('services.reassign.step7.failed');
- }.property(),
+ noticeFailed: Em.I18n.t('services.reassign.step7.failed'),
- noticeCompleted: function () {
- return Em.I18n.t('services.reassign.step7.success');
- }.property(),
+ noticeCompleted: Em.I18n.t('services.reassign.step7.success'),
- submitButtonText: function () {
- return Em.I18n.t('common.complete') + ' →';
- }.property(),
+ submitButtonText: Em.I18n.t('common.complete') + ' →',
templateName: require('templates/main/service/reassign/step7'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/reconfigure.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/reconfigure.js b/ambari-web/app/views/main/service/reconfigure.js
index dd7a8d3..8838545 100644
--- a/ambari-web/app/views/main/service/reconfigure.js
+++ b/ambari-web/app/views/main/service/reconfigure.js
@@ -54,13 +54,10 @@ App.StageLabelView = Em.View.extend({
})
},
- isStarted: function () {
- return (this.get('command') && this.get('command.isStarted'));
- }.property('command.isStarted'),
+ isStarted: Em.computed.alias('command.isStarted'),
+
+ showLink: Em.computed.alias('command.showLink')
- showLink: function () {
- return (this.get('command') && this.get('command.showLink'));
- }.property('command.showLink')
});
App.StageSuccessView = Em.View.extend({
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/service.js b/ambari-web/app/views/main/service/service.js
index 269f261..520fd75 100644
--- a/ambari-web/app/views/main/service/service.js
+++ b/ambari-web/app/views/main/service/service.js
@@ -135,9 +135,7 @@ App.MainDashboardServiceView = Em.View.extend(App.MainDashboardServiceViewWrappe
App.tooltip($('[rel=SummaryComponentHealthTooltip]'));
},
templateName: require('templates/main/service/info/summary/master_components'),
- mastersComp: function () {
- return this.get('parentView.parentView.mastersObj');
- }.property("parentView.parentView.mastersObj"),
+ mastersComp: Em.computed.alias('parentView.parentView.mastersObj'),
willDestroyElement: function() {
$('[rel=SummaryComponentHealthTooltip]').tooltip('destroy');
}
@@ -147,13 +145,9 @@ App.MainDashboardServiceView = Em.View.extend(App.MainDashboardServiceViewWrappe
return (value || value == 0) ? value : this.t('services.service.summary.notAvailable');
},
- alertsCount: function () {
- return this.get('service.alertsCount');
- }.property('service.alertsCount'),
+ alertsCount: Em.computed.alias('service.alertsCount'),
- hasCriticalAlerts: function () {
- return this.get('service.hasCriticalAlerts');
- }.property('service.hasCriticalAlerts'),
+ hasCriticalAlerts: Em.computed.alias('service.hasCriticalAlerts'),
isCollapsed: false,
@@ -162,9 +156,7 @@ App.MainDashboardServiceView = Em.View.extend(App.MainDashboardServiceViewWrappe
this.set('isCollapsed', !this.isCollapsed);
},
- masters: function(){
- return this.get('service.hostComponents').filterProperty('isMaster', true);
- }.property('service'),
+ masters: Em.computed.filterBy('service.hostComponents', 'isMaster', true),
clients: function(){
var clients = this.get('service.hostComponents').filterProperty('isClient', true);
http://git-wip-us.apache.org/repos/asf/ambari/blob/177a91f4/ambari-web/app/views/main/service/services/hbase.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/hbase.js b/ambari-web/app/views/main/service/services/hbase.js
index 8b6b9f7..de0818d 100644
--- a/ambari-web/app/views/main/service/services/hbase.js
+++ b/ambari-web/app/views/main/service/services/hbase.js
@@ -25,15 +25,11 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
/**
* All master components
*/
- masters: function () {
- return this.get('service.hostComponents').filterProperty('isMaster', true);
- }.property('service.hostComponents.length'),
+ masters: Em.computed.filterBy('service.hostComponents', 'isMaster', true),
/**
* Passive master components
*/
- passiveMasters: function () {
- return this.get('masters').filterProperty('haStatus', 'false');
- }.property('masters'),
+ passiveMasters: Em.computed.filterBy('masters', 'haStatus', 'false'),
regionServesText: function () {
if (this.get('service.regionServersTotal') == 0) {
@@ -55,16 +51,12 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
}
}.property("service"),
- showPhoenixInfo: function () {
- return !!this.get('service.phoenixServersTotal');
- }.property("service.phoenixServersTotal"),
+ showPhoenixInfo: Em.computed.bool('service.phoenixServersTotal'),
/**
* One(!) active master component
*/
- activeMaster: function () {
- return this.get('masters').findProperty('haStatus', 'true');
- }.property('masters'),
+ activeMaster: Em.computed.findBy('masters', 'haStatus', 'true'),
activeMasterTitle: function(){
return this.t('service.hbase.activeMaster');