This is an automated email from the ASF dual-hosted git repository.

jeffreyh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 099c80ea5d7 Update v3.x pdf resource (#3153)
099c80ea5d7 is described below

commit 099c80ea5d7c7e0e94a9ca50f2d95e82da8c7129
Author: yangon <[email protected]>
AuthorDate: Thu Dec 4 10:07:08 2025 +0800

    Update v3.x pdf resource (#3153)
---
 .github/workflows/build-check.yml                  |  14 ++---
 src/constant/download.data.ts                      |   6 +-
 src/theme/TOC/index.tsx                            |  65 ++++++++++++++-------
 static/pdf/Apache_Doris_v3_0_4412376f6e.pdf        | Bin 15755677 -> 0 bytes
 ...s_v4_x.pdf => Apache_Doris_v3_x_t5x7q9z2y4.pdf} | Bin 60602860 -> 57613601 
bytes
 ...s_v4_x.pdf => Apache_Doris_v4_x_j3h8d6b1v0.pdf} | Bin
 6 files changed, 55 insertions(+), 30 deletions(-)

diff --git a/.github/workflows/build-check.yml 
b/.github/workflows/build-check.yml
index 7d0642493f9..14fc7d21374 100644
--- a/.github/workflows/build-check.yml
+++ b/.github/workflows/build-check.yml
@@ -70,10 +70,10 @@ jobs:
                     exit 1
                 fi
 
