some cleanup

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-08-24 10:09:50 -04:00
1 parent 2d75fd6717
commit fe1105b60b
15 files changed
+15 -21

No files matched your search

-1
View File
@@ -48,7 +48,6 @@ function getSubFrames(): ClusterFrameInfo[] {
}
export function broadcastMessage(channel: string, ...args: any[]) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const views = (webContents || remote?.webContents)?.getAllWebContents();
if (!views) return;
+3 -2
View File
@@ -19,13 +19,14 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { app, ipcMain, remote } from "electron";
import { ipcMain } from "electron";
import winston, { format } from "winston";
import type Transport from "winston-transport";
import { consoleFormat } from "winston-console-format";
import { isDebugging, isTestEnv } from "./vars";
import BrowserConsole from "winston-transport-browserconsole";
import { SentryTransport } from "./logger-transports";
import { getPath } from "./utils/getPath";
const logLevel = process.env.LOG_LEVEL
? process.env.LOG_LEVEL
@@ -69,7 +70,7 @@ if (!isTestEnv) {
handleExceptions: false,
level: logLevel,
filename: "lens.log",
dirname: (app ?? remote?.app)?.getPath("logs"),
dirname: getPath("logs"),
maxsize: 16 * 1024,
maxFiles: 16,
tailable: true,
-1
View File
@@ -33,6 +33,5 @@ export function getPath(name: Parameters<typeof app["getPath"]>[0]): string {
return app.getPath(name);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires
return remote.app.getPath(name);
}
+2 -2
View File
@@ -19,13 +19,13 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { app, remote } from "electron";
import path from "path";
import * as uuid from "uuid";
import type { ClusterId } from "../cluster-types";
import { getPath } from "./getPath";
export function storedKubeConfigFolder(): string {
return path.resolve((app || remote.app).getPath("userData"), "kubeconfigs");
return path.resolve(getPath("userData"), "kubeconfigs");
}
export function getCustomKubeConfigPath(clusterId: ClusterId = uuid.v4()): string {
-5
View File
@@ -26,14 +26,9 @@ import { ClusterManager } from "./cluster-manager";
import logger from "./logger";
export function exitApp() {
console.log("before windowManager");
const windowManager = WindowManager.getInstance(false);
console.log("before clusterManager");
const clusterManager = ClusterManager.getInstance(false);
console.log("after clusterManager");
appEventBus.emit({ name: "service", action: "close" });
windowManager?.hide();
clusterManager?.stop();
+1 -1
View File
@@ -65,7 +65,7 @@ export function createAppStorage<T>(key: string, defaultValue: T, clusterId?: st
// bind auto-saving data changes to %storage-file.json
reaction(
() => toJS(storage.data),
async (state: Record<string, any> = {}) => {
async state => {
logger.info(`${logPrefix} saving ${filePath}`);
try {