1
1
import React from "react" ;
2
2
import { useEffect , useState } from "react" ;
3
- import { getSupportLevelDisplay } from "../connector_registry " ;
4
-
3
+ import Tabs from "@theme/Tabs " ;
4
+ import TabItem from "@theme/TabItem" ;
5
5
import styles from "./ConnectorRegistry.module.css" ;
6
6
import { REGISTRY_URL } from "../connector_registry" ;
7
7
@@ -30,35 +30,23 @@ function connectorSort(a, b) {
30
30
if ( a . name_oss > b . name_oss ) return 1 ;
31
31
}
32
32
33
- export default function ConnectorRegistry ( { type } ) {
34
- const [ registry , setRegistry ] = useState ( [ ] ) ;
35
-
36
- useEffect ( ( ) => {
37
- fetchCatalog ( REGISTRY_URL , setRegistry ) ;
38
- } , [ ] ) ;
39
-
40
- if ( registry . length === 0 ) return < div > { `Loading ${ type } s...` } </ div > ;
41
-
42
- const connectors = registry
43
- . filter ( ( c ) => c . connector_type === type )
44
- . filter ( ( c ) => c . name_oss )
45
- . filter ( ( c ) => c . supportLevel_oss ) ; // at lease one connector is missing a support level
46
-
33
+ function ConnectorTable ( { connectors, connectorSupportLevel } ) {
47
34
return (
48
- < div >
49
- < table >
50
- < thead >
51
- < tr >
52
- < th > Connector Name</ th >
53
- < th > Links</ th >
54
- < th > Support Level</ th >
55
- < th > OSS</ th >
56
- < th > Cloud</ th >
57
- < th > Docker Image</ th >
58
- </ tr >
59
- </ thead >
60
- < tbody >
61
- { connectors . sort ( connectorSort ) . map ( ( connector ) => {
35
+ < table >
36
+ < thead >
37
+ < tr >
38
+ < th > Connector Name</ th >
39
+ < th > Links</ th >
40
+ < th > OSS</ th >
41
+ < th > Cloud</ th >
42
+ < th > Docker Image</ th >
43
+ </ tr >
44
+ </ thead >
45
+ < tbody >
46
+ { connectors
47
+ . sort ( connectorSort )
48
+ . filter ( ( c ) => c . supportLevel_oss === connectorSupportLevel )
49
+ . map ( ( connector ) => {
62
50
const docsLink = connector . documentationUrl_oss ?. replace (
63
51
"https://docs.airbyte.com" ,
64
52
""
@@ -86,9 +74,6 @@ export default function ConnectorRegistry({ type }) {
86
74
< a href = { connector . issue_url } > 🐛</ a >
87
75
) : null }
88
76
</ td >
89
- < td >
90
- < small > { getSupportLevelDisplay ( connector . supportLevel_oss ) } </ small >
91
- </ td >
92
77
< td > { connector . is_oss ? "✅" : "❌" } </ td >
93
78
< td > { connector . is_cloud ? "✅" : "❌" } </ td >
94
79
< td >
@@ -102,8 +87,46 @@ export default function ConnectorRegistry({ type }) {
102
87
</ tr >
103
88
) ;
104
89
} ) }
105
- </ tbody >
106
- </ table >
107
- </ div >
90
+ </ tbody >
91
+ </ table >
92
+ ) ;
93
+ }
94
+
95
+ export default function ConnectorRegistry ( { type } ) {
96
+ const [ registry , setRegistry ] = useState ( [ ] ) ;
97
+
98
+ useEffect ( ( ) => {
99
+ fetchCatalog ( REGISTRY_URL , setRegistry ) ;
100
+ } , [ ] ) ;
101
+
102
+ if ( registry . length === 0 ) return < div > { `Loading ${ type } s...` } </ div > ;
103
+
104
+ const connectors = registry
105
+ . filter ( ( c ) => c . connector_type === type )
106
+ . filter ( ( c ) => c . name_oss )
107
+ . filter ( ( c ) => c . supportLevel_oss ) ; // at least one connector is missing a support level
108
+
109
+ return (
110
+ < Tabs >
111
+ < TabItem value = "certified" label = "Airbyte Connectors" default >
112
+ < ConnectorTable
113
+ connectors = { connectors }
114
+ connectorSupportLevel = { "certified" }
115
+ />
116
+ </ TabItem >
117
+ < TabItem value = "community" label = "Marketplace" default >
118
+ < ConnectorTable
119
+ connectors = { connectors }
120
+ connectorSupportLevel = { "community" }
121
+ />
122
+ </ TabItem >
123
+ { /* There are no archived connectors to show at the moment, so hiding for now */ }
124
+ { /* <TabItem value="archived" label="Archived" default>
125
+ <ConnectorTable
126
+ connectors={connectors}
127
+ connectorSupportLevel={"archived"}
128
+ />
129
+ </TabItem> */ }
130
+ </ Tabs >
108
131
) ;
109
132
}
0 commit comments