mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
1 parent
c0c1c227ca
commit
70bbb9fa62
10 files changed
+76
-53
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import "./cluster.scss"
|
||||
|
||||
import React from "react";
|
||||
import { computed, reaction } from "mobx";
|
||||
import { computed, reaction, when } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { MainLayout } from "../layout/main-layout";
|
||||
import { ClusterIssues } from "./cluster-issues";
|
||||
@@ -13,6 +13,7 @@ import { nodesStore } from "../+nodes/nodes.store";
|
||||
import { podsStore } from "../+workloads-pods/pods.store";
|
||||
import { clusterStore } from "./cluster.store";
|
||||
import { eventStore } from "../+events/event.store";
|
||||
import { configStore } from "../../config.store";
|
||||
import { isAllowedResource } from "../../api/rbac";
|
||||
|
||||
@observer
|
||||
@@ -24,7 +25,10 @@ export class Cluster extends React.Component {
|
||||
|
||||
private dependentStores = [nodesStore, podsStore];
|
||||
|
||||
// todo: refactor
|
||||
async componentDidMount() {
|
||||
await when(() => configStore.isLoaded);
|
||||
|
||||
const { dependentStores } = this;
|
||||
if (!isAllowedResource("nodes")) {
|
||||
dependentStores.splice(dependentStores.indexOf(nodesStore), 1)
|
||||
|
||||
@@ -2,7 +2,6 @@ import "./app.scss";
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { i18nStore } from "../i18n";
|
||||
import { configStore } from "../config.store";
|
||||
import { Terminal } from "./dock/terminal";
|
||||
import { Redirect, Route, Switch } from "react-router";
|
||||
import { Notifications } from "./notifications";
|
||||
@@ -35,6 +34,7 @@ import { clusterStore } from "../../common/cluster-store";
|
||||
import { ClusterSettings, clusterSettingsRoute } from "./+cluster-settings";
|
||||
import { Workspaces, workspacesRoute } from "./+workspaces";
|
||||
import { ErrorBoundary } from "./error-boundary";
|
||||
import { configStore } from "../config.store";
|
||||
|
||||
@observer
|
||||
export class App extends React.Component {
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import "./cluster-manager.scss"
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { computed, observable } from "mobx";
|
||||
import { observable } from "mobx";
|
||||
import { App } from "../app";
|
||||
import { ClusterStatus } from "./cluster-status";
|
||||
import { ClustersMenu } from "./clusters-menu";
|
||||
import { BottomBar } from "./bottom-bar";
|
||||
import { cssNames, IClassName } from "../../utils";
|
||||
import { invokeIpc } from "../../../common/ipc";
|
||||
import { ClusterIpcChannel } from "../../../main/cluster";
|
||||
import { clusterStore } from "../../../common/cluster-store";
|
||||
import { clusterIpc } from "../../../common/cluster-ipc";
|
||||
|
||||
interface Props {
|
||||
className?: IClassName;
|
||||
@@ -18,21 +17,17 @@ interface Props {
|
||||
|
||||
@observer
|
||||
export class ClusterManager extends React.Component<Props> {
|
||||
@observable appReady = false;
|
||||
|
||||
@computed get clusterReady() {
|
||||
return clusterStore.activeCluster?.isReady
|
||||
}
|
||||
@observable isReady = false;
|
||||
|
||||
async componentDidMount() {
|
||||
invokeIpc(ClusterIpcChannel.INIT);
|
||||
clusterIpc.refresh.invokeFromRenderer();
|
||||
await App.init();
|
||||
this.appReady = true;
|
||||
this.isReady = true;
|
||||
}
|
||||
|
||||
render() {
|
||||
const { className, contentClass } = this.props;
|
||||
const isReady = this.appReady && this.clusterReady;
|
||||
const isReady = this.isReady && clusterStore.activeCluster?.isReady;
|
||||
return (
|
||||
<div className={cssNames("ClusterManager", className)}>
|
||||
<div id="draggable-top"/>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import "./cluster-status.scss"
|
||||
import React from "react";
|
||||
import type { KubeAuthProxyResponse } from "../../../main/kube-auth-proxy";
|
||||
import { ClusterIpcChannel } from "../../../main/cluster";
|
||||
import { invokeIpc } from "../../../common/ipc";
|
||||
import { clusterStore } from "../../../common/cluster-store";
|
||||
import { ipcRenderer } from "electron";
|
||||
import { observable } from "mobx";
|
||||
@@ -10,6 +8,7 @@ import { observer } from "mobx-react";
|
||||
import { Icon } from "../icon";
|
||||
import { Button } from "../button";
|
||||
import { cssNames } from "../../utils";
|
||||
import { clusterIpc } from "../../../common/cluster-ipc";
|
||||
|
||||
@observer
|
||||
export class ClusterStatus extends React.Component {
|
||||
@@ -36,7 +35,7 @@ export class ClusterStatus extends React.Component {
|
||||
|
||||
reconnect = () => {
|
||||
this.authOutput = ["Reconnecting ...\n"];
|
||||
invokeIpc(ClusterIpcChannel.RECONNECT, this.clusterId);
|
||||
clusterIpc.reconnect.invokeFromRenderer(this.clusterId);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
Reference in new issue
Block a user