mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
extension support for workspace overview
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
4f3abb6dd6
commit
9cee1a800e
@ -192,6 +192,7 @@ export class ExtensionLoader {
|
||||
registries.appPreferenceRegistry.add(extension.appPreferences),
|
||||
registries.clusterFeatureRegistry.add(extension.clusterFeatures),
|
||||
registries.statusBarRegistry.add(extension.statusBarItems),
|
||||
registries.workspaceDetailRegistry.add(extension.workspaceDetails),
|
||||
];
|
||||
|
||||
this.events.on("remove", (removedExtension: LensRendererExtension) => {
|
||||
|
||||
@ -6,3 +6,4 @@ export type { KubeObjectStatusRegistration } from "../registries/kube-object-sta
|
||||
export type { PageRegistration, RegisteredPage, PageParams, PageComponentProps, PageComponents, PageTarget } from "../registries/page-registry";
|
||||
export type { PageMenuRegistration, ClusterPageMenuRegistration, PageMenuComponents } from "../registries/page-menu-registry";
|
||||
export type { StatusBarRegistration } from "../registries/status-bar-registry";
|
||||
export type { WorkspaceDetailRegistration } from "../registries/workspace-detail-registry";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { AppPreferenceRegistration, ClusterFeatureRegistration, ClusterPageMenuRegistration, KubeObjectDetailRegistration, KubeObjectMenuRegistration, KubeObjectStatusRegistration, PageMenuRegistration, PageRegistration, StatusBarRegistration, } from "./registries";
|
||||
import type { AppPreferenceRegistration, ClusterFeatureRegistration, ClusterPageMenuRegistration, KubeObjectDetailRegistration, KubeObjectMenuRegistration, KubeObjectStatusRegistration, PageMenuRegistration, PageRegistration, StatusBarRegistration, WorkspaceDetailRegistration, } from "./registries";
|
||||
import type { Cluster } from "../main/cluster";
|
||||
import { LensExtension } from "./lens-extension";
|
||||
import { getExtensionPageUrl } from "./registries/page-registry";
|
||||
@ -16,6 +16,7 @@ export class LensRendererExtension extends LensExtension {
|
||||
kubeObjectDetailItems: KubeObjectDetailRegistration[] = [];
|
||||
kubeObjectMenuItems: KubeObjectMenuRegistration[] = [];
|
||||
commands: CommandRegistration[] = [];
|
||||
workspaceDetails: WorkspaceDetailRegistration[] = [];
|
||||
|
||||
async navigate<P extends object>(pageId?: string, params?: P) {
|
||||
const { navigate } = await import("../renderer/navigation");
|
||||
|
||||
@ -9,3 +9,4 @@ export * from "./kube-object-detail-registry";
|
||||
export * from "./kube-object-menu-registry";
|
||||
export * from "./cluster-feature-registry";
|
||||
export * from "./kube-object-status-registry";
|
||||
export * from "./workspace-detail-registry";
|
||||
|
||||
15
src/extensions/registries/workspace-detail-registry.ts
Normal file
15
src/extensions/registries/workspace-detail-registry.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import type React from "react";
|
||||
import { BaseRegistry } from "./base-registry";
|
||||
|
||||
export interface WorkspaceDetailComponents {
|
||||
Detail: React.ComponentType<any>;
|
||||
}
|
||||
|
||||
export interface WorkspaceDetailRegistration {
|
||||
components: WorkspaceDetailComponents;
|
||||
}
|
||||
|
||||
export class WorkspaceDetailRegistry extends BaseRegistry<WorkspaceDetailRegistration> {
|
||||
}
|
||||
|
||||
export const workspaceDetailRegistry = new WorkspaceDetailRegistry();
|
||||
@ -1,4 +1,6 @@
|
||||
.WorkspaceOverview {
|
||||
|
||||
.ItemListLayout.WorkspaceClusters {
|
||||
background-color: var(--mainBackground);
|
||||
|
||||
.TableCell {
|
||||
@ -11,4 +13,5 @@
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,7 @@ import { ClusterItem, WorkspaceClusterStore } from "./workspace-cluster.store";
|
||||
import { navigate } from "../../navigation";
|
||||
import { clusterViewURL } from "../cluster-manager/cluster-view.route";
|
||||
import { WorkspaceClusterMenu } from "./workspace-cluster-menu";
|
||||
import { workspaceDetailRegistry } from "../../../extensions/registries/workspace-detail-registry";
|
||||
|
||||
interface Props {
|
||||
workspace: Workspace;
|
||||
@ -32,13 +33,16 @@ export class WorkspaceOverview extends Component<Props> {
|
||||
|
||||
workspaceClusterStore.loadAll();
|
||||
|
||||
const workspaceDetails = workspaceDetailRegistry.getItems();
|
||||
|
||||
return (
|
||||
<div className="WorkspaceOverview flex column gaps box grow">
|
||||
<ItemListLayout
|
||||
className="WorkspaceClusters"
|
||||
renderHeaderTitle={<div>Clusters</div>}
|
||||
isClusterScoped
|
||||
isSearchable={false}
|
||||
isSelectable={false}
|
||||
className="WorkspaceOverview"
|
||||
store={workspaceClusterStore}
|
||||
sortingCallbacks={{
|
||||
[sortBy.name]: (item: ClusterItem) => item.name,
|
||||
@ -62,6 +66,12 @@ export class WorkspaceOverview extends Component<Props> {
|
||||
<WorkspaceClusterMenu clusterItem={clusterItem} workspace={workspace} workspaceClusterStore={workspaceClusterStore}/>
|
||||
)}
|
||||
/>
|
||||
{ workspaceDetails.length > 0 &&
|
||||
<div className="extensions flex column gaps">
|
||||
{workspaceDetailRegistry.getItems().map(({ components: { Detail } }, index) => <Detail key={index} className="workspace-detail"/>)}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user