Repository: ambari Updated Branches: refs/heads/trunk 378a49e33 -> f3877c132
AMBARI-20167. importing from workflow from the coordinator setup hangs. (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/f3877c13 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f3877c13 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f3877c13 Branch: refs/heads/trunk Commit: f3877c13200e9f8000fe70d0b799112e205715bc Parents: 378a49e Author: Gaurav Nagar <[email protected]> Authored: Fri Feb 24 22:44:09 2017 +0530 Committer: Gaurav Nagar <[email protected]> Committed: Fri Feb 24 22:45:30 2017 +0530 ---------------------------------------------------------------------- .../resources/ui/app/components/coord-config.js | 26 +++++++++++++++++--- .../app/templates/components/coord-config.hbs | 2 +- 2 files changed, 24 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f3877c13/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js index 4a57e37..61d9f35 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js @@ -593,7 +593,16 @@ export default Ember.Component.extend(Validations, Ember.Evented, { }); }, openTab(type, path){ - this.sendAction('openTab', type, path); + this.set('errorMsg', ''); + var path = this.appendFileName(path, type); + var deferred = this.readFromHdfs(path); + deferred.promise.then(function(data){ + this.sendAction('openTab', type, path); + }.bind(this)).catch(function(data){ + console.log(data); + this.set('errorMsg', 'There is some problem while importing.'); + this.set('data', data); + }.bind(this)); }, showParameterSettings(value){ if(this.get('coordinator.parameters') !== null){ @@ -636,15 +645,26 @@ export default Ember.Component.extend(Validations, Ember.Evented, { }, showWorkflowName(){ this.set('workflowName', null); + this.set('errorMsg', ""); var path = this.appendFileName(this.get('coordinator.workflow.appPath'), 'wf'); + if (this.get('propertyExtractor').containsParameters(path)) { + this.set('containsParameteriedPaths', true); + this.set('parameterizedPathWarning', 'Workflow path contains variables'); + return; + } else { + this.set('containsParameteriedPaths', false); + this.set('parameterizedPathWarning', ''); + } var deferred = this.readFromHdfs(path); deferred.promise.then(function(data){ var x2js = new X2JS(); var workflowJson = x2js.xml_str2json(data); this.set('workflowName', workflowJson["workflow-app"]._name); - }.bind(this)).catch(function(e){ + }.bind(this)).catch(function(data){ + console.log(data); this.set('workflowName', null); - throw new Error(e); + this.set('errorMsg', "There is some problem while fetching workflow name."); + this.set("data", data); }.bind(this)); }, showVersionSettings(value){ http://git-wip-us.apache.org/repos/asf/ambari/blob/f3877c13/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs index 7db5ce2..0e35d0e 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs @@ -106,7 +106,7 @@ {{input type="text" class="form-control" name="appPath" focus-out="showWorkflowName" value=coordinator.workflow.appPath placeholder="Path of the workflow file"}} <span class="input-group-btn"> <button class="btn btn-secondary" type="button" {{action "openFileBrowser" "coordinator.workflow.appPath"}}>Browse</button> - <button class="btn btn-default" type="button" {{action "openTab" 'wf' coordinator.workflow.appPath}} name="button"><i class="fa fa-external-link"></i></button> + <button class="btn btn-default" type="button" disabled={{containsParameteriedPaths}} title={{parameterizedPathWarning}} {{action "openTab" 'wf' coordinator.workflow.appPath}} name="button"><i class="fa fa-external-link"></i></button> </span> </div> {{#if workflowName}}
