Repository: ambari Updated Branches: refs/heads/branch-2.5 8a9c66d8b -> f2518aeed
AMBARI-19882. Search in recent projects should also search in path and search should be case insensitive (Venkata Sairam via pallavkul) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f2518aee Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f2518aee Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f2518aee Branch: refs/heads/branch-2.5 Commit: f2518aeed0d0bcf01bd1c471d746f2764f628ee9 Parents: 8a9c66d Author: pallavkul <[email protected]> Authored: Tue Feb 7 17:45:42 2017 +0530 Committer: pallavkul <[email protected]> Committed: Tue Feb 7 17:47:07 2017 +0530 ---------------------------------------------------------------------- .../resources/ui/app/components/drafts-wf.js | 53 +++++++------------- .../ui/app/templates/components/drafts-wf.hbs | 19 +++---- 2 files changed, 23 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f2518aee/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 33533db..86c8dc9 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 @@ -25,42 +25,23 @@ export default Ember.Component.extend({ "isWorkflow": true, "sortProp": ['updatedAt:desc'], "filteredModels": Ember.computed("model", "search", "isBundle", "isCoordinator", "isWorkflow", function(){ - Ember.run.later(()=>{ - this.$('.actions').hide(); - }, 10); - var condition = "", condition1 = "", condition2 = "", searchTxt = this.get("search"); - if(searchTxt && searchTxt.length){ - condition1 = "(role.get('name') && role.get('name').indexOf(searchTxt)>-1)"; - } - if(this.get("isWorkflow")){ - if(condition2.length){ - condition2 = condition2 + " role.get('type') == 'WORKFLOW'"; - } else { - condition2 = condition2 + " role.get('type') == 'WORKFLOW'"; - } - } - if(this.get("isCoordinator")){ - if(condition2.length){ - condition2 = condition2 + " || role.get('type') == 'COORDINATOR'"; - } else { - condition2 = condition2 + "role.get('type') == 'COORDINATOR'"; - } - } - if(this.get("isBundle")){ - if(condition2.length) { - condition2 = condition2 + " || role.get('type') == 'BUNDLE'"; - } else { - condition2 = condition2 + " role.get('type') == 'BUNDLE'"; - } - } - if(condition1.length && condition2.length) { - condition = condition1 + "&&(" + condition2+ ")"; - } else if(condition2.length) { - condition = condition2; - } - return this.get("model").filter( (role) => { - return eval(condition); - }); + 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("model").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; + }); }), modelSorted : Ember.computed.sort("filteredModels", "sortProp"), "isDeleteDraftConformation": false, http://git-wip-us.apache.org/repos/asf/ambari/blob/f2518aee/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 802a8bc..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 @@ -19,10 +19,10 @@ {{spin-spinner lines=13 length=20 width=10}} </div> <div class="searchWorkflows"> - {{input type="checkbox" name="isWorkflow" checked=isWorkflow}}Workflow - {{input type="checkbox" name="isCoordinator" checked=isCoordinator}}Coordinator - {{input type="checkbox" name="isBundle" checked=isBundle}}Bundle - {{input type="text" class="l-input" value=search placeholder="Workflow Name"}} + {{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"> @@ -35,7 +35,6 @@ <th>Name</th> <th>Path</th> <th>Updated at</th> - <th>Action</th> </tr> </thead> <tbody> @@ -53,8 +52,8 @@ <i class="fa fa-cubes marginright5"></i> {{/if}} </td> - <td title={{job.name}}> - <div class="width100"> + <td title={{job.name}} class="pointer action-link"> + <div class="width100" {{action "importActionToEditor" job.workflowDefinitionPath job.type}}> {{job.name}} </div> </td> @@ -68,12 +67,6 @@ {{format-unicode-date job.updatedAt}} </div> </td> - <td class=" no-sort fixed-col"> - <button {{action "importActionToEditor" job.workflowDefinitionPath job.type}} type="button" - class="btn btn-default"> - Open - </button> - </td> </tr> {{/if}} {{/each}}
