@@ -59,11 +59,12 @@ export class DiscoveryServices extends GenericEditableConfigList<
5959 getChildContext ( ) {
6060 return {
6161 registerLibrary : ( library : LibraryData , registration_stage : string ) => {
62- if ( this . itemToEdit ( ) ) {
63- const data = new ( window as any ) . FormData ( ) ;
62+ const item = this . itemToEdit ( ) ;
63+ if ( item ) {
64+ const data = new FormData ( ) ;
6465 data . append ( "library_short_name" , library . short_name ) ;
6566 data . append ( "registration_stage" , registration_stage ) ;
66- data . append ( "integration_id" , this . itemToEdit ( ) . id ) ;
67+ data . append ( "integration_id" , String ( item . id ) ) ;
6768 this . props . registerLibrary ( data ) . then ( ( ) => {
6869 if ( this . props . fetchLibraryRegistrations ) {
6970 this . props . fetchLibraryRegistrations ( ) ;
@@ -83,12 +84,6 @@ export class DiscoveryServices extends GenericEditableConfigList<
8384 return ( serviceReg ?. libraries ?? [ ] ) . filter ( ( l ) => l . status === "success" ) ;
8485 }
8586
86- protected getAssociatedItems (
87- item : DiscoveryServiceData
88- ) : Array < any > | undefined {
89- return this . registeredLibraries ( item ) ;
90- }
91-
9287 protected formatAssociatedCount ( count : number ) : string {
9388 return count === 0
9489 ? "no registered libraries"
@@ -99,8 +94,9 @@ export class DiscoveryServices extends GenericEditableConfigList<
9994
10095 protected getAssociatedEntries (
10196 item : DiscoveryServiceData
102- ) : Array < { label : string ; suffix ?: string ; href ?: string } > {
103- const registered = this . registeredLibraries ( item ) ?? [ ] ;
97+ ) : Array < { label : string ; suffix ?: string ; href ?: string } > | undefined {
98+ const registered = this . registeredLibraries ( item ) ;
99+ if ( registered === undefined ) return undefined ;
104100 const allLibraries = this . props . data ?. allLibraries ?? [ ] ;
105101 return registered . map ( ( lib ) => {
106102 const meta = allLibraries . find ( ( l ) => l . short_name === lib . short_name ) ;
@@ -113,8 +109,8 @@ export class DiscoveryServices extends GenericEditableConfigList<
113109 } ) ;
114110 }
115111
116- UNSAFE_componentWillMount ( ) {
117- super . UNSAFE_componentWillMount ( ) ;
112+ componentDidMount ( ) {
113+ super . componentDidMount ( ) ;
118114 if ( this . props . fetchLibraryRegistrations ) {
119115 this . props . fetchLibraryRegistrations ( ) ;
120116 }
0 commit comments