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

urfree pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/main by this push:
     new ef15468  update
ef15468 is described below

commit ef154680796a3f69d531375888589d5da209614f
Author: LiLi <[email protected]>
AuthorDate: Mon Feb 21 11:25:45 2022 +0800

    update
    
    Signed-off-by: LiLi <[email protected]>
---
 site2/website-next/docusaurus.config.js      | 228 ++++++++++++++++-----------
 site2/website-next/src/components/CLI.js     |  29 ++--
 site2/website-next/src/components/RestApi.js |  67 +++++---
 site2/website-next/src/pages/download.js     |   1 -
 site2/website-next/src/pages/versions.js     |   3 +-
 5 files changed, 201 insertions(+), 127 deletions(-)

diff --git a/site2/website-next/docusaurus.config.js 
b/site2/website-next/docusaurus.config.js
index ae7914b..24a13df 100644
--- a/site2/website-next/docusaurus.config.js
+++ b/site2/website-next/docusaurus.config.js
@@ -116,24 +116,24 @@ module.exports = {
       },
       items: [
         {
-          type: 'dropdown',
-          label: 'Get Started',
-          position: 'right',
+          type: "dropdown",
+          label: "Get Started",
+          position: "right",
           items: [
             {
               type: "doc",
               docId: "concepts-overview",
-              label: 'Pulsar Concepts'
+              label: "Pulsar Concepts",
             },
             {
               type: "doc",
-              label: 'Quickstart',
+              label: "Quickstart",
               docId: "about",
             },
             {
-              label: 'Ecosystem',
-              to: 'ecosystem'
-            }
+              label: "Ecosystem",
+              to: "ecosystem",
+            },
             // ... more items
           ],
         },
