fix: Fixed Screen Refresh Bug on Monitor Tab. Now When You Go To Change a Label While the Monitor Is Running. The Page Stops Refreshing Until You’re Done Changing the Name. This Is To Prevent Your Text Box From Being Deselected When the Table Refreshes.
This commit is contained in:
+7
-2
@@ -927,6 +927,7 @@ const nmapTab = (() => {
|
|||||||
const monitorTab = (() => {
|
const monitorTab = (() => {
|
||||||
let running = false;
|
let running = false;
|
||||||
let entries = {};
|
let entries = {};
|
||||||
|
var editingLabel = false;
|
||||||
|
|
||||||
var els = {
|
var els = {
|
||||||
input: () => document.getElementById('monitor-input'),
|
input: () => document.getElementById('monitor-input'),
|
||||||
@@ -953,6 +954,7 @@ const monitorTab = (() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
|
if (editingLabel) return;
|
||||||
var body = els.body();
|
var body = els.body();
|
||||||
var ips = Object.keys(entries).sort();
|
var ips = Object.keys(entries).sort();
|
||||||
|
|
||||||
@@ -1112,7 +1114,7 @@ const monitorTab = (() => {
|
|||||||
if (!cell) return;
|
if (!cell) return;
|
||||||
var ip = cell.dataset.ip;
|
var ip = cell.dataset.ip;
|
||||||
var currentLabel = cell.textContent === '-' ? '' : cell.textContent;
|
var currentLabel = cell.textContent === '-' ? '' : cell.textContent;
|
||||||
|
editingLabel = true;
|
||||||
var input = document.createElement('input');
|
var input = document.createElement('input');
|
||||||
input.type = 'text';
|
input.type = 'text';
|
||||||
input.value = currentLabel;
|
input.value = currentLabel;
|
||||||
@@ -1124,6 +1126,7 @@ const monitorTab = (() => {
|
|||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
var newLabel = input.value.trim();
|
var newLabel = input.value.trim();
|
||||||
|
editingLabel = false;
|
||||||
invoke('monitor_update_label', { ip: ip, label: newLabel }).then(function () {
|
invoke('monitor_update_label', { ip: ip, label: newLabel }).then(function () {
|
||||||
return invoke('monitor_get_entries');
|
return invoke('monitor_get_entries');
|
||||||
}).then(function (updated) {
|
}).then(function (updated) {
|
||||||
@@ -1136,7 +1139,9 @@ const monitorTab = (() => {
|
|||||||
input.addEventListener('blur', save);
|
input.addEventListener('blur', save);
|
||||||
input.addEventListener('keydown', function (ev) {
|
input.addEventListener('keydown', function (ev) {
|
||||||
if (ev.key === 'Enter') save();
|
if (ev.key === 'Enter') save();
|
||||||
if (ev.key === 'Escape') render();
|
if (ev.key === 'Escape')
|
||||||
|
editingLabel = false;
|
||||||
|
render();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user