commit 49e585ef4bcbafd1964f0d0b8b9eda4b2624c86e Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 23:20:05 2013 +0000 default is to have age filter enabled commit c3635b3b096ea73906a553db5b588eaee29b2145 Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 23:15:08 2013 +0000 disable Seen IPs checkbox when v6ish cidr is seen commit f1550f2dcff96a9b2d77cbc3a8582429f3b078df Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 22:56:12 2013 +0000 make daterange green when age filter activated commit 838578f2b9935c6f2abba7679f2ba87f30f651a3 Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 22:47:29 2013 +0000 use class to control input colouring commit 291d230e6a0216b4f5ad52b8eb04f3949ffe85e3 Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 22:43:45 2013 +0000 move cidr input and remove sidebar title this is only so that the tooltip on the cide input isn't obscured by the table heading. I've no idea how to avoid that happening :-/ commit d0df5c7af82bea3fc674585962ca67f4cd82e553 Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 22:11:34 2013 +0000 layout fixes for ipinventory sidebar commit faeb614147e673d4d08822cafb65ca003c400edd Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 21:27:01 2013 +0000 prevent autoload for ipinventory data; prevent submit if CIDR is empty commit b993611ff9bf1bd1eaed410beab09c754c786b1a Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 21:08:26 2013 +0000 revert to 0.0.0.0/32 default search commit d9e34ec19a2ca0d5893215a0508478985c96076e Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 20:59:22 2013 +0000 set age sort to desc - show oldest unused commit 4a4231c69c8483c65d211119d772ad40a3a95b69 Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Dec 30 20:55:00 2013 +0000 fix parameter names; make 0.0.0.0/0 default commit 5fb6e42426ae8bf96d81b2f2ad25d118c900646d Author: Eric A. Miller <emiller@cpan.org> Date: Mon Dec 30 15:16:13 2013 -0500 Add IP Inventory report with options sidebar commit 4b84ca3714990199303cd5e099310e4c1ff1458f Author: Eric A. Miller <emiller@cpan.org> Date: Mon Dec 30 14:34:29 2013 -0500 Add 'IP' as a report category commit 849ae4e0a6f51102cb90236629f4e1b43fc9bc2e Author: Eric A. Miller <emiller@cpan.org> Date: Mon Dec 30 14:33:10 2013 -0500 Add CidrIps virtual view ResultSource. Enumerates all IP addresses within an IPv4 subnet. commit 30abbb957bd40270a14ca6289e76f70bf721696e Author: Eric A. Miller <emiller@cpan.org> Date: Mon Dec 30 14:29:27 2013 -0500 Add Dan Grossman's date range picker component for Twitter Bootstrap. Component relies on Moment.js which is also added. commit 19830639bdbcd409a49228f18d29f6dff5e933e8 Author: Eric A. Miller <emiller@cpan.org> Date: Mon Dec 30 14:23:11 2013 -0500 DBIx::Class::Helpers is currently a requirement for DBIx::Class::ResultSource::View's which use Helper::Row::SubClass. Use a base ResultSet class so that we can make Helper::ResultSet::SetOperations and Helper::ResultSet::Shortcut available to all of our classes. SetOperations is specifically needed for UNION operations, Shortcut's are candy. Note: Trying to add entire Helper::ResultSet seemed to cause problems.
136 lines
4.7 KiB
JavaScript
136 lines
4.7 KiB
JavaScript
// csv download icon on any table page
|
|
// needs to be dynamically updated to use current search options
|
|
function update_csv_download_link (type, tab, show) {
|
|
var form = '#' + tab + '_form';
|
|
var query = $(form).serialize();
|
|
|
|
if (show.length) {
|
|
$('#nd_csv-download')
|
|
.attr('href', uri_base + '/ajax/content/' + type + '/' + tab + '?' + query)
|
|
.attr('download', 'netdisco-' + type + '-' + tab + '.csv')
|
|
.show();
|
|
}
|
|
else {
|
|
$('#nd_csv-download').hide();
|
|
}
|
|
}
|
|
|
|
// page title includes tab name and possibly device name
|
|
// this is nice for when you have multiple netdisco pages open in the
|
|
// browser
|
|
function update_page_title (tab) {
|
|
var pgtitle = 'Netdisco';
|
|
if ($.trim($('#nd_device-name').text()).length) {
|
|
pgtitle = $.trim($('#nd_device-name').text()) +' - '+ $('#'+ tab + '_link').text();
|
|
}
|
|
return pgtitle;
|
|
}
|
|
|
|
// update browser search history with the new query.
|
|
// however if it's the same tab, this is a *replace* of the query url.
|
|
// and just skip this bit if it's the report or admin display.
|
|
function update_browser_history (tab, pgtitle) {
|
|
var form = '#' + tab + '_form';
|
|
var query = $(form).serialize();
|
|
|
|
if (window.History && window.History.enabled) {
|
|
is_from_history_plugin = 1;
|
|
window.History.replaceState(
|
|
{name: tab, fields: $(form).serializeArray()},
|
|
pgtitle, uri_base + '/' + path + '?' + query
|
|
);
|
|
is_from_history_plugin = 0;
|
|
}
|
|
}
|
|
|
|
// each sidebar search form has a hidden copy of the main navbar search
|
|
function copy_navbar_to_sidebar (tab) {
|
|
var form = '#' + tab + '_form';
|
|
|
|
// copy navbar value to currently active sidebar form
|
|
if ($('#nq').val()) {
|
|
$(form).find("input[name=q]").val( $('#nq').val() );
|
|
}
|
|
// then copy to all other inactive tab sidebars
|
|
$('form').find("input[name=q]").each( function() {
|
|
$(this).val( $(form).find("input[name=q]").val() );
|
|
});
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
[% IF search %]
|
|
// search tabs
|
|
[% FOREACH tab IN settings._search_tabs %]
|
|
$('[% "#${tab.tag}_form" %]').submit(function (event) {
|
|
var pgtitle = update_page_title('[% tab.tag %]');
|
|
copy_navbar_to_sidebar('[% tab.tag %]');
|
|
update_browser_history('[% tab.tag %]', pgtitle);
|
|
update_csv_download_link('search', '[% tab.tag %]', '[% tab.provides_csv %]');
|
|
do_search(event, '[% tab.tag %]');
|
|
});
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF device %]
|
|
// device tabs
|
|
[% FOREACH tab IN settings._device_tabs %]
|
|
$('[% "#${tab.tag}_form" %]').submit(function (event) {
|
|
var pgtitle = update_page_title('[% tab.tag %]');
|
|
copy_navbar_to_sidebar('[% tab.tag %]');
|
|
update_browser_history('[% tab.tag %]', pgtitle);
|
|
update_csv_download_link('device', '[% tab.tag %]', '[% tab.provides_csv %]');
|
|
|
|
[% IF tab.tag == 'ports' %]
|
|
// to be fair I can't remember why we do this in JS and not from the app
|
|
// perhaps because selecting form fields to go in the cookie is easier?
|
|
var cookie = $('#ports_form').find('input,select')
|
|
.not('#nd_port-query,input[name="q"],input[name="tab"]')
|
|
.serializeArray();
|
|
$('#ports_form').find('input[type="checkbox"]').map(function() {
|
|
cookie.push({'name': 'columns', 'value': $(this).attr('name')});
|
|
});
|
|
$.cookie('nd_ports-form', $.param(cookie) ,{ expires: 365 });
|
|
|
|
// form reset icon on ports tab
|
|
$('#nd_sidebar-reset-link').attr('href', uri_base + '/device?tab=[% tab.tag %]&reset=on&' +
|
|
$('#ports_form')
|
|
.find('input[name="q"],input[name="f"],input[name="partial"],input[name="invert"]')
|
|
.serialize());
|
|
|
|
[% ELSIF tab.tag == 'netmap' %]
|
|
// form reset icon on netmap tab
|
|
$('#nd_sidebar-reset-link').attr('href', uri_base + '/device?tab=[% tab.tag %]&reset=on&' +
|
|
$('#netmap_form').find('input[name="q"]').serialize());
|
|
[% END %]
|
|
|
|
do_search(event, '[% tab.tag %]');
|
|
});
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF report %]
|
|
// for the report pages
|
|
$('[% "#${report.tag}_form" %]').submit(function (event) {
|
|
update_page_title('[% report.tag %]');
|
|
update_csv_download_link('report', '[% report.tag %]', '1');
|
|
do_search(event, '[% report.tag %]');
|
|
});
|
|
[% END -%]
|
|
|
|
[% IF task %]
|
|
// for the admin pages
|
|
$('[% "#${task.tag}_form" %]').submit(function (event) {
|
|
update_page_title('[% task.tag %]');
|
|
update_csv_download_link('task', '[% task.tag %]', '1');
|
|
do_search(event, '[% task.tag %]');
|
|
});
|
|
[% END %]
|
|
|
|
// on page load, load the content for the active tab
|
|
[% IF params.tab %]
|
|
[% IF params.tab != 'ipinventory' %]
|
|
$('#[% params.tab %]_form').trigger("submit");
|
|
[% END %]
|
|
[% END %]
|
|
});
|