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:
parent
8856d8f812
commit
749003830f
@ -357,11 +357,8 @@ export const clusterStore = ClusterStore.getInstance<ClusterStore>();
|
|||||||
export function getClusterIdFromHost(host: string): ClusterId | undefined {
|
export function getClusterIdFromHost(host: string): ClusterId | undefined {
|
||||||
// e.g host == "%clusterId.localhost:45345"
|
// e.g host == "%clusterId.localhost:45345"
|
||||||
const subDomains = host.split(":")[0].split(".");
|
const subDomains = host.split(":")[0].split(".");
|
||||||
const lastTwoParts = subDomains.slice(-2);
|
|
||||||
|
|
||||||
lastTwoParts.pop(); // remove last entry (namely "localhost")
|
return subDomains.slice(-2, -1)[0]; // ClusterId or undefined
|
||||||
|
|
||||||
return lastTwoParts[0]; // ClusterId or undefined
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getClusterFrameUrl(clusterId: ClusterId) {
|
export function getClusterFrameUrl(clusterId: ClusterId) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user