mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Enforce semicolons in eslint
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
0f3f5611ba
commit
1477bb8274
531 files changed
+3979
-3975
No files matched your search
@@ -13,4 +13,4 @@ export default migration({
|
||||
store.set(contextName, { kubeConfig: value[1] });
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -11,4 +11,4 @@ export default migration({
|
||||
store.set(contextName, { kubeConfig: cluster.kubeConfig, icon: cluster.icon || null, preferences: cluster.preferences || {} });
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -6,7 +6,7 @@ export default migration({
|
||||
run(store, log) {
|
||||
for (const value of store) {
|
||||
const clusterKey = value[0];
|
||||
if (clusterKey === "__internal__") continue
|
||||
if (clusterKey === "__internal__") continue;
|
||||
const cluster = value[1];
|
||||
if (!cluster.preferences) cluster.preferences = {};
|
||||
if (cluster.icon) {
|
||||
@@ -16,4 +16,4 @@ export default migration({
|
||||
store.set(clusterKey, { contextName: clusterKey, kubeConfig: value[1].kubeConfig, preferences: value[1].preferences });
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,38 +1,38 @@
|
||||
import { migration } from "../migration-wrapper";
|
||||
import yaml from "js-yaml"
|
||||
import yaml from "js-yaml";
|
||||
|
||||
export default migration({
|
||||
version: "2.6.0-beta.3",
|
||||
run(store, log) {
|
||||
for (const value of store) {
|
||||
const clusterKey = value[0];
|
||||
if (clusterKey === "__internal__") continue
|
||||
if (clusterKey === "__internal__") continue;
|
||||
const cluster = value[1];
|
||||
if (!cluster.kubeConfig) continue
|
||||
const kubeConfig = yaml.safeLoad(cluster.kubeConfig)
|
||||
if (!kubeConfig.hasOwnProperty('users')) continue
|
||||
const userObj = kubeConfig.users[0]
|
||||
if (!cluster.kubeConfig) continue;
|
||||
const kubeConfig = yaml.safeLoad(cluster.kubeConfig);
|
||||
if (!kubeConfig.hasOwnProperty('users')) continue;
|
||||
const userObj = kubeConfig.users[0];
|
||||
if (userObj) {
|
||||
const user = userObj.user
|
||||
const user = userObj.user;
|
||||
if (user["auth-provider"] && user["auth-provider"].config) {
|
||||
const authConfig = user["auth-provider"].config
|
||||
const authConfig = user["auth-provider"].config;
|
||||
if (authConfig["access-token"]) {
|
||||
authConfig["access-token"] = `${authConfig["access-token"]}`
|
||||
authConfig["access-token"] = `${authConfig["access-token"]}`;
|
||||
}
|
||||
if (authConfig.expiry) {
|
||||
authConfig.expiry = `${authConfig.expiry}`
|
||||
authConfig.expiry = `${authConfig.expiry}`;
|
||||
}
|
||||
log(authConfig)
|
||||
user["auth-provider"].config = authConfig
|
||||
log(authConfig);
|
||||
user["auth-provider"].config = authConfig;
|
||||
kubeConfig.users = [{
|
||||
name: userObj.name,
|
||||
user: user
|
||||
}]
|
||||
cluster.kubeConfig = yaml.safeDump(kubeConfig)
|
||||
store.set(clusterKey, cluster)
|
||||
}];
|
||||
cluster.kubeConfig = yaml.safeDump(kubeConfig);
|
||||
store.set(clusterKey, cluster);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -6,10 +6,10 @@ export default migration({
|
||||
run(store, log) {
|
||||
for (const value of store) {
|
||||
const clusterKey = value[0];
|
||||
if (clusterKey === "__internal__") continue
|
||||
if (clusterKey === "__internal__") continue;
|
||||
const cluster = value[1];
|
||||
cluster.workspace = "default"
|
||||
store.set(clusterKey, cluster)
|
||||
cluster.workspace = "default";
|
||||
store.set(clusterKey, cluster);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,25 +1,25 @@
|
||||
// Add id for clusters and store them to array
|
||||
import { migration } from "../migration-wrapper";
|
||||
import { v4 as uuid } from "uuid"
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
export default migration({
|
||||
version: "2.7.0-beta.1",
|
||||
run(store, log) {
|
||||
const clusters: any[] = []
|
||||
const clusters: any[] = [];
|
||||
for (const value of store) {
|
||||
const clusterKey = value[0];
|
||||
if (clusterKey === "__internal__") continue
|
||||
if (clusterKey === "clusters") continue
|
||||
if (clusterKey === "__internal__") continue;
|
||||
if (clusterKey === "clusters") continue;
|
||||
const cluster = value[1];
|
||||
cluster.id = uuid()
|
||||
cluster.id = uuid();
|
||||
if (!cluster.preferences.clusterName) {
|
||||
cluster.preferences.clusterName = clusterKey
|
||||
cluster.preferences.clusterName = clusterKey;
|
||||
}
|
||||
clusters.push(cluster)
|
||||
store.delete(clusterKey)
|
||||
clusters.push(cluster);
|
||||
store.delete(clusterKey);
|
||||
}
|
||||
if (clusters.length > 0) {
|
||||
store.set("clusters", clusters)
|
||||
store.set("clusters", clusters);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,24 +1,24 @@
|
||||
// Move embedded kubeconfig into separate file and add reference to it to cluster settings
|
||||
// convert file path cluster icons to their base64 encoded versions
|
||||
|
||||
import path from "path"
|
||||
import { app, remote } from "electron"
|
||||
import path from "path";
|
||||
import { app, remote } from "electron";
|
||||
import { migration } from "../migration-wrapper";
|
||||
import fse from "fs-extra"
|
||||
import fse from "fs-extra";
|
||||
import { ClusterModel, ClusterStore } from "../../common/cluster-store";
|
||||
import { loadConfig } from "../../common/kube-helpers";
|
||||
|
||||
export default migration({
|
||||
version: "3.6.0-beta.1",
|
||||
run(store, printLog) {
|
||||
const userDataPath = (app || remote.app).getPath("userData")
|
||||
const userDataPath = (app || remote.app).getPath("userData");
|
||||
const kubeConfigBase = ClusterStore.getCustomKubeConfigPath("");
|
||||
const storedClusters: ClusterModel[] = store.get("clusters") || [];
|
||||
|
||||
if (!storedClusters.length) return;
|
||||
fse.ensureDirSync(kubeConfigBase);
|
||||
|
||||
printLog("Number of clusters to migrate: ", storedClusters.length)
|
||||
printLog("Number of clusters to migrate: ", storedClusters.length);
|
||||
const migratedClusters = storedClusters
|
||||
.map(cluster => {
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ export default migration({
|
||||
delete cluster.kubeConfig;
|
||||
|
||||
} catch (error) {
|
||||
printLog(`Failed to migrate Kubeconfig for cluster "${cluster.id}", removing cluster...`, error)
|
||||
printLog(`Failed to migrate Kubeconfig for cluster "${cluster.id}", removing cluster...`, error);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ export default migration({
|
||||
*/
|
||||
try {
|
||||
if (cluster.preferences?.icon) {
|
||||
printLog(`migrating ${cluster.preferences.icon} for ${cluster.preferences.clusterName}`)
|
||||
const iconPath = cluster.preferences.icon.replace("store://", "")
|
||||
printLog(`migrating ${cluster.preferences.icon} for ${cluster.preferences.clusterName}`);
|
||||
const iconPath = cluster.preferences.icon.replace("store://", "");
|
||||
const fileData = fse.readFileSync(path.join(userDataPath, iconPath));
|
||||
|
||||
cluster.preferences.icon = `data:;base64,${fileData.toString('base64')}`;
|
||||
@@ -49,7 +49,7 @@ export default migration({
|
||||
delete cluster.preferences?.icon;
|
||||
}
|
||||
} catch (error) {
|
||||
printLog(`Failed to migrate cluster icon for cluster "${cluster.id}"`, error)
|
||||
printLog(`Failed to migrate cluster icon for cluster "${cluster.id}"`, error);
|
||||
delete cluster.preferences.icon;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export default migration({
|
||||
|
||||
// "overwrite" the cluster configs
|
||||
if (migratedClusters.length > 0) {
|
||||
store.set("clusters", migratedClusters)
|
||||
store.set("clusters", migratedClusters);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,13 +1,13 @@
|
||||
// Cluster store migrations
|
||||
|
||||
import version200Beta2 from "./2.0.0-beta.2"
|
||||
import version241 from "./2.4.1"
|
||||
import version260Beta2 from "./2.6.0-beta.2"
|
||||
import version260Beta3 from "./2.6.0-beta.3"
|
||||
import version270Beta0 from "./2.7.0-beta.0"
|
||||
import version270Beta1 from "./2.7.0-beta.1"
|
||||
import version360Beta1 from "./3.6.0-beta.1"
|
||||
import snap from "./snap"
|
||||
import version200Beta2 from "./2.0.0-beta.2";
|
||||
import version241 from "./2.4.1";
|
||||
import version260Beta2 from "./2.6.0-beta.2";
|
||||
import version260Beta3 from "./2.6.0-beta.3";
|
||||
import version270Beta0 from "./2.7.0-beta.0";
|
||||
import version270Beta1 from "./2.7.0-beta.1";
|
||||
import version360Beta1 from "./3.6.0-beta.1";
|
||||
import snap from "./snap";
|
||||
|
||||
export default {
|
||||
...version200Beta2,
|
||||
@@ -18,4 +18,4 @@ export default {
|
||||
...version270Beta1,
|
||||
...version360Beta1,
|
||||
...snap
|
||||
}
|
||||
};
|
||||
@@ -3,31 +3,31 @@
|
||||
import { migration } from "../migration-wrapper";
|
||||
import { ClusterModel, ClusterStore } from "../../common/cluster-store";
|
||||
import { getAppVersion } from "../../common/utils/app-version";
|
||||
import fs from "fs"
|
||||
import fs from "fs";
|
||||
|
||||
export default migration({
|
||||
version: getAppVersion(), // Run always after upgrade
|
||||
run(store, printLog) {
|
||||
if (!process.env["SNAP"]) return;
|
||||
|
||||
printLog("Migrating embedded kubeconfig paths")
|
||||
printLog("Migrating embedded kubeconfig paths");
|
||||
const storedClusters: ClusterModel[] = store.get("clusters") || [];
|
||||
if (!storedClusters.length) return;
|
||||
|
||||
printLog("Number of clusters to migrate: ", storedClusters.length)
|
||||
printLog("Number of clusters to migrate: ", storedClusters.length);
|
||||
const migratedClusters = storedClusters
|
||||
.map(cluster => {
|
||||
/**
|
||||
* replace snap version with 'current' in kubeconfig path
|
||||
*/
|
||||
if (!fs.existsSync(cluster.kubeConfigPath)) {
|
||||
const kubeconfigPath = cluster.kubeConfigPath.replace(/\/snap\/kontena-lens\/[0-9]*\//, "/snap/kontena-lens/current/")
|
||||
cluster.kubeConfigPath = kubeconfigPath
|
||||
const kubeconfigPath = cluster.kubeConfigPath.replace(/\/snap\/kontena-lens\/[0-9]*\//, "/snap/kontena-lens/current/");
|
||||
cluster.kubeConfigPath = kubeconfigPath;
|
||||
}
|
||||
return cluster;
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
store.set("clusters", migratedClusters)
|
||||
store.set("clusters", migratedClusters);
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -6,4 +6,4 @@ export default migration({
|
||||
run(store) {
|
||||
store.set("lastSeenAppVersion", "0.0.0");
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
// User store migrations
|
||||
|
||||
import version210Beta4 from "./2.1.0-beta.4"
|
||||
import version210Beta4 from "./2.1.0-beta.4";
|
||||
|
||||
export default {
|
||||
...version210Beta4,
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user