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 = {}> {
1616 return this . entities [ id ] ;
1717 }
1818
19+ has < Id extends keyof Entities > ( id : Id ) : boolean {
20+ const entity = this . entities [ id ] ;
21+ return entity && entity . name !== 'EmptyPlaceholder' ;
22+ }
23+
1924 register < Id extends string , T > ( id : Id , entity : T ) : Registry < Entities & { [ key in Id ] : T } > {
2025 this . entities [ id ] = entity ;
2126
@@ -31,4 +36,5 @@ type ComponentType<T> =
3136export interface ComponentsRegistryTemplate < T extends Registry , Entities = NonNullable < T [ 'type' ] > > {
3237 set < Id extends keyof Entities > ( id : Id , entity : ComponentType < Entities [ Id ] > ) : this;
3338 get < Id extends keyof Entities > ( id : Id ) : ComponentType < Entities [ Id ] > ;
39+ has < Id extends keyof Entities > ( id : Id ) : boolean ;
3440}
Original file line number Diff line number Diff line change @@ -39,8 +39,6 @@ function Header() {
3939 const isAddClusterAvailable =
4040 useAddClusterFeatureAvailable ( ) && uiFactory . onAddCluster !== undefined ;
4141
42- const AIAssistantButton = componentsRegistry . get ( 'AIAssistantButton' ) ;
43-
4442 const breadcrumbItems = React . useMemo ( ( ) => {
4543 let options = { ...pageBreadcrumbsOptions , singleClusterMode} ;
4644
@@ -79,7 +77,8 @@ function Header() {
7977 ) ;
8078 }
8179
82- if ( AIAssistantButton ) {
80+ if ( componentsRegistry . has ( 'AIAssistantButton' ) ) {
81+ const AIAssistantButton = componentsRegistry . get ( 'AIAssistantButton' ) ;
8382 elements . push ( < AIAssistantButton key = "ai-assistant" /> ) ;
8483 }
8584
You can’t perform that action at this time.
0 commit comments