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

Make Kedro-Viz shareable via a hosted URL #1487

Merged
merged 165 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 163 commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
5af4d9f
nodes working
rashidakanchwala Feb 17, 2023
283a4f5
added pipeline
rashidakanchwala Feb 17, 2023
96bb1d2
Merge branch 'kedro-viz-save-load' of https://github.com/kedro-org/ke…
rashidakanchwala Feb 17, 2023
7de3f65
fix path
rashidakanchwala Feb 17, 2023
3a023f9
fix bug and lint
rashidakanchwala Feb 17, 2023
3c2b625
fix lint
rashidakanchwala Feb 17, 2023
71de836
Add deploy button, modal, and form fields
tynandebold Aug 14, 2023
a98a17d
Fix failing tests
tynandebold Aug 14, 2023
15d095c
Fix failing tests
tynandebold Aug 14, 2023
462f447
Update single file to S3 via file input
tynandebold Aug 15, 2023
319a7a8
Update test case
tynandebold Aug 15, 2023
dd2041f
Merge branch 'main' of https://github.com/kedro-org/kedro-viz into fe…
tynandebold Aug 15, 2023
616cbdf
Remove package lock changes
tynandebold Aug 15, 2023
f46032d
Hide exp tracking and deploy button when not running Viz locally; rem…
tynandebold Aug 16, 2023
67371b7
Add the beginnings of a /deploy REST endpoint
tynandebold Aug 17, 2023
5f25491
Trying to send credentials to the backend
tynandebold Aug 17, 2023
5da7410
Merge remote-tracking branch 'origin' into kedro-viz-save-load
rashidakanchwala Aug 18, 2023
4762c2f
update responses
rashidakanchwala Aug 18, 2023
4bc45e5
test
rashidakanchwala Aug 18, 2023
d2e28a5
Merge branch 'main' into feature/shareable-urls
rashidakanchwala Aug 18, 2023
b2a22d1
Merge remote-tracking branch 'origin/feature/shareable-urls' into sha…
rashidakanchwala Aug 18, 2023
a2456da
Update UI to remove unneeded fields
tynandebold Aug 21, 2023
3a883e9
Fix failing text
tynandebold Aug 21, 2023
d911a26
Merge branch 'feature/shareable-urls' of https://github.com/kedro-org…
tynandebold Aug 21, 2023
6ba6a04
Workable Prototype
rashidakanchwala Aug 21, 2023
6081e85
fix rebase
rashidakanchwala Aug 21, 2023
d044bd1
fixing stuff
rashidakanchwala Aug 21, 2023
5c27954
Merge branch 'main' of https://github.com/kedro-org/kedro-viz into fe…
tynandebold Aug 22, 2023
258de8d
Merge branch 'shareable-viz-backend' of https://github.com/kedro-org/…
tynandebold Aug 22, 2023
028e220
Successfully returning a 200 from /api/deploy endpoint
tynandebold Aug 22, 2023
1115db6
Remove aws sdk package
tynandebold Aug 22, 2023
925eea4
backend fixes
rashidakanchwala Aug 22, 2023
bd8063b
Merge branch 'feature/shareable-urls' of https://github.com/kedro-org…
rashidakanchwala Aug 22, 2023
53d0216
remove map files when uploading
rashidakanchwala Aug 22, 2023
344bd6b
fix issue on html folder
rashidakanchwala Aug 22, 2023
944f326
UI updates for loading, success, error states; resetting modal
tynandebold Aug 23, 2023
6bdd8da
fix lowerbound on fsspec
rashidakanchwala Aug 23, 2023
63d82fb
Merge branch 'main' into feature/shareable-urls
rashidakanchwala Sep 1, 2023
b986c85
refactored to latest
rashidakanchwala Sep 1, 2023
d0f7e65
some refactor
rashidakanchwala Sep 1, 2023
703b64c
fix lint - WIP
rashidakanchwala Sep 1, 2023
9ecb395
Merge branch 'main' into shareable-flowchart
rashidakanchwala Sep 4, 2023
6b01350
refactor work
rashidakanchwala Sep 4, 2023
8b91f7e
Merge branch 'shareable-flowchart' of https://github.com/kedro-org/ke…
rashidakanchwala Sep 4, 2023
30e5f8a
fix lint
rashidakanchwala Sep 4, 2023
3c5eced
remove old code
rashidakanchwala Sep 4, 2023
fd75407
further refactor
rashidakanchwala Sep 4, 2023
480bd51
add error handling and debugging
rashidakanchwala Sep 5, 2023
e94f0ec
fix based on review
rashidakanchwala Sep 5, 2023
a6ecd7c
modify upload static files logic
ravi-kumar-pilla Sep 5, 2023
1232e92
Merge branch 'shareable-flowchart' of https://github.com/kedro-org/ke…
ravi-kumar-pilla Sep 5, 2023
737af74
refactor upload api with latest fsspec
ravi-kumar-pilla Sep 5, 2023
9e24189
fix unit tests_1
ravi-kumar-pilla Sep 5, 2023
ef4617f
revert os logic to pathlib
rashidakanchwala Sep 6, 2023
9e6d9a5
fix static folder issue
rashidakanchwala Sep 6, 2023
5b0a860
fix format and lint errors
ravi-kumar-pilla Sep 6, 2023
a6781ac
add unit tests for shareable viz s3deployer
ravi-kumar-pilla Sep 7, 2023
6d28f6b
add pytests for responses module
ravi-kumar-pilla Sep 7, 2023
16673a4
add s3fs as dependency
ravi-kumar-pilla Sep 7, 2023
605c450
add temporary no cover for apps
ravi-kumar-pilla Sep 7, 2023
ad8d089
update lower reqs
rashidakanchwala Sep 8, 2023
ae2992a
update fsspec
rashidakanchwala Sep 8, 2023
52a2a8a
check kedro latest version as 18.0 in e2e tests
ravi-kumar-pilla Sep 8, 2023
a0e7052
update fsspec and s3fs requirements to support earliest kedro version
ravi-kumar-pilla Sep 8, 2023
0046755
add timestamp file for deploy
ravi-kumar-pilla Sep 11, 2023
ef093d2
merged main
ravi-kumar-pilla Sep 11, 2023
77e9ad4
add pytest for timestamp route
ravi-kumar-pilla Sep 11, 2023
bf9f106
fix lint and format errors
ravi-kumar-pilla Sep 11, 2023
c300d74
Merge branch 'main' into shareable-flowchart
tynandebold Sep 13, 2023
f75c161
Merge branch 'main' of https://github.com/kedro-org/kedro-viz into fe…
tynandebold Sep 13, 2023
427ef8f
merge BE to FE
rashidakanchwala Sep 13, 2023
2dab4c0
fix server changes and test e2e scenarios
ravi-kumar-pilla Sep 13, 2023
031c59a
try to catch versionConflicterror
rashidakanchwala Sep 14, 2023
1bba3d4
Style updates; sending updated args to the backend
tynandebold Sep 14, 2023
39ff155
Re-deploy flow
tynandebold Sep 14, 2023
a6e7ef0
add route /api/project-metadata to provide package version info
ravi-kumar-pilla Sep 14, 2023
7854c6a
remove frontend build for backend unit tests
ravi-kumar-pilla Sep 14, 2023
d162a8f
remove s3fs requirement to test
ravi-kumar-pilla Sep 14, 2023
1415f00
add s3fs without specific version
ravi-kumar-pilla Sep 14, 2023
3533925
adjust requirements and add pytests for project metadata
ravi-kumar-pilla Sep 15, 2023
455eeec
test open s3fs requirement
ravi-kumar-pilla Sep 15, 2023
948d420
test open s3fs requirement
ravi-kumar-pilla Sep 15, 2023
aa2d5e4
test open s3fs requirement
ravi-kumar-pilla Sep 15, 2023
0592751
Move share viz button to new location; add download icon
tynandebold Sep 15, 2023
d496844
Update tests
tynandebold Sep 15, 2023
6fdcade
Add shareable timestamp component
tynandebold Sep 15, 2023
9b3ef7a
Update timestamp fetch
tynandebold Sep 15, 2023
b401f2f
add version info and modify route name from /api/timestamp to /api/de…
ravi-kumar-pilla Sep 15, 2023
bc56877
Merge branch 'shareable-flowchart' of https://github.com/kedro-org/ke…
tynandebold Sep 15, 2023
bb8af53
Rename file; add version to timestamp
tynandebold Sep 15, 2023
b0c7486
Add back correct isRunningLocally check
tynandebold Sep 15, 2023
b526626
Remove console.log and update endpoint url
tynandebold Sep 15, 2023
4174d43
add pytests for updated api
ravi-kumar-pilla Sep 15, 2023
008624d
Merge branch 'main' into shareable-flowchart
rashidakanchwala Sep 18, 2023
de88895
undo all new requirements
rashidakanchwala Sep 18, 2023
74132c6
undo all fsspec changes
rashidakanchwala Sep 18, 2023
44681d4
added s3fs as dependency
rashidakanchwala Sep 18, 2023
16a01e5
Merge branch 'shareable-flowchart' of https://github.com/kedro-org/ke…
rashidakanchwala Sep 18, 2023
08551e3
fix unit tests
rashidakanchwala Sep 18, 2023
b8720b4
clean up tests
rashidakanchwala Sep 18, 2023
13f4425
lint
rashidakanchwala Sep 18, 2023
d69f7c5
fix lint
rashidakanchwala Sep 18, 2023
a88cce9
Merge branch 'main' into feature/shareable-urls
rashidakanchwala Sep 18, 2023
8c60a71
Merge branch 'shareable-flowchart' into feature/shareable-urls
rashidakanchwala Sep 18, 2023
f26a53e
fix test and lint and compatibility response
rashidakanchwala Sep 18, 2023
498a504
Merge branch 'shareable-flowchart' into feature/shareable-urls
rashidakanchwala Sep 18, 2023
a6ea86e
add packaging
rashidakanchwala Sep 18, 2023
269ed26
packaging reqs
rashidakanchwala Sep 18, 2023
903ed7d
Merge branch 'shareable-flowchart' into feature/shareable-urls
rashidakanchwala Sep 18, 2023
02bb175
Merge branch 'feature/shareable-urls' of https://github.com/kedro-org…
tynandebold Sep 19, 2023
79e3366
Consume compatibility endpoint; use Dropdown for bucket regions
tynandebold Sep 19, 2023
0d16e96
Update failing test
tynandebold Sep 19, 2023
62f4c45
Run format-fix
tynandebold Sep 19, 2023
e9252da
Remove unused import
tynandebold Sep 19, 2023
ee219e7
fix lint and router link
rashidakanchwala Sep 19, 2023
28114df
Update API endpoint
tynandebold Sep 19, 2023
e4d25de
Add try/catch; remove console.log
tynandebold Sep 19, 2023
bc60297
Update e2e test
tynandebold Sep 19, 2023
b2c9b42
Update e2e test, again
tynandebold Sep 19, 2023
a87558e
Drodown component update
tynandebold Sep 19, 2023
72a7e18
fix api endpoint
rashidakanchwala Sep 20, 2023
bed3d85
Merge branch 'shareable-flowchart' into feature/shareable-urls
rashidakanchwala Sep 20, 2023
d09e5c7
fixes based on reviews
rashidakanchwala Sep 20, 2023
4cea3e9
fixes based on reviews
rashidakanchwala Sep 20, 2023
242842a
Merge branch 'feature/shareable-urls' of https://github.com/kedro-org…
tynandebold Sep 21, 2023
c3de82f
Merge branch 'main' into shareable-flowchart
rashidakanchwala Sep 22, 2023
33f568d
changes based on reviews
rashidakanchwala Sep 22, 2023
890f92e
Merge branch 'shareable-flowchart' of https://github.com/kedro-org/ke…
rashidakanchwala Sep 22, 2023
3809add
fix lint
rashidakanchwala Sep 22, 2023
9dd5bd9
shareable URL modal UI Fixes (#1537)
jitu5 Sep 25, 2023
2b9d9a9
Merge branch 'feature/shareable-urls' of https://github.com/kedro-org…
tynandebold Sep 25, 2023
e912b92
fixes based on review
rashidakanchwala Sep 26, 2023
d2de353
updated cli help definition
rashidakanchwala Sep 26, 2023
29a0fab
update filpath to directory
rashidakanchwala Sep 26, 2023
76bd6dd
update filpath to directory
rashidakanchwala Sep 26, 2023
339ebd2
Add the first of the Cypress tests
tynandebold Sep 26, 2023
635634b
add s3 protocol in the backend
rashidakanchwala Sep 27, 2023
96e4afb
Merge branch 'shareable-flowchart' into feature/shareable-urls
rashidakanchwala Sep 27, 2023
268048b
leftover from merge fix
rashidakanchwala Sep 27, 2023
aa04a88
Changing language from deploy to publish
tynandebold Sep 27, 2023
032d62e
Update wording again; return a better error message to the FE; handle…
tynandebold Sep 27, 2023
648178e
Add go back button to error modal stategs
tynandebold Sep 28, 2023
9343c97
Update tests; use fstrings; remove unused CSS
tynandebold Sep 28, 2023
35c964b
Merge branch 'main' of https://github.com/kedro-org/kedro-viz into fe…
tynandebold Sep 28, 2023
317abb9
E2E cypress test for Shareable URL modal (#1543)
jitu5 Sep 28, 2023
bc5243c
update pip fsspec
rashidakanchwala Sep 29, 2023
de0007f
Update UI with docs links; update feature hits
tynandebold Oct 3, 2023
50dc04c
Merge branch 'main' of https://github.com/kedro-org/kedro-viz into fe…
tynandebold Oct 3, 2023
8218300
Update feature hints for when Viz is deployed
tynandebold Oct 3, 2023
53e6b9b
Merge branch 'feature/shareable-urls' of https://github.com/kedro-org…
tynandebold Oct 3, 2023
6849db9
Update release notes
tynandebold Oct 3, 2023
4ad0fb7
Update release notes again
tynandebold Oct 3, 2023
d322ddc
Add tracking to create_api_app_from_file
tynandebold Oct 3, 2023
8ed3d95
fix e2e tests
rashidakanchwala Oct 3, 2023
1f79c1f
Revert changes to create_api_app_from_file function
tynandebold Oct 4, 2023
6ab25be
Merge branch 'feature/shareable-urls' of https://github.com/kedro-org…
tynandebold Oct 4, 2023
ded96ff
Fix for telemetry in sharaeable viz (#1551)
ravi-kumar-pilla Oct 4, 2023
01965e6
Design QA changes
tynandebold Oct 5, 2023
1657183
Merge branch 'feature/shareable-urls' of https://github.com/kedro-org…
tynandebold Oct 5, 2023
d441207
Update release file
tynandebold Oct 5, 2023
922dd72
PR review fixes
tynandebold Oct 5, 2023
2926f7f
Add back graphql subscription (removal moved to another PR)
tynandebold Oct 5, 2023
0ef2fe5
Merge branch 'main' of https://github.com/kedro-org/kedro-viz into fe…
tynandebold Oct 5, 2023
1d42332
Update cypress test
tynandebold Oct 6, 2023
c82fa36
Merge branch 'main' into feature/shareable-urls
tynandebold Oct 10, 2023
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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ kedro-viz.tgz
# e2e testing
cypress/videos
cypress/screenshots
cypress/downloads/
cypress/downloads/

# production
build/
Expand Down Expand Up @@ -65,4 +65,3 @@ coverage.xml

# Kedro
*.log

11 changes: 5 additions & 6 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ Please follow the established format:

# Release 6.6.0

## Bug fixes and other changes

- Fix for Kedro Viz Connection Error. (#1507)
- Fix display of modular pipeline nodes that are associated with tags. (#1542)
- Remove GraphQL subscription. (#1554)
## Major features and improvements

# Release 6.5.1
- Make Kedro-Viz shareable via a hosted URL. (#1487)

## Bug fixes and other changes

- Updated dependencies to ensure compatibility with Vite and Next.js environments; combine CSS into a single file when used as a React component. (#1510)
- Fix for Kedro Viz Connection Error. (#1507)
- Fix display of modular pipeline nodes that are associated with tags. (#1542)
- Remove GraphQL subscription. (#1554)

# Release 6.5.0

Expand Down
4 changes: 4 additions & 0 deletions cypress/fixtures/mock/deploySuccessResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"message": "Website deployed on S3",
"url": "http://myBucketName.s3-website.us-east-1.amazonaws.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"package_name": "fsspec",
"package_version": "2023.9.1",
"is_compatible": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"package_name": "fsspec",
"package_version": "2023.8.1",
"is_compatible": false
}
8 changes: 5 additions & 3 deletions cypress/tests/ui/flowchart/menu.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import { prettifyName } from '../../../../src/utils';

describe('Flowchart Menu', () => {
it('verifies that users can select a section of the flowchart, through the drop down. #TC-16', () => {
it('verifies that users can select a section of the flowchart through the drop down. #TC-16', () => {
// Alias
cy.intercept('GET', '/api/pipelines/*').as('pipelineRequest');
cy.get(':nth-child(2) > .menu-option__content > span').as('menuOption');
cy.get('.pipeline-list :nth-child(2) > .menu-option__content > span').as(
'menuOption'
);

let menuOptionValue;

Expand All @@ -17,7 +19,7 @@ describe('Flowchart Menu', () => {
});

// Action
cy.get('[data-test="kedro-pipeline-selector"]').click();
cy.get('.pipeline-list [data-test="kedro-pipeline-selector"]').click();
cy.get('@menuOption').click({ force: true });

// Assert after action
Expand Down
217 changes: 217 additions & 0 deletions cypress/tests/ui/flowchart/shareable-urls.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
describe('Shareable URLs', () => {
it('verifies that users can open the Deploy Kedro-Viz modal. #TC-52', () => {
// Intercept the network request to mock with a fixture
cy.__interceptRest__(
'/api/package-compatibilities',
'GET',
'/mock/package-compatibilities-compatible.json'
);

// Action
cy.reload();
cy.get('.pipeline-menu-button--deploy').click({ force: true });

// Assert after action
cy.get('.shareable-url-modal .modal__wrapper').contains(
`Publish and Share Kedro-Viz`
);
});

it("shows an incompatible message given the user's fsspec package version is outdated. #TC-53", () => {
// Intercept the network request to mock with a fixture
cy.__interceptRest__(
'/api/package-compatibilities',
'GET',
'/mock/package-compatibilities-incompatible.json'
);

// Action
cy.reload();
cy.get('.pipeline-menu-button--deploy').click({ force: true });

// Assert after action
cy.get('.shareable-url-modal .modal__wrapper').contains(
`Publishing Kedro-Viz is only supported with fsspec >=2023.9.0. You are currently on version 2023.8.1.`
);
});

it('verifies that shareable url modal closes on close button click #TC-54', () => {
// Action
cy.get('.pipeline-menu-button--deploy').click();
cy.get('.shareable-url-modal__button-wrapper button')
.contains('Cancel')
.click();

// Assert after action
cy.get('.modal.shareable-url-modal').should(
'not.have.class',
'modal--visible'
);
});

it('verifies that users can click on region dropdown and see all region options #TC-55', () => {
const regionCount = 30;

// Action
cy.get('.pipeline-menu-button--deploy').click();
cy.get('.shareable-url-modal [data-test=kedro-pipeline-selector]').click();

// Assert after action
cy.get('.shareable-url-modal .menu-option').should(
'have.length',
regionCount
);
});

it('verifies that publish button should be disabled when region is not selected and bucket name is empty #TC-56', () => {
const selectedRegion = 'Select a region';
const primaryButtonNodeText = 'Publish';

// Action
cy.get('.pipeline-menu-button--deploy').click();

// Assert after action
cy.get(
'.shareable-url-modal [data-test=kedro-pipeline-selector] .dropdown__label span'
).contains(selectedRegion);
cy.get('.shareable-url-modal textarea').should('have.value', '');
cy.get('.shareable-url-modal__button-wrapper button')
.contains(primaryButtonNodeText)
.should('be.disabled');
});

it('verifies that publish button should be disabled when a bucket region is selected and bucket name is empty #TC-57', () => {
const primaryButtonNodeText = 'Publish';

// Action
cy.get('.pipeline-menu-button--deploy').click();
cy.get('.shareable-url-modal [data-test=kedro-pipeline-selector]').click();
cy.get('.shareable-url-modal .dropdown__options section div')
.first()
.click();

// Assert after action
cy.get('.shareable-url-modal textarea').should('have.value', '');
cy.get('.shareable-url-modal__button-wrapper button')
.contains(primaryButtonNodeText)
.should('be.disabled');
});

it('verifies that publish button should be enabled when region is selected and bucket name is not empty #TC-58', () => {
const bucketName = 'myBucketName';
const primaryButtonNodeText = 'Publish';

// Action
cy.get('.pipeline-menu-button--deploy').click();
cy.get('.shareable-url-modal [data-test=kedro-pipeline-selector]').click();
cy.get('.shareable-url-modal .dropdown__options section div')
.first()
.click();
cy.get('.shareable-url-modal textarea').type(bucketName);

// Assert after action
cy.get('.shareable-url-modal__button-wrapper button')
.contains(primaryButtonNodeText)
.should('be.enabled');
});

it('verifies that error message appears with wrong inputs on publish button click #TC-59', () => {
const bucketName = 'myBucketName';
const primaryButtonNodeText = 'Publish';
const errorButtonNodeText = 'Go back';

// Action
cy.get('.pipeline-menu-button--deploy').click();
cy.get('.shareable-url-modal [data-test=kedro-pipeline-selector]').click();
cy.get('.shareable-url-modal .dropdown__options section div')
.first()
.click();
cy.get('.shareable-url-modal textarea').type(bucketName);
cy.get('.shareable-url-modal__button-wrapper button')
.contains(primaryButtonNodeText)
.click();

// Assert after action
cy.get('.shareable-url-modal .modal__wrapper').contains(
'Something went wrong. Please try again later.'
);
cy.get('.shareable-url-modal__error button').contains(errorButtonNodeText);
});

it('verifies that AWS link is generated with correct inputs on publish button click #TC-60', () => {
const bucketName = 'myBucketName';
const primaryButtonNodeText = 'Publish';

// Intercept the network request to mock with a fixture
cy.__interceptRest__(
'/api/deploy',
'POST',
'/mock/deploySuccessResponse.json'
).as('publishRequest');

// Action
cy.reload();
cy.get('.pipeline-menu-button--deploy').click();
cy.get('.shareable-url-modal [data-test=kedro-pipeline-selector]').click();
cy.get('.shareable-url-modal .dropdown__options section div')
.first()
.click();
cy.get('.shareable-url-modal textarea').type(bucketName);
cy.get('.shareable-url-modal__button-wrapper button')
.contains(primaryButtonNodeText)
.click();

// Wait for the POST request to complete and check the mocked response
cy.wait('@publishRequest').then((interception) => {
// Assert after action
cy.get('.shareable-url-modal__result-url').contains(
interception.response.body.url
);
});
});

it('verifies that AWS link is generated with correct inputs on Republish button click #TC-61', () => {
const bucketName = 'myBucketName';
const primaryButtonNodeText = 'Publish';
const primaryButtonNodeTextVariant = 'Republish';
const secondaryButtonNodeText = 'Link Settings';

// Intercept the network request to mock with a fixture
cy.__interceptRest__(
'/api/deploy',
'POST',
'/mock/deploySuccessResponse.json'
).as('publishRequest');

// Action
cy.reload();
cy.get('.pipeline-menu-button--deploy').click();
cy.get('.shareable-url-modal [data-test=kedro-pipeline-selector]').click();
cy.get('.shareable-url-modal .dropdown__options section div')
.first()
.click();
cy.get('.shareable-url-modal textarea').type(bucketName);
cy.get('.shareable-url-modal__button-wrapper button')
.contains(primaryButtonNodeText)
.click();

// Wait for the POST request to complete
cy.wait('@publishRequest');

// Action
cy.get('.shareable-url-modal__button-wrapper button')
.contains(secondaryButtonNodeText)
.click();
cy.get('.shareable-url-modal__button-wrapper button')
.contains(primaryButtonNodeTextVariant)
.click();

// Wait for the POST request to complete and check the mocked response
cy.wait('@publishRequest').then((interception) => {
// Assert after action
cy.get('.shareable-url-modal__result-url').contains(
interception.response.body.url
);
});
});
});
4 changes: 2 additions & 2 deletions package/features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def before_scenario(context, scenario):

if (
kedro_version
and kedro_version <= Version.parse("0.18.0")
and sys.version_info >= (3, 9)
and kedro_version <= Version.parse("0.18.12")
and sys.version_info >= (3, 11)
):
print(
(
Expand Down
2 changes: 1 addition & 1 deletion package/features/viz.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: Viz plugin in new project
Given I have prepared a config file with example code

Scenario: Execute viz with the earliest Kedro version that it supports
Given I have installed kedro version "0.17.5"
Given I have installed kedro version "0.18.2"
And I have run a non-interactive kedro new with pandas-iris starter
And I have installed the project's requirements
When I execute the kedro viz command
Expand Down
4 changes: 1 addition & 3 deletions package/kedro_viz/api/rest/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ async def deploy_kedro_viz(input_values: S3DeployerConfiguration):
)
except Exception as exc: # pragma: no cover
logger.exception("Deploying Kedro Viz failed: %s ", exc)
return JSONResponse(
status_code=500, content={"message": "Failed to deploy Kedro Viz"}
)
return JSONResponse(status_code=500, content={"message": f"{exc}"})
ravi-kumar-pilla marked this conversation as resolved.
Show resolved Hide resolved


@router.get(
Expand Down
33 changes: 33 additions & 0 deletions package/kedro_viz/integrations/deployment/s3_deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@

import json
import logging
import tempfile
from datetime import datetime
from pathlib import Path

import fsspec
from jinja2 import Environment, FileSystemLoader
from semver import VersionInfo

from kedro_viz import __version__
from kedro_viz.api.rest.responses import save_api_responses_to_fs
from kedro_viz.integrations.kedro import telemetry as kedro_telemetry

_HTML_DIR = Path(__file__).parent.parent.parent.absolute() / "html"
_METADATA_PATH = "api/deploy-viz-metadata"
Expand Down Expand Up @@ -48,11 +51,41 @@ def _upload_api_responses(self):
"""Upload API responses to S3."""
save_api_responses_to_fs(self._bucket_path)

def _ingest_heap_analytics(self):
"""Ingest heap analytics to index file in the build folder."""
project_path = Path.cwd().absolute()
heap_app_id = kedro_telemetry.get_heap_app_id(project_path)
heap_user_identity = kedro_telemetry.get_heap_identity()
should_add_telemetry = bool(heap_app_id) and bool(heap_user_identity)
html_content = (_HTML_DIR / "index.html").read_text(encoding="utf-8")
injected_head_content = []

env = Environment(loader=FileSystemLoader(_HTML_DIR))

if should_add_telemetry:
logger.debug("Ingesting heap analytics.")
telemetry_content = env.get_template("telemetry.html").render(
heap_app_id=heap_app_id, heap_user_identity=heap_user_identity
)
injected_head_content.append(telemetry_content)

injected_head_content.append("</head>")
html_content = html_content.replace("</head>", "\n".join(injected_head_content))

with tempfile.TemporaryDirectory() as temp_dir:
temp_file_path = f"{temp_dir}/index.html"

with open(temp_file_path, "w", encoding="utf-8") as temp_index_file:
temp_index_file.write(html_content)

self._remote_fs.put(temp_file_path, f"{self._bucket_path}/")

def _upload_static_files(self, html_dir: Path):
"""Upload static HTML files to S3."""
logger.debug("Uploading static html files to %s.", self._bucket_path)
try:
self._remote_fs.put(f"{str(html_dir)}/*", self._bucket_path, recursive=True)
self._ingest_heap_analytics()
except Exception as exc: # pragma: no cover
logger.exception("Upload failed: %s ", exc)
raise exc
Expand Down
2 changes: 1 addition & 1 deletion package/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ packaging~=23.0
kedro>=0.17.5
ipython>=7.0.0, <9.0
fastapi>=0.73.0, <0.96.0
fsspec>=2021.4, <2024.1
fsspec[s3]>=2021.4, <2024.1
aiofiles==22.1.0
uvicorn[standard]~=0.22.0
watchgod~=0.8.2
Expand Down
Loading