Skip to content

Commit

Permalink
Update docs to show archived information if connector is not in regis…
Browse files Browse the repository at this point in the history
…tries (airbytehq#35468)
  • Loading branch information
evantahler authored and jatinyadav-cc committed Feb 26, 2024
1 parent f294d2f commit 25eb13f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 25 deletions.
13 changes: 10 additions & 3 deletions docusaurus/src/components/ConnectorRegistry.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export default function ConnectorRegistry({ type }) {

const connectors = registry
.filter((c) => c.connector_type === type)
.filter((c) => c.name_oss);
.filter((c) => c.name_oss)
.filter((c) => c.supportLevel_oss); // at lease one connector is missing a support level

return (
<div>
Expand Down Expand Up @@ -77,8 +78,14 @@ export default function ConnectorRegistry({ type }) {
{/* min width to prevent wrapping */}
<td style={{ minWidth: 75 }}>
<a href={docsLink}>📕</a>
<a href={connector.github_url}>⚙️</a>
<a href={connector.issue_url}>🐛</a>
{connector.supportLevel_oss != "archived" ? (
<a href={connector.github_url}>⚙️</a>
) : (
""
)}
{connector.supportLevel_oss != "archived" ? (
<a href={connector.issue_url}>🐛</a>
) : null}
</td>
<td>
<small>{connector.supportLevel_oss}</small>
Expand Down
19 changes: 11 additions & 8 deletions docusaurus/src/components/HeaderDecoration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,17 @@ export const HeaderDecoration = ({
</a>
</dd>
</div>
<div>
<dt>Latest Version</dt>
<dd>
<a href={github_url} target="_blank">
{dockerImageTag}
</a>
</dd>
</div>
{supportLevel !== "archived" && (
<div>
<dt>Latest Version</dt>

<dd>
<a href={github_url} target="_blank">
{dockerImageTag}
</a>
</dd>
</div>
)}
</dl>

<div className={styles.header}>
Expand Down
61 changes: 47 additions & 14 deletions docusaurus/src/remark/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,52 @@ const isDocsPage = (vfile) => {
};

const getRegistryEntry = async (vfile) => {
const pathParts = vfile.path.split("/");
const connectorName = pathParts.pop().split(".")[0];
const connectorType = pathParts.pop();
const dockerRepository = `airbyte/${connectorType.replace(
/s$/,
""
)}-${connectorName}`;

const registry = await catalog;

return registry.find(
(r) => r.dockerRepository_oss === dockerRepository
const pathParts = vfile.path.split("/");
const connectorName = pathParts.pop().split(".")[0];
const connectorType = pathParts.pop();
const dockerRepository = `airbyte/${connectorType.replace(
/s$/,
""
)}-${connectorName}`;

const registry = await catalog;

let registryEntry = registry.find(
(r) => r.dockerRepository_oss === dockerRepository
);

if (!registryEntry) {
registryEntry = buildArchivedRegistryEntry(
connectorName,
dockerRepository,
connectorType
);
}
}

return registryEntry;
};

const buildArchivedRegistryEntry = (
connectorName,
dockerRepository,
connectorType
) => {
const dockerName = dockerRepository.split("/")[1];
const registryEntry = {
connectorName,
name_oss: dockerName,
dockerRepository_oss: dockerRepository,
is_oss: false,
is_cloud: false,
iconUrl_oss: `https://connectors.airbyte.com/files/metadata/airbyte/${dockerName}/latest/icon.svg`,
supportLevel_oss: "archived",
documentationUrl_oss: `https://docs.airbyte.com/integrations/${connectorType}s/${connectorName}`,
};

module.exports = { isDocsPage, getRegistryEntry };
return registryEntry;
};

module.exports = {
isDocsPage,
getRegistryEntry,
};

0 comments on commit 25eb13f

Please sign in to comment.