mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Implement extensions API for workloads overview details
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
e7086a66d1
commit
860cd75fe7
@ -279,6 +279,7 @@ export class ExtensionLoader extends Singleton {
|
||||
registries.kubeObjectMenuRegistry.add(extension.kubeObjectMenuItems),
|
||||
registries.kubeObjectDetailRegistry.add(extension.kubeObjectDetailItems),
|
||||
registries.kubeObjectStatusRegistry.add(extension.kubeObjectStatusTexts),
|
||||
registries.workloadsOverviewDetailRegistry.add(extension.workloadsOverviewDetailItems),
|
||||
registries.commandRegistry.add(extension.commands),
|
||||
];
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
import type {
|
||||
AppPreferenceRegistration, ClusterPageMenuRegistration, KubeObjectDetailRegistration, KubeObjectMenuRegistration,
|
||||
KubeObjectStatusRegistration, PageMenuRegistration, PageRegistration, StatusBarRegistration, WelcomeMenuRegistration,
|
||||
KubeObjectStatusRegistration, PageMenuRegistration, PageRegistration, StatusBarRegistration, WelcomeMenuRegistration, WorkloadsOverviewDetailRegistration,
|
||||
} from "./registries";
|
||||
import type { Cluster } from "../main/cluster";
|
||||
import { LensExtension } from "./lens-extension";
|
||||
@ -42,6 +42,7 @@ export class LensRendererExtension extends LensExtension {
|
||||
kubeObjectMenuItems: KubeObjectMenuRegistration[] = [];
|
||||
commands: CommandRegistration[] = [];
|
||||
welcomeMenus: WelcomeMenuRegistration[] = [];
|
||||
workloadsOverviewDetailItems: WorkloadsOverviewDetailRegistration[] = [];
|
||||
|
||||
async navigate<P extends object>(pageId?: string, params?: P) {
|
||||
const { navigate } = await import("../renderer/navigation");
|
||||
|
||||
@ -33,3 +33,4 @@ export * from "./command-registry";
|
||||
export * from "./entity-setting-registry";
|
||||
export * from "./welcome-menu-registry";
|
||||
export * from "./protocol-handler-registry";
|
||||
export * from "./workloads-overview-detail-registry";
|
||||
|
||||
@ -38,6 +38,7 @@ import { Events } from "../+events";
|
||||
import { isAllowedResource } from "../../../common/rbac";
|
||||
import { kubeWatchApi } from "../../api/kube-watch-api";
|
||||
import { clusterContext } from "../context";
|
||||
import { workloadsOverviewDetailRegistry } from "../../../extensions/registries";
|
||||
|
||||
interface Props extends RouteComponentProps<IWorkloadsOverviewRouteParams> {
|
||||
}
|
||||
@ -57,11 +58,34 @@ export class WorkloadsOverview extends React.Component<Props> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const items = workloadsOverviewDetailRegistry.getItems().map((item, index) => {
|
||||
return (
|
||||
<item.components.Details key={`workload-overview-${index}`}/>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="WorkloadsOverview flex column gaps">
|
||||
<OverviewStatuses/>
|
||||
{isAllowedResource("events") && <Events compact hideFilters className="box grow"/>}
|
||||
{items}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
workloadsOverviewDetailRegistry.add([
|
||||
{
|
||||
components: {
|
||||
Details: (props: any) => <OverviewStatuses {...props} />,
|
||||
}
|
||||
},
|
||||
{
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: () => {
|
||||
return (
|
||||
isAllowedResource("events") && <Events compact hideFilters className="box grow"/>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user