[14/32] ambari git commit: AMBARI-20333 - Value for User Limit Factor should be float instead of integer in YARN Queue Manager. (Anita Jebaraj via sangeetar)
AMBARI-20333 - Value for User Limit Factor should be float instead of integer in YARN Queue Manager. (Anita Jebaraj via sangeetar) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/df4c44a0 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/df4c44a0 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/df4c44a0 Branch: refs/heads/branch-feature-AMBARI-12556 Commit: df4c44a04dece13565927f34e14766876826accf Parents: f6e88e0 Author: Sangeeta Ravindran Authored: Wed Mar 15 15:36:51 2017 -0700 Committer: Sangeeta Ravindran Committed: Wed Mar 15 15:36:51 2017 -0700 -- .../ui/app/components/capacityInput.js | 62 .../main/resources/ui/app/templates/queue.hbs | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/df4c44a0/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js -- diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js index 8eb06c2..b6c419a 100644 --- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js +++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js @@ -65,6 +65,68 @@ App.IntInputComponent = Ember.TextField.extend({ }.observes('value') }); +App.DecimalInputComponent = Ember.TextField.extend({ + classNames:['form-control'], + + initVal: function() { +this.set('value', (!Em.isBlank(this.get('value')) && !isNaN(parseFloat(this.get('value' ? parseFloat(this.get('value')): null); + }.on('init'), + + keyDown: function(evt) { +var newChar, val = this.get('value') || 0; +val = val.toString(); +if ((evt.keyCode > 64 && evt.keyCode < 91) || + (evt.keyCode > 185 && evt.keyCode < 190) || + (evt.keyCode > 190 && evt.keyCode < 193) || + (evt.keyCode > 218 && evt.keyCode < 223)) { + return false; +} +if (evt.keyCode === 190 || evt.keyCode === 9) { + return true; +} +if (evt.keyCode > 95 && evt.keyCode < 106) { + newChar = (evt.keyCode - 96).toString(); +} else { + newChar = String.fromCharCode(evt.keyCode); +} +if (newChar.match(/[0-9]/)) { + val = val.substring(0, evt.target.selectionStart) + newChar + val.substring(evt.target.selectionEnd); +} +if (/^\d+\.\d{3}$/.test(val)) { + return false; +} +return parseFloat(val); + }, + + debounceId: null, + + cancelDebounceCallback: function() { +Ember.run.cancel(this.get('debounceId')); +this.set('debounceId', null); + }, + + initDebounceCallback: function(val) { +var debounce = Ember.run.debounce(this, function() { + this.set('value', parseFloat(val)); +}, 8000); +this.set('debounceId', debounce); + }, + + valueDidChange: function() { +var val = this.get('value'); +this.cancelDebounceCallback(); +if (/^\d+(\.(\d{1,2})?)?$/.test(val)) { + if (/^\d+\.[0]$/.test(val) || /^\d+\.$/.test(val)) { +this.initDebounceCallback(val); + } else { +this.set('value', parseFloat(val)); + } +} +else + this.set('value', (!Em.isBlank(this.get('value')) && !isNaN(parseFloat(this.get('value' ? parseFloat(val) : null); + }.observes('value').on('change') +}); + App.CapacityInputComponent = App.IntInputComponent.extend({ totalCapacity:null, http://git-wip-us.apache.org/repos/asf/ambari/blob/df4c44a0/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs -- diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs index 69f5b3b..dcfb84f 100644 --- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs +++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs @@ -265,7 +265,7 @@ }} {{#if isOperator}} - {{int-input value=content.user_limit_factor maxlength=10 class="input-sm input-int" defaultVal=1 placeholder=1}} + {{decimal-input value=content.user_limit_factor maxlength=10 class="input-sm input-int" defaultVal=1 placeholder=1}} {{#if queueDirtyFilelds.user_limit_factor}}
ambari git commit: AMBARI-20333 - Value for User Limit Factor should be float instead of integer in YARN Queue Manager. (Anita Jebaraj via sangeetar)
Repository: ambari Updated Branches: refs/heads/trunk f6e88e087 -> df4c44a04 AMBARI-20333 - Value for User Limit Factor should be float instead of integer in YARN Queue Manager. (Anita Jebaraj via sangeetar) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/df4c44a0 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/df4c44a0 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/df4c44a0 Branch: refs/heads/trunk Commit: df4c44a04dece13565927f34e14766876826accf Parents: f6e88e0 Author: Sangeeta Ravindran Authored: Wed Mar 15 15:36:51 2017 -0700 Committer: Sangeeta Ravindran Committed: Wed Mar 15 15:36:51 2017 -0700 -- .../ui/app/components/capacityInput.js | 62 .../main/resources/ui/app/templates/queue.hbs | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/df4c44a0/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js -- diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js index 8eb06c2..b6c419a 100644 --- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js +++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/capacityInput.js @@ -65,6 +65,68 @@ App.IntInputComponent = Ember.TextField.extend({ }.observes('value') }); +App.DecimalInputComponent = Ember.TextField.extend({ + classNames:['form-control'], + + initVal: function() { +this.set('value', (!Em.isBlank(this.get('value')) && !isNaN(parseFloat(this.get('value' ? parseFloat(this.get('value')): null); + }.on('init'), + + keyDown: function(evt) { +var newChar, val = this.get('value') || 0; +val = val.toString(); +if ((evt.keyCode > 64 && evt.keyCode < 91) || + (evt.keyCode > 185 && evt.keyCode < 190) || + (evt.keyCode > 190 && evt.keyCode < 193) || + (evt.keyCode > 218 && evt.keyCode < 223)) { + return false; +} +if (evt.keyCode === 190 || evt.keyCode === 9) { + return true; +} +if (evt.keyCode > 95 && evt.keyCode < 106) { + newChar = (evt.keyCode - 96).toString(); +} else { + newChar = String.fromCharCode(evt.keyCode); +} +if (newChar.match(/[0-9]/)) { + val = val.substring(0, evt.target.selectionStart) + newChar + val.substring(evt.target.selectionEnd); +} +if (/^\d+\.\d{3}$/.test(val)) { + return false; +} +return parseFloat(val); + }, + + debounceId: null, + + cancelDebounceCallback: function() { +Ember.run.cancel(this.get('debounceId')); +this.set('debounceId', null); + }, + + initDebounceCallback: function(val) { +var debounce = Ember.run.debounce(this, function() { + this.set('value', parseFloat(val)); +}, 8000); +this.set('debounceId', debounce); + }, + + valueDidChange: function() { +var val = this.get('value'); +this.cancelDebounceCallback(); +if (/^\d+(\.(\d{1,2})?)?$/.test(val)) { + if (/^\d+\.[0]$/.test(val) || /^\d+\.$/.test(val)) { +this.initDebounceCallback(val); + } else { +this.set('value', parseFloat(val)); + } +} +else + this.set('value', (!Em.isBlank(this.get('value')) && !isNaN(parseFloat(this.get('value' ? parseFloat(val) : null); + }.observes('value').on('change') +}); + App.CapacityInputComponent = App.IntInputComponent.extend({ totalCapacity:null, http://git-wip-us.apache.org/repos/asf/ambari/blob/df4c44a0/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs -- diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs index 69f5b3b..dcfb84f 100644 --- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs +++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/queue.hbs @@ -265,7 +265,7 @@ }} {{#if isOperator}} - {{int-input value=content.user_limit_factor maxlength=10 class="input-sm input-int" defaultVal=1 placeholder=1}} + {{decimal-input value=content.user_limit_factor maxlength=10 class="input-sm input-int" defaultVal=1 placeholder=1}} {{#if queueDirtyFilelds.user_limit_factor}}