From 50a90fbc5bbd641055832a71fd468fc7275d8f0b Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Tue, 12 Dec 2023 11:36:08 +0100 Subject: [PATCH] Update origvalue on save for poe state --- python/nav/web/static/js/src/portadmin.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/python/nav/web/static/js/src/portadmin.js b/python/nav/web/static/js/src/portadmin.js index 4b1224d1d7..621b0c8864 100644 --- a/python/nav/web/static/js/src/portadmin.js +++ b/python/nav/web/static/js/src/portadmin.js @@ -482,6 +482,9 @@ require(['libs/spin.min', 'libs/jquery-ui.min'], function (Spinner) { if ('ifadminstatus' in data) { updateAdminStatusDefault($row, data.ifadminstatus); } + if ('poe_state' in data) { + updatePoeDefault($row, data.poe_state); + } } function updateIfAliasDefault($row, ifalias) { @@ -518,6 +521,15 @@ require(['libs/spin.min', 'libs/jquery-ui.min'], function (Spinner) { } } + function updatePoeDefault($row, new_value) { + var old_value = $row.find('option[data-orig]').val(); + if (old_value !== new_value) { + console.log('Updating PoE state default from ' + old_value + ' to ' + new_value); + $row.find('option[data-orig]').removeAttr('data-orig'); + $row.find('option[value=' + new_value + ']').attr('data-orig', new_value); + } + } + function removeFromQueue(id) { if (queue_data.hasOwnProperty(id)) { delete queue_data[id];