-            # - name: Build
-            #   run: |
-            #       npm install -g yarn
-            #       yarn cache clean
-            #       export NODE_OPTIONS=--max-old-space-size=8192
-            #       yarn && yarn build
-            #       rm -rf build
+            - name: Build
+              run: |
+                  npm install -g yarn
+                  yarn cache clean
+                  export NODE_OPTIONS=--max-old-space-size=8192
+                  yarn && yarn build
+                  rm -rf build
diff --git a/src/constant/download.data.ts b/src/constant/download.data.ts
index 7d75acdaea5..a05ab5e094a 100644
--- a/src/constant/download.data.ts
+++ b/src/constant/download.data.ts
@@ -2578,12 +2578,12 @@ export const DOWNLOAD_PDFS = [
      {
         version: '4.x',
         filename: 'Apache Doris 中文手册(v4.x).pdf',
-        link: 'https://doris.apache.org/pdf/Apache_Doris_v4_x.pdf',
+        link: 'https://doris.apache.org/pdf/Apache_Doris_v4_x_j3h8d6b1v0.pdf',
     },
     {
         version: '3.x',
-        filename: 'Apache Doris 中文手册(v3.0).pdf',
-        link: 'https://doris.apache.org/pdf/Apache_Doris_v3_0_4412376f6e.pdf',
+        filename: 'Apache Doris 中文手册(v3.x).pdf',
+        link: 'https://doris.apache.org/pdf/Apache_Doris_v3_x_t5x7q9z2y4.pdf',
     },
     {
         version: '2.1',
diff --git a/src/theme/TOC/index.tsx b/src/theme/TOC/index.tsx
index ad1a38a5041..ddf4b298ea9 100644
--- a/src/theme/TOC/index.tsx
+++ b/src/theme/TOC/index.tsx
@@ -11,6 +11,7 @@ import { SlackIcon } from '../../components/Icons/slack-icon';
 import useIsBrowser from '@docusaurus/useIsBrowser';
 import { DOWNLOAD_PDFS } from '@site/src/constant/download.data';
 import { VERSIONS, DEFAULT_VERSION } from '@site/src/constant/version';
+import { Spin } from 'antd';
 import Link from '@docusaurus/Link';
 
 import styles from './styles.module.css';
@@ -20,25 +21,47 @@ import styles from './styles.module.css';
 const LINK_CLASS_NAME = 'table-of-contents__link toc-highlight';
 const LINK_ACTIVE_CLASS_NAME = 'table-of-contents__link--active';
 
-export function downloadFile(url: string, filename: string) {
-    var xml = new XMLHttpRequest();
-    xml.open('GET', url, true);
-    xml.responseType = 'blob';
-    xml.onload = function () {
-        var url = window.URL.createObjectURL(xml.response);
-        var a = document.createElement('a');
-        a.href = url;
-        a.download = filename;
-        a.click();
-    };
-    xml.send();
-}
-
 export default function TOC({ className, ...props }: Props): 
React.ReactElement {
     const { siteConfig } = useDocusaurusContext();
     const isBrowser = useIsBrowser();
     const isCN = siteConfig.baseUrl.indexOf('zh-CN') > -1;
     const [currentVersion, setCurrentVersion] = useState(DEFAULT_VERSION);
+    const [loading, setLoading] = useState(false);
+
+    function downloadFileWithLoading(url: string, filename: string): 
Promise<void> {
+        return new Promise((resolve, reject) => {
+            setLoading(true);
+            const xhr = new XMLHttpRequest();
+            xhr.open('GET', url, true);
+            xhr.responseType = 'blob';
+            xhr.onload = function () {
+                setLoading(false);
+                if (xhr.status === 200) {
+                    try {
+                        const blobUrl = 
window.URL.createObjectURL(xhr.response);
+                        const a = document.createElement('a');
+                        a.href = blobUrl;
+                        a.download = filename;
+                        a.click();
+                        window.URL.revokeObjectURL(blobUrl);
+                        resolve();
+                    } catch (error) {
+                        reject(error);
+                    }
+                }
+            };
+            xhr.onerror = function () {
+                setLoading(false);
+                reject(new Error('netwo'));
+            };
+            xhr.ontimeout = function () {
+                setLoading(false);
+                reject(new Error('timeout'));
+            };
+
+            xhr.send();
+        });
+    }
 
     useEffect(() => {
         if (typeof window !== 'undefined') {
@@ -55,7 +78,7 @@ export default function TOC({ className, ...props }: Props): 
React.ReactElement
             }
         }
     }, [typeof window !== 'undefined' && location.pathname]);
-    
+
     return (
         <div className={clsx(styles.tableOfContents, 'thin-scrollbar', 
'toc-container', className)}>
             <div style={isBrowser && location.pathname.startsWith('/blog') ? { 
display: 'none' } : {}}>
@@ -65,16 +88,18 @@ export default function TOC({ className, ...props }: 
Props): React.ReactElement
                         <span className="group-hover:text-[#444FD9]">{isCN ? 
'Doris 首页' : 'Doris Homepage'}</span>
                     </div>
                 </Link>
-                {isCN && ['4.x','3.x', '2.0', '2.1'].includes(currentVersion) 
? (
+                {isCN && ['4.x', '3.x', '2.0', '2.1'].includes(currentVersion) 
? (
                     <div
-                        className="toc-icon-content group"
-                        onClick={() => {
+                        className={`${loading ? '!cursor-not-allowed' : 
'cursor-pointer'} toc-icon-content group`}
+                        onClick={async () => {
+                            if (loading) return;
                             const pdfInfo = DOWNLOAD_PDFS.find(item => 
item.version === currentVersion);
-                            downloadFile(pdfInfo.link, pdfInfo.filename);
+                            await downloadFileWithLoading(pdfInfo.link, 
pdfInfo.filename);
                         }}
                     >
                         <PdfIcon className="group-hover:text-[#444FD9]" />
-                        <span className="group-hover:text-[#444FD9]">{isCN ? 
'下载 PDF' : 'Download PDF'}</span>
+                        <span className={` group-hover:text-[#444FD9] 
mr-2`}>{isCN ? '下载 PDF' : 'Download PDF'}</span>
+                        <Spin size="small" spinning={loading} />
                     </div>
                 ) : null}
                 {isCN ? (
diff --git a/static/pdf/Apache_Doris_v3_0_4412376f6e.pdf 
b/static/pdf/Apache_Doris_v3_0_4412376f6e.pdf
deleted file mode 100644
index b015a27a9e3..00000000000
Binary files a/static/pdf/Apache_Doris_v3_0_4412376f6e.pdf and /dev/null differ
diff --git a/static/pdf/Apache_Doris_v4_x.pdf 
b/static/pdf/Apache_Doris_v3_x_t5x7q9z2y4.pdf
similarity index 90%
copy from static/pdf/Apache_Doris_v4_x.pdf
copy to static/pdf/Apache_Doris_v3_x_t5x7q9z2y4.pdf
index 3a6434dfd8e..ae9f096c3de 100644
Binary files a/static/pdf/Apache_Doris_v4_x.pdf and 
b/static/pdf/Apache_Doris_v3_x_t5x7q9z2y4.pdf differ
diff --git a/static/pdf/Apache_Doris_v4_x.pdf 
b/static/pdf/Apache_Doris_v4_x_j3h8d6b1v0.pdf
similarity index 100%
rename from static/pdf/Apache_Doris_v4_x.pdf
rename to static/pdf/Apache_Doris_v4_x_j3h8d6b1v0.pdf


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to