diff --git a/app/static/js/hosts.js b/app/static/js/hosts.js index b2babbe4534db934a9a8460aa41231f81ff54641..38aa1139565cd4048c32991a39fd41e9a73a8971 100644 --- a/app/static/js/hosts.js +++ b/app/static/js/hosts.js @@ -120,6 +120,9 @@ $(document).ready(function() { $("#hostForm input[name=interface_name]").prop("readonly", true); var hosts_table = $("#hosts_table").DataTable({ + dom: "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-3 text-right'><'col-sm-12 col-md-3'f>>" + + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>", "ajax": { "url": $SCRIPT_ROOT + "/network/_retrieve_hosts", "type": "POST" @@ -127,6 +130,7 @@ $(document).ready(function() { "processing": true, "serverSide": true, "searchDelay": 500, + "stateSave": true, "orderMulti": false, "aaSorting": [], "pagingType": "full_numbers", @@ -150,4 +154,21 @@ $(document).ready(function() { ] }); + if( $("#hosts_table").length ) { + new $.fn.dataTable.Buttons(hosts_table, { + buttons: [ + { + text: 'Reset', + className: "btn-outline-secondary", + action: function ( e, dt, node, conf ) { + dt.state.clear(); + dt.search('').order([]).draw(); + } + } + ] + }); + + hosts_table.buttons().container().appendTo("#hosts_table_wrapper .col-md-3:eq(0)"); + } + }); diff --git a/app/static/js/items.js b/app/static/js/items.js index 060647b55bf6ad67d77d47e51ea329db10ec6aa6..8fb76149a01a7260b04d15b25fd99ed40d608223 100644 --- a/app/static/js/items.js +++ b/app/static/js/items.js @@ -74,6 +74,7 @@ $(document).ready(function() { "processing": true, "serverSide": true, "searchDelay": 500, + "stateSave": true, "orderMulti": false, "aaSorting": [], "pagingType": "full_numbers", @@ -110,6 +111,14 @@ $(document).ready(function() { action: function ( e, dt, node, conf ) { download_excel(); } + }, + { + text: 'Reset', + className: "btn-outline-secondary", + action: function ( e, dt, node, conf ) { + dt.state.clear(); + dt.search('').order([]).draw(); + } } ] }); diff --git a/docs/_static/inventory.png b/docs/_static/inventory.png deleted file mode 100644 index 356beb2b03cba7c021ca49216e97f70a4d1691d5..0000000000000000000000000000000000000000 Binary files a/docs/_static/inventory.png and /dev/null differ diff --git a/docs/_static/inventory/inventory.png b/docs/_static/inventory/inventory.png new file mode 100644 index 0000000000000000000000000000000000000000..fac85f5a0be0ec96a698b477ea5a0041fa601f67 Binary files /dev/null and b/docs/_static/inventory/inventory.png differ diff --git a/docs/_static/inventory/search_ics_id_field.png b/docs/_static/inventory/search_ics_id_field.png index fcd0e9287062ef69311be65fa9436b4b7d044c09..52178ebfe37bca15034e96920439d06132dd3180 100644 Binary files a/docs/_static/inventory/search_ics_id_field.png and b/docs/_static/inventory/search_ics_id_field.png differ diff --git a/docs/_static/inventory/search_ics_id_multiple.png b/docs/_static/inventory/search_ics_id_multiple.png index bc7a5645522d2c1000d346c908169e734fc4b9e1..8b2b74482955d54a27f50710933a786792e02ede 100644 Binary files a/docs/_static/inventory/search_ics_id_multiple.png and b/docs/_static/inventory/search_ics_id_multiple.png differ diff --git a/docs/_static/inventory/search_juniper.png b/docs/_static/inventory/search_juniper.png index a7ea6e18d1bc037beeafdd6156dd873be7c323fe..64873eca028cf946d9d6c84a9d2c5a97401ea6d6 100644 Binary files a/docs/_static/inventory/search_juniper.png and b/docs/_static/inventory/search_juniper.png differ diff --git a/docs/_static/inventory/search_quote_mac.png b/docs/_static/inventory/search_quote_mac.png index ee10090aa20d38e42ecc65c694e71ecf182b5b72..d0b4ac0db0780b0d6fd1d3d5757d65f674e36a95 100644 Binary files a/docs/_static/inventory/search_quote_mac.png and b/docs/_static/inventory/search_quote_mac.png differ diff --git a/docs/_static/inventory/search_quote_tag.png b/docs/_static/inventory/search_quote_tag.png index 390be85a52812034e34f6198ede5922d339d81af..7b5e2806da2ba9a2dbfe9379e8e719fa510730cd 100644 Binary files a/docs/_static/inventory/search_quote_tag.png and b/docs/_static/inventory/search_quote_tag.png differ diff --git a/docs/_static/inventory/search_serial_number.png b/docs/_static/inventory/search_serial_number.png index 9af6aaa3094e4cb6e240e14adca08cb1d5566205..e6ddfb911fc3ad7588dca8331ce44409dc10d3e0 100644 Binary files a/docs/_static/inventory/search_serial_number.png and b/docs/_static/inventory/search_serial_number.png differ diff --git a/docs/_static/inventory/search_wildcard.png b/docs/_static/inventory/search_wildcard.png index f8f59b8b47947268f76f6c2916f1a07cf648c198..e02241650126838e8766e545ab0f478750af73b5 100644 Binary files a/docs/_static/inventory/search_wildcard.png and b/docs/_static/inventory/search_wildcard.png differ diff --git a/docs/_static/network/list_hosts.png b/docs/_static/network/list_hosts.png index 1f441789d940a5188b6bd99b418746eab13d7a0a..9965b1ffc3e95cf51116db9eb34266d047fb0217 100644 Binary files a/docs/_static/network/list_hosts.png and b/docs/_static/network/list_hosts.png differ diff --git a/docs/_static/network/search_host_ip.png b/docs/_static/network/search_host_ip.png index ff3c258a5912cb56cb863f10b9d4c268a2bfe588..2be3ed725f0af9e30c78f960288fee4a99212823 100644 Binary files a/docs/_static/network/search_host_ip.png and b/docs/_static/network/search_host_ip.png differ diff --git a/docs/_static/network/search_host_name_field.png b/docs/_static/network/search_host_name_field.png index baa87b687bd79f46d8c879876109d56edd496a94..de03700a1bf2eaaf00696b2a1492ac5caf6d6cc6 100644 Binary files a/docs/_static/network/search_host_name_field.png and b/docs/_static/network/search_host_name_field.png differ diff --git a/docs/_static/network/search_host_quote_name.png b/docs/_static/network/search_host_quote_name.png index 1d18f65af1a8707aa166b74ab8efc7c72062d72f..619a4309958857d56527b9ccf86d65c1f67c0155 100644 Binary files a/docs/_static/network/search_host_quote_name.png and b/docs/_static/network/search_host_quote_name.png differ diff --git a/docs/_static/network/search_host_ts2.png b/docs/_static/network/search_host_ts2.png index b84b7730119d9bb05c83bf7efe93fae7a838d7da..7a8fd47bb104fe191028be9a7b3ee1b53211ee72 100644 Binary files a/docs/_static/network/search_host_ts2.png and b/docs/_static/network/search_host_ts2.png differ diff --git a/docs/_static/network/search_host_wildcard.png b/docs/_static/network/search_host_wildcard.png index 06ad7863109125d259b037ba624a9b6ea6b08d93..c8ffb6d6fdc16345b89feb84c04ceb92359de6bb 100644 Binary files a/docs/_static/network/search_host_wildcard.png and b/docs/_static/network/search_host_wildcard.png differ diff --git a/docs/inventory.rst b/docs/inventory.rst index 1c3403788d155e9c356e0f2fe3b2b0a0d99bb48f..f74a93920989563b786f4b8e55f3136d7413b7dd 100644 --- a/docs/inventory.rst +++ b/docs/inventory.rst @@ -17,7 +17,7 @@ The **serial number** is a free text field. The *items* page of the inventory lists all existing items. -.. image:: _static/inventory.png +.. image:: _static/inventory/inventory.png .. _inventory-search: @@ -25,6 +25,9 @@ Search ------ You can find a specific item or group of items by using the search box. +The search input (as well as column ordering and paging position) is saved locally in your browser and restored when you reload the page. +To clear the state of the table, click on the *Reset* button. + Elasticsearch is used as the full-text search engine and allows to use a query string “mini-languageâ€. - To perform a free text search, simply enter a text string. For example, if you’re looking for Juniper devices, enter ``juniper``. Notice that the search is case insensitive. @@ -37,7 +40,7 @@ Elasticsearch is used as the full-text search engine and allows to use a query s .. image:: _static/inventory/search_ics_id_multiple.png -- As you can see on the above screenshot, by default the search is performed on all fields. The id ``AAA997`` was found both in the ics_id and parent fields. You can restrict the search to a specific field: ``ics_id:AAA997`` +- As you can see on the above screenshot, by default the search is performed on all fields. The id ``AAA997`` was found both in the ICS id and parent fields. You can restrict the search to a specific field: ``ics_id:AAA997`` .. image:: _static/inventory/search_ics_id_field.png diff --git a/docs/network.rst b/docs/network.rst index b497188c03ed9a91f8782075788aafee947edf10..fa7f70874e34de7abe8edc9e907ddc67b1868fa9 100644 --- a/docs/network.rst +++ b/docs/network.rst @@ -32,6 +32,9 @@ Search ------ You can find a specific host or group of hosts by using the search box. +The search input (as well as column ordering and paging position) is saved locally in your browser and restored when you reload the page. +To clear the state of the table, click on the *Reset* button. + As for the inventory :ref:`inventory-search`, Elasticsearch is used as the full-text search engine and allows to use a query string “mini-languageâ€. - To perform a free text search, simply enter a text string. For example, if you’re looking for things related to TS2 (Test Stand 2), just enter ``ts2``. Notice that the search is case insensitive.