Skip to content

Commit

Permalink
Update origvalue on save for poe state
Browse files Browse the repository at this point in the history
  • Loading branch information
stveit committed Dec 12, 2023
1 parent 56b864f commit fb3a412
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/nav/web/static/js/src/portadmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit fb3a412

Please sign in to comment.