[16/50] ambari git commit: AMBARI-20375. Remove duplicate code from wizard menu (onechiporenko)
AMBARI-20375. Remove duplicate code from wizard menu (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c3c3422e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c3c3422e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c3c3422e Branch: refs/heads/branch-dev-logsearch Commit: c3c3422e51c58c6e9ec3affd492f28a26499dc1e Parents: af69dcc Author: Oleg NechiporenkoAuthored: Thu Mar 9 14:03:11 2017 +0200 Committer: Oleg Nechiporenko Committed: Thu Mar 9 16:41:51 2017 +0200 -- .../app/mixins/wizard/wizard_menu_view.js | 125 ++- .../app/views/main/service/reassign_view.js | 32 - 2 files changed, 38 insertions(+), 119 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/c3c3422e/ambari-web/app/mixins/wizard/wizard_menu_view.js -- diff --git a/ambari-web/app/mixins/wizard/wizard_menu_view.js b/ambari-web/app/mixins/wizard/wizard_menu_view.js index 90b7354..712263e 100644 --- a/ambari-web/app/mixins/wizard/wizard_menu_view.js +++ b/ambari-web/app/mixins/wizard/wizard_menu_view.js @@ -16,101 +16,52 @@ * limitations under the License. */ - var App = require('app'); +function isStepDisabled(index) { + return Em.computed('controller.isStepDisabled.@each.{step,value}', function () { +return this.isStepDisabled(index); + }).cacheable(); +} + +function isStepCompleted(index) { + return Em.computed('controller.{currentStep,isStepDisabled.@each.value}', function () { +return this.isStepCompleted(index); + }).cacheable(); +} + App.WizardMenuMixin = Em.Mixin.create({ isStepDisabled: function (index) { return this.get('controller.isStepDisabled').findProperty('step', index).get('value'); }, - isStep0Disabled: function () { -return this.isStepDisabled(0); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep1Disabled: function () { -return this.isStepDisabled(1); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep2Disabled: function () { -return this.isStepDisabled(2); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep3Disabled: function () { -return this.isStepDisabled(3); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep4Disabled: function () { -return this.isStepDisabled(4); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep5Disabled: function () { -return this.isStepDisabled(5); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep6Disabled: function () { -return this.isStepDisabled(6); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep7Disabled: function () { -return this.isStepDisabled(7); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep8Disabled: function () { -return this.isStepDisabled(8); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep9Disabled: function () { -return this.isStepDisabled(9); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep10Disabled: function () { -return this.isStepDisabled(10); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep0Completed: function () { -return this.get('controller.currentStep') > 0; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep1Completed: function () { -return this.get('controller.currentStep') > 1; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep2Completed: function () { -return this.get('controller.currentStep') > 2; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep3Completed: function () { -return this.get('controller.currentStep') > 3; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep4Completed: function () { -return this.get('controller.currentStep') > 4; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep5Completed: function () { -return this.get('controller.currentStep') > 5; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep6Completed: function () { -return this.get('controller.currentStep') > 6; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep7Completed: function () { -return this.get('controller.currentStep') > 7; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep8Completed: function () { -return this.get('controller.currentStep') > 8; -
ambari git commit: AMBARI-20375. Remove duplicate code from wizard menu (onechiporenko)
Repository: ambari Updated Branches: refs/heads/trunk af69dcc43 -> c3c3422e5 AMBARI-20375. Remove duplicate code from wizard menu (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c3c3422e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c3c3422e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c3c3422e Branch: refs/heads/trunk Commit: c3c3422e51c58c6e9ec3affd492f28a26499dc1e Parents: af69dcc Author: Oleg NechiporenkoAuthored: Thu Mar 9 14:03:11 2017 +0200 Committer: Oleg Nechiporenko Committed: Thu Mar 9 16:41:51 2017 +0200 -- .../app/mixins/wizard/wizard_menu_view.js | 125 ++- .../app/views/main/service/reassign_view.js | 32 - 2 files changed, 38 insertions(+), 119 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/c3c3422e/ambari-web/app/mixins/wizard/wizard_menu_view.js -- diff --git a/ambari-web/app/mixins/wizard/wizard_menu_view.js b/ambari-web/app/mixins/wizard/wizard_menu_view.js index 90b7354..712263e 100644 --- a/ambari-web/app/mixins/wizard/wizard_menu_view.js +++ b/ambari-web/app/mixins/wizard/wizard_menu_view.js @@ -16,101 +16,52 @@ * limitations under the License. */ - var App = require('app'); +function isStepDisabled(index) { + return Em.computed('controller.isStepDisabled.@each.{step,value}', function () { +return this.isStepDisabled(index); + }).cacheable(); +} + +function isStepCompleted(index) { + return Em.computed('controller.{currentStep,isStepDisabled.@each.value}', function () { +return this.isStepCompleted(index); + }).cacheable(); +} + App.WizardMenuMixin = Em.Mixin.create({ isStepDisabled: function (index) { return this.get('controller.isStepDisabled').findProperty('step', index).get('value'); }, - isStep0Disabled: function () { -return this.isStepDisabled(0); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep1Disabled: function () { -return this.isStepDisabled(1); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep2Disabled: function () { -return this.isStepDisabled(2); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep3Disabled: function () { -return this.isStepDisabled(3); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep4Disabled: function () { -return this.isStepDisabled(4); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep5Disabled: function () { -return this.isStepDisabled(5); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep6Disabled: function () { -return this.isStepDisabled(6); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep7Disabled: function () { -return this.isStepDisabled(7); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep8Disabled: function () { -return this.isStepDisabled(8); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep9Disabled: function () { -return this.isStepDisabled(9); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep10Disabled: function () { -return this.isStepDisabled(10); - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep0Completed: function () { -return this.get('controller.currentStep') > 0; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep1Completed: function () { -return this.get('controller.currentStep') > 1; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep2Completed: function () { -return this.get('controller.currentStep') > 2; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep3Completed: function () { -return this.get('controller.currentStep') > 3; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep4Completed: function () { -return this.get('controller.currentStep') > 4; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep5Completed: function () { -return this.get('controller.currentStep') > 5; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep6Completed: function () { -return this.get('controller.currentStep') > 6; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep7Completed: function () { -return this.get('controller.currentStep') > 7; - }.property('controller.isStepDisabled.@each.value').cacheable(), - - isStep8Completed: function () { -return this.get('controller.currentStep') >