mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove <ClusterManager> renderer component
- Flatten into <RootFrame> (old <LensApp>) - Rename <App> as <ClusterFrame> Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
8331d4ff13
commit
22da7a9757
@ -25,7 +25,7 @@ import { navigation } from "../../renderer/navigation";
|
|||||||
export type { PageParamInit, PageParam } from "../../renderer/navigation/page-param";
|
export type { PageParamInit, PageParam } from "../../renderer/navigation/page-param";
|
||||||
export { navigate, isActiveRoute } from "../../renderer/navigation/helpers";
|
export { navigate, isActiveRoute } from "../../renderer/navigation/helpers";
|
||||||
export { hideDetails, showDetails, getDetailsUrl } from "../../renderer/components/kube-object/kube-object-details";
|
export { hideDetails, showDetails, getDetailsUrl } from "../../renderer/components/kube-object/kube-object-details";
|
||||||
export type { IURLParams } from "../../common/utils/buildUrl";
|
export type { URLParams } from "../../common/utils/buildUrl";
|
||||||
|
|
||||||
// exporting to extensions-api version of helper without `isSystem` flag
|
// exporting to extensions-api version of helper without `isSystem` flag
|
||||||
export function createPageParam<V = string>(init: PageParamInit<V>) {
|
export function createPageParam<V = string>(init: PageParamInit<V>) {
|
||||||
|
|||||||
@ -37,8 +37,8 @@ import { ExtensionDiscovery } from "../extensions/extension-discovery";
|
|||||||
import { ExtensionLoader } from "../extensions/extension-loader";
|
import { ExtensionLoader } from "../extensions/extension-loader";
|
||||||
import { ExtensionsStore } from "../extensions/extensions-store";
|
import { ExtensionsStore } from "../extensions/extensions-store";
|
||||||
import { FilesystemProvisionerStore } from "../main/extension-filesystem";
|
import { FilesystemProvisionerStore } from "../main/extension-filesystem";
|
||||||
import { App } from "./components/app";
|
import { ClusterFrame } from "./components/cluster-frame";
|
||||||
import { LensApp } from "./lens-app";
|
import { RootFrame } from "./root-frame";
|
||||||
import { ThemeStore } from "./theme.store";
|
import { ThemeStore } from "./theme.store";
|
||||||
import { HelmRepoManager } from "../main/helm/helm-repo-manager";
|
import { HelmRepoManager } from "../main/helm/helm-repo-manager";
|
||||||
import { ExtensionInstallationStateStore } from "./components/+extensions/extension-install.store";
|
import { ExtensionInstallationStateStore } from "./components/+extensions/extension-install.store";
|
||||||
@ -127,4 +127,4 @@ export async function bootstrap(App: AppComponent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// run
|
// run
|
||||||
bootstrap(process.isMainFrame ? LensApp : App);
|
bootstrap(process.isMainFrame ? RootFrame : ClusterFrame);
|
||||||
|
|||||||
@ -29,8 +29,8 @@ jest.mock("electron", () => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
import { BottomBar } from "./bottom-bar";
|
import { BottomBar } from "../bottom-bar";
|
||||||
import { StatusBarRegistry } from "../../../extensions/registries";
|
import { StatusBarRegistry } from "../../../../extensions/registries";
|
||||||
|
|
||||||
describe("<BottomBar />", () => {
|
describe("<BottomBar />", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
22
src/renderer/components/bottom-bar/index.ts
Normal file
22
src/renderer/components/bottom-bar/index.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2021 OpenLens Authors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export * from "./bottom-bar";
|
||||||
@ -71,7 +71,7 @@ import { namespaceStore } from "./+namespaces/namespace.store";
|
|||||||
import * as routes from "../../common/routes";
|
import * as routes from "../../common/routes";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class App extends React.Component {
|
export class ClusterFrame extends React.Component {
|
||||||
static async init() {
|
static async init() {
|
||||||
const frameId = webFrame.routingId;
|
const frameId = webFrame.routingId;
|
||||||
const clusterId = getHostedClusterId();
|
const clusterId = getHostedClusterId();
|
||||||
@ -1,68 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2021 OpenLens Authors
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import "./cluster-manager.scss";
|
|
||||||
|
|
||||||
import React from "react";
|
|
||||||
import { Redirect, Route, Switch } from "react-router";
|
|
||||||
import { observer } from "mobx-react";
|
|
||||||
import { BottomBar } from "./bottom-bar";
|
|
||||||
import { Catalog } from "../+catalog";
|
|
||||||
import { Preferences } from "../+preferences";
|
|
||||||
import { AddCluster } from "../+add-cluster";
|
|
||||||
import { ClusterView } from "./cluster-view";
|
|
||||||
import { GlobalPageRegistry } from "../../../extensions/registries/page-registry";
|
|
||||||
import { Extensions } from "../+extensions";
|
|
||||||
import { HotbarMenu } from "../hotbar/hotbar-menu";
|
|
||||||
import { EntitySettings } from "../+entity-settings";
|
|
||||||
import { Welcome } from "../+welcome";
|
|
||||||
import * as routes from "../../../common/routes";
|
|
||||||
|
|
||||||
@observer
|
|
||||||
export class ClusterManager extends React.Component {
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<div className="ClusterManager">
|
|
||||||
<main>
|
|
||||||
<div id="lens-views"/>
|
|
||||||
<Switch>
|
|
||||||
<Route component={Welcome} {...routes.welcomeRoute} />
|
|
||||||
<Route component={Catalog} {...routes.catalogRoute} />
|
|
||||||
<Route component={Preferences} {...routes.preferencesRoute} />
|
|
||||||
<Route component={Extensions} {...routes.extensionsRoute} />
|
|
||||||
<Route component={AddCluster} {...routes.addClusterRoute} />
|
|
||||||
<Route component={ClusterView} {...routes.clusterViewRoute} />
|
|
||||||
<Route component={EntitySettings} {...routes.entitySettingsRoute} />
|
|
||||||
{
|
|
||||||
GlobalPageRegistry.getInstance().getItems()
|
|
||||||
.map(({ url, components: { Page } }) => (
|
|
||||||
<Route key={url} path={url} component={Page} />
|
|
||||||
))
|
|
||||||
}
|
|
||||||
<Redirect exact to={routes.welcomeURL()}/>
|
|
||||||
</Switch>
|
|
||||||
</main>
|
|
||||||
<HotbarMenu/>
|
|
||||||
<BottomBar/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -19,7 +19,7 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.ClusterStatus {
|
.ClusterConnectionStatus {
|
||||||
--flex-gap: #{$padding * 2};
|
--flex-gap: #{$padding * 2};
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -39,4 +39,4 @@
|
|||||||
--size: 70px;
|
--size: 70px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,10 +19,10 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { KubeAuthProxyLog } from "../../../main/kube-auth-proxy";
|
import "./cluster-connection-status.scss";
|
||||||
|
|
||||||
import "./cluster-status.scss";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import type { KubeAuthProxyLog } from "../../../main/kube-auth-proxy";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { ipcRenderer } from "electron";
|
import { ipcRenderer } from "electron";
|
||||||
import { computed, observable } from "mobx";
|
import { computed, observable } from "mobx";
|
||||||
@ -41,7 +41,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class ClusterStatus extends React.Component<Props> {
|
export class ClusterConnectionStatus extends React.Component<Props> {
|
||||||
@observable authOutput: KubeAuthProxyLog[] = [];
|
@observable authOutput: KubeAuthProxyLog[] = [];
|
||||||
@observable isReconnecting = false;
|
@observable isReconnecting = false;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ import React from "react";
|
|||||||
import { reaction } from "mobx";
|
import { reaction } from "mobx";
|
||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import type { RouteComponentProps } from "react-router";
|
import type { RouteComponentProps } from "react-router";
|
||||||
import { ClusterStatus } from "./cluster-status";
|
import { ClusterConnectionStatus } from "./cluster-connection-status";
|
||||||
import { hasLoadedView, initView, lensViews, refreshViews } from "./lens-views";
|
import { hasLoadedView, initView, lensViews, refreshViews } from "./lens-views";
|
||||||
import type { Cluster } from "../../../main/cluster";
|
import type { Cluster } from "../../../main/cluster";
|
||||||
import { ClusterStore } from "../../../common/cluster-store";
|
import { ClusterStore } from "../../../common/cluster-store";
|
||||||
@ -95,7 +95,7 @@ export class ClusterView extends React.Component<Props> {
|
|||||||
return (
|
return (
|
||||||
<div className="ClusterView flex align-center">
|
<div className="ClusterView flex align-center">
|
||||||
{showStatus && (
|
{showStatus && (
|
||||||
<ClusterStatus key={cluster.id} clusterId={cluster.id} className="box center"/>
|
<ClusterConnectionStatus key={cluster.id} clusterId={cluster.id} className="box center"/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -19,4 +19,4 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from "./cluster-manager";
|
export * from "./cluster-view";
|
||||||
@ -65,7 +65,7 @@ export async function initView(clusterId: ClusterId) {
|
|||||||
await autoCleanOnRemove(clusterId, iframe);
|
await autoCleanOnRemove(clusterId, iframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function autoCleanOnRemove(clusterId: ClusterId, iframe: HTMLIFrameElement) {
|
async function autoCleanOnRemove(clusterId: ClusterId, iframe: HTMLIFrameElement) {
|
||||||
await when(() => {
|
await when(() => {
|
||||||
const cluster = ClusterStore.getInstance().getById(clusterId);
|
const cluster = ClusterStore.getInstance().getById(clusterId);
|
||||||
|
|
||||||
@ -19,7 +19,7 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.ClusterManager {
|
.root-frame {
|
||||||
--bottom-bar-height: 22px;
|
--bottom-bar-height: 22px;
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
@ -20,11 +20,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import "../common/system-ca";
|
import "../common/system-ca";
|
||||||
|
import "./components/root-frame.scss";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Route, Router, Switch } from "react-router";
|
import { Redirect, Route, Router, Switch } from "react-router";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { history } from "./navigation";
|
import { history } from "./navigation";
|
||||||
import { ClusterManager } from "./components/cluster-manager";
|
import { Catalog } from "./components/+catalog";
|
||||||
|
import { Preferences } from "./components/+preferences";
|
||||||
|
import { AddCluster } from "./components/+add-cluster";
|
||||||
|
import { ClusterView } from "./components/cluster-view";
|
||||||
|
import { GlobalPageRegistry } from "../extensions/registries/page-registry";
|
||||||
|
import { Extensions } from "./components/+extensions";
|
||||||
|
import { EntitySettings } from "./components/+entity-settings";
|
||||||
|
import { Welcome } from "./components/+welcome";
|
||||||
import { ErrorBoundary } from "./components/error-boundary";
|
import { ErrorBoundary } from "./components/error-boundary";
|
||||||
import { Notifications } from "./components/notifications";
|
import { Notifications } from "./components/notifications";
|
||||||
import { ConfirmDialog } from "./components/confirm-dialog";
|
import { ConfirmDialog } from "./components/confirm-dialog";
|
||||||
@ -38,9 +47,12 @@ import { IpcRendererNavigationEvents } from "./navigation/events";
|
|||||||
import { catalogEntityRegistry } from "./api/catalog-entity-registry";
|
import { catalogEntityRegistry } from "./api/catalog-entity-registry";
|
||||||
import { CommandRegistry } from "../extensions/registries";
|
import { CommandRegistry } from "../extensions/registries";
|
||||||
import { reaction } from "mobx";
|
import { reaction } from "mobx";
|
||||||
|
import { HotbarMenu } from "./components/hotbar/hotbar-menu";
|
||||||
|
import { BottomBar } from "./components/bottom-bar";
|
||||||
|
import * as routes from "../common/routes";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class LensApp extends React.Component {
|
export class RootFrame extends React.Component {
|
||||||
static async init() {
|
static async init() {
|
||||||
catalogEntityRegistry.init();
|
catalogEntityRegistry.init();
|
||||||
ExtensionLoader.getInstance().loadOnClusterManagerRenderer();
|
ExtensionLoader.getInstance().loadOnClusterManagerRenderer();
|
||||||
@ -68,9 +80,30 @@ export class LensApp extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Router history={history}>
|
<Router history={history}>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<Switch>
|
<div className="root-frame">
|
||||||
<Route component={ClusterManager}/>
|
<main>
|
||||||
</Switch>
|
<div id="lens-views" />
|
||||||
|
<Switch>
|
||||||
|
<Route component={Welcome} {...routes.welcomeRoute} />
|
||||||
|
<Route component={Catalog} {...routes.catalogRoute} />
|
||||||
|
<Route component={Preferences} {...routes.preferencesRoute} />
|
||||||
|
<Route component={Extensions} {...routes.extensionsRoute} />
|
||||||
|
<Route component={AddCluster} {...routes.addClusterRoute} />
|
||||||
|
<Route component={ClusterView} {...routes.clusterViewRoute} />
|
||||||
|
<Route component={EntitySettings} {...routes.entitySettingsRoute} />
|
||||||
|
{
|
||||||
|
GlobalPageRegistry.getInstance()
|
||||||
|
.getItems()
|
||||||
|
.map(({ url, components: { Page } }) => (
|
||||||
|
<Route key={url} path={url} component={Page} />
|
||||||
|
))
|
||||||
|
}
|
||||||
|
<Redirect exact to={routes.welcomeURL()} />
|
||||||
|
</Switch>
|
||||||
|
</main>
|
||||||
|
<HotbarMenu />
|
||||||
|
<BottomBar />
|
||||||
|
</div>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
<Notifications/>
|
<Notifications/>
|
||||||
<ConfirmDialog/>
|
<ConfirmDialog/>
|
||||||
Loading…
Reference in New Issue
Block a user