Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"tailwindcss": "^3.4.14",
"typescript": "^5.5.3",
"typescript-eslint": "^8.7.0",
"vite": "^6.1.1",
"vite": "^6.2.4",
"vite-plugin-svgr": "^4.3.0"
}
}
1 change: 0 additions & 1 deletion frontend/src/hooks/useLinkOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function useLinkOperationsBase() {

const interconnectDevices = await authenticatedApiClient.getDevicesByType('INTERCONNECT');
// only two devices here so find is okay
// TODO might have to make this more robust
return interconnectDevices.data?.find(d => d.name === connectionInfo.interconnectDeviceName);
};

Expand Down
12 changes: 9 additions & 3 deletions frontend/src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,16 @@ export const getCurvedPath = (
};

export function substringFromFirstNumber(port: string) {
const idx = port.search(/\d/); // find the index of the first number
if (idx !== -1) {
return port.substring(0, idx) + port.substring(idx); // concatenate prefix and the rest
// match up to the first 3 alphabetic characters followed by any numbers
const match = port.match(/^([a-zA-Z]{1,3})\D*(\d.*)$/);

if (match) {
const prefix = match[1]; // up to the first 3 alphabetic characters
const numbers = match[2]; // all numbers after the prefix
return prefix + numbers;
}

// if no match, return an empty string
return "";
}

Expand Down
Loading