diff --git a/apps/dashboard/web/polaris_web/web/src/util/func.js b/apps/dashboard/web/polaris_web/web/src/util/func.js index d82fd1f41a..74d6196d07 100644 --- a/apps/dashboard/web/polaris_web/web/src/util/func.js +++ b/apps/dashboard/web/polaris_web/web/src/util/func.js @@ -547,8 +547,18 @@ prettifyEpoch(epoch) { sortFunc: (data, sortKey, sortOrder) => { if(sortKey === 'displayName'){ let finalArr = data.sort((a, b) => { - const nameA = a?.displayName.toLowerCase() || a?.name.toLowerCase(); - const nameB = b?.displayName.toLowerCase() || b?.name.toLowerCase(); + let nameA = "" + if(a?.displayName?.length > 0){ + nameA = a?.displayName.toLowerCase() ; + }else if(a?.name.length > 0){ + nameA = a?.name.toLowerCase(); + } + let nameB = "" + if(b?.displayName?.length > 0){ + nameB = b?.displayName.toLowerCase() ; + }else if(b?.name.length > 0){ + nameB = b?.name.toLowerCase(); + } // Define a regex to check if the name starts with a digit const startsWithDigitA = /^\d/.test(nameA);