From 46c0b6b6e07342eeb3848077ecde3a16ea729210 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 8 Jul 2017 19:32:12 +0100 Subject: [PATCH] further to commit 5efdd750 also for csv output --- lib/App/Netdisco/Web/Plugin/Device/Ports.pm | 1 + share/views/ajax/device/ports_csv.tt | 29 +++++---------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/lib/App/Netdisco/Web/Plugin/Device/Ports.pm b/lib/App/Netdisco/Web/Plugin/Device/Ports.pm index 65fc454e..e67477e0 100644 --- a/lib/App/Netdisco/Web/Plugin/Device/Ports.pm +++ b/lib/App/Netdisco/Web/Plugin/Device/Ports.pm @@ -185,6 +185,7 @@ get '/ajax/content/device/ports' => require_login sub { template 'ajax/device/ports_csv.tt', { results => $results, nodes => $nodes_name, + ips => $ips_name, device => $device, }, { layout => undef }; } diff --git a/share/views/ajax/device/ports_csv.tt b/share/views/ajax/device/ports_csv.tt index 76790a50..72ee06a4 100644 --- a/share/views/ajax/device/ports_csv.tt +++ b/share/views/ajax/device/ports_csv.tt @@ -190,30 +190,15 @@ [% mynode.push('') %] [% SET has_ips = 0 %] - [% IF params.n_ip4 %] - [% FOREACH ip IN node.ip4s %] - [% SET has_ips = 1 %] + [% FOREACH ip IN node.$ips %] + [% SET has_ips = 1 %] - [% CALL mynode.splice(-3, 1, ip.ip) %] - [% CALL mynode.splice(-2, 1, ip.dns) %] - [% CALL mynode.splice(-1, 1, (ip.active ? 'No' : 'Yes')) %] + [% CALL mynode.splice(-3, 1, ip.ip) %] + [% CALL mynode.splice(-2, 1, ip.dns) %] + [% CALL mynode.splice(-1, 1, (ip.active ? 'No' : 'Yes')) %] - [% CALL myport.splice(c_nodes_pos, mynode.size, mynode) %] - [% CSV.dump(myport) %] - [% END %] - [% END %] - - [% IF params.n_ip6 %] - [% FOREACH ip IN node.ip6s %] - [% SET has_ips = 1 %] - - [% CALL mynode.splice(-3, 1, ip.ip) %] - [% CALL mynode.splice(-2, 1, ip.dns) %] - [% CALL mynode.splice(-1, 1, (ip.active ? 'No' : 'Yes')) %] - - [% CALL myport.splice(c_nodes_pos, mynode.size, mynode) %] - [% CSV.dump(myport) %] - [% END %] + [% CALL myport.splice(c_nodes_pos, mynode.size, mynode) %] + [% CSV.dump(myport) %] [% END %] [% CSV.dump(myport) IF NOT has_ips %]