mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
1 parent
693385a0a0
commit
ae9afc2894
5 files changed
+24
-32
No files matched your search
@@ -11,6 +11,8 @@ import { getFeatures, installFeature, uninstallFeature, upgradeFeature } from ".
|
||||
import request, { RequestPromiseOptions } from "request-promise-native"
|
||||
import logger from "./logger"
|
||||
|
||||
// fixme: push cluster-state/status info to views on change
|
||||
|
||||
enum ClusterStatus {
|
||||
AccessGranted = 2,
|
||||
AccessDenied = 1,
|
||||
|
||||
@@ -11,6 +11,8 @@ import { helmCli } from "./helm/helm-cli"
|
||||
import { isWindows } from "../common/vars";
|
||||
import { tracker } from "../common/tracker";
|
||||
|
||||
// fixme: terminal doesn't work in ui
|
||||
|
||||
export class ShellSession extends EventEmitter {
|
||||
static shellEnvs: Map<string, any> = new Map()
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import path from "path";
|
||||
import { reaction } from "mobx";
|
||||
import { BrowserWindow, shell } from "electron"
|
||||
import windowStateKeeper from "electron-window-state"
|
||||
import type { ClusterId } from "../common/cluster-store";
|
||||
import { clusterStore } from "../common/cluster-store";
|
||||
import logger from "./logger";
|
||||
import { appName } from "../common/vars";
|
||||
|
||||
// fixme: remove switching view delay on first load
|
||||
|
||||
@@ -33,6 +35,20 @@ export class WindowManager {
|
||||
|
||||
// init events and show active cluster view
|
||||
this.bindEvents();
|
||||
|
||||
// handle initial view load without clusters
|
||||
if (!clusterStore.clusters.size) {
|
||||
this.initNoClustersView();
|
||||
}
|
||||
}
|
||||
|
||||
// fixme: first run without clusters
|
||||
protected async initNoClustersView() {
|
||||
const htmlView = path.join(__dirname, `${appName}.html`);
|
||||
const view = this.initView(undefined);
|
||||
await view.loadFile(htmlView);
|
||||
view.show();
|
||||
this.hideSplash();
|
||||
}
|
||||
|
||||
protected bindEvents() {
|
||||
@@ -65,7 +81,9 @@ export class WindowManager {
|
||||
|
||||
async activateView(clusterId: ClusterId) {
|
||||
const cluster = clusterStore.getById(clusterId);
|
||||
if (!cluster) return;
|
||||
if (!cluster) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const activeView = this.activeView;
|
||||
const isLoadedBefore = !!this.getView(clusterId);
|
||||
@@ -98,7 +116,7 @@ export class WindowManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected initView(clusterId: ClusterId) {
|
||||
protected initView(clusterId: ClusterId): BrowserWindow {
|
||||
let view = this.getView(clusterId);
|
||||
if (!view) {
|
||||
const { width, height, x, y } = this.windowState;
|
||||
|
||||
Reference in new issue
Block a user