#948 Column order wrong when displaying custom fields

This commit is contained in:
Oliver Gorwits
2022-12-13 11:30:36 +00:00
parent 645519dc50
commit c82dfc8a10
3 changed files with 56 additions and 56 deletions

View File

@@ -173,12 +173,12 @@ hook after_error_render => sub { setting('layout' => 'main') };
map {{ name => $_, %{ setting('sidebar_defaults')->{'device_ports'}->{$_} } }}
grep { $_ =~ m/^c_/ } keys %{ setting('sidebar_defaults')->{'device_ports'} };
splice @port_columns, setting('device_port_col_idx_left'), 0,
grep {$_->{position} eq 'left'} @{ setting('_extra_device_port_cols') };
splice @port_columns, setting('device_port_col_idx_mid'), 0,
grep {$_->{position} eq 'mid'} @{ setting('_extra_device_port_cols') };
splice @port_columns, setting('device_port_col_idx_right'), 0,
splice @port_columns, setting('device_port_col_idx_right') + 1, 0,
grep {$_->{position} eq 'right'} @{ setting('_extra_device_port_cols') };
splice @port_columns, setting('device_port_col_idx_mid') + 1, 0,
grep {$_->{position} eq 'mid'} @{ setting('_extra_device_port_cols') };
splice @port_columns, setting('device_port_col_idx_left') + 1, 0,
grep {$_->{position} eq 'left'} @{ setting('_extra_device_port_cols') };
set('port_columns' => \@port_columns);

View File

@@ -162,9 +162,9 @@ sidebar_defaults:
report_portutilization:
age_num: { default: 3 }
age_unit: { default: months }
device_port_col_idx_left: 0
device_port_col_idx_mid: 2
device_port_col_idx_right: -1
device_port_col_idx_left: 7
device_port_col_idx_mid: 18
device_port_col_idx_right: 22
jobqueue_refresh: 10
safe_password_store: true
reports: []

View File

@@ -58,30 +58,6 @@
[% END %]
</td>
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'left' AND params.${config.name} %]
[% TRY %]
<td>
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
</td>
[% CATCH %]
[% CLEAR %]
[% IF config.editable AND user_can_port_control AND params.c_admin AND row.portctl %]
<td nowrap class="nd_editable-cell" contenteditable="true"
data-field="[% config.field | html_entity %]" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit-icon"></i>
[% ELSE %]
<td nowrap class="nd_editable-cell">
[% END %]
<div class="nd_editable-cell-content">
[% row.get_column(config.field) | html_entity %]
</div>
</td>
[% END %]
[% END %]
[% IF params.c_port %]
[% IF user_can_port_control AND params.c_admin AND row.portctl %]
[% IF row.up_admin == 'up' %]
@@ -135,30 +111,6 @@
</td>
[% END %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'mid' AND params.${config.name} %]
[% TRY %]
<td>
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
</td>
[% CATCH %]
[% CLEAR %]
[% IF config.editable AND user_can_port_control AND params.c_admin AND row.portctl %]
<td nowrap class="nd_editable-cell" contenteditable="true"
data-field="[% config.field | html_entity %]" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit-icon"></i>
[% ELSE %]
<td nowrap class="nd_editable-cell">
[% END %]
<div class="nd_editable-cell-content">
[% row.get_column(config.field) | html_entity %]
</div>
</td>
[% END %]
[% END %]
[% IF params.c_descr %]
<td nowrap>[% row.descr | html_entity %]</td>
[% END %]
@@ -193,6 +145,30 @@
</td>
[% END %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'left' AND params.${config.name} %]
[% TRY %]
<td>
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
</td>
[% CATCH %]
[% CLEAR %]
[% IF config.editable AND user_can_port_control AND params.c_admin AND row.portctl %]
<td nowrap class="nd_editable-cell" contenteditable="true"
data-field="[% config.field | html_entity %]" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit-icon"></i>
[% ELSE %]
<td nowrap class="nd_editable-cell">
[% END %]
<div class="nd_editable-cell-content">
[% row.get_column(config.field) | html_entity %]
</div>
</td>
[% END %]
[% END %]
[% IF params.c_speed_admin %]
<td>[% row.speed_admin | html_entity %]</td>
[% END %]
@@ -332,6 +308,30 @@
</td>
[% END %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'mid' AND params.${config.name} %]
[% TRY %]
<td>
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
</td>
[% CATCH %]
[% CLEAR %]
[% IF config.editable AND user_can_port_control AND params.c_admin AND row.portctl %]
<td nowrap class="nd_editable-cell" contenteditable="true"
data-field="[% config.field | html_entity %]" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit-icon"></i>
[% ELSE %]
<td nowrap class="nd_editable-cell">
[% END %]
<div class="nd_editable-cell-content">
[% row.get_column(config.field) | html_entity %]
</div>
</td>
[% END %]
[% END %]
[% IF params.c_nodes OR params.c_neighbors %]
<td>
[% IF params.c_neighbors AND (row.remote_ip OR row.is_uplink) %]