You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2015/11/18 17:51:43 UTC

[47/50] [abbrv] ambari git commit: AMBARI-13949. Apply created Em.computed macros to ambari-web views (onechiporenko)

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