Repository: ambari Updated Branches: refs/heads/trunk 38b6f22eb -> f5c573a36
AMBARI-19439. Warning message when user tries to close a designer tab. (Padma Priya via pallavkul) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f5c573a3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f5c573a3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f5c573a3 Branch: refs/heads/trunk Commit: f5c573a367e280cb761cbc9003283c751aac5823 Parents: 38b6f22 Author: pallavkul <[email protected]> Authored: Tue Jan 10 20:48:09 2017 +0530 Committer: pallavkul <[email protected]> Committed: Tue Jan 10 20:48:09 2017 +0530 ---------------------------------------------------------------------- .../ui/app/components/designer-workspace.js | 16 ++++++++++++++-- .../src/main/resources/ui/app/routes/design.js | 7 ++++++- .../app/templates/components/designer-workspace.hbs | 7 ++++++- 3 files changed, 26 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f5c573a3/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js index f70658e..a04c66d 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js @@ -179,7 +179,20 @@ export default Ember.Component.extend({ showProjectManager(){ this.createOrShowProjManager(); }, - closeTab(index){ + showWarning(index){ + var tab = this.get('tabs').objectAt(index); + this.set('indexToClose', index); + if(tab && tab.type ==='dashboard'){ + this.send('closeTab'); + return; + } + this.set('showingWarning', true); + Ember.run.later(()=>{ + this.$('#ConfirmDialog').modal('show'); + }); + }, + closeTab(){ + var index = this.get('indexToClose'); if(index < this.get('tabs').length - 1){ var previousTab = this.get('tabs').objectAt(index + 1); this.$('.nav-tabs a[href="#'+ previousTab.id + '"]').tab('show'); @@ -188,7 +201,6 @@ export default Ember.Component.extend({ this.get('tabs').removeAt(index); Ember.run.later(()=>{ var type = this.$('.nav-tabs').find('.active').attr('data-type'); - console.error(type); if(type === 'dashboard'){ this.createOrshowDashboard(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/f5c573a3/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js index 3affe7c..b6beef8 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js @@ -50,7 +50,12 @@ export default Ember.Route.extend(Ember.Evented, { request.setRequestHeader("X-Requested-By", "workflow-designer"); }, success : function(response){ - resolve(JSON.parse(response)); + try { + resolve(JSON.parse(response)); + } catch (e) { + console.error(e); + reject(response); + } }, error : function(response){ reject(response); http://git-wip-us.apache.org/repos/asf/ambari/blob/f5c573a3/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs index 9bc46c2..7a6005a 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs @@ -95,7 +95,7 @@ <i class="fa fa-th marginright5"></i> {{/if}} {{tab.name}} - <span class="closeTab" {{action "closeTab" index bubbles=false }}>x</span> + <span class="closeTab" {{action "showWarning" index bubbles=false }}>x</span> </a> </li> {{/each}} @@ -128,6 +128,11 @@ {{#if showingAssetManager}} {{#asset-manager showAssetManager="showAssetManager" deleteAsset="deleteAsset" assetList=assetList}}{{/asset-manager}} {{/if}} + {{#if showingWarning}} + {{#confirmation-dialog title="Confirm workflow reset" + confirmationMessage="Any unsaved changes may be lost. Do you want to close this tab ?" + okBtnText="Continue" cancelBtnText="Cancel" onOk="closeTab"}}{{/confirmation-dialog}} + {{/if}} <!-- {{#if (eq type 'wf')}} {{flow-designer xmlAppPath=appPath isNew=isNew}}
