Skip to content

Conversation

@clarkead
Copy link
Contributor

What changes were proposed in this pull request?

Spark's Web UI is using an older version of Bootstrap (v. 2.3.2) for the portal pages. Bootstrap 2.x was moved to EOL in Aug 2013 and Bootstrap 3.x was moved to EOL in July 2019 (https://github.com/twbs/release). Older versions of Bootstrap are also getting flagged in security scans for various CVEs:

https://snyk.io/vuln/SNYK-JS-BOOTSTRAP-72889
https://snyk.io/vuln/SNYK-JS-BOOTSTRAP-173700
https://snyk.io/vuln/npm:bootstrap:20180529
https://snyk.io/vuln/npm:bootstrap:20160627

I haven't validated each CVE, but it would be nice to resolve any potential issues and get on a supported release.

The bad news is that there have been quite a few changes between Bootstrap 2 and Bootstrap 4. I've tried updating the library, refactoring/tweaking the CSS and JS to maintain a similar appearance and functionality, and testing the UI for functionality and appearance. This is a fairly large change so I'm sure additional testing and fixes will be needed.

How was this patch tested?

This has been manually tested, but there is a ton of functionality and there are many pages and detail pages so it is very possible bugs introduced from the upgrade were missed. Additional testing and feedback is welcomed. If it appears a whole page was missed let me know and I'll take a pass at addressing that page/section.

@srowen
Copy link
Member

srowen commented Jan 28, 2020

Probably a good idea, yes, but hard to evaluate indeed. Does this update jquery too?
The LICENSE file or licenses/ might need to change just to reflect the new file names.
As far as you know this doesn't change functionality, or doesn't intend to, right?

@srowen
Copy link
Member

srowen commented Jan 28, 2020

Jenkins test this please

@SparkQA
Copy link

SparkQA commented Jan 28, 2020

Test build #117485 has finished for PR 27370 at commit 5720577.

  • This patch fails RAT tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • public final class ColumnDictionary implements Dictionary

@clarkead
Copy link
Contributor Author

Thank you for taking a look. The intention with this patch is not to change any functionality. The goal is to just migrate Spark's WebUI onto a supported Bootstrap release. Due to Bootstrap changing some of their default CSS the font sizes, paddings, and margins did change. As a result, I made some overrides in the CSS and some minor changes to the HTML markup to try and maintain the existing feel, but there are still minor differences. It should be noted that the main navbar does collapse to a toggle button now for mobile devices. Previously when viewed on a mobile device or small browser window the top navbar would become partially cut off.

jQuery was not modified as it was already on version 3.4.1, but dataTables.bootstrap.min.js was updated to the latest dataTables.bootstrap4.min.js and jquery.dataTables.1.10.18.min.js was updated to jquery.dataTables.min.js (version 1.10.20). This was mostly needed for compatibility with the latest Bootstrap 4 release.

I noticed this afternoon my initial PR had an issue with my upstream merge so I've added a new commit to resolve it. I'll look into the reported license issue.

@srowen
Copy link
Member

srowen commented Jan 29, 2020

Yeah, I do think we need to make a change like this at some point. Thanks for doing the legwork. My only hesitation about merging it soon is that we're about to be in 3.0 code freeze, and it sounds like this may need a little testing. On the one hand, we'll be doing some of that in the 3.0 QA period, so I'm not against it (if you can resolve merge conflicts and feel as confident as you can this works). We can also push back to consider post 3.0.

@clarkead
Copy link
Contributor Author

I've updated the Bootstrap license to reflect the license change to MIT. I've also updated the dataTables license to reflect the updated date range. Finally, I had to update the dev/.rat-excludes to reflect the file name changes and additional files provided by the third party libraries.

@clarkead
Copy link
Contributor Author

As far as when to merge it goes, while I'd like to see it merged as part of the 3.0 release I understand the concern regarding the risk it introduces so I'm good if you want to push it to after 3.0 is out the door. In either case I'll support merge conflicts and will try to resolve visual bug defects found.

As far as my confidence level in the patch, I've tested it for the use cases and pages that I know of, but I'm sure there are areas that I don't know about or missed. I am confident though that any issues issues found can be quickly resolved.

@gengliangwang
Copy link
Member

