Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inverse_link option #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ It takes optional parameters:
* `collapsed=0|1`: Controls whether host information is collapsed by default or not. A value of `1` will collapse all host information by defaultcontrols whether host information is collapsed by default or not. A value of `1` will collapse all host information by default. (default='0')
* `host_details=0|1`: Render host details or not. (default=`1`)
* `skip_empty=0|1`: Skip hosts for which no facts were gathered (unreachable, etc). (default=`0`).
* `inverse_link=0|1`: Generate link to direct URL with the regex for the *inverse* of the current search query when typing in the search box (`1`) instead of just generating a direct URL for the current search (`0`). (default=`0`)

**sql**:

Expand Down
1 change: 1 addition & 0 deletions src/ansiblecmdb/data/tpl/html_fancy.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local_js = to_bool(context.get('local_js', '0'))
collapsed = to_bool(context.get('collapsed', '0'))
host_details = to_bool(context.get('host_details', '1'))
skip_empty = to_bool(context.get('skip_empty', '0'))
inverse_link = to_bool(context.get('inverse_link', '0'))

# Get column definitions from html_fancy_defs.html
cols = var_cols(columns)
Expand Down
4 changes: 4 additions & 0 deletions src/ansiblecmdb/data/tpl/html_fancy_defs.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,11 @@ <h3 class="toggle-collapse ${collapsed_class}" id="${host['name']}" data-host-na
$('#filter_link').remove();
if (table.search() == "") {
} else {
% if inverse_link is True:
$('#host_overview_tbl_filter label').after('<span id="filter_link">&nbsp; <a title="Direct link to search" href="?search='+table.search()+'">&nbsp;</a></span>');
% else:
$('#host_overview_tbl_filter label').after('<span id="filter_link">&nbsp; <a title="Direct link to inverse search" href="?search=^(?!.*'+table.search()+')">&nbsp;</a></span>');
% endif
}
} );

Expand Down