From 3132840598aa5edfc686cbc05d1613ba91bae7a7 Mon Sep 17 00:00:00 2001 From: Ravi Kumar Pilla Date: Wed, 22 May 2024 04:24:57 -0500 Subject: [PATCH 1/2] Fix broken URL when active pipeline name changes on initial load (#1914) Remove params check to update activePipeline --- RELEASE.md | 1 + package/kedro_viz/data_access/repositories/catalog.py | 2 +- package/kedro_viz/integrations/kedro/hooks.py | 5 ++++- package/kedro_viz/models/flowchart.py | 2 +- src/components/flowchart-wrapper/flowchart-wrapper.js | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index c285a2b74e..5c557c90d6 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -20,6 +20,7 @@ Please follow the established format: - Remove default props from functional components. (#1906) - Fix for schema change in strawberry-graphql JSON scalar. (#1903) - Fix messaging level when package compatibility is not satisfied. (#1904) +- Fix broken URL when active pipeline name changes on initial load. (#1914) # Release 9.0.0 diff --git a/package/kedro_viz/data_access/repositories/catalog.py b/package/kedro_viz/data_access/repositories/catalog.py index 427a13cf0d..bfbd61a437 100644 --- a/package/kedro_viz/data_access/repositories/catalog.py +++ b/package/kedro_viz/data_access/repositories/catalog.py @@ -12,7 +12,7 @@ from kedro.pipeline._transcoding import TRANSCODING_SEPARATOR, _strip_transcoding except ImportError: # pragma: no cover # older versions - from kedro.pipeline.pipeline import TRANSCODING_SEPARATOR, _strip_transcoding + from kedro.pipeline.pipeline import TRANSCODING_SEPARATOR, _strip_transcoding # type: ignore from packaging.version import parse diff --git a/package/kedro_viz/integrations/kedro/hooks.py b/package/kedro_viz/integrations/kedro/hooks.py index d68c5eea70..32f2ffa594 100644 --- a/package/kedro_viz/integrations/kedro/hooks.py +++ b/package/kedro_viz/integrations/kedro/hooks.py @@ -17,7 +17,10 @@ from kedro.pipeline._transcoding import TRANSCODING_SEPARATOR, _strip_transcoding except ImportError: # pragma: no cover # older versions - from kedro.pipeline.pipeline import TRANSCODING_SEPARATOR, _strip_transcoding + from kedro.pipeline.pipeline import ( # type: ignore + TRANSCODING_SEPARATOR, + _strip_transcoding, + ) logger = logging.getLogger(__name__) diff --git a/package/kedro_viz/models/flowchart.py b/package/kedro_viz/models/flowchart.py index e93418323c..b4d43d5cbc 100644 --- a/package/kedro_viz/models/flowchart.py +++ b/package/kedro_viz/models/flowchart.py @@ -17,7 +17,7 @@ from kedro.pipeline._transcoding import TRANSCODING_SEPARATOR, _strip_transcoding except ImportError: # pragma: no cover # older versions - from kedro.pipeline.pipeline import TRANSCODING_SEPARATOR, _strip_transcoding + from kedro.pipeline.pipeline import TRANSCODING_SEPARATOR, _strip_transcoding # type: ignore from pydantic import ( BaseModel, diff --git a/src/components/flowchart-wrapper/flowchart-wrapper.js b/src/components/flowchart-wrapper/flowchart-wrapper.js index 02750f59fc..bbc04812f1 100644 --- a/src/components/flowchart-wrapper/flowchart-wrapper.js +++ b/src/components/flowchart-wrapper/flowchart-wrapper.js @@ -92,7 +92,7 @@ export const FlowChartWrapper = ({ if (localStorageParams) { const paramActions = { pipeline: (value) => { - if (!searchParams.has(params.pipeline) && activePipeline) { + if (activePipeline) { toSetQueryParam(params.pipeline, value.active || activePipeline); } }, From 6b83643d8995657582a1e7e381dcb5478e3aa3e5 Mon Sep 17 00:00:00 2001 From: Huong Nguyen <32060364+Huongg@users.noreply.github.com> Date: Thu, 23 May 2024 11:58:58 +0100 Subject: [PATCH 2/2] include gitpod in the list (#1923) Signed-off-by: huongg --- src/utils/index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index d82777c7d2..c84615c78f 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -189,14 +189,12 @@ export const formatNumberWithCommas = (number) => { * @returns {Boolean} True if the app is running locally. */ export const isRunningLocally = () => { - const hosts = ['localhost', '127.0.0.1', 'demo.kedro.org']; - const itemFoundIndex = hosts.indexOf(window.location.hostname); + const hosts = ['localhost', '127.0.0.1', 'demo.kedro.org', 'gitpod']; + const itemFound = hosts.some((host) => + window.location.hostname.includes(host) + ); - if (itemFoundIndex === -1) { - return false; // The hostname isn't in our list of local hosts - } else { - return true; - } + return itemFound; }; /**