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

chore(dashboard): Integrate dashboard app into the SPA bundle #14356

Merged
merged 21 commits into from May 4, 2021

Conversation

suddjian
Copy link
Member

@suddjian suddjian commented Apr 26, 2021

SUMMARY

  • Move Dashboard app's individual reducer and app initialization logic to the Single Page App /views/App
  • Move remaining page-specific logic from the backend to the frontend (css, title)
  • Convert the links in the dashboard list from anchors to react-router links

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

  • Run the changes in ephemeral env, navigate to dashboards, edit, reload, create new dashboards, go between dashboard page and other views, try url parameters such as standalone.
  • Add a e2e test that navigates between pages

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Apr 27, 2021

Codecov Report

Merging #14356 (06cc3ae) into master (a8781c5) will increase coverage by 0.57%.
The diff coverage is 57.74%.

❗ Current head 06cc3ae differs from pull request most recent head c999cc5. Consider uploading reports for the commit c999cc5 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14356      +/-   ##
==========================================
+ Coverage   77.18%   77.76%   +0.57%     
==========================================
  Files         954      957       +3     
  Lines       48184    51712    +3528     
  Branches     5977     6494     +517     
==========================================
+ Hits        37193    40213    +3020     
- Misses      10794    11297     +503     
- Partials      197      202       +5     
Flag Coverage Δ
hive 81.42% <66.66%> (+0.66%) ⬆️
javascript 72.20% <57.35%> (+0.09%) ⬆️
mysql 81.81% <66.66%> (+0.77%) ⬆️
postgres 81.83% <66.66%> (+0.76%) ⬆️
presto 81.53% <66.66%> (+0.76%) ⬆️
python 82.40% <66.66%> (+0.80%) ⬆️
sqlite 81.47% <66.66%> (+0.78%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rontend/src/dashboard/containers/DashboardPage.tsx 0.00% <0.00%> (ø)
superset-frontend/src/views/App.tsx 0.00% <0.00%> (ø)
superset/views/base.py 76.19% <ø> (ø)
...rontend/src/views/CRUD/dashboard/DashboardCard.tsx 77.27% <66.66%> (+1.08%) ⬆️
superset/views/core.py 79.49% <66.66%> (+3.77%) ⬆️
superset-frontend/src/utils/urlUtils.ts 61.53% <75.00%> (+2.44%) ⬆️
superset-frontend/src/views/routes.tsx 64.86% <80.00%> (+1.22%) ⬆️
...set-frontend/src/components/ListViewCard/index.tsx 100.00% <100.00%> (ø)
superset-frontend/src/components/Menu/Menu.tsx 69.47% <100.00%> (+0.99%) ⬆️
...rontend/src/views/CRUD/dashboard/DashboardList.tsx 75.83% <100.00%> (+0.20%) ⬆️
... and 70 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8781c5...c999cc5. Read the comment docs.

@suddjian suddjian marked this pull request as ready for review April 28, 2021 19:47
@apache apache deleted a comment from github-actions bot Apr 28, 2021
superset/views/core.py Outdated Show resolved Hide resolved
@suddjian suddjian changed the title chore(dashboard): [WiP] Integrate dashboard app into the SPA bundle chore(dashboard): Integrate dashboard app into the SPA bundle Apr 29, 2021
@@ -159,6 +162,10 @@ export function Menu({
}: MenuProps) {
const [dropdownOpen, setDropdownOpen] = useState(false);

// would useQueryParam here but not all apps provide a router context
const standalone = getUrlParam('standalone', 'boolean');
if (standalone) return <></>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh this is cool, we'll support standalone=true for all pages

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the course of writing this I also learned about standalone=2 which removes the dashboard header lol

Copy link
Member Author

@suddjian suddjian Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could have standalone be a set of bit flags where each bit is a different feature to remove /s

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦

@apache apache deleted a comment from github-actions bot Apr 29, 2021
@@ -169,13 +182,14 @@ function ListViewCard({
imgPosition = 'top',
cover,
}: CardProps) {
const Link = url && linkComponent ? linkComponent : AnchorLink;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just in case this is used outside of a react-router context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most list view links still need to be anchor links. It's just the dashboard ones that can be <Link>s for now.

@suddjian
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

@suddjian Ephemeral environment spinning up at http://54.191.158.50:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@apache apache deleted a comment from github-actions bot Apr 30, 2021
return (
<StyledCard
data-test="styled-card"
cover={
cover || (
<Cover>
<a href={url}>
<Link to={url!}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can adda. test to make sure this renders as expected with/without the url?

@@ -139,7 +141,7 @@ function DashboardCard({
<CardStyles
onClick={() => {
if (!bulkSelectEnabled) {
window.location.href = dashboard.url;
history.push(dashboard.url);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do an E2E test to go into and out of a dashboard, to make sure we can get hither and yon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to have one that hits the dashboard url directly and one that navigates to it via the list view link

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted a couple opportunities for tests, but in general LGTM!!

@suddjian suddjian merged commit 21cf12a into master May 4, 2021
@github-actions
Copy link
Contributor

github-actions bot commented May 4, 2021

Ephemeral environment shutdown and build artifacts deleted.

hughhhh pushed a commit that referenced this pull request May 4, 2021
* chore(dashboard): Integrate dashboard app into the SPA bundle

* fix url params

* change variable name

* change title correctly

* custom css

* lint

* remove unused file

* remove content assertions from dashboard tests

* fix case with missing bootstrap data

* fix: respect crud views flag

* crud views -> spa

* remove unused dashboard templates

* fix: remove unused variable

* fix: missed a spot with the crudViews -> spa

* router link to dashboard from dashboard list page

* link using the router when in card mode

* lint

* fix tests, add memory router

* remove  dashboard app files

* split up the bundle a little more

* use webpack preload
@suddjian suddjian deleted the dashboard-spa branch May 10, 2021 21:10
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
…#14356)

* chore(dashboard): Integrate dashboard app into the SPA bundle

* fix url params

* change variable name

* change title correctly

* custom css

* lint

* remove unused file

* remove content assertions from dashboard tests

* fix case with missing bootstrap data

* fix: respect crud views flag

* crud views -> spa

* remove unused dashboard templates

* fix: remove unused variable

* fix: missed a spot with the crudViews -> spa

* router link to dashboard from dashboard list page

* link using the router when in card mode

* lint

* fix tests, add memory router

* remove  dashboard app files

* split up the bundle a little more

* use webpack preload
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
…#14356)

* chore(dashboard): Integrate dashboard app into the SPA bundle

* fix url params

* change variable name

* change title correctly

* custom css

* lint

* remove unused file

* remove content assertions from dashboard tests

* fix case with missing bootstrap data

* fix: respect crud views flag

* crud views -> spa

* remove unused dashboard templates

* fix: remove unused variable

* fix: missed a spot with the crudViews -> spa

* router link to dashboard from dashboard list page

* link using the router when in card mode

* lint

* fix tests, add memory router

* remove  dashboard app files

* split up the bundle a little more

* use webpack preload
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
…#14356)

* chore(dashboard): Integrate dashboard app into the SPA bundle

* fix url params

* change variable name

* change title correctly

* custom css

* lint

* remove unused file

* remove content assertions from dashboard tests

* fix case with missing bootstrap data

* fix: respect crud views flag

* crud views -> spa

* remove unused dashboard templates

* fix: remove unused variable

* fix: missed a spot with the crudViews -> spa

* router link to dashboard from dashboard list page

* link using the router when in card mode

* lint

* fix tests, add memory router

* remove  dashboard app files

* split up the bundle a little more

* use webpack preload
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/XL 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants