Skip to content

Commit 65ad1f9

Browse files
authored
[docs] Filter connectors by suport level tabs (#45204)
1 parent f23ae56 commit 65ad1f9

File tree

1 file changed

+59
-36
lines changed

1 file changed

+59
-36
lines changed

docusaurus/src/components/ConnectorRegistry.jsx

+59-36
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { useEffect, useState } from "react";
3-
import { getSupportLevelDisplay } from "../connector_registry";
4-
3+
import Tabs from "@theme/Tabs";
4+
import TabItem from "@theme/TabItem";
55
import styles from "./ConnectorRegistry.module.css";
66
import { REGISTRY_URL } from "../connector_registry";
77

@@ -30,35 +30,23 @@ function connectorSort(a, b) {
3030
if (a.name_oss > b.name_oss) return 1;
3131
}
3232

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 }) {
4734
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) => {
6250
const docsLink = connector.documentationUrl_oss?.replace(
6351
"https://docs.airbyte.com",
6452
""
@@ -86,9 +74,6 @@ export default function ConnectorRegistry({ type }) {
8674
<a href={connector.issue_url}>🐛</a>
8775
) : null}
8876
</td>
89-
<td>
90-
<small>{getSupportLevelDisplay(connector.supportLevel_oss)}</small>
91-
</td>
9277
<td>{connector.is_oss ? "✅" : "❌"}</td>
9378
<td>{connector.is_cloud ? "✅" : "❌"}</td>
9479
<td>
@@ -102,8 +87,46 @@ export default function ConnectorRegistry({ type }) {
10287
</tr>
10388
);
10489
})}
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>
108131
);
109132
}

0 commit comments

Comments
 (0)