#732 Node Search via API for known node returns invalid or empty JSON

A few things going on here ... swagger submitting "false" query
params which intefered with truth testing by existence, and also the
Node search not using {results => {}} format response for template,
and also that response then containing DBIC objects which cannot be
translated to JSON without running HRI first.
This commit is contained in:
Oliver Gorwits
2020-07-06 19:00:38 +01:00
parent 650c419dc7
commit fc4bd4b342
2 changed files with 31 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ use Dancer::Plugin::Auth::Extensible;
use NetAddr::IP::Lite ':lower';
use Regexp::Common 'net';
use NetAddr::MAC ();
use POSIX qw/strftime/;
use App::Netdisco::Web::Plugin;
use App::Netdisco::Util::Web 'sql_match';
@@ -42,6 +43,7 @@ register_search_tab({
},
daterange => {
description => 'Date Range in format "YYYY-MM-DD to YYYY-MM-DD"',
default => ('1970-01-01 to '. strftime('%Y-%m-%d', gmtime)),
},
age_invert => {
description => 'Results should NOT be within daterange',