AMBARI-20337.Need to show timer while loading coordinator name while bundle creation.(Madhan Mohan Reddy via gauravn7)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/934f3f18 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/934f3f18 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/934f3f18 Branch: refs/heads/branch-dev-logsearch Commit: 934f3f18277b3cb48e1e8c9a16836aebdec1d1b0 Parents: ba04d22 Author: Gaurav Nagar <grv...@gmail.com> Authored: Wed Mar 8 17:24:45 2017 +0530 Committer: Gaurav Nagar <grv...@gmail.com> Committed: Wed Mar 8 17:24:45 2017 +0530 ---------------------------------------------------------------------- .../ui/app/components/bundle-coord-config.js | 28 +++++++++++++++++--- .../app/templates/components/bundle-config.hbs | 4 +-- .../components/bundle-coord-config.hbs | 5 +++- 3 files changed, 30 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/934f3f18/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-coord-config.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-coord-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-coord-config.js index 2280f82..c2ac96b 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-coord-config.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-coord-config.js @@ -26,6 +26,7 @@ const Validations = buildValidations({ }) }); export default Ember.Component.extend(Validations, { + propertyExtractor : Ember.inject.service('property-extractor'), initialize : function(){ this.on('fileSelected',function(fileName){ this.set(this.get('filePathModel'), fileName); @@ -52,8 +53,8 @@ export default Ember.Component.extend(Validations, { } }).done(function(data){ deferred.resolve(data); - }).fail(function(){ - deferred.reject(); + }).fail(function(data){ + deferred.reject(data); }); return deferred; }, @@ -95,13 +96,32 @@ export default Ember.Component.extend(Validations, { }, showCoordinatorName(){ this.set('coordinatorName', null); - var deferred = this.readFromHdfs(this.get('coordinator.appPath')); + this.set('errorMsg', ''); + if (this.get('coordinator.appPath') === '') { + return; + } + var path = this.get('appendFileName')(this.get('coordinator.appPath'), 'coord'); + if (this.get('propertyExtractor').containsParameters(path)) { + this.set('containsParameteriedPaths', true); + this.set('parameterizedPathWarning', 'Coordinator path contains variables'); + return; + } else { + this.set('containsParameteriedPaths', false); + this.set('parameterizedPathWarning', ''); + } + this.set('coordNameFetchingInProgress', true); + var deferred = this.readFromHdfs(path); deferred.promise.then(function(data){ var x2js = new X2JS(); var coordJson = x2js.xml_str2json(data); this.set('coordinator.name', coordJson["coordinator-app"]._name); - }.bind(this)).catch(function(){ + this.set('coordNameFetchingInProgress', false); + }.bind(this)).catch(function(data){ + console.error(data); this.set('coordinatorName', null); + this.set('errorMsg', 'There is some problem while fetching coordinator name.'); + this.set('data', data); + this.set('coordNameFetchingInProgress', false); }.bind(this)); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/934f3f18/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs index 2d374a5..39ab06d 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs @@ -103,10 +103,10 @@ {{#field-error model=this field='bundle.coordinators' showErrorMessage=showErrorMessage}}{{/field-error}} {{#if coordinatorCreateMode}} - {{#bundle-coord-config coordinator=currentCoordinator openTab="openTab" openFileBrowser="openFileBrowser" add="addCoordinator" cancel="cancelCoordinatorOperation" createMode=coordinatorCreateMode}}{{/bundle-coord-config}} + {{#bundle-coord-config coordinator=currentCoordinator openTab="openTab" openFileBrowser="openFileBrowser" add="addCoordinator" cancel="cancelCoordinatorOperation" createMode=coordinatorCreateMode errorMsg=errorMsg data=data appendFileName=appendFileName}}{{/bundle-coord-config}} {{/if}} {{#if coordinatorEditMode}} - {{#bundle-coord-config coordinator=currentCoordinator openTab="openTab" openFileBrowser="openFileBrowser" update="updateCoordinator" cancel="cancelCoordinatorOperation" editMode=coordinatorEditMode}}{{/bundle-coord-config}} + {{#bundle-coord-config coordinator=currentCoordinator openTab="openTab" openFileBrowser="openFileBrowser" update="updateCoordinator" cancel="cancelCoordinatorOperation" editMode=coordinatorEditMode errorMsg=errorMsg data=data appendFileName=appendFileName}}{{/bundle-coord-config}} {{/if}} </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/934f3f18/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-coord-config.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-coord-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-coord-config.hbs index 56cacd6..1ac1414 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-coord-config.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-coord-config.hbs @@ -23,9 +23,12 @@ {{input type="text" class="form-control" name="appPath" focus-out="showCoordinatorName" value=coordinator.appPath placeholder="Path of the coordinator file"}} <span class="input-group-btn"> <button class="btn btn-secondary" type="button" {{action "openFileBrowser" "coordinator.appPath"}}>Browse</button> - <button class="btn btn-default" type="button" {{action "openTab" 'coord' coordinator.appPath}} name="button"><i class="fa fa-external-link"></i></button> + <button class="btn btn-default" type="button" disabled={{containsParameteriedPaths}} title={{parameterizedPathWarning}} {{action "openTab" 'coord' coordinator.appPath}} name="button"><i class="fa fa-external-link"></i></button> </span> </div> + {{#if coordNameFetchingInProgress}} + {{spin-spinner lines=8 length=5 width=3 radius=5 top=16 left=440}} + {{/if}} {{#field-error model=this field='coordinator.appPath' showErrorMessage=showErrorMessage}}{{/field-error}} </div> </div>