@@ -144,64 +144,110 @@ module.exports = {
           label: "Docs",
         },
         {
-          type: 'dropdown',
-          label: 'Community',
-          position: 'right',
+          label: "REST APIs",
+          position: "right",
           items: [
-            { 
-              to: "community#welcome", 
-              label: "Welcome" 
+            {
+              label: "Admin REST API",
+              to: "/admin-rest-api",
             },
-            { 
-              to: "community#discussions", 
-              label: "Discussions"
+            {
+              label: "Functions",
+              to: "/functions-rest-api",
             },
-            { 
-              to: "community#governance", 
-              label: "Governance"
+            {
+              label: "Sources",
+              to: "/source-rest-api",
             },
-            { 
-              to: "community#community", 
-              label: "Meet the Community"
+            {
+              label: "Sinks",
+              to: "/sink-rest-api",
             },
-            { 
-              to: "community#how-to-contribute", 
-              label: "Contribute"
+            {
+              label: "Packages",
+              to: "/packages-rest-api",
             },
-            { 
-              to: "https://github.com/apache/pulsar/wiki";, 
-              label: "Wiki"
+          ],
+        },
+        {
+          label: "CLI",
+          position: "right",
+          items: [
+            {
+              label: "Pulsar Admin",
+              to: "/pulsar-admin-cli",
             },
-            { 
-              to: "https://github.com/apache/pulsar/issues";, 
-              label: "Issue Tracking"
+            {
+              label: "Pulsar Client",
+              to: "/pulsar-client-cli",
             },
-
-          ]
+            {
+              label: "Pulsar Perf",
+              to: "/pulsar-perf-cli",
+            },
+            {
+              label: "Pulsar",
+              to: "/pulsar-cli",
+            },
+          ],
         },
         {
-          type: 'dropdown',
-          label: 'Learn',
-          position: 'right',
+          type: "dropdown",
+          label: "Community",
+          position: "right",
           items: [
-            { 
-              to: "blog", 
-              label: "Blog" 
+            {
+              to: "community#welcome",
+              label: "Welcome",
             },
-            { 
-              to: "case-studies", 
-              label: "Case Studies"
+            {
+              to: "community#discussions",
+              label: "Discussions",
             },
-            { 
-              to: "resources", 
-              label: "Resources"
+            {
+              to: "community#governance",
+              label: "Governance",
             },
-            { 
-              to: "events", 
-              label: "Events"
+            {
+              to: "community#community",
+              label: "Meet the Community",
             },
-
-          ]
+            {
+              to: "community#how-to-contribute",
+              label: "Contribute",
+            },
+            {
+              to: "https://github.com/apache/pulsar/wiki";,
+              label: "Wiki",
+            },
+            {
+              to: "https://github.com/apache/pulsar/issues";,
+              label: "Issue Tracking",
+            },
+          ],
+        },
+        {
+          type: "dropdown",
+          label: "Learn",
+          position: "right",
+          items: [
+            {
+              to: "blog",
+              label: "Blog",
+            },
+            {
+              to: "case-studies",
+              label: "Case Studies",
+            },
+            {
+              to: "resources",
+              label: "Resources",
+            },
+            {
+              to: "events",
+              label: "Events",
+            },
+          ],
         },
         // {
         //   type: "localeDropdown",
@@ -278,55 +324,57 @@ module.exports = {
     },
     footer: {
       logo: {
-        alt: 'Pulsar Logo',
-        src: 'img/pulsar-white.svg',
-        href: '/',
+        alt: "Pulsar Logo",
+        src: "img/pulsar-white.svg",
+        href: "/",
       },
       links: [
         {
-          title: 'Apache Foundation.', //Column title
-                 items: [
-              { //Embedded HTML
-                     html: `
+          title: "Apache Foundation.", //Column title
+          items: [
+            {
+              //Embedded HTML
+              html: `
                      <img src="/img/Apache_Feather_Logo.svg" alt="" width="20">
                      `,
-                   },
-                   {
-                     label: "Foundation",
-                href: "http://www.apache.org/";,
-                   },
-                   {
-                     label: "Events",
-                href: "https://www.apache.org/events/current-event.html";,
-                   },
-                   {
-                     label: "License",
-                href: "https://www.apache.org/licenses/";,
-                   },
-                   {
-                     label: "Thanks",
-                href: "https://www.apache.org/foundation/thanks";,
-                   },
-                   {
-                     label: "Security",
-                href: "https://www.apache.org/security";,
-                   },
-                   {
-                     label: "Sponsorship",
-                href: "https://www.apache.org/foundation/sponsorship";,
-                   },
-                 ],
+            },
+            {
+              label: "Foundation",
+              href: "http://www.apache.org/";,
+            },
+            {
+              label: "Events",
+              href: "https://www.apache.org/events/current-event.html";,
+            },
+            {
+              label: "License",
+              href: "https://www.apache.org/licenses/";,
+            },
+            {
+              label: "Thanks",
+              href: "https://www.apache.org/foundation/thanks";,
+            },
+            {
+              label: "Security",
+              href: "https://www.apache.org/security";,
+            },
+            {
+              label: "Sponsorship",
+              href: "https://www.apache.org/foundation/sponsorship";,
+            },
+          ],
         },
         {
-          title: ' ', //Column title
-                 items: [
-                   { //Embedded HTML
-                     html: `
+          title: " ", //Column title
+          items: [
+            {
+              //Embedded HTML
+              html: `
                      <div><small><strong>Apache Pulsar is available under the 
<a href="/">Apache License, version 2.0.</a></strong></small></div>
                 <div>Apache Pulsar is a distributed, open source pub-sub 
messaging and streaming platform for real-time workloads, managing hundreds of 
billions of events per day.</div>
                      `,
-                   },
-                 ],
+            },
+          ],
         },
       ],
       copyright: `<p>Apache Pulsar is available under the Apache License, 
version 2.0.</p>
diff --git a/site2/website-next/src/components/CLI.js 
b/site2/website-next/src/components/CLI.js
index b269789..1042dd9 100644
--- a/site2/website-next/src/components/CLI.js
+++ b/site2/website-next/src/components/CLI.js
@@ -1,21 +1,29 @@
 const React = require("react");
 import Layout from "@theme/Layout";
 const versionList = require("../../versions.json");
+import { setVersion, getVersion, getApiVersion } from "../utils/index.js";
+
+function parseVersion() {}
 
 class CLI extends React.Component {
   componentDidMount() {
+    let version = getVersion();
+
     let params = window.location.search;
     let latestVersion = versionList[0];
     let clientModule = this.props.module || "pulsar-admin";
     params = params.replace("?", "");
     const paramsList = params.split("&");
-    let version = "master";
-    for (let i in paramsList) {
-      let param = paramsList[i].split("=");
-      if (param[0] === "version") {
-        version = param[1];
+
+    if (paramsList && paramsList.length > 0) {
+      for (let i in paramsList) {
+        let param = paramsList[i].split("=");
+        if (param[0] === "version") {
+          version = param[1];
+        }
       }
     }
+
     if (version === "master") {
       let latestVersionSplit = latestVersion.split(".");
       version =
@@ -24,6 +32,7 @@ class CLI extends React.Component {
         (parseInt(latestVersionSplit[1]) + 1) +
         ".0";
     }
+
     let versions = version.split(".");
     let majorVersion = parseInt(versions[0]);
     let minorVersion = parseInt(versions[1]);
@@ -44,18 +53,14 @@ class CLI extends React.Component {
       majorVersion === 1
     ) {
       if (version === latestVersion) {
-        window.location.href = "/docs/en" + referenceLink;
+        window.location.href = "/docs" + referenceLink;
       } else {
-        window.location.href = "/docs/en/" + version + referenceLink;
+        window.location.href = "/docs/" + version + referenceLink;
       }
     } else {
       version = parseInt(versions[0]) + "." + parseInt(versions[1]) + ".0";
       window.location.href =
-        "http://pulsar.apache.org/tools/"; +
-        clientModule +
-        "/" +
-        version +
-        "-SNAPSHOT";
+        "/tools/" + clientModule + "/" + version + "-SNAPSHOT";
     }
   }
 
diff --git a/site2/website-next/src/components/RestApi.js 
b/site2/website-next/src/components/RestApi.js
index 01513cc..ae076e1 100644
--- a/site2/website-next/src/components/RestApi.js
+++ b/site2/website-next/src/components/RestApi.js
@@ -1,31 +1,54 @@
 const React = require("react");
 import Layout from "@theme/Layout";
+import { setVersion, getVersion, getApiVersion } from "../utils/index.js";
+
+function parseVersion(pathName) {
+  let swagger = "swagger";
+  if (pathName.indexOf("functions") > -1) {
+    swagger = "swaggerfunctions";
+  } else if (pathName.indexOf("source") > -1) {
+    swagger = "swaggersource";
+  } else if (pathName.indexOf("sink") > -1) {
+    swagger = "swaggersink";
+  } else if (pathName.indexOf("packages") > -1) {
+    swagger = "swaggerpackages";
+  }
+  let version = getVersion();
+  let apiversion = getApiVersion(swagger);
+
+  if (version !== "master") {
+    var versions = version.split(".");
+    var majorVersion = parseInt(versions[0]);
+    var minorVersion = parseInt(versions[1]);
+    if (majorVersion < 2) {
+      version = "2.3.0";
+    } else if (minorVersion < 3) {
+      version = "2.3.0";
+    }
+  }
+
+  return [version, apiversion];
+}
 class RestApi extends React.Component {
   componentDidMount() {
-    var params = window.location.search;
-    var pathName = window.location.pathname;
+    let pathName = window.location.pathname;
+
+    let [version, apiversion] = parseVersion(pathName);
+
+    let params = window.location.search;
     params = params.replace("?", "");
     const paramsList = params.split("&");
-    var version = "master";
-    var apiversion = "";
-    for (var i in paramsList) {
-      var param = paramsList[i].split("=");
-      if (param[0] === "version") {
-        version = param[1];
-      }
-      if (param[0] === "apiversion") {
-        apiversion = param[1];
-      }
-    }
-
-    if (version !== "master") {
-      var versions = version.split(".");
-      var majorVersion = parseInt(versions[0]);
-      var minorVersion = parseInt(versions[1]);
-      if (majorVersion < 2) {
-        version = "2.3.0";
-      } else if (minorVersion < 3) {
-        version = "2.3.0";
+    if (paramsList && paramsList.length > 0) {
+      version = "master";
+      apiversion = "";
+      for (let i in paramsList) {
+        let param = paramsList[i].split("=");
+        if (param[0] === "version") {
+          version = param[1];
+        }
+        if (param[0] === "apiversion") {
+          apiversion = param[1];
+        }
       }
     }
 
diff --git a/site2/website-next/src/pages/download.js 
b/site2/website-next/src/pages/download.js
index f0a78d0..0b1034a 100644
--- a/site2/website-next/src/pages/download.js
+++ b/site2/website-next/src/pages/download.js
@@ -8,7 +8,6 @@ import useDocusaurusContext from 
"@docusaurus/useDocusaurusContext";
 import Translate, { translate } from "@docusaurus/Translate";
 import ReactMarkdown from "react-markdown";
 
-const versions = require(`../../versions.json`);
 const releases = require(`../../releases.json`);
 const pulsarManagerReleases = require(`../../pulsar-manager-release.json`);
 const pulsarAdaptersReleases = require(`../../pulsar-adapters-release.json`);
diff --git a/site2/website-next/src/pages/versions.js 
b/site2/website-next/src/pages/versions.js
index 5e00677..331ddab 100644
--- a/site2/website-next/src/pages/versions.js
+++ b/site2/website-next/src/pages/versions.js
@@ -3,8 +3,7 @@ import Layout from "@theme/Layout";
 import VersionsTable from "../components/VersionsTable";
 import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
 import Translate, { translate } from "@docusaurus/Translate";
-import { docUrl } from "../utils/index";
-const versions = require("../../versions.json");
+const versions = require("../../versions-full.json");
 const oldversions = require("../../oldversions.json");
 
 export default function DenseTable() {

Reply via email to