Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs to show archived information if connector is not in registries #35468

Merged
merged 3 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.filter((c) => c.supportLevel_oss); // at lease one connector is missing a support level
.filter((c) => c.supportLevel_oss); // at least 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>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

<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}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious why this expression is multiline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 it's what my linter did


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,
};
Loading