mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Lint: comma-spacing (error) & comma-dangle (error) (#4200)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
02e77afcd1
commit
c6dce043a7
406 files changed
+1590
-1580
No files matched your search
@@ -35,13 +35,13 @@ jest.mock("winston", () => ({
|
||||
simple: jest.fn(),
|
||||
label: jest.fn(),
|
||||
timestamp: jest.fn(),
|
||||
printf: jest.fn()
|
||||
printf: jest.fn(),
|
||||
},
|
||||
createLogger: jest.fn().mockReturnValue(logger),
|
||||
transports: {
|
||||
Console: jest.fn(),
|
||||
File: jest.fn(),
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("../../common/ipc");
|
||||
@@ -85,7 +85,7 @@ describe("create clusters", () => {
|
||||
}],
|
||||
kind: "Config",
|
||||
preferences: {},
|
||||
})
|
||||
}),
|
||||
};
|
||||
|
||||
mockFs(mockOpts);
|
||||
@@ -93,7 +93,7 @@ describe("create clusters", () => {
|
||||
c = new Cluster({
|
||||
id: "foo",
|
||||
contextName: "minikube",
|
||||
kubeConfigPath: "minikube-config.yml"
|
||||
kubeConfigPath: "minikube-config.yml",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -126,12 +126,12 @@ describe("create clusters", () => {
|
||||
}({
|
||||
id: "foo",
|
||||
contextName: "minikube",
|
||||
kubeConfigPath: "minikube-config.yml"
|
||||
kubeConfigPath: "minikube-config.yml",
|
||||
});
|
||||
|
||||
c.contextHandler = {
|
||||
ensureServer: jest.fn(),
|
||||
stopServer: jest.fn()
|
||||
stopServer: jest.fn(),
|
||||
} as any;
|
||||
|
||||
jest.spyOn(c, "reconnect");
|
||||
|
||||
@@ -91,7 +91,7 @@ AppPaths.init();
|
||||
describe("ContextHandler", () => {
|
||||
beforeEach(() => {
|
||||
mockFs({
|
||||
"tmp": {}
|
||||
"tmp": {},
|
||||
});
|
||||
|
||||
PrometheusProviderRegistry.createInstance();
|
||||
|
||||
@@ -41,7 +41,7 @@ jest.mock("winston", () => ({
|
||||
transports: {
|
||||
Console: jest.fn(),
|
||||
File: jest.fn(),
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("../../common/ipc");
|
||||
|
||||
@@ -43,7 +43,7 @@ jest.mock("winston", () => ({
|
||||
transports: {
|
||||
Console: jest.fn(),
|
||||
File: jest.fn(),
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
import { KubeconfigManager } from "../kubeconfig-manager";
|
||||
@@ -102,7 +102,7 @@ describe("kubeconfig manager tests", () => {
|
||||
}],
|
||||
kind: "Config",
|
||||
preferences: {},
|
||||
})
|
||||
}),
|
||||
};
|
||||
|
||||
mockFs(mockOpts);
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("isLongRunningRequest", () => {
|
||||
it("returns true on watches", () => {
|
||||
["watch=true", "watch=1", "watch"].forEach((param) => {
|
||||
expect(
|
||||
isLongRunningRequest(`/api/v1/namespaces/default/pods?${param}`)
|
||||
isLongRunningRequest(`/api/v1/namespaces/default/pods?${param}`),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -33,7 +33,7 @@ describe("isLongRunningRequest", () => {
|
||||
it("returns false on disabled watches", () => {
|
||||
["watch=false", "watch=0", ""].forEach((param) => {
|
||||
expect(
|
||||
isLongRunningRequest(`/api/v1/namespaces/default/pods?${param}`)
|
||||
isLongRunningRequest(`/api/v1/namespaces/default/pods?${param}`),
|
||||
).toBeFalsy();
|
||||
});
|
||||
});
|
||||
@@ -41,7 +41,7 @@ describe("isLongRunningRequest", () => {
|
||||
it("returns true on follows", () => {
|
||||
["follow=true", "follow=1", "follow"].forEach((param) => {
|
||||
expect(
|
||||
isLongRunningRequest(`/api/v1/namespaces/default/pods/foo/log?${param}`)
|
||||
isLongRunningRequest(`/api/v1/namespaces/default/pods/foo/log?${param}`),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -49,7 +49,7 @@ describe("isLongRunningRequest", () => {
|
||||
it("returns false on disabled follows", () => {
|
||||
["follow=false", "follow=0", ""].forEach((param) => {
|
||||
expect(
|
||||
isLongRunningRequest(`/api/v1/namespaces/default/pods/foo/log?${param}`)
|
||||
isLongRunningRequest(`/api/v1/namespaces/default/pods/foo/log?${param}`),
|
||||
).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ describe("Router", () => {
|
||||
it("blocks path traversal attacks", async () => {
|
||||
const response: any = {
|
||||
statusCode: 200,
|
||||
end: jest.fn()
|
||||
end: jest.fn(),
|
||||
};
|
||||
|
||||
await (Router as any).handleStaticFile({
|
||||
@@ -63,10 +63,10 @@ describe("Router", () => {
|
||||
statusCode: 200,
|
||||
write: jest.fn(),
|
||||
setHeader: jest.fn(),
|
||||
end: jest.fn()
|
||||
end: jest.fn(),
|
||||
};
|
||||
const req: any = {
|
||||
url: ""
|
||||
url: "",
|
||||
};
|
||||
|
||||
await (Router as any).handleStaticFile({
|
||||
|
||||
@@ -67,7 +67,7 @@ describe("kubeconfig-sync.source tests", () => {
|
||||
clusters: [],
|
||||
users: [],
|
||||
contexts: [],
|
||||
currentContext: "foobar"
|
||||
currentContext: "foobar",
|
||||
});
|
||||
|
||||
expect(configToModels(config, "").length).toBe(0);
|
||||
@@ -88,7 +88,7 @@ describe("kubeconfig-sync.source tests", () => {
|
||||
name: "context-name",
|
||||
user: "user-name",
|
||||
}],
|
||||
currentContext: "foobar"
|
||||
currentContext: "foobar",
|
||||
});
|
||||
|
||||
const models = configToModels(config, "/bar");
|
||||
@@ -135,7 +135,7 @@ describe("kubeconfig-sync.source tests", () => {
|
||||
user: "user-name",
|
||||
},
|
||||
}],
|
||||
currentContext: "foobar"
|
||||
currentContext: "foobar",
|
||||
});
|
||||
const rootSource = new ObservableMap<string, [Cluster, CatalogEntity]>();
|
||||
const filePath = "/bar";
|
||||
@@ -178,7 +178,7 @@ describe("kubeconfig-sync.source tests", () => {
|
||||
user: "user-name",
|
||||
},
|
||||
}],
|
||||
currentContext: "foobar"
|
||||
currentContext: "foobar",
|
||||
});
|
||||
const rootSource = new ObservableMap<string, [Cluster, CatalogEntity]>();
|
||||
const filePath = "/bar";
|
||||
@@ -232,7 +232,7 @@ describe("kubeconfig-sync.source tests", () => {
|
||||
user: "user-name",
|
||||
},
|
||||
}],
|
||||
currentContext: "foobar"
|
||||
currentContext: "foobar",
|
||||
});
|
||||
const rootSource = new ObservableMap<string, [Cluster, CatalogEntity]>();
|
||||
const filePath = "/bar";
|
||||
@@ -276,7 +276,7 @@ describe("kubeconfig-sync.source tests", () => {
|
||||
user: "user-name",
|
||||
},
|
||||
}],
|
||||
currentContext: "foobar"
|
||||
currentContext: "foobar",
|
||||
});
|
||||
|
||||
computeDiff(newContents, rootSource, filePath);
|
||||
|
||||
@@ -29,18 +29,18 @@ export const catalogEntity = new GeneralEntity({
|
||||
uid: "catalog-entity",
|
||||
name: "Catalog",
|
||||
source: "app",
|
||||
labels: {}
|
||||
labels: {},
|
||||
},
|
||||
spec: {
|
||||
path: catalogURL(),
|
||||
icon: {
|
||||
material: "view_list",
|
||||
background: "#3d90ce"
|
||||
}
|
||||
background: "#3d90ce",
|
||||
},
|
||||
},
|
||||
status: {
|
||||
phase: "active",
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const preferencesEntity = new GeneralEntity({
|
||||
@@ -48,18 +48,18 @@ const preferencesEntity = new GeneralEntity({
|
||||
uid: "preferences-entity",
|
||||
name: "Preferences",
|
||||
source: "app",
|
||||
labels: {}
|
||||
labels: {},
|
||||
},
|
||||
spec: {
|
||||
path: preferencesURL(),
|
||||
icon: {
|
||||
material: "settings",
|
||||
background: "#3d90ce"
|
||||
}
|
||||
background: "#3d90ce",
|
||||
},
|
||||
},
|
||||
status: {
|
||||
phase: "active",
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const welcomePageEntity = new GeneralEntity({
|
||||
@@ -67,24 +67,24 @@ const welcomePageEntity = new GeneralEntity({
|
||||
uid: "welcome-page-entity",
|
||||
name: "Welcome Page",
|
||||
source: "app",
|
||||
labels: {}
|
||||
labels: {},
|
||||
},
|
||||
spec: {
|
||||
path: welcomeURL(),
|
||||
icon: {
|
||||
material: "meeting_room",
|
||||
background: "#3d90ce"
|
||||
}
|
||||
background: "#3d90ce",
|
||||
},
|
||||
},
|
||||
status: {
|
||||
phase: "active",
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const generalEntities = observable([
|
||||
catalogEntity,
|
||||
preferencesEntity,
|
||||
welcomePageEntity
|
||||
welcomePageEntity,
|
||||
]);
|
||||
|
||||
export function syncGeneralEntities() {
|
||||
|
||||
@@ -89,7 +89,7 @@ export class KubeconfigSyncManager extends Singleton {
|
||||
catalogEntityRegistry.addComputedSource(KubeconfigSyncManager.syncName, computed(() => (
|
||||
Array.from(iter.flatMap(
|
||||
this.sources.values(),
|
||||
([entities]) => entities.get()
|
||||
([entities]) => entities.get(),
|
||||
))
|
||||
)));
|
||||
|
||||
|
||||
@@ -75,15 +75,15 @@ export function syncWeblinks() {
|
||||
uid: weblinkData.id,
|
||||
name: weblinkData.name,
|
||||
source: "local",
|
||||
labels: {}
|
||||
labels: {},
|
||||
},
|
||||
spec: {
|
||||
url: weblinkData.url
|
||||
url: weblinkData.url,
|
||||
},
|
||||
status: {
|
||||
phase: "available",
|
||||
active: true
|
||||
}
|
||||
active: true,
|
||||
},
|
||||
});
|
||||
|
||||
webLinkEntities.set(weblinkData.id, [
|
||||
|
||||
@@ -52,28 +52,28 @@ describe("CatalogEntityRegistry", () => {
|
||||
uid: "test",
|
||||
name: "test-link",
|
||||
source: "test",
|
||||
labels: {}
|
||||
labels: {},
|
||||
},
|
||||
spec: {
|
||||
url: "https://k8slens.dev"
|
||||
url: "https://k8slens.dev",
|
||||
},
|
||||
status: {
|
||||
phase: "available"
|
||||
}
|
||||
phase: "available",
|
||||
},
|
||||
});
|
||||
const invalidEntity = new InvalidEntity({
|
||||
metadata: {
|
||||
uid: "invalid",
|
||||
name: "test-link",
|
||||
source: "test",
|
||||
labels: {}
|
||||
labels: {},
|
||||
},
|
||||
spec: {
|
||||
url: "https://k8slens.dev"
|
||||
url: "https://k8slens.dev",
|
||||
},
|
||||
status: {
|
||||
phase: "available"
|
||||
}
|
||||
phase: "available",
|
||||
},
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -46,8 +46,8 @@ export class CatalogEntityRegistry {
|
||||
return Array.from(
|
||||
iter.filter(
|
||||
iter.flatMap(this.sources.values(), source => source.get()),
|
||||
entity => this.categoryRegistry.getCategoryForEntity(entity)
|
||||
)
|
||||
entity => this.categoryRegistry.getCategoryForEntity(entity),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,14 +51,14 @@ export class ClusterManager extends Singleton {
|
||||
reaction(
|
||||
() => this.store.clustersList.map(c => c.getState()),
|
||||
() => this.updateCatalog(this.store.clustersList),
|
||||
{ fireImmediately: false, }
|
||||
{ fireImmediately: false },
|
||||
);
|
||||
|
||||
// reacting to every cluster's preferences change and total amount of items
|
||||
reaction(
|
||||
() => this.store.clustersList.map(c => toJS(c.preferences)),
|
||||
() => this.updateCatalog(this.store.clustersList),
|
||||
{ fireImmediately: false, }
|
||||
{ fireImmediately: false },
|
||||
);
|
||||
|
||||
reaction(() => catalogEntityRegistry.getItemsForApiKind<KubernetesCluster>("entity.k8slens.dev/v1alpha1", "KubernetesCluster"), (entities) => {
|
||||
@@ -263,7 +263,7 @@ export function catalogEntityFromCluster(cluster: Cluster) {
|
||||
spec: {
|
||||
kubeconfigPath: cluster.kubeConfigPath,
|
||||
kubeconfigContext: cluster.contextName,
|
||||
icon: {}
|
||||
icon: {},
|
||||
},
|
||||
status: {
|
||||
phase: cluster.disconnected
|
||||
@@ -271,7 +271,7 @@ export function catalogEntityFromCluster(cluster: Cluster) {
|
||||
: LensKubernetesClusterStatus.CONNECTED,
|
||||
reason: "",
|
||||
message: "",
|
||||
active: !cluster.disconnected
|
||||
}
|
||||
active: !cluster.disconnected,
|
||||
},
|
||||
});
|
||||
}
|
||||
+4
-4
@@ -251,7 +251,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
logger.debug(`[CLUSTER]: Cluster init success`, {
|
||||
id: this.id,
|
||||
context: this.contextName,
|
||||
apiUrl: this.apiUrl
|
||||
apiUrl: this.apiUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -306,7 +306,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
if (ipcMain) {
|
||||
this.eventDisposers.push(
|
||||
reaction(() => this.getState(), () => this.pushState()),
|
||||
reaction(() => this.prometheusPreferences, (prefs) => this.contextHandler.setupPrometheus(prefs), { equals: comparer.structural, }),
|
||||
reaction(() => this.prometheusPreferences, (prefs) => this.contextHandler.setupPrometheus(prefs), { equals: comparer.structural }),
|
||||
() => {
|
||||
clearInterval(refreshTimer);
|
||||
clearInterval(refreshMetadataTimer);
|
||||
@@ -545,7 +545,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
const accessReview = await authApi.createSelfSubjectAccessReview({
|
||||
apiVersion: "authorization.k8s.io/v1",
|
||||
kind: "SelfSubjectAccessReview",
|
||||
spec: { resourceAttributes }
|
||||
spec: { resourceAttributes },
|
||||
});
|
||||
|
||||
return accessReview.body.status.allowed;
|
||||
@@ -687,7 +687,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
resource: apiResource.apiName,
|
||||
group: apiResource.group,
|
||||
verb: "list",
|
||||
namespace
|
||||
namespace,
|
||||
});
|
||||
|
||||
this.resourceAccessStatuses.set(apiResource, result);
|
||||
|
||||
@@ -90,7 +90,7 @@ export class ContextHandler {
|
||||
const proxyConfig = await this.cluster.getProxyKubeconfig();
|
||||
const apiClient = proxyConfig.makeApiClient(CoreV1Api);
|
||||
const potentialServices = await Promise.allSettled(
|
||||
providers.map(provider => provider.getPrometheusService(apiClient))
|
||||
providers.map(provider => provider.getPrometheusService(apiClient)),
|
||||
);
|
||||
|
||||
for (const result of potentialServices) {
|
||||
|
||||
@@ -74,7 +74,7 @@ const charts = new Map([
|
||||
repo: "stable",
|
||||
digest: "test",
|
||||
created: "now",
|
||||
}
|
||||
},
|
||||
]),
|
||||
"redis": sortCharts([
|
||||
{
|
||||
@@ -92,7 +92,7 @@ const charts = new Map([
|
||||
repo: "stable",
|
||||
digest: "test",
|
||||
created: "now",
|
||||
}
|
||||
},
|
||||
]),
|
||||
}],
|
||||
["experiment", {
|
||||
@@ -113,7 +113,7 @@ const charts = new Map([
|
||||
digest: "test",
|
||||
deprecated: true,
|
||||
created: "now",
|
||||
}
|
||||
},
|
||||
]),
|
||||
}],
|
||||
["bitnami", {
|
||||
@@ -133,7 +133,7 @@ const charts = new Map([
|
||||
repo: "bitnami",
|
||||
digest: "test",
|
||||
created: "now",
|
||||
}
|
||||
},
|
||||
]),
|
||||
"pretzel": sortCharts([
|
||||
{
|
||||
@@ -151,7 +151,7 @@ const charts = new Map([
|
||||
repo: "bitnami",
|
||||
digest: "test",
|
||||
created: "now",
|
||||
}
|
||||
},
|
||||
]),
|
||||
}],
|
||||
]);
|
||||
|
||||
@@ -62,7 +62,7 @@ describe("Helm Service tests", () => {
|
||||
repo: "stable",
|
||||
digest: "test",
|
||||
created: "now",
|
||||
}
|
||||
},
|
||||
],
|
||||
"invalid-semver": [
|
||||
{
|
||||
@@ -114,8 +114,8 @@ describe("Helm Service tests", () => {
|
||||
repo: "stable",
|
||||
digest: "test",
|
||||
created: "now",
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
experiment: {
|
||||
"fairwind": [
|
||||
@@ -136,8 +136,8 @@ describe("Helm Service tests", () => {
|
||||
digest: "test",
|
||||
created: "now",
|
||||
},
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -189,9 +189,9 @@ describe("Helm Service tests", () => {
|
||||
repo: "bitnami",
|
||||
digest: "test",
|
||||
created: "now",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -143,9 +143,9 @@ function normalizeHelmCharts(repoName: string, entries: RepoHelmChartList): Repo
|
||||
repo: repoName,
|
||||
})),
|
||||
),
|
||||
] as const
|
||||
] as const,
|
||||
),
|
||||
([, charts]) => !charts.every(chart => chart.deprecated),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ export class HelmCli extends LensBinary {
|
||||
version,
|
||||
baseDir,
|
||||
originalBinaryName: "helm",
|
||||
newBinaryName: "helm3"
|
||||
newBinaryName: "helm3",
|
||||
};
|
||||
|
||||
super(opts);
|
||||
|
||||
@@ -69,8 +69,8 @@ export async function installChart(chart: string, values: any, name: string | un
|
||||
log: stdout,
|
||||
release: {
|
||||
name: releaseName,
|
||||
namespace
|
||||
}
|
||||
namespace,
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
throw error?.stderr || error;
|
||||
@@ -91,7 +91,7 @@ export async function upgradeRelease(name: string, chart: string, values: any, n
|
||||
|
||||
return {
|
||||
log: stdout,
|
||||
release: getRelease(name, namespace, cluster)
|
||||
release: getRelease(name, namespace, cluster),
|
||||
};
|
||||
} catch (error) {
|
||||
throw error?.stderr || error;
|
||||
|
||||
@@ -112,7 +112,7 @@ export class HelmRepoManager extends Singleton {
|
||||
} catch { }
|
||||
|
||||
return {
|
||||
repositories: []
|
||||
repositories: [],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ export class HelmRepoManager extends Singleton {
|
||||
|
||||
return repositories.map(repo => ({
|
||||
...repo,
|
||||
cacheFilePath: `${this.helmEnv.HELM_REPOSITORY_CACHE}/${repo.name}-index.yaml`
|
||||
cacheFilePath: `${this.helmEnv.HELM_REPOSITORY_CACHE}/${repo.name}-index.yaml`,
|
||||
}));
|
||||
} catch (error) {
|
||||
logger.error(`[HELM]: repositories listing error "${error}"`);
|
||||
|
||||
@@ -42,7 +42,7 @@ class HelmService {
|
||||
const repositories = await HelmRepoManager.getInstance().repositories();
|
||||
|
||||
return Object.fromEntries(
|
||||
await Promise.all(repositories.map(async repo => [repo.name, await HelmChartManager.forRepo(repo).charts()]))
|
||||
await Promise.all(repositories.map(async repo => [repo.name, await HelmChartManager.forRepo(repo).charts()])),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ export class KubeAuthProxy {
|
||||
"--context", `${this.cluster.contextName}`,
|
||||
"--accept-hosts", this.acceptHosts,
|
||||
"--reject-paths", "^[^/]",
|
||||
"--api-prefix", this.apiPrefix
|
||||
"--api-prefix", this.apiPrefix,
|
||||
];
|
||||
|
||||
if (process.env.DEBUG_PROXY === "true") {
|
||||
@@ -90,7 +90,7 @@ export class KubeAuthProxy {
|
||||
}
|
||||
logger.debug(`spawning kubectl proxy with args: ${args}`);
|
||||
|
||||
this.proxyProcess = spawn(proxyBin, args, { env: this.env, });
|
||||
this.proxyProcess = spawn(proxyBin, args, { env: this.env });
|
||||
this.proxyProcess.on("error", (error) => {
|
||||
this.sendIpcLogMessage({ data: error.message, error: true });
|
||||
this.exit();
|
||||
|
||||
@@ -105,7 +105,7 @@ export class KubeconfigManager {
|
||||
name: contextName,
|
||||
server: this.resolveProxyUrl,
|
||||
skipTLSVerify: undefined,
|
||||
}
|
||||
},
|
||||
],
|
||||
users: [
|
||||
{ name: "proxy" },
|
||||
@@ -116,8 +116,8 @@ export class KubeconfigManager {
|
||||
name: contextName,
|
||||
cluster: contextName,
|
||||
namespace: cluster.defaultNamespace || kubeConfig.getContextObject(contextName).namespace,
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
};
|
||||
// write
|
||||
const configYaml = dumpConfigYaml(proxyConfig);
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ const kubectlMap: Map<string, string> = new Map([
|
||||
["1.18", "1.18.20"],
|
||||
["1.19", "1.19.12"],
|
||||
["1.20", "1.20.8"],
|
||||
["1.21", bundledVersion]
|
||||
["1.21", bundledVersion],
|
||||
]);
|
||||
let bundledPath: string;
|
||||
const initScriptVersionString = "# lens-initscript v3\n";
|
||||
|
||||
@@ -154,7 +154,7 @@ export class LensBinary {
|
||||
this.logger.debug(`Extracting ${this.originalBinaryName} binary`);
|
||||
tar.x({
|
||||
file: this.tarPath,
|
||||
cwd: this.dirname
|
||||
cwd: this.dirname,
|
||||
}).then((() => {
|
||||
resolve();
|
||||
}));
|
||||
@@ -187,7 +187,7 @@ export class LensBinary {
|
||||
const requestOpts: request.UriOptions & request.CoreOptions = {
|
||||
uri: url,
|
||||
gzip: true,
|
||||
...this.requestOpts
|
||||
...this.requestOpts,
|
||||
};
|
||||
const stream = request(requestOpts);
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ export class LensProxy extends Singleton {
|
||||
this.proxyServer = spdy.createServer({
|
||||
spdy: {
|
||||
plain: true,
|
||||
protocols: ["http/1.1", "spdy/3.1"]
|
||||
}
|
||||
protocols: ["http/1.1", "spdy/3.1"],
|
||||
},
|
||||
}, (req: http.IncomingMessage, res: http.ServerResponse) => {
|
||||
this.handleRequest(req, res);
|
||||
});
|
||||
|
||||
+27
-27
@@ -38,7 +38,7 @@ interface MenuItemsOpts extends MenuItemConstructorOptions {
|
||||
|
||||
export function initMenu(windowManager: WindowManager) {
|
||||
return autorun(() => buildMenu(windowManager), {
|
||||
delay: 100
|
||||
delay: 100,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ export function showAbout(browserWindow: BrowserWindow) {
|
||||
type: "info",
|
||||
buttons: ["Close"],
|
||||
message: productName,
|
||||
detail: appInfo.join("\r\n")
|
||||
detail: appInfo.join("\r\n"),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "about",
|
||||
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
||||
showAbout(browserWindow);
|
||||
}
|
||||
},
|
||||
},
|
||||
{ type: "separator" },
|
||||
{
|
||||
@@ -98,7 +98,7 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "extensions",
|
||||
click() {
|
||||
navigate(extensionsURL());
|
||||
}
|
||||
},
|
||||
},
|
||||
{ type: "separator" },
|
||||
{ role: "services" },
|
||||
@@ -113,8 +113,8 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "quit",
|
||||
click() {
|
||||
exitApp();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
const fileMenu: MenuItemsOpts = {
|
||||
@@ -127,7 +127,7 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "add-cluster",
|
||||
click() {
|
||||
navigate(addClusterURL());
|
||||
}
|
||||
},
|
||||
},
|
||||
...ignoreOnMac([
|
||||
{ type: "separator" },
|
||||
@@ -137,15 +137,15 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
accelerator: "Ctrl+,",
|
||||
click() {
|
||||
navigate(preferencesURL());
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Extensions",
|
||||
accelerator: "Ctrl+Shift+E",
|
||||
click() {
|
||||
navigate(extensionsURL());
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
]),
|
||||
|
||||
{ type: "separator" },
|
||||
@@ -154,8 +154,8 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
{
|
||||
role: "close",
|
||||
label: "Close Window",
|
||||
accelerator: "Shift+Cmd+W"
|
||||
}
|
||||
accelerator: "Shift+Cmd+W",
|
||||
},
|
||||
] as MenuItemConstructorOptions[] : []),
|
||||
|
||||
...ignoreOnMac([
|
||||
@@ -165,9 +165,9 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "quit",
|
||||
click() {
|
||||
exitApp();
|
||||
}
|
||||
}
|
||||
])
|
||||
},
|
||||
},
|
||||
]),
|
||||
],
|
||||
};
|
||||
const editMenu: MenuItemsOpts = {
|
||||
@@ -183,7 +183,7 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
{ role: "delete" },
|
||||
{ type: "separator" },
|
||||
{ role: "selectAll" },
|
||||
]
|
||||
],
|
||||
};
|
||||
const viewMenu: MenuItemsOpts = {
|
||||
label: "View",
|
||||
@@ -195,7 +195,7 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "catalog",
|
||||
click() {
|
||||
navigate(catalogURL());
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Command Palette...",
|
||||
@@ -203,7 +203,7 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "command-palette",
|
||||
click() {
|
||||
broadcastMessage("command-palette:open");
|
||||
}
|
||||
},
|
||||
},
|
||||
{ type: "separator" },
|
||||
{
|
||||
@@ -212,7 +212,7 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "go-back",
|
||||
click() {
|
||||
webContents.getAllWebContents().filter(wc => wc.getType() === "window").forEach(wc => wc.goBack());
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Forward",
|
||||
@@ -220,7 +220,7 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "go-forward",
|
||||
click() {
|
||||
webContents.getAllWebContents().filter(wc => wc.getType() === "window").forEach(wc => wc.goForward());
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Reload",
|
||||
@@ -228,7 +228,7 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "reload",
|
||||
click() {
|
||||
windowManager.reload();
|
||||
}
|
||||
},
|
||||
},
|
||||
{ role: "toggleDevTools" },
|
||||
{ type: "separator" },
|
||||
@@ -236,8 +236,8 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
{ role: "zoomIn" },
|
||||
{ role: "zoomOut" },
|
||||
{ type: "separator" },
|
||||
{ role: "togglefullscreen" }
|
||||
]
|
||||
{ role: "togglefullscreen" },
|
||||
],
|
||||
};
|
||||
const helpMenu: MenuItemsOpts = {
|
||||
role: "help",
|
||||
@@ -270,10 +270,10 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
id: "about",
|
||||
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
||||
showAbout(browserWindow);
|
||||
}
|
||||
}
|
||||
])
|
||||
]
|
||||
},
|
||||
},
|
||||
]),
|
||||
],
|
||||
};
|
||||
// Prepare menu items order
|
||||
const appMenu = new Map([
|
||||
|
||||
@@ -39,7 +39,7 @@ export class PrometheusLens extends PrometheusProvider {
|
||||
id: this.id,
|
||||
namespace: service.metadata.namespace,
|
||||
service: service.metadata.name,
|
||||
port: service.spec.ports[0].port
|
||||
port: service.spec.ports[0].port,
|
||||
};
|
||||
} catch(error) {
|
||||
logger.warn(`PrometheusLens: failed to list services: ${error.response.body.message}`);
|
||||
|
||||
@@ -53,7 +53,7 @@ export abstract class PrometheusProvider {
|
||||
id: this.id,
|
||||
namespace: service.metadata.namespace,
|
||||
service: service.metadata.name,
|
||||
port: service.spec.ports[0].port
|
||||
port: service.spec.ports[0].port,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class PrometheusStacklight extends PrometheusProvider {
|
||||
id: this.id,
|
||||
namespace: service.metadata.namespace,
|
||||
service: service.metadata.name,
|
||||
port: service.spec.ports[0].port
|
||||
port: service.spec.ports[0].port,
|
||||
};
|
||||
} catch(error) {
|
||||
logger.warn(`PrometheusLens: failed to list services: ${error.response.body.message}`);
|
||||
|
||||
@@ -60,7 +60,7 @@ function throwIfDefined(val: any): void {
|
||||
describe("protocol router tests", () => {
|
||||
beforeEach(() => {
|
||||
mockFs({
|
||||
"tmp": {}
|
||||
"tmp": {},
|
||||
});
|
||||
ExtensionsStore.createInstance();
|
||||
ExtensionLoader.createInstance();
|
||||
|
||||
@@ -62,7 +62,7 @@ export class ResourceApplier {
|
||||
args.push(
|
||||
"--type", "json",
|
||||
"--patch", JSON.stringify(patch),
|
||||
"-o", "json"
|
||||
"-o", "json",
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
+2
-2
@@ -70,7 +70,7 @@ function getMimeType(filename: string) {
|
||||
svg: "image/svg+xml",
|
||||
js: "application/javascript",
|
||||
woff2: "font/woff2",
|
||||
ttf: "font/ttf"
|
||||
ttf: "font/ttf",
|
||||
};
|
||||
|
||||
return mimeTypes[path.extname(filename).slice(1)] || "text/plain";
|
||||
@@ -118,7 +118,7 @@ export class Router {
|
||||
response: res,
|
||||
query: url.searchParams,
|
||||
payload,
|
||||
params
|
||||
params,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -35,17 +35,17 @@ function generateKubeConfig(username: string, secret: V1Secret, cluster: Cluster
|
||||
"name": cluster.contextName,
|
||||
"cluster": {
|
||||
"server": cluster.apiUrl,
|
||||
"certificate-authority-data": secret.data["ca.crt"]
|
||||
}
|
||||
}
|
||||
"certificate-authority-data": secret.data["ca.crt"],
|
||||
},
|
||||
},
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"name": username,
|
||||
"user": {
|
||||
"token": tokenData.toString("utf8"),
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"contexts": [
|
||||
{
|
||||
@@ -54,10 +54,10 @@ function generateKubeConfig(username: string, secret: V1Secret, cluster: Cluster
|
||||
"user": username,
|
||||
"cluster": cluster.contextName,
|
||||
"namespace": secret.metadata.namespace,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"current-context": cluster.contextName
|
||||
"current-context": cluster.contextName,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ export class MetricsRoute {
|
||||
try {
|
||||
const [prometheusPath, prometheusProvider] = await Promise.all([
|
||||
cluster.contextHandler.getPrometheusPath(),
|
||||
cluster.contextHandler.getPrometheusProvider()
|
||||
cluster.contextHandler.getPrometheusProvider(),
|
||||
]);
|
||||
|
||||
prometheusMetadata.provider = prometheusProvider?.id;
|
||||
|
||||
@@ -79,11 +79,11 @@ class PortForward {
|
||||
"port-forward",
|
||||
"-n", this.namespace,
|
||||
`${this.kind}/${this.name}`,
|
||||
`${this.forwardPort ?? ""}:${this.port}`
|
||||
`${this.forwardPort ?? ""}:${this.port}`,
|
||||
];
|
||||
|
||||
this.process = spawn(kubectlBin, args, {
|
||||
env: process.env
|
||||
env: process.env,
|
||||
});
|
||||
PortForward.portForwards.push(this);
|
||||
this.process.on("exit", () => {
|
||||
@@ -158,7 +158,7 @@ export class PortForwardRoute {
|
||||
logger.error("[PORT-FORWARD-ROUTE]: failed to start a port-forward", { namespace, port, resourceType, resourceName });
|
||||
|
||||
return respondJson(response, {
|
||||
message: `Failed to forward port ${port} to ${thePort ? forwardPort : "random port"}`
|
||||
message: `Failed to forward port ${port} to ${thePort ? forwardPort : "random port"}`,
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ export class PortForwardRoute {
|
||||
logger.error(`[PORT-FORWARD-ROUTE]: failed to open a port-forward: ${error}`, { namespace, port, resourceType, resourceName });
|
||||
|
||||
return respondJson(response, {
|
||||
message: `Failed to forward port ${port}`
|
||||
message: `Failed to forward port ${port}`,
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ export class PortForwardRoute {
|
||||
port: f.port,
|
||||
forwardPort: f.forwardPort,
|
||||
protocol: f.protocol,
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
respondJson(response, { portForwards });
|
||||
@@ -224,7 +224,7 @@ export class PortForwardRoute {
|
||||
logger.error("[PORT-FORWARD-ROUTE]: error stopping a port-forward", { namespace, port, forwardPort, resourceType, resourceName });
|
||||
|
||||
return respondJson(response, {
|
||||
message: `error stopping a forward port ${port}`
|
||||
message: `error stopping a forward port ${port}`,
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ export class NodeShellSession extends ShellSession {
|
||||
.createNamespacedPod("kube-system", {
|
||||
metadata: {
|
||||
name: this.podId,
|
||||
namespace: "kube-system"
|
||||
namespace: "kube-system",
|
||||
},
|
||||
spec: {
|
||||
nodeName: this.nodeName,
|
||||
@@ -84,7 +84,7 @@ export class NodeShellSession extends ShellSession {
|
||||
hostIPC: true,
|
||||
hostNetwork: true,
|
||||
tolerations: [{
|
||||
operator: "Exists"
|
||||
operator: "Exists",
|
||||
}],
|
||||
containers: [{
|
||||
name: "shell",
|
||||
@@ -93,10 +93,10 @@ export class NodeShellSession extends ShellSession {
|
||||
privileged: true,
|
||||
},
|
||||
command: ["nsenter"],
|
||||
args: ["-t", "1", "-m", "-u", "-i", "-n", "sleep", "14000"]
|
||||
args: ["-t", "1", "-m", "-u", "-i", "-n", "sleep", "14000"],
|
||||
}],
|
||||
imagePullSecrets,
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ export class NodeShellSession extends ShellSession {
|
||||
(err) => {
|
||||
console.log(err);
|
||||
reject(err);
|
||||
}
|
||||
},
|
||||
)
|
||||
.then(req => {
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -154,7 +154,7 @@ export abstract class ShellSession {
|
||||
env.LENS_SESSION = "true";
|
||||
env.WSLENV = [
|
||||
process.env.WSLENV,
|
||||
"KUBECONFIG/up:LENS_SESSION/u"
|
||||
"KUBECONFIG/up:LENS_SESSION/u",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(":");
|
||||
@@ -183,7 +183,7 @@ export abstract class ShellSession {
|
||||
env.NO_PROXY = [
|
||||
"localhost",
|
||||
"127.0.0.1",
|
||||
env.NO_PROXY
|
||||
env.NO_PROXY,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join();
|
||||
|
||||
+4
-4
@@ -40,7 +40,7 @@ export function getTrayIcon(): string {
|
||||
return path.resolve(
|
||||
__static,
|
||||
isDevelopment ? "../build/tray" : "icons", // copied within electron-builder extras
|
||||
"trayIconTemplate.png"
|
||||
"trayIconTemplate.png",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ function createTrayMenu(windowManager: WindowManager): Menu {
|
||||
.navigate(preferencesURL())
|
||||
.catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to navigate to Preferences`, { error }));
|
||||
},
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
if (isAutoUpdateEnabled()) {
|
||||
@@ -122,7 +122,7 @@ function createTrayMenu(windowManager: WindowManager): Menu {
|
||||
label: "Quit App",
|
||||
click() {
|
||||
exitApp();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
]));
|
||||
}
|
||||
@@ -32,6 +32,6 @@ const anyKubeconfig = /^kubeconfig$/i;
|
||||
export function clearKubeconfigEnvVars(env: Record<string, any>): Record<string, any> {
|
||||
return Object.fromEntries(
|
||||
Object.entries(env)
|
||||
.filter(([key]) => anyKubeconfig.exec(key) === null)
|
||||
.filter(([key]) => anyKubeconfig.exec(key) === null),
|
||||
);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export async function shellEnv(shell?: string, forceRetry = false) : Promise<Env
|
||||
shellEnvironment(shell),
|
||||
new Promise((_resolve, reject) => setTimeout(() => {
|
||||
reject(new Error("Resolving shell environment is taking very long. Please review your shell configuration."));
|
||||
}, 30_000))
|
||||
}, 30_000)),
|
||||
]);
|
||||
} catch (error) {
|
||||
logger.error(`shellEnv: ${error}`);
|
||||
|
||||
@@ -263,7 +263,7 @@ export class WindowManager extends Singleton {
|
||||
enableRemoteModule: true,
|
||||
contextIsolation: false,
|
||||
nodeIntegrationInSubFrames: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
await this.splashWindow.loadURL("static://splash.html");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user