refactor(ui): simplify formatDeviceName with regex in devices template

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-17 11:05:26 +00:00
parent 03712cfb08
commit 581adf0e26
+3 -5
View File
@@ -329,11 +329,9 @@ function devicesPage() {
/** Extract the device name from the full token name (e.g. "Mobile App iPhone 15 Pro" → "iPhone 15 Pro"). */ /** Extract the device name from the full token name (e.g. "Mobile App iPhone 15 Pro" → "iPhone 15 Pro"). */
formatDeviceName(name) { formatDeviceName(name) {
if (!name) return 'Unknown Device'; if (!name) return 'Unknown Device';
const sep = name.indexOf(''); // Match either em dash () or hyphen (-) separators used by the mobile flows.
if (sep > -1) return name.substring(sep + 1).trim(); const match = name.match(/[\-]\s*(.+)$/);
const dash = name.indexOf('-'); return match ? match[1].trim() : name;
if (dash > -1) return name.substring(dash + 1).trim();
return name;
}, },
formatDate(d) { formatDate(d) {