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

shorter kubeconfig-sync file label

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-05-24 09:00:25 +03:00
parent 76d3a4b180
commit 3edcf9cbaa

View File

@ -35,6 +35,7 @@ import { catalogEntityFromCluster } from "../cluster-manager";
import { UserStore } from "../../common/user-store";
import { ClusterStore, UpdateClusterModel } from "../../common/cluster-store";
import { createHash } from "crypto";
import { homedir } from "os";
const logPrefix = "[KUBECONFIG-SYNC]:";
@ -187,7 +188,9 @@ export function computeDiff(contents: string, source: RootSource, filePath: stri
const entity = catalogEntityFromCluster(cluster);
entity.metadata.labels.file = filePath;
if (!filePath.startsWith(ClusterStore.storedKubeConfigFolder)) {
entity.metadata.labels.file = filePath.replace(homedir(), "~");
}
source.set(contextName, [cluster, entity]);
logger.debug(`${logPrefix} Added new cluster from sync`, { filePath, contextName });