From 2e4522f29467b0f4078a1fe3dce5a1aed73564a0 Mon Sep 17 00:00:00 2001 From: "Vega, Obed" Date: Wed, 16 Apr 2025 17:12:37 -0700 Subject: [PATCH 1/7] fix behavior in select component --- i18n/en/code.json | 4 +- .../SelectComponent/SelectComponent.js | 37 +++++++++++++------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/i18n/en/code.json b/i18n/en/code.json index 22db157e58..e05c54a296 100644 --- a/i18n/en/code.json +++ b/i18n/en/code.json @@ -262,13 +262,13 @@ "message": "Categories" }, "home_page.select_platform": { - "message": "Select platform" + "message": "Select a platform" }, "home_page.select_platform_2": { "message": "Get documentation based on the AI Unlimited platform." }, "home_page.edition_cloud": { - "message": "Cloud Service Provider" + "message": "Cloud service provider" }, "home_page.edition_ms_fabric": { "message": "Microsoft Fabric" diff --git a/src/components/SelectComponent/SelectComponent.js b/src/components/SelectComponent/SelectComponent.js index 18dea779bd..c6715bad22 100644 --- a/src/components/SelectComponent/SelectComponent.js +++ b/src/components/SelectComponent/SelectComponent.js @@ -5,29 +5,42 @@ import styles from './styles.module.css'; import useBaseUrl from '@docusaurus/useBaseUrl'; export default function SelectComponent() { - const [selectedOption, setSelectedOption] = useState(''); const location = useLocation(); const normalizePath = (path) => path.replace(/\/$/, ''); const currentPath = normalizePath(location.pathname); - const aiUnlimitedUrl = useBaseUrl('/ai-unlimited/install-ai-unlimited'); - const fabricUrl = useBaseUrl('/ai-unlimited/fabric/get-started'); const pathsNoAlert = normalizePath(`/quickstarts/`); const shouldDisplayAlert = !currentPath.includes(pathsNoAlert); + const isPathMatching = (basePath, path) => normalizePath(path).startsWith(normalizePath(basePath)); + + const initialOption = isPathMatching('/ai-unlimited/fabric', currentPath) + ? '1' + : isPathMatching('/ai-unlimited', currentPath) + ? '0' + : undefined; + + const [selectedOption, setSelectedOption] = useState(initialOption); + useEffect(() => { - if (currentPath === aiUnlimitedUrl) { - setSelectedOption('0'); - } else if (currentPath === fabricUrl) { + if (isPathMatching('/ai-unlimited/fabric', currentPath)) { setSelectedOption('1'); + } else if (isPathMatching('/ai-unlimited', currentPath)) { + setSelectedOption('0'); + } else { + setSelectedOption(undefined); } - }, [currentPath, aiUnlimitedUrl, fabricUrl]); + }, [currentPath]); const handleSelection = (event) => { const selectedIndex = event.detail.index?.toString(); - if (selectedIndex === '0' && currentPath !== aiUnlimitedUrl) { - window.location.href = aiUnlimitedUrl; - } else if (selectedIndex === '1' && currentPath !== fabricUrl) { - window.location.href = fabricUrl; + if (selectedIndex === selectedOption || selectedIndex === undefined) { + return; + } + + if (selectedIndex === '0') { + window.location.href = '/ai-unlimited'; + } else if (selectedIndex === '1') { + window.location.href = '/ai-unlimited/fabric'; } }; @@ -56,4 +69,4 @@ export default function SelectComponent() { }} ); -} +} \ No newline at end of file From 8074daf67d80366357cf38d87708b27d8f0299e3 Mon Sep 17 00:00:00 2001 From: "Vega, Obed" Date: Mon, 19 May 2025 08:50:13 -0700 Subject: [PATCH 2/7] fix redirect fo fabric --- src/components/SelectComponent/SelectComponent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SelectComponent/SelectComponent.js b/src/components/SelectComponent/SelectComponent.js index c6715bad22..2cd3e31fa6 100644 --- a/src/components/SelectComponent/SelectComponent.js +++ b/src/components/SelectComponent/SelectComponent.js @@ -38,9 +38,9 @@ export default function SelectComponent() { } if (selectedIndex === '0') { - window.location.href = '/ai-unlimited'; + window.location.href = '/ai-unlimited/install-ai-unlimited'; } else if (selectedIndex === '1') { - window.location.href = '/ai-unlimited/fabric'; + window.location.href = '/ai-unlimited/fabric/get-started'; } }; From a33277155c2a79bc5dcecdd8b2caaa429fbe9273 Mon Sep 17 00:00:00 2001 From: "Vega, Obed" Date: Wed, 28 May 2025 13:16:30 -0700 Subject: [PATCH 3/7] fix/select edition behavior --- src/components/SelectComponent/SelectComponent.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/SelectComponent/SelectComponent.js b/src/components/SelectComponent/SelectComponent.js index 2cd3e31fa6..fe3a7cf67d 100644 --- a/src/components/SelectComponent/SelectComponent.js +++ b/src/components/SelectComponent/SelectComponent.js @@ -8,6 +8,9 @@ export default function SelectComponent() { const location = useLocation(); const normalizePath = (path) => path.replace(/\/$/, ''); const currentPath = normalizePath(location.pathname); + const aiUnlimitedUrl = useBaseUrl('/ai-unlimited/install-ai-unlimited'); + const fabricUrl = useBaseUrl('/ai-unlimited/fabric/get-started'); + const pathsNoAlert = normalizePath(`/quickstarts/`); const shouldDisplayAlert = !currentPath.includes(pathsNoAlert); @@ -38,9 +41,9 @@ export default function SelectComponent() { } if (selectedIndex === '0') { - window.location.href = '/ai-unlimited/install-ai-unlimited'; + window.location.href = aiUnlimitedUrl; } else if (selectedIndex === '1') { - window.location.href = '/ai-unlimited/fabric/get-started'; + window.location.href = fabricUrl; } }; From 86bf744ddbb318898966a139d3ac21ea43963c9d Mon Sep 17 00:00:00 2001 From: "Vega, Obed" Date: Thu, 29 May 2025 09:53:16 -0700 Subject: [PATCH 4/7] fix/select edition behavior-1 --- .../SelectComponent/SelectComponent.js | 70 +++++++++++++------ 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/src/components/SelectComponent/SelectComponent.js b/src/components/SelectComponent/SelectComponent.js index fe3a7cf67d..771598bf6d 100644 --- a/src/components/SelectComponent/SelectComponent.js +++ b/src/components/SelectComponent/SelectComponent.js @@ -5,44 +5,68 @@ import styles from './styles.module.css'; import useBaseUrl from '@docusaurus/useBaseUrl'; export default function SelectComponent() { + const [selectedOption, setSelectedOption] = useState(''); const location = useLocation(); const normalizePath = (path) => path.replace(/\/$/, ''); const currentPath = normalizePath(location.pathname); const aiUnlimitedUrl = useBaseUrl('/ai-unlimited/install-ai-unlimited'); const fabricUrl = useBaseUrl('/ai-unlimited/fabric/get-started'); - const pathsNoAlert = normalizePath(`/quickstarts/`); const shouldDisplayAlert = !currentPath.includes(pathsNoAlert); + const selectedOptionZeroPaths = [ + aiUnlimitedUrl, + normalizePath('/ai-unlimited/install-ai-unlimited/deploy-manager-aws-console'), + normalizePath('/ai-unlimited/install-ai-unlimited/deploy-manager-azure-portal'), + normalizePath('/ai-unlimited/install-ai-unlimited/setup-ai-unlimited'), + normalizePath('/ai-unlimited/explore-and-analyze-data'), + normalizePath('/ai-unlimited/explore-and-analyze-data/get-api-key'), + normalizePath('/ai-unlimited/explore-and-analyze-data/create-first-project'), + normalizePath('/ai-unlimited/explore-and-analyze-data/collaborate-project'), + normalizePath('/ai-unlimited/explore-and-analyze-data/project-flow'), + normalizePath('/ai-unlimited/explore-and-analyze-data/use-cases'), + normalizePath('/ai-unlimited/explore-and-analyze-data/magic-commands'), + normalizePath('/ai-unlimited/manage-ai-unlimited'), + normalizePath('/ai-unlimited/manage-ai-unlimited/add-collaborators'), + normalizePath('/ai-unlimited/manage-ai-unlimited/suspend-and-restore-project'), + normalizePath('/ai-unlimited/manage-ai-unlimited/change-settings'), + normalizePath('/ai-unlimited/resources'), + normalizePath('/ai-unlimited/resources/aws-account-requirements'), + normalizePath('/ai-unlimited/resources/azure-account-requirements'), + normalizePath('/ai-unlimited/resources/create-oauth-app/'), + normalizePath('/ai-unlimited/resources/jupyterlab/'), + normalizePath('/ai-unlimited/resources/jupyterlab/deploy-jupyter-aws-console/'), + normalizePath('/ai-unlimited/resources/jupyterlab/deploy-jupyter-azure-portal/'), + normalizePath('/ai-unlimited/resources/jupyterlab/run-jupyter-docker/'), + normalizePath('/ai-unlimited/resources/quickstart/'), + normalizePath('/ai-unlimited/resources/quickstart/run-ai-unlimited-jupyterlab-docker/'), + normalizePath(`/ai-unlimited/resources/quickstart/docker-when-you're-done/`), + normalizePath('/ai-unlimited/whats-new/'), + normalizePath('/ai-unlimited/faq/'), + normalizePath('/ai-unlimited/glossary/'), + normalizePath('/ai-unlimited/support/'), + ]; - const isPathMatching = (basePath, path) => normalizePath(path).startsWith(normalizePath(basePath)); - - const initialOption = isPathMatching('/ai-unlimited/fabric', currentPath) - ? '1' - : isPathMatching('/ai-unlimited', currentPath) - ? '0' - : undefined; - - const [selectedOption, setSelectedOption] = useState(initialOption); - + const selectedOptionOnePaths = [ + fabricUrl, + normalizePath('/ai-unlimited/fabric/get-started/create-notebook/'), + normalizePath('/ai-unlimited/fabric/get-started/load-data/'), + normalizePath('/ai-unlimited/fabric/get-started/connect-explore/'), + normalizePath('/ai-unlimited/fabric/first-use-case/'), + normalizePath('/ai-unlimited/fabric/in-db-functions/'), + ]; useEffect(() => { - if (isPathMatching('/ai-unlimited/fabric', currentPath)) { - setSelectedOption('1'); - } else if (isPathMatching('/ai-unlimited', currentPath)) { + if (selectedOptionZeroPaths.includes(currentPath)) { setSelectedOption('0'); - } else { - setSelectedOption(undefined); + } else if (selectedOptionOnePaths.includes(currentPath)) { + setSelectedOption('1'); } - }, [currentPath]); + }, [currentPath, aiUnlimitedUrl, fabricUrl]); const handleSelection = (event) => { const selectedIndex = event.detail.index?.toString(); - if (selectedIndex === selectedOption || selectedIndex === undefined) { - return; - } - - if (selectedIndex === '0') { + if (selectedIndex === '0' && !selectedOptionZeroPaths.includes(currentPath)) { window.location.href = aiUnlimitedUrl; - } else if (selectedIndex === '1') { + } else if (selectedIndex === '1' && !selectedOptionOnePaths.includes(currentPath)) { window.location.href = fabricUrl; } }; From f075c7743c6a22519629ed9135c2c3a539231b95 Mon Sep 17 00:00:00 2001 From: "Vega, Obed" Date: Thu, 29 May 2025 12:04:22 -0700 Subject: [PATCH 5/7] fix/select edition behavior2 --- .../SelectComponent/SelectComponent.js | 69 ++++++++++--------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/components/SelectComponent/SelectComponent.js b/src/components/SelectComponent/SelectComponent.js index 771598bf6d..8674e270f8 100644 --- a/src/components/SelectComponent/SelectComponent.js +++ b/src/components/SelectComponent/SelectComponent.js @@ -15,44 +15,45 @@ export default function SelectComponent() { const shouldDisplayAlert = !currentPath.includes(pathsNoAlert); const selectedOptionZeroPaths = [ aiUnlimitedUrl, - normalizePath('/ai-unlimited/install-ai-unlimited/deploy-manager-aws-console'), - normalizePath('/ai-unlimited/install-ai-unlimited/deploy-manager-azure-portal'), - normalizePath('/ai-unlimited/install-ai-unlimited/setup-ai-unlimited'), - normalizePath('/ai-unlimited/explore-and-analyze-data'), - normalizePath('/ai-unlimited/explore-and-analyze-data/get-api-key'), - normalizePath('/ai-unlimited/explore-and-analyze-data/create-first-project'), - normalizePath('/ai-unlimited/explore-and-analyze-data/collaborate-project'), - normalizePath('/ai-unlimited/explore-and-analyze-data/project-flow'), - normalizePath('/ai-unlimited/explore-and-analyze-data/use-cases'), - normalizePath('/ai-unlimited/explore-and-analyze-data/magic-commands'), - normalizePath('/ai-unlimited/manage-ai-unlimited'), - normalizePath('/ai-unlimited/manage-ai-unlimited/add-collaborators'), - normalizePath('/ai-unlimited/manage-ai-unlimited/suspend-and-restore-project'), - normalizePath('/ai-unlimited/manage-ai-unlimited/change-settings'), - normalizePath('/ai-unlimited/resources'), - normalizePath('/ai-unlimited/resources/aws-account-requirements'), - normalizePath('/ai-unlimited/resources/azure-account-requirements'), - normalizePath('/ai-unlimited/resources/create-oauth-app/'), - normalizePath('/ai-unlimited/resources/jupyterlab/'), - normalizePath('/ai-unlimited/resources/jupyterlab/deploy-jupyter-aws-console/'), - normalizePath('/ai-unlimited/resources/jupyterlab/deploy-jupyter-azure-portal/'), - normalizePath('/ai-unlimited/resources/jupyterlab/run-jupyter-docker/'), - normalizePath('/ai-unlimited/resources/quickstart/'), - normalizePath('/ai-unlimited/resources/quickstart/run-ai-unlimited-jupyterlab-docker/'), - normalizePath(`/ai-unlimited/resources/quickstart/docker-when-you're-done/`), - normalizePath('/ai-unlimited/whats-new/'), - normalizePath('/ai-unlimited/faq/'), - normalizePath('/ai-unlimited/glossary/'), - normalizePath('/ai-unlimited/support/'), + useBaseUrl('/ai-unlimited/install-ai-unlimited/deploy-manager-aws-console'), + useBaseUrl('/ai-unlimited/install-ai-unlimited/deploy-manager-azure-portal'), + useBaseUrl('/ai-unlimited/install-ai-unlimited/setup-ai-unlimited'), + useBaseUrl('/ai-unlimited/explore-and-analyze-data'), + useBaseUrl('/ai-unlimited/explore-and-analyze-data/get-api-key'), + useBaseUrl('/ai-unlimited/explore-and-analyze-data/create-first-project'), + useBaseUrl('/ai-unlimited/explore-and-analyze-data/collaborate-project'), + useBaseUrl('/ai-unlimited/explore-and-analyze-data/project-flow'), + useBaseUrl('/ai-unlimited/explore-and-analyze-data/use-cases'), + useBaseUrl('/ai-unlimited/explore-and-analyze-data/magic-commands'), + useBaseUrl('/ai-unlimited/manage-ai-unlimited'), + useBaseUrl('/ai-unlimited/manage-ai-unlimited/add-collaborators/'), + useBaseUrl('/ai-unlimited/manage-ai-unlimited/suspend-and-restore-project'), + useBaseUrl('/ai-unlimited/manage-ai-unlimited/change-settings'), + useBaseUrl('/ai-unlimited/resources'), + useBaseUrl('/ai-unlimited/resources/aws-account-requirements'), + useBaseUrl('/ai-unlimited/resources/azure-account-requirements'), + useBaseUrl('/ai-unlimited/resources/create-oauth-app/'), + useBaseUrl('/ai-unlimited/resources/jupyterlab/'), + useBaseUrl('/ai-unlimited/resources/jupyterlab/deploy-jupyter-aws-console/'), + useBaseUrl('/ai-unlimited/resources/jupyterlab/deploy-jupyter-azure-portal/'), + useBaseUrl('/ai-unlimited/resources/jupyterlab/run-jupyter-docker/'), + useBaseUrl('/ai-unlimited/resources/quickstart/'), + useBaseUrl('/ai-unlimited/resources/quickstart/run-ai-unlimited-jupyterlab-docker/'), + useBaseUrl(`/ai-unlimited/resources/quickstart/docker-when-you're-done/`), + useBaseUrl('/ai-unlimited/whats-new/'), + useBaseUrl('/ai-unlimited/faq/'), + useBaseUrl('/ai-unlimited/glossary/'), + useBaseUrl('/ai-unlimited/support/'), ]; const selectedOptionOnePaths = [ fabricUrl, - normalizePath('/ai-unlimited/fabric/get-started/create-notebook/'), - normalizePath('/ai-unlimited/fabric/get-started/load-data/'), - normalizePath('/ai-unlimited/fabric/get-started/connect-explore/'), - normalizePath('/ai-unlimited/fabric/first-use-case/'), - normalizePath('/ai-unlimited/fabric/in-db-functions/'), + fabricUrl, + useBaseUrl('/ai-unlimited/fabric/get-started/create-notebook'), + useBaseUrl('/ai-unlimited/fabric/get-started/load-data'), + useBaseUrl('/ai-unlimited/fabric/get-started/connect-explore'), + useBaseUrl('/ai-unlimited/fabric/first-use-case'), + useBaseUrl('/ai-unlimited/fabric/in-db-functions'), ]; useEffect(() => { if (selectedOptionZeroPaths.includes(currentPath)) { From 757b35bdaae289391b4a95ca3f6a33f8b7a163a1 Mon Sep 17 00:00:00 2001 From: "Vega, Obed" Date: Thu, 29 May 2025 13:57:48 -0700 Subject: [PATCH 6/7] fix/select edition behavior3 --- .../SelectComponent/SelectComponent.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/SelectComponent/SelectComponent.js b/src/components/SelectComponent/SelectComponent.js index 8674e270f8..1123d18b27 100644 --- a/src/components/SelectComponent/SelectComponent.js +++ b/src/components/SelectComponent/SelectComponent.js @@ -26,24 +26,24 @@ export default function SelectComponent() { useBaseUrl('/ai-unlimited/explore-and-analyze-data/use-cases'), useBaseUrl('/ai-unlimited/explore-and-analyze-data/magic-commands'), useBaseUrl('/ai-unlimited/manage-ai-unlimited'), - useBaseUrl('/ai-unlimited/manage-ai-unlimited/add-collaborators/'), + useBaseUrl('/ai-unlimited/manage-ai-unlimited/add-collaborators'), useBaseUrl('/ai-unlimited/manage-ai-unlimited/suspend-and-restore-project'), useBaseUrl('/ai-unlimited/manage-ai-unlimited/change-settings'), useBaseUrl('/ai-unlimited/resources'), useBaseUrl('/ai-unlimited/resources/aws-account-requirements'), useBaseUrl('/ai-unlimited/resources/azure-account-requirements'), - useBaseUrl('/ai-unlimited/resources/create-oauth-app/'), - useBaseUrl('/ai-unlimited/resources/jupyterlab/'), - useBaseUrl('/ai-unlimited/resources/jupyterlab/deploy-jupyter-aws-console/'), - useBaseUrl('/ai-unlimited/resources/jupyterlab/deploy-jupyter-azure-portal/'), - useBaseUrl('/ai-unlimited/resources/jupyterlab/run-jupyter-docker/'), - useBaseUrl('/ai-unlimited/resources/quickstart/'), - useBaseUrl('/ai-unlimited/resources/quickstart/run-ai-unlimited-jupyterlab-docker/'), - useBaseUrl(`/ai-unlimited/resources/quickstart/docker-when-you're-done/`), - useBaseUrl('/ai-unlimited/whats-new/'), - useBaseUrl('/ai-unlimited/faq/'), - useBaseUrl('/ai-unlimited/glossary/'), - useBaseUrl('/ai-unlimited/support/'), + useBaseUrl('/ai-unlimited/resources/create-oauth-app'), + useBaseUrl('/ai-unlimited/resources/jupyterlab'), + useBaseUrl('/ai-unlimited/resources/jupyterlab/deploy-jupyter-aws-console'), + useBaseUrl('/ai-unlimited/resources/jupyterlab/deploy-jupyter-azure-portal'), + useBaseUrl('/ai-unlimited/resources/jupyterlab/run-jupyter-docker'), + useBaseUrl('/ai-unlimited/resources/quickstart'), + useBaseUrl('/ai-unlimited/resources/quickstart/run-ai-unlimited-jupyterlab-docker'), + useBaseUrl(`/ai-unlimited/resources/quickstart/docker-when-you're-done`), + useBaseUrl('/ai-unlimited/whats-new'), + useBaseUrl('/ai-unlimited/faq'), + useBaseUrl('/ai-unlimited/glossary'), + useBaseUrl('/ai-unlimited/support'), ]; const selectedOptionOnePaths = [ From d1caba93f88da180e4d2db5f6713879cbd18e021 Mon Sep 17 00:00:00 2001 From: "Vega, Obed" Date: Mon, 2 Jun 2025 09:43:44 -0700 Subject: [PATCH 7/7] fix select component behavior --- src/components/SelectComponent/SelectComponent.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/SelectComponent/SelectComponent.js b/src/components/SelectComponent/SelectComponent.js index 1123d18b27..fdfa5b2617 100644 --- a/src/components/SelectComponent/SelectComponent.js +++ b/src/components/SelectComponent/SelectComponent.js @@ -41,6 +41,7 @@ export default function SelectComponent() { useBaseUrl('/ai-unlimited/resources/quickstart/run-ai-unlimited-jupyterlab-docker'), useBaseUrl(`/ai-unlimited/resources/quickstart/docker-when-you're-done`), useBaseUrl('/ai-unlimited/whats-new'), + useBaseUrl('/ai-unlimited/whats-new/release-notes'), useBaseUrl('/ai-unlimited/faq'), useBaseUrl('/ai-unlimited/glossary'), useBaseUrl('/ai-unlimited/support'), @@ -55,6 +56,7 @@ export default function SelectComponent() { useBaseUrl('/ai-unlimited/fabric/first-use-case'), useBaseUrl('/ai-unlimited/fabric/in-db-functions'), ]; + useEffect(() => { if (selectedOptionZeroPaths.includes(currentPath)) { setSelectedOption('0');