From 8b5db6d5cb208f3bc09d7aeacd002093b12ca7b4 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 23 Sep 2013 12:37:57 +0100 Subject: [PATCH] use separate cols for csv where we used to concat data --- Netdisco/share/views/ajax/device/ports_csv.tt | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/Netdisco/share/views/ajax/device/ports_csv.tt b/Netdisco/share/views/ajax/device/ports_csv.tt index 0bc37995..19bc8ded 100644 --- a/Netdisco/share/views/ajax/device/ports_csv.tt +++ b/Netdisco/share/views/ajax/device/ports_csv.tt @@ -6,14 +6,28 @@ [% NEXT IF item.name == 'c_admin' %] [% NEXT UNLESS params.${item.name} %] - [% headers.push(item.label) %] - [% IF item.name == 'c_nodes' %] - [% SET c_nodes_pos = headers.max %] + [% SET c_nodes_pos = headers.size %] + [% headers.push('Node MAC') %] [% headers.push('Archived Node') %] [% headers.push('Age Stamp') IF params.n_age %] - [% headers.push('IP Address') IF params.n_ip %] + [% headers.push('Node IP') IF params.n_ip %] + [% headers.push('Node DNS') IF params.n_ip %] [% headers.push('Archived IP') IF params.n_ip %] + [% ELSIF item.name == 'c_duplex' %] + [% headers.push('Duplex Setting') %] + [% headers.push('Duplex') %] + [% ELSIF item.name == 'c_power' %] + [% headers.push('PoE Status') %] + [% headers.push('PoE Power (mW)') %] + [% ELSIF item.name == 'c_neighbors' %] + [% headers.push('Neighbor IP') %] + [% headers.push('Neighbor DNS') %] + [% ELSIF item.name == 'c_up' %] + [% headers.push('Port Setting') %] + [% headers.push('Port Status') %] + [% ELSE %] + [% headers.push(item.label) %] [% END %] [% END %] [% CSV.dump(headers) %] @@ -53,9 +67,11 @@ [% IF params.c_duplex %] [% IF row.up == 'up' AND row.duplex %] - [% myport.push( (row.duplex_admin.ucfirst || 'Auto') _ ' / ' _ row.duplex.ucfirst ) %] + [% myport.push( row.duplex_admin.ucfirst || 'Auto' ) %] + [% myport.push( row.duplex.ucfirst ) %] [% ELSE %] [% myport.push('') %] + [% myport.push('') %] [% END %] [% END %] @@ -100,9 +116,11 @@ [% IF params.c_power %] [% IF row.power AND row.power.admin == 'true' %] - [% myport.push( (row.power.power || '0') _ 'mW (' _ row.power.status _ ')' ) %] + [% myport.push( row.power.status ) %] + [% myport.push( row.power.power || '0' ) %] [% ELSE %] [% myport.push('') %] + [% myport.push('') %] [% END %] [% END %] @@ -112,26 +130,24 @@ [% myport.push('') IF params.n_age %] [% myport.push('') IF params.n_ip %] [% myport.push('') IF params.n_ip %] + [% myport.push('') IF params.n_ip %] [% END %] [% IF params.c_neighbors %] - [% IF params.c_neighbors AND (row.remote_ip OR row.is_uplink) %] + [% IF (row.remote_ip OR row.is_uplink) %] [% IF row.neighbor %] - [% SET output = row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip %] - [% SET output = output _ ' (port: ' _ row.remote_port %] - [% SET output = output _ ' id: '_ row.remote_id IF row.remote_id %] - [% SET output = output _ ' type: '_ row.remote_type IF row.remote_type %] - [% myport.push( output _ ')' ) %] + [% myport.push( row.neighbor.ip ) %] + [% myport.push( row.neighbor.dns.remove(settings.domain_suffix) ) %] [% ELSIF row.remote_ip AND row.remote_port %] - [% SET output = row.remote_ip _ ' (port: ' _ row.remote_port %] - [% SET output = output _ ' id: '_ row.remote_id IF row.remote_id %] - [% SET output = output _ ' type: '_ row.remote_type IF row.remote_type %] - [% myport.push( output _ ')' ) %] + [% myport.push( row.remote_ip ) %] + [% myport.push('') %] [% ELSE %] [% myport.push('(possible uplink)') %] + [% myport.push('') %] [% END %] [% ELSE %] [% myport.push('') %] + [% myport.push('') %] [% END %] [% END %] @@ -140,7 +156,8 @@ [% END %] [% IF params.c_up %] - [% myport.push( row.up_admin.ucfirst _ ' / ' _ row.up.ucfirst ) %] + [% myport.push( row.up_admin.ucfirst ) %] + [% myport.push( row.up.ucfirst ) %] [% END %] [% FOREACH config IN settings._extra_device_port_cols %] @@ -170,13 +187,9 @@ [% FOREACH ip IN node.ips %] [% SET has_ips = 1 %] - [% SET dns = ip.dns %] - [% IF dns %] - [% CALL mynode.splice(-2, 1, dns _ ' (' _ ip.ip _ ')') %] - [% ELSE %] - [% CALL mynode.splice(-2, 1, ip.ip) %] - [% END %] + [% 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) %]