fix(router-frontend): fix bugs in front-end

fix the bug in nodeslistman.js that causes long names of offline nodes are shown
This commit is contained in:
Frank.R.Wu 2021-11-23 14:57:50 +08:00
parent 2fb58a9c27
commit d4c82f5724

View File

@ -322,10 +322,12 @@ var onListNodes = function (obj) {
"render": function (data, type, row, meta) {
const firstBg = data.indexOf(">");
const secondSl = data.substring(1).indexOf("<");
const aTag = data.substring(0, firstBg + 1)
const aTagTail = data.substring(secondSl + 1)
const name = data.substring(firstBg + 1, secondSl + 1)
let html = name.length > 15 ?
const aTag = firstBg === -1 ? "" : data.substring(0, firstBg + 1);
const aTagTail = secondSl === -1 ? "" : data.substring(secondSl + 1);
const name = firstBg === -1 || secondSl === -1 ?
data :
data.substring(firstBg + 1, secondSl + 1);
const html = name.length > 15 ?
`<span title='${name}'>${name.substring(0, 15)} ...</span>` :
name;
return aTag + html + aTagTail;