1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

switch to using just slice

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-02-12 11:37:02 -05:00
parent 8856d8f812
commit 749003830f

View File

@ -357,11 +357,8 @@ export const clusterStore = ClusterStore.getInstance<ClusterStore>();
export function getClusterIdFromHost(host: string): ClusterId | undefined {
// e.g host == "%clusterId.localhost:45345"
const subDomains = host.split(":")[0].split(".");
const lastTwoParts = subDomains.slice(-2);
lastTwoParts.pop(); // remove last entry (namely "localhost")
return lastTwoParts[0]; // ClusterId or undefined
return subDomains.slice(-2, -1)[0]; // ClusterId or undefined
}
export function getClusterFrameUrl(clusterId: ClusterId) {