@clarkead Thanks for the work. I am +1 with the upgrade(actually it was in my backlog).
Could you resolve the code conflict? I will help do some manual testing and code review.

<div class="container-fluid">
<table id="active-executors-table" class="table table-striped compact cell-border">
<thead>
<table id="summary-execs-table" class="table table-striped compact cell-border" style="width: 100%">
Copy link
Member

Choose a reason for hiding this comment

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

It seems that this file only removes the element <div class="container-fluid"> and add style="width: 100%"
Could you keep the other part of the file unchanged so that it is easier for review?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for reviewing the PR. I just submitted a PR to review the indent formatting updates to make the review easier.

@gengliangwang
Copy link
Member

@clarkead I think we should keep the version in the dataTable related file names.

"Show Additional Metrics" +
"</a></div>" +
"<div class='container-fluid container-fluid-div' id='toggle-metrics' hidden>" +
"<div class='container-fluid-div ml-4 d-none' id='toggle-metrics'>" +
Copy link
Member

Choose a reason for hiding this comment

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

why do we need ml-4 d-none

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ml-4 is needed to add the left margin on the set of checkboxes so that it is indented similarly to the original / current formatting. Without the ml-4 class the checkboxes are flush with the "Show Additional Metrics" arrow.

With regards to d-none, jQuery 1.8 deprecated .toggle() and jQuery 1.9 removed it so I had to change the JS for the "Show Additional Metrics" expand/collapse functionality. I decided to change it to the jQuery .toggleClass() method and use the Bootstrap provided d-none (display none) class to show and hide the div instead of creating a new custom class.

Copy link
Member

Choose a reason for hiding this comment

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

I see. How about putting the margin-left into the CSS of container-fluid-div so that we don't need to write 'ml-4' every time.

@@ -1,13 +1,22 @@
Copyright 2013 Twitter, Inc.
The MIT License (MIT)
Copy link
Member

Choose a reason for hiding this comment

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

We need to update LICENSE-binary as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just updated the license-binary files associated with bootstrap and datatables.

Copy link
Member

Choose a reason for hiding this comment

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

