You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2018/09/12 12:27:59 UTC
[kibble] 01/06: add a path filter to repo explorer
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git
commit 51e3b8aee49bbe46b497073eff0d032c4124c456
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Sep 12 14:26:04 2018 +0200
add a path filter to repo explorer
---
ui/js/coffee/explorer.coffee | 49 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/ui/js/coffee/explorer.coffee b/ui/js/coffee/explorer.coffee
index e96ec2c..be9a7f9 100644
--- a/ui/js/coffee/explorer.coffee
+++ b/ui/js/coffee/explorer.coffee
@@ -103,6 +103,16 @@ explorer = (json, state) ->
label.style.paddingLeft = '5px'
label.appendChild(document.createTextNode('Show authors'))
state.widget.inject(label)
+ br = new HTML('br')
+ p = new HTML('input', {id:'pathfilter', size: 32, type: 'text', value: globArgs.pathfilter, onChange: 'pathFilterGlob = this.value;',placeholder: 'optional path-filter'})
+
+ state.widget.inject(br)
+ state.widget.inject(p)
+
+ b = new HTML('input', {style: { marginLeft: '10px'}, class: 'btn btn-small btn-success', type: 'button', onClick: 'pathFilter();', value: "filter paths"})
+ rb = new HTML('input', {style: { marginLeft: '10px'}, class: 'btn btn-small btn-danger', type: 'button', onClick: 'get("pathfilter").value = ""; pathFilter();', value: "reset"})
+ state.widget.inject(b)
+ state.widget.inject(rb)
sourceexplorer = (json, state) ->
@@ -591,6 +601,44 @@ subFilter = () ->
else
$(this).attr('href', "#{m[1]}#{m[2]}")
)
+
+pathFilterGlob = null
+
+pathFilter = () ->
+ source = pathFilterGlob
+ if source == ""
+ source = null
+ tName = 'pathfilter'
+ globArgs[tName] = source
+ x = {}
+ x[tName] = source
+ updateWidgets('donut', null, x)
+ updateWidgets('gauge', null, x)
+ updateWidgets('line', null, x)
+ updateWidgets('contacts', null, x)
+ updateWidgets('top5', null, x)
+ updateWidgets('factors', null, x)
+ updateWidgets('trends', null, x)
+ updateWidgets('radar', null, x)
+ updateWidgets('widget', null, x)
+ updateWidgets('relationship', null, x)
+ updateWidgets('treemap', null, x)
+ updateWidgets('report', null, x)
+ updateWidgets('mvp', null, x)
+ updateWidgets('comstat', null, x)
+ updateWidgets('worldmap', null, x)
+ updateWidgets('jsondump', null, x)
+
+ $( "a" ).each( () ->
+ url = $(this).attr('href')
+ if url
+ m = url.match(/^(.+\?page=[-a-z]+.*?)(?:&pathfilter=[^&]+)?(.*)$/)
+ if m
+ if source
+ $(this).attr('href', "#{m[1]}&pathfilter=#{source}#{m[2]}")
+ else
+ $(this).attr('href', "#{m[1]}#{m[2]}")
+ )
viewexplorer = (json, state) ->
@@ -678,6 +726,7 @@ viewexplorer = (json, state) ->
state.widget.inject(b)
state.widget.inject(rb)
+
if globArgs.subfilter and globArgs.subfilter.length > 0
source = globArgs.subfilter
$( "a" ).each( () ->