File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
components/ComponentsProvider Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ export class Registry<Entities extends RegistryEntities = {}> {
16
16
return this . entities [ id ] ;
17
17
}
18
18
19
+ has < Id extends keyof Entities > ( id : Id ) : boolean {
20
+ const entity = this . entities [ id ] ;
21
+ return entity && entity . name !== 'EmptyPlaceholder' ;
22
+ }
23
+
19
24
register < Id extends string , T > ( id : Id , entity : T ) : Registry < Entities & { [ key in Id ] : T } > {
20
25
this . entities [ id ] = entity ;
21
26
@@ -31,4 +36,5 @@ type ComponentType<T> =
31
36
export interface ComponentsRegistryTemplate < T extends Registry , Entities = NonNullable < T [ 'type' ] > > {
32
37
set < Id extends keyof Entities > ( id : Id , entity : ComponentType < Entities [ Id ] > ) : this;
33
38
get < Id extends keyof Entities > ( id : Id ) : ComponentType < Entities [ Id ] > ;
39
+ has < Id extends keyof Entities > ( id : Id ) : boolean ;
34
40
}
Original file line number Diff line number Diff line change @@ -39,8 +39,6 @@ function Header() {
39
39
const isAddClusterAvailable =
40
40
useAddClusterFeatureAvailable ( ) && uiFactory . onAddCluster !== undefined ;
41
41
42
- const AIAssistantButton = componentsRegistry . get ( 'AIAssistantButton' ) ;
43
-
44
42
const breadcrumbItems = React . useMemo ( ( ) => {
45
43
let options = { ...pageBreadcrumbsOptions , singleClusterMode} ;
46
44
@@ -79,7 +77,8 @@ function Header() {
79
77
) ;
80
78
}
81
79
82
- if ( AIAssistantButton ) {
80
+ if ( componentsRegistry . has ( 'AIAssistantButton' ) ) {
81
+ const AIAssistantButton = componentsRegistry . get ( 'AIAssistantButton' ) ;
83
82
elements . push ( < AIAssistantButton key = "ai-assistant" /> ) ;
84
83
}
85
84
You can’t perform that action at this time.
0 commit comments