diff --git a/src/main/cluster.ts b/src/main/cluster.ts index 01dee90f3c..5f8afbe6e4 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -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, diff --git a/src/main/shell-session.ts b/src/main/shell-session.ts index 4b82b2d77d..6071428b26 100644 --- a/src/main/shell-session.ts +++ b/src/main/shell-session.ts @@ -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 = new Map() diff --git a/src/main/window-manager.ts b/src/main/window-manager.ts index 38b70f3780..e52e6bb065 100644 --- a/src/main/window-manager.ts +++ b/src/main/window-manager.ts @@ -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; diff --git a/src/renderer/components/cluster-manager/cluster-context.tsx b/src/renderer/components/cluster-manager/cluster-context.tsx deleted file mode 100644 index 6314e0f933..0000000000 --- a/src/renderer/components/cluster-manager/cluster-context.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from "react"; -import { observer } from "mobx-react"; -import { ClusterId, clusterStore } from "../../../common/cluster-store"; -import { WorkspaceId, workspaceStore } from "../../../common/workspace-store"; - -export const clusterContext = React.createContext(getClusterContext()); - -export interface ClusterContextValue { - workspaceId: WorkspaceId; - clusterId?: ClusterId; -} - -export function getClusterContext(): ClusterContextValue { - return { - clusterId: clusterStore.activeClusterId, - workspaceId: workspaceStore.currentWorkspaceId, - } -} - -@observer -export class ClusterContext extends React.Component { - render() { - const { Provider } = clusterContext; - return ( - - {this.props.children} - - ) - } -} diff --git a/src/renderer/utils/arrays.ts b/src/renderer/utils/arrays.ts deleted file mode 100644 index e69de29bb2..0000000000