Device tag fixes, #3063

Ylian Saint-Hilaire committed Aug 26, 2021 at 09:53 UTC 4cdf56b55691f0dba762e13d3eb28e4465a9a525
2 files changed +16 -14
views/default-mobile.handlebars
+7 -6
@@ -1,4 +1,4 @@
1 -<!DOCTYPE html>
1 +<!DOCTYPE html>
2 <html lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta charset="utf-8">
@@ -3430,11 +3430,11 @@
3430
3431 // Node tags
3432 var groupingTags = '<i>' + "None" + '</i>';
3433 - if (node.tags != null) { groupingTags = ''; for (var i in node.tags) { groupingTags += '<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">' + EscapeHtml(node.tags[i]) + '</span>'; } }
3433 + if (node.tags != null) { groupingTags = ''; for (var i in node.tags) { groupingTags += '<span style="background-color:lightgray;padding:3px;border-radius:5px">' + EscapeHtml(node.tags[i]) + '</span> '; } }
3434 if ((meshrights & 4) != 0) {
3435 - x += addDeviceAttribute("Tags", '<span onclick=showEditNodeValueDialog(3) style=cursor:pointer;color:black>' + groupingTags + '</span>');
3435 + x += addDeviceAttribute("Tags", '<span onclick=showEditNodeValueDialog(3) style=line-height:26px;cursor:pointer;color:black>' + groupingTags + '</span>');
3436 } else {
3437 - x += addDeviceAttribute("Tags", '<span style=color:black>' + groupingTags + '</span>');
3437 + x += addDeviceAttribute("Tags", '<span style=line-height:26px;color:black>' + groupingTags + '</span>');
3438 }
3439
3440 // SSH & RDP Credentials
@@ -3869,8 +3869,8 @@
3869 for (var i in nodes) { if (nodes[i].tags) { for (var j in nodes[i].tags) { if (allTags.indexOf(nodes[i].tags[j]) == -1) { allTags.push(nodes[i].tags[j]); } } } }
3870 if (allTags.length > 0) {
3871 allTags.sort();
3872 - for (var i in allTags) { y += '<span style=padding:4px;background-color:#BBB;border-radius:3px;margin:3px;cursor:pointer onclick=showEditNodeValueDialogAddTag("' + encodeURIComponentEx(allTags[i]) + '")>' + EscapeHtml(allTags[i]) + '</span>'; }
3873 - x += '<div style=height:8px></div>' + y;
3872 + for (var i in allTags) { y += '<span style=padding:4px;background-color:#BBB;border-radius:3px;cursor:pointer onclick=showEditNodeValueDialogAddTag("' + encodeURIComponentEx(allTags[i]) + '")>' + EscapeHtml(allTags[i]) + '</span> '; }
3873 + x += '<div style=margin-top:8px;width:280px;line-height:26px;max-height:160px;overflow-y:auto>' + y + '</div>';
3874 }
3875 }
3876 setDialogMode(2, "Edit Device", 3, showEditNodeValueDialogEx, x, mode);
@@ -3887,6 +3887,7 @@
3887 for (var i in tt) { t2.push(tt[i].trim()); }
3888 if (t2.indexOf(t) >= 0) return;
3889 Q('dp10devicevalue').value += ((Q('dp10devicevalue').value.length == 0) ? '' : ', ') + decodeURIComponent(t);
3890 + setTimeout(function () { Q('dp10devicevalue').selectionStart = Q('dp10devicevalue').selectionEnd = 90000; }, 0);
3891 p10editdevicevalueValidate();
3892 }
3893
views/default.handlebars
+9 -8
@@ -5161,8 +5161,8 @@
5161 for (var i in nodes) { if (nodes[i].tags) { for (var j in nodes[i].tags) { if (allTags.indexOf(nodes[i].tags[j]) == -1) { allTags.push(nodes[i].tags[j]); } } } }
5162 if (allTags.length > 0) {
5163 allTags.sort();
5164 - for (var i in allTags) { y += '<span style=padding:4px;background-color:#BBB;border-radius:3px;margin:3px;cursor:pointer onclick=showEditNodeValueDialogAddTag("' + encodeURIComponentEx(allTags[i]) + '")>' + EscapeHtml(allTags[i]) + '</span>'; }
5165 - x += '<div style=height:4px></div>' + addHtmlValue("Existing Tags", y);
5164 + for (var i in allTags) { y += '<span style=padding:4px;background-color:#BBB;border-radius:3px;cursor:pointer onclick=showEditNodeValueDialogAddTag("' + encodeURIComponentEx(allTags[i]) + '")>' + EscapeHtml(allTags[i]) + '</span> '; }
5165 + x += '<div style=margin-top:8px;width:370px;line-height:26px;max-height:160px;overflow-y:auto>' + y + '</div>';
5166 }
5167 setDialogMode(2, "Edit Device Tags", 3, d2groupActionFunctionTagsExec, x);
5168 } else if (op == 108) {
@@ -6611,13 +6611,13 @@
6611 x += addDeviceAttribute("Connectivity", cstate.join(', '));
6612 }
6613
6614 - // Node grouping tags
6614 + // Node tags
6615 var groupingTags = '<i>' + "None" + '</i>';
6616 - if (node.tags != null) { groupingTags = ''; for (var i in node.tags) { groupingTags += '<span class="tagSpan">' + EscapeHtml(node.tags[i]) + '</span>'; } }
6616 + if (node.tags != null) { groupingTags = ''; for (var i in node.tags) { groupingTags += '<span style="background-color:lightgray;padding:3px;border-radius:5px">' + EscapeHtml(node.tags[i]) + '</span> '; } }
6617 if ((meshrights & 4) != 0) {
6618 - x += addDeviceAttribute("Tags", '<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>' + groupingTags + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>');
6618 + x += addDeviceAttribute("Tags", '<span onclick=showEditNodeValueDialog(3) style=line-height:26px;cursor:pointer;color:black>' + groupingTags + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>');
6619 } else {
6620 - x += addDeviceAttribute("Tags", groupingTags);
6620 + x += addDeviceAttribute("Tags", '<span style=line-height:26px;color:black>' + groupingTags + '</span>');
6621 }
6622
6623 // SSH & RDP Credentials
@@ -7693,8 +7693,8 @@
7693 for (var i in nodes) { if (nodes[i].tags) { for (var j in nodes[i].tags) { if (allTags.indexOf(nodes[i].tags[j]) == -1) { allTags.push(nodes[i].tags[j]); } } } }
7694 if (allTags.length > 0) {
7695 allTags.sort();
7696 - for (var i in allTags) { y += '<span style=padding:4px;background-color:#BBB;border-radius:3px;margin:3px;cursor:pointer onclick=showEditNodeValueDialogAddTag("' + encodeURIComponentEx(allTags[i]) + '")>' + EscapeHtml(allTags[i]) + '</span>'; }
7697 - x += '<div style=height:4px></div>' + addHtmlValue("Existing Tags", y);
7696 + for (var i in allTags) { y += '<span style=padding:4px;background-color:#BBB;border-radius:3px;cursor:pointer onclick=showEditNodeValueDialogAddTag("' + encodeURIComponentEx(allTags[i]) + '")>' + EscapeHtml(allTags[i]) + '</span> '; }
7697 + x += '<div style=margin-top:8px;width:370px;line-height:26px;max-height:160px;overflow-y:auto>' + y + '</div>';
7698 }
7699 }
7700 setDialogMode(2, "Edit Device", 3, showEditNodeValueDialogEx, x, mode);
@@ -7711,6 +7711,7 @@
7711 for (var i in tt) { t2.push(tt[i].trim()); }
7712 if (t2.indexOf(t) >= 0) return;
7713 Q('dp10devicevalue').value += ((Q('dp10devicevalue').value.length == 0)?'':', ') + decodeURIComponent(t);
7714 + setTimeout(function(){ Q('dp10devicevalue').selectionStart = Q('dp10devicevalue').selectionEnd = 90000; }, 0);
7715 p10editdevicevalueValidate();
7716 }
7717