Skip to content

Commit

Permalink
Revert "Revert "[docs] add linux amd64 download button" (#41671)"
Browse files Browse the repository at this point in the history
This reverts commit 64faf69.
  • Loading branch information
cgardens authored Jul 16, 2024
1 parent b7d7db6 commit 5010208
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 6 deletions.
23 changes: 18 additions & 5 deletions docs/using-airbyte/getting-started/oss-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ brew upgrade abctl
</TabItem>
<TabItem value="abctl-linux" label="Linux" default>

**1: Download the latest release of `abctl` [here](https://github.com/airbytehq/abctl/releases)**
**1: Download the latest release of `abctl`.**

<a class="abctl-download button button--primary disabled" data-architecture="linux-amd64" href="#" style={{ marginRight: '10px' }} download>Loading...</a>
<a class="abctl-download button button--primary disabled" data-architecture="linux-arm64" href="#" download>Loading...</a>
<br/>
<br/>

:::info
Be sure to download the file that is compatible with your machine's processor architecture.
:::
<details>
<summary>Be sure to download the file that is compatible with your machine's processor architecture.</summary>

You'll see two options: `linux-amd64` and `linux-arm64`
If you're unsure which one you need, running the following command will help:
Expand All @@ -63,6 +68,8 @@ uname -m

- If the output is `x86_64`, you have an x86-64 processor.
- If the output is `aarch64` or something similar, you have an ARM-based processor.
</details>
:::

**2: Extract the archive**

Expand Down Expand Up @@ -99,7 +106,11 @@ If this command prints the installed version of the Airbyte Command Line Tool, i
</TabItem>
<TabItem value="abctl-windows" label="Windows" default>

**1: Download the latest release of `abctl` [here](https://github.com/airbytehq/abctl/releases)**
**1: Download the latest release of `abctl`.**

<a class="abctl-download button button--primary disabled" data-architecture="windows-amd64" href="#" download>Loading...</a>
<br/>
<br/>

**2: Extract the archive**
- Right click the zip file you've downloaded and select `Extract All...`, then choose a destination folder.
Expand Down Expand Up @@ -210,4 +221,6 @@ There are several channels for community support of local setup and deployment.
On Udemy, [The Complete Hands-on Introduction to Airbyte](https://www.udemy.com/course/the-complete-hands-on-introduction-to-airbyte/) is a convenient and hands-on introduction to Airbyte that includes setting up example source and destination configurations. You'll also go on to use it in conjunction with Apache Airflow, Snowflake, dbt, and more.

**Bug Reports:**<br/>If you find an issue with the `abctl` command, please report it as a github
issue [here](https://github.com/airbytehq/airbyte/issues) with the type of `🐛 [abctl] Report an issue with the abctl tool`.
issue [here](https://github.com/airbytehq/airbyte/issues) with the type of `🐛 [abctl] Report an issue with the abctl tool`.

**Releases:**<br/>If you'd like to select which release of abctl to run, you can find the list of releases [here](https://github.com/airbytehq/abctl/releases/).
3 changes: 2 additions & 1 deletion docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ const config = {
],

clientModules: [
require.resolve("./src/scripts/fontAwesomeIcons.js"),
require.resolve("./src/scripts/cloudStatus.js"),
require.resolve('./src/scripts/download-abctl-buttons.js'),
require.resolve("./src/scripts/fontAwesomeIcons.js"),
],

presets: [
Expand Down
51 changes: 51 additions & 0 deletions docusaurus/src/scripts/download-abctl-buttons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";

if (ExecutionEnvironment.canUseDOM) {
// Pre-fetch the urls for the binaries.
const binaries = fetch(
'https://api.github.com/repos/airbytehq/abctl/releases/latest')
.then(response => response.json())
.then(data => data.assets);

// Initialize button by choosing the relevant binary based on the data-architecture tag.
function initializeDownloadButton(button) {
binaries.then(assets => {
const architecture = button.getAttribute('data-architecture');
const binary = assets.find(
b => b.name.toLowerCase().includes(architecture.toLowerCase()));
if (binary) {
button.href = binary.browser_download_url;
button.innerText = `Download ${architecture}`;
button.classList.remove('disabled');
} else {
fallback(button);
}
})
.catch(error => {
console.error('Error fetching latest release:', error);
fallback(button);
});
}

// If loading fails for some reason or we can't find the asset, fallback on just
// making a link to the latest releases page.
function fallback(button) {
const architecture = button.getAttribute('data-architecture');
button.href = 'https://github.com/airbytehq/abctl/releases/latest';
button.innerText = `Latest ${architecture} Release`
button.target = '_blank'; // Opens the link in a new tab
button.classList.remove('disabled');
}

// All buttons with this behavior have the class abctl-download.
function initializeAllDownloadButtons() {
const buttons = document.getElementsByClassName('abctl-download');
Array.from(buttons).forEach(initializeDownloadButton);
}

// Document load is a bit weird in docusaurus.
// https://stackoverflow.com/a/74736980/4195169
window.addEventListener('load', () => {
setTimeout(initializeAllDownloadButtons, 1000);
});
}

0 comments on commit 5010208

Please sign in to comment.