Skip to content

Commit

Permalink
Fixed DFL-3648, Show match of the URL instead of the short_distinguis…
Browse files Browse the repository at this point in the history
…her when using the token filter in the resource tree
  • Loading branch information
p01 committed Oct 4, 2012
1 parent 1062413 commit 7a04571
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/resource-manager/resource_templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ templates.resource_tree =
ui_strings.S_HTTP_LABEL_FILTER_OTHER
],

URL_MATCH_CONTEXT_SIZE: 10,
DEPTH_IDENTATION: 18,

_expander_extras:function(context, pivotID, depth)
Expand Down Expand Up @@ -218,18 +219,28 @@ templates.resource_tree =

resource:function(context, depth, r)
{
var search = context.searchTerm;
var partial_URL_match = '';
if (search != '')
{
var pos_first = r.url.indexOf(search)-this.URL_MATCH_CONTEXT_SIZE;
var pos_last = r.url.lastIndexOf(search)+this.URL_MATCH_CONTEXT_SIZE+search.length;

partial_URL_match = (pos_first>0?'…':'')+r.url.substring( pos_first, pos_last)+(pos_last<r.url.length?'…':'');
}
var tpl =
['li',
['h2',
['span',
(r.filename || r.short_distinguisher || r.url || 'NO URL'),
partial_URL_match||(r.filename || r.short_distinguisher || r.url || ''),
'class','resource-tree-resource-label',
'style', 'margin-left:'+ (1+depth)*this.DEPTH_IDENTATION +'px;',
'data-tooltip','js-script-select',
'data-tooltip-text',r.url
],
' ',
r.sameOrigin?[]:['span',r.host,'class','resource-domain'],

'handler','resource-detail',
'data-resource-uid',String(r.uid),
'class','resource-tree-resource'
Expand Down

0 comments on commit 7a04571

Please sign in to comment.