diff --git a/RELEASE.md b/RELEASE.md index 81f3a63be9..43b48161ea 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -5,7 +5,13 @@ Please follow the established format: - Use present tense (e.g. 'Add new feature') - Include the ID number for the related PR (or PRs) in parentheses --> -# Next release +# Release 9.2.0 + +## Major features and improvements +- Enable/disable preview for all the datasets when publishing Kedro-Viz from CLI. (#1894) +- Enable/disable preview for all the datasets when publishing Kedro-Viz from UI. (#1895) + +## Bug fixes and other changes ## Major features and improvements - Display published URLs. (#1907) @@ -18,8 +24,6 @@ Please follow the established format: - Introduce the toggle to expand and collapse all pipelines button in the utility bar. (#1858) - Allow Kedro-Viz commands to run from any sub directory within Kedro project. (#1871) -- Enable/disable preview for all the datasets when publishing Kedro-Viz from CLI. (#1894) - ## Bug fixes and other changes - Fix broken URL when active pipeline name changes on initial load. (#1914) - Fix bug related to tag filtering and sharing with stateful URL. (#1878) diff --git a/package/kedro_viz/api/rest/requests.py b/package/kedro_viz/api/rest/requests.py index 857ee12963..6f0a8bafb3 100644 --- a/package/kedro_viz/api/rest/requests.py +++ b/package/kedro_viz/api/rest/requests.py @@ -7,5 +7,6 @@ class DeployerConfiguration(BaseModel): """Credentials for Deployers.""" platform: str + is_all_previews_enabled: bool = False endpoint: str bucket_name: str diff --git a/package/kedro_viz/api/rest/router.py b/package/kedro_viz/api/rest/router.py index 51d445c1a2..d8a8499677 100644 --- a/package/kedro_viz/api/rest/router.py +++ b/package/kedro_viz/api/rest/router.py @@ -63,7 +63,7 @@ async def deploy_kedro_viz(input_values: DeployerConfiguration): deployer = DeployerFactory.create_deployer( input_values.platform, input_values.endpoint, input_values.bucket_name ) - deployer.deploy() + deployer.deploy(input_values.is_all_previews_enabled) response = { "message": "Website deployed on " f"{input_values.platform and input_values.platform.upper()}", diff --git a/package/kedro_viz/launchers/cli.py b/package/kedro_viz/launchers/cli.py index b3bf7654bc..daad1e2b8e 100644 --- a/package/kedro_viz/launchers/cli.py +++ b/package/kedro_viz/launchers/cli.py @@ -235,11 +235,11 @@ def run( help="A flag to include all registered hooks in your Kedro Project", ) @click.option( - "--include-preview", + "--include-previews", is_flag=True, - help="Enable/disable preview for all the datasets.", + help="A flag to include preview for all the datasets", ) -def deploy(platform, endpoint, bucket_name, include_hooks, include_preview): +def deploy(platform, endpoint, bucket_name, include_hooks, include_previews): """Deploy and host Kedro Viz on provided platform""" if not platform or platform.lower() not in SHAREABLEVIZ_SUPPORTED_PLATFORMS: display_cli_message( @@ -259,7 +259,7 @@ def deploy(platform, endpoint, bucket_name, include_hooks, include_preview): create_shareableviz_process( platform, - include_preview, + include_previews, endpoint, bucket_name, include_hooks, @@ -273,14 +273,14 @@ def deploy(platform, endpoint, bucket_name, include_hooks, include_preview): help="A flag to include all registered hooks in your Kedro Project", ) @click.option( - "--include-preview", + "--include-previews", is_flag=True, - help="Enable/disable preview for all the datasets.", + help="A flag to include preview for all the datasets", ) -def build(include_hooks, include_preview): +def build(include_hooks, include_previews): """Create build directory of local Kedro Viz instance with Kedro project data""" - create_shareableviz_process("local", include_preview, include_hooks=include_hooks) + create_shareableviz_process("local", include_previews, include_hooks=include_hooks) def create_shareableviz_process( diff --git a/package/tests/test_api/test_rest/test_router.py b/package/tests/test_api/test_rest/test_router.py index 9b5c28cc18..9ba1de7e2c 100644 --- a/package/tests/test_api/test_rest/test_router.py +++ b/package/tests/test_api/test_rest/test_router.py @@ -6,25 +6,32 @@ class MockDeployer: def __init__(self, platform, endpoint, bucket_name): pass - def deploy(self): + def deploy(self, is_all_previews_enabled): pass @pytest.mark.parametrize( - "platform, endpoint, bucket_name", + "platform, endpoint, bucket_name, is_all_previews_enabled", [ - ("aws", "http://mocked-url.com", "s3://shareableviz"), - ("azure", "http://mocked-url.com", "abfs://shareableviz"), + ("aws", "http://mocked-url.com", "s3://shareableviz", True), + ("azure", "http://mocked-url.com", "abfs://shareableviz", False), ], ) -def test_deploy_kedro_viz(client, platform, endpoint, bucket_name, mocker): +def test_deploy_kedro_viz( + client, platform, endpoint, bucket_name, is_all_previews_enabled, mocker +): mocker.patch( "kedro_viz.api.rest.router.DeployerFactory.create_deployer", return_value=MockDeployer(platform, endpoint, bucket_name), ) response = client.post( "/api/deploy", - json={"platform": platform, "endpoint": endpoint, "bucket_name": bucket_name}, + json={ + "platform": platform, + "endpoint": endpoint, + "bucket_name": bucket_name, + "is_all_previews_enabled": is_all_previews_enabled, + }, ) assert response.status_code == 200 diff --git a/package/tests/test_launchers/test_cli.py b/package/tests/test_launchers/test_cli.py index 94c75c95a3..d30e651bba 100755 --- a/package/tests/test_launchers/test_cli.py +++ b/package/tests/test_launchers/test_cli.py @@ -455,7 +455,7 @@ def test_viz_command_group(mocker, mock_click_echo): "http://example-bucket.s3-website.us-east-2.amazonaws.com/", "--bucket-name", "example-bucket", - "--include-preview", + "--include-previews", ], { "platform": "aws", @@ -560,7 +560,7 @@ def test_viz_deploy_invalid_endpoint(mocker, mock_click_echo): {"platform": "local", "include_hooks": True}, ), ( - ["viz", "build", "--include-preview"], + ["viz", "build", "--include-previews"], {"platform": "local", "preview": True}, ), ], diff --git a/src/components/shareable-url-modal/shareable-url-modal.js b/src/components/shareable-url-modal/shareable-url-modal.js index f65cdd07af..19261561c8 100644 --- a/src/components/shareable-url-modal/shareable-url-modal.js +++ b/src/components/shareable-url-modal/shareable-url-modal.js @@ -43,7 +43,7 @@ const ShareableUrlModal = ({ onToggleModal, visible }) => { const [hostingPlatformLocalStorageVal, setHostingPlatformLocalStorageVal] = useState(loadLocalStorage(localStorageShareableUrl) || {}); const [publishedPlatformKey, setPublishedPlatformKey] = useState(undefined); - const [isPreviewEnabled, setIsPreviewEnabled] = useState(true); + const [isPreviewEnabled, setIsPreviewEnabled] = useState(false); useEffect(() => { async function fetchPackageCompatibility() { @@ -171,7 +171,10 @@ const ShareableUrlModal = ({ onToggleModal, visible }) => { setShowPublishedView(false); try { - const request = await deployViz(inputValues); + const request = await deployViz({ + ...inputValues, + is_all_previews_enabled: isPreviewEnabled, + }); const response = await request.json(); if (request.ok) { @@ -223,6 +226,7 @@ const ShareableUrlModal = ({ onToggleModal, visible }) => { hasPlatform: false, hasEndpoint: false, }); + setIsPreviewEnabled(false); }; const { platform } = inputValues || {};