$("#showAdditionalMetrics").append(
"<div><a id='additionalMetrics'>" +
"<span class='expand-input-rate-arrow arrow-closed' id='arrowtoggle-optional-metrics'></span>" +
"<span class='expand-input-rate-arrow arrow-closed' id='arrowtoggle-optional-metrics'></span> " +
Copy link
Member

Choose a reason for hiding this comment

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

Nit: this line seems only adding one space, we can avoid such changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed this is a little lame. I'll remove the space and use styling instead.

Copy link
Contributor Author

@clarkead clarkead Mar 3, 2020

Choose a reason for hiding this comment

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

The space was removed. It was originally added to make the arrow spacing consistent between the executor page and the other pages since the other pages rely on whitespace for the gap between the arrow and the expand / collapse text. Fixing all other occurrences would require many more code changes so I just reverted the space for now.

@gengliangwang
Copy link
Member

gengliangwang commented Mar 2, 2020

@clarkead I found some issues in the stage page.
This is after changes:
image
The cursor should be a pointer and there should be a list of checkbox after click.
Before changes:
image

@clarkead
Copy link
Contributor Author

clarkead commented Mar 2, 2020

It appears I missed updating the .toggle() calls in the stagepage.js. It also affects the "Aggregated Metrics by Executor" toggle as well. I'll resolve that now.

@gengliangwang
Copy link
Member

There are also some differences in the timeline.
Before changes:
image

After changes:
image

@gengliangwang gengliangwang changed the title [SPARK-30654] Bootstrap4 WebUI upgrade [SPARK-30654][WebUI] Bootstrap4 WebUI upgrade Mar 2, 2020
…(css) to include the version number as requested. Also discovered and fixed a table width formatting issue on the history page.
@clarkead
Copy link
Contributor Author

clarkead commented Mar 7, 2020

@gengliangwang I've added the version number to the dataTables js and css filenames as discussed. I also noticed while testing that the table on the first page of the history server was not displaying at 100% width as it currently does in master so I fixed that via a tweak to core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala (removed an unnecessary "row" class).

@gengliangwang
Copy link
Member

Jenkins retest this please

@gengliangwang
Copy link
Member

Jenkins test this please

@SparkQA
Copy link

SparkQA commented Mar 10, 2020

Test build #119593 has finished for PR 27370 at commit ae1e0c2.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gengliangwang
Copy link
Member

@clarkead this PR is very close to being merged.
Could you fix the test failure?

@clarkead
Copy link
Contributor Author

@gengliangwang I'll take a look at this today and try to get a fix in.

@gengliangwang
Copy link
Member

add to whitelist

@gengliangwang
Copy link
Member

Jenkins test this please

@SparkQA
Copy link

SparkQA commented Mar 12, 2020

Test build #119688 has finished for PR 27370 at commit e1f0b0e.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gengliangwang
Copy link
Member

retest this please.

@SparkQA
Copy link

SparkQA commented Mar 12, 2020

Test build #119696 has finished for PR 27370 at commit e1f0b0e.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gengliangwang
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Mar 12, 2020

Test build #119707 has finished for PR 27370 at commit e1f0b0e.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gengliangwang
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Mar 12, 2020

Test build #119723 has finished for PR 27370 at commit e1f0b0e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@gengliangwang gengliangwang left a comment

Choose a reason for hiding this comment

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

LGTM

@gengliangwang
Copy link
Member

gengliangwang commented Mar 13, 2020

I will merge this one if no one has other comments this Friday.

@gengliangwang
Copy link
Member

Thanks for all the work, merging to master.

@clarkead
Copy link
Contributor Author

@gengliangwang and @srowen Thank you for your time and help getting this merged in. Much appreciated.

sjincho pushed a commit to sjincho/spark that referenced this pull request Apr 15, 2020
### What changes were proposed in this pull request?
Spark's Web UI is using an older version of Bootstrap (v. 2.3.2) for the portal pages. Bootstrap 2.x was moved to EOL in Aug 2013 and Bootstrap 3.x was moved to EOL in July 2019 (https://github.com/twbs/release). Older versions of Bootstrap are also getting flagged in security scans for various CVEs:

https://snyk.io/vuln/SNYK-JS-BOOTSTRAP-72889
https://snyk.io/vuln/SNYK-JS-BOOTSTRAP-173700
https://snyk.io/vuln/npm:bootstrap:20180529
https://snyk.io/vuln/npm:bootstrap:20160627

I haven't validated each CVE, but it would be nice to resolve any potential issues and get on a supported release.

The bad news is that there have been quite a few changes between Bootstrap 2 and Bootstrap 4. I've tried updating the library, refactoring/tweaking the CSS and JS to maintain a similar appearance and functionality, and testing the UI for functionality and appearance. This is a fairly large change so I'm sure additional testing and fixes will be needed.

### How was this patch tested?
This has been manually tested, but there is a ton of functionality and there are many pages and detail pages so it is very possible bugs introduced from the upgrade were missed. Additional testing and feedback is welcomed. If it appears a whole page was missed let me know and I'll take a pass at addressing that page/section.

Closes apache#27370 from clarkead/bootstrap4-core-upgrade.

Authored-by: Dale Clarke <[email protected]>
Signed-off-by: Gengliang Wang <[email protected]>
dongjoon-hyun pushed a commit that referenced this pull request May 13, 2020
…o longer used

### What changes were proposed in this pull request?

This PR removes `bootstrap-tooltip.js` which is no longer used.
That script is replaced with `bootstrap.bundle.min.js` in SPARK-30654 ( #27370 ).

### Why are the changes needed?

For cleaning up repository..

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Manually checked whether tooltips are shown in the UI and no error message shown in the debug console.

Closes #28515 from sarutak/remove-tooltipjs.

Authored-by: Kousuke Saruta <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
@emmanuelrflores
Copy link

Has this been put into a release? Looking at commit by @gengliangwang, it looks like it should be in 3.1.2, but when I look at the release notes for 3.1.2 on the main site or the jira site, I can't find the reference.

I'm not familiar with the release process or how the notes are detailed, so my apologies if I missed something. Thank you

@srowen
Copy link
Member

srowen commented Jun 30, 2021

The commit message above shows the commit it produces, and that it's in branch 3.1. The JIRA says 3.1.0
2a4fed0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants