mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add draft how to render a react component in contract of injection token
Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
c025b1a7c2
commit
aab72a9bf8
@ -81,7 +81,7 @@ class NonInjectedClusterOverview extends React.Component<Dependencies> {
|
||||
<>
|
||||
<ClusterMetrics/>
|
||||
{this.props.uiBlocks.map((block) => (
|
||||
<div key={block.id}>{block.text}</div>
|
||||
<div key={block.id}>{<block.Component />}</div>
|
||||
))}
|
||||
lol
|
||||
<ClusterPieCharts/>
|
||||
|
||||
@ -2,17 +2,19 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { clusterOverviewUIBlockInjectionToken } from "@k8slens/metrics";
|
||||
|
||||
const uiBlock = getInjectable({
|
||||
id: "lol",
|
||||
instantiate: () => {
|
||||
return {
|
||||
id: "lol-id",
|
||||
text: "lol",
|
||||
};
|
||||
},
|
||||
|
||||
instantiate: () => ({
|
||||
id: "lol-id",
|
||||
text: "lol-1",
|
||||
Component: () => <div>Trollollol</div>,
|
||||
}),
|
||||
|
||||
injectionToken: clusterOverviewUIBlockInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
export type ClusterOverviewUIBlock = {
|
||||
id: string;
|
||||
text: string;
|
||||
Component: React.ElementType
|
||||
};
|
||||
|
||||
export const clusterOverviewUIBlockInjectionToken = getInjectionToken<ClusterOverviewUIBlock>({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user