Repository: ambari Updated Branches: refs/heads/trunk a3f593d8f -> 0ff34acb3
Revert "AMBARI-20371. WFM: Delete option in Manage recent list. (pallavkul)" This reverts commit a3f593d8f83560b3496c87a08c9908fa6b0348d6. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0ff34acb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0ff34acb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0ff34acb Branch: refs/heads/trunk Commit: 0ff34acb3cd9f71a82e8175a4d0086d16ddf01d0 Parents: a3f593d Author: pallavkul <pallav....@gmail.com> Authored: Thu Mar 9 19:28:19 2017 +0530 Committer: pallavkul <pallav....@gmail.com> Committed: Thu Mar 9 19:28:19 2017 +0530 ---------------------------------------------------------------------- .../ui/app/components/designer-workspace.js | 1 - .../resources/ui/app/components/drafts-wf.js | 84 ++------- .../ui/app/components/recent-projects.js | 32 +++- .../src/main/resources/ui/app/styles/app.less | 14 +- .../templates/components/designer-workspace.hbs | 2 +- .../ui/app/templates/components/drafts-wf.hbs | 175 +++++++------------ .../templates/components/recent-projects.hbs | 17 +- 7 files changed, 130 insertions(+), 195 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0ff34acb/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 980904f..0e49d70 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 @@ -213,7 +213,6 @@ export default Ember.Component.extend({ }, editWorkflow(path, type){ this.sendAction('editWorkflow', path, type); - this.send('hideProjectManagerList'); }, showProjectManagerList(){ var deferred = Ember.RSVP.defer(); http://git-wip-us.apache.org/repos/asf/ambari/blob/0ff34acb/contrib/views/wfmanager/src/main/resources/ui/app/components/drafts-wf.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/drafts-wf.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/drafts-wf.js index ed448d9..1d01e9b 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/drafts-wf.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/drafts-wf.js @@ -24,10 +24,9 @@ export default Ember.Component.extend({ "isCoordinator": true, "isWorkflow": true, "sortProp": ['updatedAt:desc'], - "filteredModels": Ember.computed("recentFiles", "search", "isBundle", "isCoordinator", "isWorkflow", { - get(key) { + "filteredModels": Ember.computed("model", "search", "isBundle", "isCoordinator", "isWorkflow", function(){ var score = 0, condition = true, searchTxt = this.get("search").toLowerCase(), isWorkflow = this.get("isWorkflow"), isCoordinator = this.get("isCoordinator"), isBundle = this.get("isBundle"); - return this.get("recentFiles").filter( (role) => { + return this.get("model").filter( (role) => { score = 0 if(searchTxt && searchTxt.length) { condition = role.get('name') && role.get('name').toLowerCase().indexOf(searchTxt)>-1; @@ -43,42 +42,22 @@ export default Ember.Component.extend({ } return condition && score > 0; }); - }, - set(key, value) { - this.set('recentFiles', value); - - var score = 0, condition = true, searchTxt = this.get("search").toLowerCase(), isWorkflow = this.get("isWorkflow"), isCoordinator = this.get("isCoordinator"), isBundle = this.get("isBundle"); - return this.get("recentFiles").filter( (role) => { - score = 0 - if(searchTxt && searchTxt.length) { - condition = role.get('name') && role.get('name').toLowerCase().indexOf(searchTxt)>-1; - } - if(isWorkflow && role.get('type') === 'WORKFLOW') { - score++; - } - if(isCoordinator && role.get('type') === 'COORDINATOR') { - score++; - } - if(isBundle && role.get('type') === 'BUNDLE') { - score++; - } - return condition && score > 0; - }); - //return value; - } }), - resetDetails() { - this.set("deleteMsg", null); - this.set("deleteInProgress", false); - }, modelSorted : Ember.computed.sort("filteredModels", "sortProp"), "isDeleteDraftConformation": false, "currentDraft": undefined, "deleteInProgress": false, "deleteMsg": undefined, "currentJobService" : Ember.inject.service('current-job'), + elementsInserted: function () { + this.$('.actions').hide(); + }.on("didInsertElement"), rendered : function(){ var self = this; + this.$("#projectsList").on("hidden.bs.modal", function () { + this.sendAction("close"); + history.back(); + }.bind(this)); this.$("#projectDeleteModal").on('hidden.bs.modal', function () { self.set("isDeleteDraftConformation", true); self.set("deleteMsg", null); @@ -94,11 +73,15 @@ export default Ember.Component.extend({ this.sendAction('editWorkflow', path, type); }, confirmDelete (job ){ - this.send("showDeleteConfirmation", job); + this.set("showingConfirmation", true); + this.set("currentDraft", job); }, - close () { - this.$("#projectsList").modal("hide"); - this.sendAction('close'); + deleteDraft () { + this.sendAction("deleteWorkflow", this.get('currentDraft')); + }, + closeProjects () { + //this.$('.modal-backdrop').remove(); + this.$("#projectsList").modal("hide"); }, showActions (job) { this.$('.'+job.get("updatedAt")+'Actions').show(); @@ -107,39 +90,6 @@ export default Ember.Component.extend({ hideActions (job) { this.$('.'+job.get("updatedAt")+'Actions').hide(); this.$('.Actions'+job.get("updatedAt")).show(); - }, - showDeleteConfirmation(job) { - this.resetDetails(); - this.set('currentDraft', job); - this.set('showingDeleteConfirmation', true); - Ember.run.later(()=>{ - this.$("#projectsDeleteConfirmation").modal("show"); - }, 100); - }, - deleteWorkflow () { - let job = this.get("currentDraft"); - this.set("deleteInProgress", true); - var self= this; - var rec = this.get("store").peekRecord('wfproject', job.id); - if(rec){ - rec.destroyRecord().then(function () { - self.get('recentFiles', self.get('store').peekAll("wfproject")); - self.set("deleteInProgress", false); - self.set("deleteMsg", "Workflow successfully deleted."); - self.get('store').unloadRecord(rec); - self.set('filteredModels', self.get('store').peekAll("wfproject")); - Ember.run.later(()=>{ - self.set('showingDeleteConfirmation', false); - self.$("#projectsDeleteConfirmation").modal("hide"); - }, 1000); - }).catch(function (response) { - self.get('store').unloadRecord(rec); - self.get('filteredModels', self.get('store').peekAll("wfproject")); - self.sendAction("showProjectManagerList"); - self.set("deleteInProgress", false); - self.set("deleteMsg", "There is some problem while deletion.Please try again."); - }); - } } } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/0ff34acb/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js index bbc51cc..18a57f6 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js @@ -18,12 +18,40 @@ import Ember from 'ember'; export default Ember.Component.extend({ + store: Ember.inject.service(), + rendered : function(){ + var self = this; + this.$("#projectDeleteModal").on('hidden.bs.modal', function () { + self.set("isDeleteDraftConformation", true); + self.set("deleteMsg", null); + self.set("deleteInProgress", false); + }.bind(this)); + this.$("#projectsList").on("hidden.bs.modal", function () { + this.sendAction("close"); + }.bind(this)); + this.$("#projectsList").modal("show"); + }.on('didInsertElement'), actions: { close(){ - this.sendAction('close'); + this.sendAction("close"); }, + deleteWorkflow (job) { + this.set("deleteInProgress", true); + var self= this; + var rec = this.get("store").peekRecord('wfproject', job.id); + if(rec){ + rec.destroyRecord().then(function () { + self.set("deleteInProgress", false); + self.set("deleteMsg", "Workflow successfully deleted."); + }).catch(function (response) { + self.set("deleteInProgress", false); + self.set("deleteMsg", "There is some problem while deletion.Please try again."); + }); + } + }, editWorkflow ( path, type ) { this.sendAction('editWorkflow', path, type); - } + this.$("#projectsList").modal("hide"); + }, } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/0ff34acb/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less index 5577239..a30833c 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less +++ b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less @@ -1597,7 +1597,7 @@ input:invalid { .inlineBlock{ display:inline-block; } -.asset-list .fa-trash-o, #projectsList .fa-trash-o{ +.asset-list .fa-trash-o { color: @defaultRed; cursor: pointer; } @@ -1713,6 +1713,9 @@ input:invalid { .displayBlock { display : block; } +.tab-pane #draftsTable, #projectsList #dashboard, .tab-pane .searchWorkflows { + display : none; + } .projects-list { white-space: nowrap; width: 100%; @@ -1757,12 +1760,3 @@ input:invalid { .processing-message { padding-left: 48%; } -#projectsList .modal-body { - max-height: 70vh; - overflow-y: scroll; - overflow-x: auto; - } -#projectsDeleteConfirmation .modal-body { - max-height: 70vh; - overflow: auto; -} http://git-wip-us.apache.org/repos/asf/ambari/blob/0ff34acb/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 c190511..c8d8dc3 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 @@ -160,7 +160,7 @@ {{#asset-manager showAssetManager="showAssetManager"}}{{/asset-manager}} {{/if}} {{#if isProjManagerVisible}} - {{recent-projects recentFiles=recentFiles routeToDesigner="routeToDesigner" editWorkflow="editWorkflow" deleteWorkflow="deleteWorkflow" close="hideProjectManagerList" deleteWorkflowJob="deleteWorkflowJob" currentDraft=currentDraft showProjectManagerList="showProjectManagerList"}} + {{recent-projects recentFiles=recentFiles routeToDesigner="routeToDesigner" editWorkflow="editWorkflow" deleteWorkflow="deleteWorkflow" close="hideProjectManagerList" deleteWorkflowJob="deleteWorkflowJob" currentDraft=currentDraft}} {{/if}} {{#if showingWarning}} {{#confirmation-dialog title="Confirm workflow reset" http://git-wip-us.apache.org/repos/asf/ambari/blob/0ff34acb/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/drafts-wf.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/drafts-wf.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/drafts-wf.hbs index ac28de3..632d6bd 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/drafts-wf.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/drafts-wf.hbs @@ -15,119 +15,68 @@ * See the License for the specific language governing permissions and * limitations under the License. }} - - -<div class="modal" id="projectsList" role="dialog"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" {{action "close"}}>×</button> - <h4 class="modal-title">My Workflows</h4> - </div> - <div class="modal-body"> - - - - <div class="searchWorkflows"> - {{input type="checkbox" class="marginright5" name="isWorkflow" checked=isWorkflow}}Workflow - {{input type="checkbox" class="marginright5" name="isCoordinator" checked=isCoordinator}}Coordinator - {{input type="checkbox" class="marginright5" name="isBundle" checked=isBundle}}Bundle - {{input type="text" class="l-input" value=search placeholder="Type Workflow name or path"}} - </div> - {{#if modelSorted}} - <div id="draftsTable"> - <table id="search-table" class="table search-table listing table-striped table-hover table-bordered" - cellspacing="0" width="100%"> - <thead> - <tr> - <!--th>Draft Name</th--> - <th></th> - <th>Name</th> - <th>Path</th> - <th>Updated at</th> - </tr> - </thead> - <tbody> - {{#if modelSorted}} - {{#each modelSorted as |job idx|}} - <tr id={{job.id}}> - <!--td title={{job.workflowDefinitionPath}}> <div class="width300">{{job.workflowDefinitionPath}}</div></td--> - <td class="{{job.type}} cyScrollMsg"> - {{#if (eq job.type "WORKFLOW")}} - <i class="fa fa-sitemap marginright5"></i> - {{else if (eq job.type "COORDINATOR")}} - <i class="fa fa-history marginright5"></i> - {{else}} - <i class="fa fa-cubes marginright5"></i> - {{/if}} - </td> - <td title={{job.name}} class="pointer action-link"> - <div class="width100" {{action "importActionToEditor" job.workflowDefinitionPath job.type}}> - {{job.name}} - </div> - </td> - <td title={{job.workflowDefinitionPath}}> - <div class="width300"> - {{job.workflowDefinitionPath}} - </div> - </td> - <td> - <div class="width50"> - {{format-unicode-date job.updatedAt}} - </div> - </td> - <td> - <div class="width50"> - <span title="Delete Workflow" {{action "confirmDelete" job}}><i class="fa fa-trash-o"></i></span> - </div> - </td> - </tr> - {{/each}} +<div id="loading" class="displayBlock"> + {{spin-spinner lines=13 length=20 width=10}} +</div> +<div class="searchWorkflows"> + {{input type="checkbox" class="marginright5" name="isWorkflow" checked=isWorkflow}}Workflow + {{input type="checkbox" class="marginright5" name="isCoordinator" checked=isCoordinator}}Coordinator + {{input type="checkbox" class="marginright5" name="isBundle" checked=isBundle}}Bundle + {{input type="text" class="l-input" value=search placeholder="Type Workflow name or path"}} +</div> +{{#if modelSorted}} + <div id="draftsTable"> + <table id="search-table" class="table search-table listing table-striped table-hover table-bordered" + cellspacing="0" width="100%"> + <thead> + <tr> + <!--th>Draft Name</th--> + <th></th> + <th>Name</th> + <th>Path</th> + <th>Updated at</th> + </tr> + </thead> + <tbody> + {{#if modelSorted}} + {{#each modelSorted as |job idx|}} + {{#if true}} + <tr> + <!--td title={{job.workflowDefinitionPath}}> <div class="width300">{{job.workflowDefinitionPath}}</div></td--> + <td class="{{job.type}} cyScrollMsg"> + {{#if (eq job.type "WORKFLOW")}} + <i class="fa fa-sitemap marginright5"></i> + {{else if (eq job.type "COORDINATOR")}} + <i class="fa fa-history marginright5"></i> + {{else}} + <i class="fa fa-cubes marginright5"></i> + {{/if}} + </td> + <td title={{job.name}} class="pointer action-link"> + <div class="width100" {{action "importActionToEditor" job.workflowDefinitionPath job.type}}> + {{job.name}} + </div> + </td> + <td title={{job.workflowDefinitionPath}}> + <div class="width300"> + {{job.workflowDefinitionPath}} + </div> + </td> + <td> + <div class="width50"> + {{format-unicode-date job.updatedAt}} + </div> + </td> + </tr> {{/if}} - </tbody> - </table> - </div> - <div id="draftsNum">Displaying {{modelSorted.length}} workflows</div> - {{else}} - <div id="emptyDrafts"> - <label class="control-label" for="{{type}}-path">There are no workflows currently</label> - </div> - {{/if}} - - - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" {{action "close"}}>Close</button> - </div> + {{/each}} + {{/if}} + </tbody> + </table> </div> - </div> -</div> - - -{{#if showingDeleteConfirmation}} -<div class="modal" id="projectsDeleteConfirmation" role="dialog"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal">×</button> - <h4 class="modal-title">Delete confirmation</h4> - </div> - <div class="modal-body"> - {{#unless deleteMsg}} - <label>Do you want to delete the draft?</label> - {{/unless}} - {{#if true}} - {{spin-spinner lines=7 length=3 width=3 radius=3 top=-10 left=150}} - {{/if}} - <div><label>{{deleteMsg}}</label></div> - </div> - <div class="modal-footer"> - {{#unless deleteMsg}} - <button type="button" class="btn btn-primary" {{action "deleteWorkflow"}}>Delete</button> - {{/unless}} - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> - </div> + <div id="draftsNum">Displaying {{modelSorted.length}} workflows</div> +{{else}} + <div id="emptyDrafts"> + <label class="control-label" for="{{type}}-path">There are no workflows currently</label> </div> - </div> -</div> -{{/if}} +{{/if}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/0ff34acb/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs index c616586..cd8f6af 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs @@ -15,4 +15,19 @@ * See the License for the specific language governing permissions and * limitations under the License. }} -{{drafts-wf recentFiles=recentFiles routeToDesigner="routeToDesigner" editWorkflow="editWorkflow" deleteWorkflow="deleteWorkflow" showDeleteConfirmation="showDeleteConfirmation" showProjectManagerList="showProjectManagerList" close="close"}} +<div class="modal" id="projectsList" role="dialog"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title">My Workflows</h4> + </div> + <div class="modal-body"> + {{drafts-wf model=recentFiles routeToDesigner="routeToDesigner" editWorkflow="editWorkflow" deleteWorkflow="deleteWorkflow"}} + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + </div> + </div> + </div> +</div>