11import { t } from '@lingui/macro' ;
2- import { Button , DataList , Switch } from '@patternfly/react-core' ;
3- import React , { Component , type ReactNode } from 'react' ;
2+ import { Button , DataList } from '@patternfly/react-core' ;
3+ import React , { 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 ) {
@@ -306,10 +298,6 @@ class Search extends Component<RouteProps, IState> {
306298 < CollectionCard
307299 key = { i }
308300 { ...c }
309- footer = { this . renderSyncToogle (
310- c . collection_version . name ,
311- c . collection_version . namespace ,
312- ) }
313301 menu = { this . renderMenu ( false , c ) }
314302 displaySignatures = {
315303 ( this . context as IAppContextType ) . featureFlags
@@ -422,24 +410,6 @@ class Search extends Component<RouteProps, IState> {
422410 return dropdownMenu ;
423411 }
424412
425- private renderSyncToogle ( name : string , namespace : string ) : ReactNode {
426- const { synclist } = this . state ;
427-
428- if ( ! synclist ) {
429- return null ;
430- }
431-
432- return (
433- < Switch
434- id = { namespace + '.' + name }
435- className = 'sync-toggle'
436- label = { t `Sync` }
437- isChecked = { this . isCollectionSynced ( name , namespace ) }
438- onChange = { ( ) => this . toggleCollectionSync ( name , namespace ) }
439- />
440- ) ;
441- }
442-
443413 private checkUploadPrivilleges ( collection ) {
444414 const addAlert = ( ) => {
445415 this . setState ( {
@@ -475,34 +445,6 @@ class Search extends Component<RouteProps, IState> {
475445 } ) ;
476446 }
477447
478- private toggleCollectionSync ( name : string , namespace : string ) {
479- const synclist = { ...this . state . synclist } ;
480-
481- const colIndex = synclist . collections . findIndex (
482- ( el ) => el . name === name && el . namespace === namespace ,
483- ) ;
484-
485- if ( colIndex < 0 ) {
486- synclist . collections . push ( { name : name , namespace : namespace } ) ;
487- } else {
488- synclist . collections . splice ( colIndex , 1 ) ;
489- }
490-
491- MySyncListAPI . update ( synclist . id , synclist ) . then ( ( response ) => {
492- this . setState ( { synclist : response . data } ) ;
493- MySyncListAPI . curate ( synclist . id ) . then ( ( ) => null ) ;
494- } ) ;
495- }
496-
497- private isCollectionSynced ( name : string , namespace : string ) : boolean {
498- const { synclist } = this . state ;
499- const found = synclist . collections . find (
500- ( el ) => el . name === name && el . namespace === namespace ,
501- ) ;
502-
503- return synclist . policy === 'include' ? ! ! found : ! found ;
504- }
505-
506448 private renderList ( collections ) {
507449 return (
508450 < div className = 'list-container' >
@@ -517,10 +459,6 @@ class Search extends Component<RouteProps, IState> {
517459 . display_signatures
518460 }
519461 showNamespace
520- synclistSwitch = { this . renderSyncToogle (
521- c . collection_version . name ,
522- c . collection_version . namespace ,
523- ) }
524462 { ...this . renderMenu ( true , c ) }
525463 />
526464 ) ) }
@@ -530,20 +468,6 @@ class Search extends Component<RouteProps, IState> {
530468 ) ;
531469 }
532470
533- private getSynclist ( ) {
534- MySyncListAPI . list ( ) . then ( ( result ) => {
535- // ignore results if more than 1 is returned
536- // TODO: should we throw an error for this or just ignore it?
537- if ( result . data . meta . count === 1 ) {
538- this . setState ( { synclist : result . data . data [ 0 ] } ) ;
539- } else {
540- console . error (
541- `my-synclist returned ${ result . data . meta . count } synclists` ,
542- ) ;
543- }
544- } ) ;
545- }
546-
547471 private queryCollections ( ) {
548472 this . setState ( { loading : true } , ( ) => {
549473 CollectionVersionAPI . list ( {
0 commit comments