audit-logs: improve help text, and expose all audit commands for easier filtering +ui fixes
marcink -
r2807:f77aceaf default
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -29,6 +29,7
29 import random
29 import random
30 import hashlib
30 import hashlib
31 import StringIO
31 import StringIO
32 import textwrap
32 import urllib
33 import urllib
33 import math
34 import math
34 import logging
35 import logging
@@ -1864,6 +1865,8
1864
1865
1865 def journal_filter_help(request):
1866 def journal_filter_help(request):
1866 _ = request.translate
1867 _ = request.translate
1868 from rhodecode.lib.audit_logger import ACTIONS
1869 actions = '\n'.join(textwrap.wrap(', '.join(sorted(ACTIONS.keys())), 80))
1867
1870
1868 return _(
1871 return _(
1869 'Example filter terms:\n' +
1872 'Example filter terms:\n' +
@@ -1875,6 +1878,8
1875 ' date:20120101\n' +
1878 ' date:20120101\n' +
1876 ' date:[20120101100000 TO 20120102]\n' +
1879 ' date:[20120101100000 TO 20120102]\n' +
1877 '\n' +
1880 '\n' +
1881 'Actions: {actions}\n' +
1882 '\n' +
1878 'Generate wildcards using \'*\' character:\n' +
1883 'Generate wildcards using \'*\' character:\n' +
1879 ' "repository:vcs*" - search everything starting with \'vcs\'\n' +
1884 ' "repository:vcs*" - search everything starting with \'vcs\'\n' +
1880 ' "repository:*vcs*" - search for repository containing \'vcs\'\n' +
1885 ' "repository:*vcs*" - search for repository containing \'vcs\'\n' +
@@ -1882,7 +1887,7
1882 'Optional AND / OR operators in queries\n' +
1887 'Optional AND / OR operators in queries\n' +
1883 ' "repository:vcs OR repository:test"\n' +
1888 ' "repository:vcs OR repository:test"\n' +
1884 ' "username:test AND repository:test*"\n'
1889 ' "username:test AND repository:test*"\n'
1885 )
1890 ).format(actions=actions)
1886
1891
1887
1892
1888 def search_filter_help(searcher, request):
1893 def search_filter_help(searcher, request):
@@ -14,12 +14,14
14 <input type='submit' value="${_('filter')}" class="btn" />
14 <input type='submit' value="${_('filter')}" class="btn" />
15 ${_('Audit logs')} - ${_ungettext('%s entry', '%s entries', c.audit_logs.item_count) % (c.audit_logs.item_count)}
15 ${_('Audit logs')} - ${_ungettext('%s entry', '%s entries', c.audit_logs.item_count) % (c.audit_logs.item_count)}
16 ${h.end_form()}
16 ${h.end_form()}
17 <p class="tooltip filterexample" title="${h.tooltip(h.journal_filter_help(request))}">${_('Example Queries')}</p>
17 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Example Queries')}</p>
18 <pre id="search-help" style="display: none">${h.tooltip(h.journal_filter_help(request))}</pre>
18 </%def>
19 </%def>
19
20
20 <%def name="menu_bar_nav()">
21 <%def name="menu_bar_nav()">
21 ${self.menu_items(active='admin')}
22 ${self.menu_items(active='admin')}
22 </%def>
23 </%def>
24
23 <%def name="main()">
25 <%def name="main()">
24 <div class="box">
26 <div class="box">
25 <!-- box / title -->
27 <!-- box / title -->
@@ -14,7 +14,9
14 <input class="q_filter_box ${'' if c.filter_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.filter_term or ''}" placeholder="${_('audit filter...')}"/>
14 <input class="q_filter_box ${'' if c.filter_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.filter_term or ''}" placeholder="${_('audit filter...')}"/>
15 <input type='submit' value="${_('filter')}" class="btn" />
15 <input type='submit' value="${_('filter')}" class="btn" />
16 ${h.end_form()}
16 ${h.end_form()}
17 <p class="tooltip filterexample" style="position: inherit" title="${h.tooltip(h.journal_filter_help(request))}">${_('Example Queries')}</p>
17
18 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Example Queries')}</p>
19 <pre id="search-help" style="display: none">${h.tooltip(h.journal_filter_help(request))}</pre>
18
20
19 <%include file="/admin/admin_log_base.mako" />
21 <%include file="/admin/admin_log_base.mako" />
20
22
@@ -14,7 +14,9
14 <input class="q_filter_box ${'' if c.filter_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.filter_term or ''}" placeholder="${_('audit filter...')}"/>
14 <input class="q_filter_box ${'' if c.filter_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.filter_term or ''}" placeholder="${_('audit filter...')}"/>
15 <input type='submit' value="${_('filter')}" class="btn" />
15 <input type='submit' value="${_('filter')}" class="btn" />
16 ${h.end_form()}
16 ${h.end_form()}
17 <p class="tooltip filterexample" style="position: inherit" title="${h.tooltip(h.journal_filter_help(request))}">${_('Example Queries')}</p>
17
18 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Example Queries')}</p>
19 <pre id="search-help" style="display: none">${h.tooltip(h.journal_filter_help(request))}</pre>
18
20
19 <%include file="/admin/admin_log_base.mako" />
21 <%include file="/admin/admin_log_base.mako" />
20
22
@@ -7,19 +7,20
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="breadcrumbs()">
10 <%def name="breadcrumbs_links()">
11 <h1 class="block-left">
12 ${h.form(None, id_="filter_form", method="get")}
11 ${h.form(None, id_="filter_form", method="get")}
13 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term}" placeholder="${_('quick filter...')}"/>
12 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term}" placeholder="${_('quick filter...')}"/>
14 <input type='submit' value="${_('Filter')}" class="btn" />
13 <input type='submit' value="${_('filter')}" class="btn" />
15 ${_('Journal')} - ${_ungettext('%s entry', '%s entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
14 ${_('Journal')} - ${_ungettext('%s entry', '%s entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
16 ${h.end_form()}
15 ${h.end_form()}
17 </h1>
16 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Example Queries')}</p>
18 <p class="tooltip filterexample" title="${h.tooltip(h.journal_filter_help(request))}">${_('Example Queries')}</p>
17 <pre id="search-help" style="display: none">${h.tooltip(h.journal_filter_help(request))}</pre>
19 </%def>
18 </%def>
19
20 <%def name="menu_bar_nav()">
20 <%def name="menu_bar_nav()">
21 ${self.menu_items(active='journal')}
21 ${self.menu_items(active='journal')}
22 </%def>
22 </%def>
23
23 <%def name="head_extra()">
24 <%def name="head_extra()">
24 <link href="${h.route_path('journal_atom', _query=dict(auth_token=c.rhodecode_user.feed_token))}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
25 <link href="${h.route_path('journal_atom', _query=dict(auth_token=c.rhodecode_user.feed_token))}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
25 <link href="${h.route_path('journal_rss', _query=dict(auth_token=c.rhodecode_user.feed_token))}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
26 <link href="${h.route_path('journal_rss', _query=dict(auth_token=c.rhodecode_user.feed_token))}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
@@ -27,30 +28,31
27
28
28 <%def name="main()">
29 <%def name="main()">
29
30
30 <div class="box">
31 <div class="box">
31 <!-- box / title -->
32 <!-- box / title -->
32 <div class="title journal">
33 <div class="title journal">
33 ${self.breadcrumbs()}
34 ${self.breadcrumbs()}
34 <ul class="links icon-only-links block-right">
35 <ul class="links icon-only-links block-right">
35 <li>
36 <li>
36 <span><a id="refresh" href="${h.route_path('journal')}"><i class="icon-refresh"></i></a></span>
37 <span><a id="refresh" href="${h.route_path('journal')}"><i class="icon-refresh"></i></a></span>
37 </li>
38 </li>
38 <li>
39 <li>
39 <span><a href="${h.route_path('journal_atom', _query=dict(auth_token=c.rhodecode_user.feed_token))}"><i class="icon-rss-sign"></i></a></span>
40 <span><a href="${h.route_path('journal_atom', _query=dict(auth_token=c.rhodecode_user.feed_token))}"><i class="icon-rss-sign"></i></a></span>
40 </li>
41 </li>
41 </ul>
42 </ul>
42 </div>
43 <div id="journal">${c.journal_data|n}</div>
44 </div>
43 </div>
44 <div id="journal">${c.journal_data|n}</div>
45 </div>
45
46
46 <script type="text/javascript">
47 <script type="text/javascript">
47
48
48 $('#j_filter').autoGrowInput();
49 $('#j_filter').autoGrowInput();
49 $(document).on('pjax:success',function(){
50 $(document).on('pjax:success',function(){
50 show_more_event();
51 show_more_event();
51 });
52 });
52 $(document).pjax('#refresh', '#journal',
53 $(document).pjax(
53 {url: "${request.current_route_path(_query=dict(filter=c.search_term))}", push: false});
54 '#refresh', '#journal',
55 {url: "${request.current_route_path(_query=dict(filter=c.search_term))}", push: false});
54
56
55 </script>
57 </script>
56 </%def>
58 </%def>
Comments 0
You need to be logged in to leave comments. Login now