Skip to content

Commit

Permalink
fix download error
Browse files Browse the repository at this point in the history
  • Loading branch information
SbloodyS committed Oct 23, 2024
1 parent fb7bd1e commit 063ffad
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 23 deletions.
1 change: 0 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
name="keywords"
content="apache dolphinscheduler,dolphinscheduler,document,community,workflow scheduler,data orchestration,workflow orchestration,drag and drop workflow,DAG"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
10 changes: 0 additions & 10 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
Expand Down
10 changes: 0 additions & 10 deletions src/components/NavBar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@ const NavBar = () => {
>
<Button shape="round">{t("contacts")}</Button>
</Dropdown>
<Button
type="primary"
shape="round"
onClick={() => {
navigate(`/${locale}/download`);
setSelectedKeys("");
}}
>
{t("download")}
</Button>
</Space>
</section>
</nav>
Expand Down
16 changes: 14 additions & 2 deletions src/hooks/useVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,29 @@ import { useEffect, useState } from "react";
import getVersions from "../api/getVersions";

export const useVersions = () => {
const reverseVersions = (versions) => {
let reversedVersions = versions.reverse();
const devIndex = reversedVersions.indexOf("dev");
if (devIndex > -1) {
reversedVersions.splice(devIndex, 1);
reversedVersions.push("dev");
}
return reversedVersions;
};

const stored = JSON.parse(sessionStorage.getItem("versions")) || [];
const [versions, setVersions] = useState(stored.reverse());
const [versions, setVersions] = useState(reverseVersions(stored));

useEffect(() => {
if (!stored.length) {
getVersions().then((result) => {
setVersions(result.reverse());
setVersions(reverseVersions(result));
});
}
// eslint-disable-next-line
}, []);



return { versions, currentVersion: versions[0] };
};
5 changes: 5 additions & 0 deletions src/views/Documentation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ const Documentation = () => {
handleAnchor,
navigate,
} = useDocumentation(params);
let downloadButtonIsDisabled = false;
const searchRef = useRef();

if (!versions.includes(params.version)) {
return <Navigate to={`/${locale}/docs/${versions[0]}`} replace={true} />;
}
if (params.version === "dev") {
downloadButtonIsDisabled = true;
}
return (
<section className="documentation" id="documentation">
<div className="documentation-sider">
Expand All @@ -69,6 +73,7 @@ const Documentation = () => {
shape="round"
ghost
size="large"
disabled={downloadButtonIsDisabled}
onClick={() => {
navigate(`/${locale}/download/${params.version}`);
}}
Expand Down

0 comments on commit 063ffad

Please sign in to comment.