Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable/disable preview for all the datasets when publishing Kedro-Viz from UI #1895

Merged
merged 52 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
74e0371
Add options for cli common with disable preview of datasets
jitu5 May 3, 2024
5398a11
New approach for disable preview
jitu5 May 7, 2024
4da365f
Disable preview for cli and lint fix
jitu5 May 7, 2024
9f2afa2
deploy api with preview
jitu5 May 8, 2024
35f1436
Removing UI changes
jitu5 May 8, 2024
85e1a2d
Removing UI changes
jitu5 May 8, 2024
f8f96cf
Disable preview from UI
jitu5 May 8, 2024
dc51032
Code review suggestions
jitu5 May 10, 2024
f3b8007
temp code removed
jitu5 May 10, 2024
d8ef988
refactor disable preview cli
ravi-kumar-pilla May 15, 2024
3377832
fix lint
ravi-kumar-pilla May 15, 2024
7a31729
fix lint
ravi-kumar-pilla May 15, 2024
028a7f3
Merge branch 'main' of https://github.com/kedro-org/kedro-viz into fe…
ravi-kumar-pilla May 16, 2024
78f44bb
testing 1
ravi-kumar-pilla May 16, 2024
663924c
change help text
ravi-kumar-pilla May 16, 2024
defbf66
change help text
ravi-kumar-pilla May 16, 2024
9195150
update tests
ravi-kumar-pilla May 16, 2024
c4c7375
format help text
ravi-kumar-pilla May 16, 2024
6eaaaeb
change default preview for run
ravi-kumar-pilla May 16, 2024
8372ec3
update release note
ravi-kumar-pilla May 16, 2024
c854392
merged cli version to avoid test failures
ravi-kumar-pilla May 17, 2024
2f67e78
address vale suggestion
ravi-kumar-pilla May 17, 2024
ffdce46
Merge branch 'feature/disable-preview' of https://github.com/kedro-or…
ravi-kumar-pilla May 17, 2024
e465101
fix lint
ravi-kumar-pilla May 17, 2024
12eabd1
fix pytests and linter
ravi-kumar-pilla May 17, 2024
57b68b3
adjust file permission
ravi-kumar-pilla May 17, 2024
ec92a7f
merged new changes
ravi-kumar-pilla May 17, 2024
50ef2a4
update tests
ravi-kumar-pilla May 17, 2024
e523f23
update release note
ravi-kumar-pilla May 17, 2024
4f5c446
update release note
ravi-kumar-pilla May 17, 2024
a4b564b
resolve conflicts
ravi-kumar-pilla May 17, 2024
c815a9b
--include-preview flag added for CLI
jitu5 May 20, 2024
5a43fda
Merge branch 'main' into feature/disable-preview
jitu5 May 20, 2024
0998f7a
Merge branch 'main' into feature/disable-preview
jitu5 May 21, 2024
d06f36e
are_datasets_previewable renamed to is_all_previews_enabled
jitu5 May 21, 2024
73b1944
lint fix
jitu5 May 21, 2024
2294cc6
are_datasets_previewable renamed to is_all_previews_enabled
jitu5 May 21, 2024
148e92d
Merge branch 'feature/disable-preview' into feature/disable-preview-ui
jitu5 May 21, 2024
94e3501
type ignore add for TRANSCODING_SEPARATOR
jitu5 May 21, 2024
036c89e
Merge branch 'feature/disable-preview' into feature/disable-preview-ui
jitu5 May 21, 2024
46dbf28
Merge branch 'main' into feature/disable-preview
jitu5 May 22, 2024
20bbe47
Merge branch 'main' into feature/disable-preview
jitu5 May 29, 2024
6f088b5
File permissions updated
jitu5 May 29, 2024
b80c799
Merge branch 'main' into feature/disable-preview
jitu5 May 30, 2024
788a491
Merge branch 'main' into feature/disable-preview
jitu5 May 31, 2024
57aec4e
Merge branch 'main' into feature/disable-preview
jitu5 May 31, 2024
2f54122
Merge branch 'feature/disable-preview' into feature/disable-preview-ui
jitu5 May 31, 2024
80ad5e7
Merge branch 'main' into feature/disable-preview-ui
jitu5 May 31, 2024
c706625
fix
jitu5 May 31, 2024
0ac6b1b
Merge branch 'main' into feature/disable-preview-ui
jitu5 Jun 7, 2024
9d50abb
All dataset preview toggle works with deploy api
jitu5 Jun 7, 2024
4a82230
CLI flag renamed to --include-previews
jitu5 Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions package/kedro_viz/api/rest/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ class DeployerConfiguration(BaseModel):
"""Credentials for Deployers."""

platform: str
is_all_previews_enabled: bool = False
ravi-kumar-pilla marked this conversation as resolved.
Show resolved Hide resolved
endpoint: str
bucket_name: str
2 changes: 1 addition & 1 deletion package/kedro_viz/api/rest/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}",
Expand Down
16 changes: 8 additions & 8 deletions package/kedro_viz/launchers/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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(
Expand Down
19 changes: 13 additions & 6 deletions package/tests/test_api/test_rest/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions package/tests/test_launchers/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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},
),
],
Expand Down
8 changes: 6 additions & 2 deletions src/components/shareable-url-modal/shareable-url-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -223,6 +226,7 @@ const ShareableUrlModal = ({ onToggleModal, visible }) => {
hasPlatform: false,
hasEndpoint: false,
});
setIsPreviewEnabled(false);
};

const { platform } = inputValues || {};
Expand Down
Loading