11import { t } from '@lingui/core/macro' ;
2- import { Button , DataList , Switch } from '@patternfly/react-core' ;
3- import { Component , type ReactNode } from 'react' ;
2+ import { Button , DataList } from '@patternfly/react-core' ;
3+ import { Component } from 'react' ;
44import { Navigate } from 'react-router-dom' ;
55import {
66 CollectionAPI ,
77 CollectionVersionAPI ,
88 type CollectionVersionSearch ,
99 MyNamespaceAPI ,
10- MySyncListAPI ,
11- type SyncListType ,
1210} from 'src/api' ;
1311import {
1412 AlertList ,
@@ -55,7 +53,6 @@ interface IState {
5553 namespace ?: string ;
5654 } ;
5755 loading : boolean ;
58- synclist : SyncListType ;
5956 alerts : AlertType [ ] ;
6057 updateCollection : CollectionVersionSearch ;
6158 showImportModal : boolean ;
@@ -99,7 +96,6 @@ class Search extends Component<RouteProps, IState> {
9996 params,
10097 count : 0 ,
10198 loading : true ,
102- synclist : undefined ,
10399 alerts : [ ] ,
104100 updateCollection : null ,
105101 showImportModal : false ,
@@ -118,10 +114,6 @@ class Search extends Component<RouteProps, IState> {
118114
119115 private load ( ) {
120116 this . queryCollections ( ) ;
121-
122- if ( IS_INSIGHTS ) {
123- this . getSynclist ( ) ;
124- }
125117 }
126118
127119 private addAlert ( alert : AlertType ) {
@@ -310,10 +302,6 @@ class Search extends Component<RouteProps, IState> {
310302 < CollectionCard
311303 key = { i }
312304 { ...c }
313- footer = { this . renderSyncToogle (
314- c . collection_version . name ,
315- c . collection_version . namespace ,
316- ) }
317305 menu = { this . renderMenu ( false , c ) }
318306 displaySignatures = {
319307 ( this . context as IAppContextType ) . featureFlags
@@ -426,24 +414,6 @@ class Search extends Component<RouteProps, IState> {
426414 return dropdownMenu ;
427415 }
428416
429- private renderSyncToogle ( name : string , namespace : string ) : ReactNode {
430- const { synclist } = this . state ;
431-
432- if ( ! synclist ) {
433- return null ;
434- }
435-
436- return (
437- < Switch
438- id = { namespace + '.' + name }
439- className = 'sync-toggle'
440- label = { t `Sync` }
441- isChecked = { this . isCollectionSynced ( name , namespace ) }
442- onChange = { ( ) => this . toggleCollectionSync ( name , namespace ) }
443- />
444- ) ;
445- }
446-
447417 private checkUploadPrivilleges ( collection ) {
448418 const addAlert = ( ) => {
449419 this . setState ( {
@@ -479,34 +449,6 @@ class Search extends Component<RouteProps, IState> {
479449 } ) ;
480450 }
481451
482- private toggleCollectionSync ( name : string , namespace : string ) {
483- const synclist = { ...this . state . synclist } ;
484-
485- const colIndex = synclist . collections . findIndex (
486- ( el ) => el . name === name && el . namespace === namespace ,
487- ) ;
488-
489- if ( colIndex < 0 ) {
490- synclist . collections . push ( { name : name , namespace : namespace } ) ;
491- } else {
492- synclist . collections . splice ( colIndex , 1 ) ;
493- }
494-
495- MySyncListAPI . update ( synclist . id , synclist ) . then ( ( response ) => {
496- this . setState ( { synclist : response . data } ) ;
497- MySyncListAPI . curate ( synclist . id ) . then ( ( ) => null ) ;
498- } ) ;
499- }
500-
501- private isCollectionSynced ( name : string , namespace : string ) : boolean {
502- const { synclist } = this . state ;
503- const found = synclist . collections . find (
504- ( el ) => el . name === name && el . namespace === namespace ,
505- ) ;
506-
507- return synclist . policy === 'include' ? ! ! found : ! found ;
508- }
509-
510452 private renderList ( collections ) {
511453 return (
512454 < div className = 'list-container' >
@@ -521,10 +463,6 @@ class Search extends Component<RouteProps, IState> {
521463 . display_signatures
522464 }
523465 showNamespace
524- synclistSwitch = { this . renderSyncToogle (
525- c . collection_version . name ,
526- c . collection_version . namespace ,
527- ) }
528466 { ...this . renderMenu ( true , c ) }
529467 />
530468 ) ) }
@@ -534,20 +472,6 @@ class Search extends Component<RouteProps, IState> {
534472 ) ;
535473 }
536474
537- private getSynclist ( ) {
538- MySyncListAPI . list ( ) . then ( ( result ) => {
539- // ignore results if more than 1 is returned
540- // TODO: should we throw an error for this or just ignore it?
541- if ( result . data . meta . count === 1 ) {
542- this . setState ( { synclist : result . data . data [ 0 ] } ) ;
543- } else {
544- console . error (
545- `my-synclist returned ${ result . data . meta . count } synclists` ,
546- ) ;
547- }
548- } ) ;
549- }
550-
551475 private queryCollections ( ) {
552476 this . setState ( { loading : true } , ( ) => {
553477 CollectionVersionAPI . list ( {
0 commit comments