-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-4016] Allow user to show/hide UI metrics. #2867
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
70c1fb5
[SPARK-4016] Allow user to show/hide UI metrics.
kayousterhout d7cfaaf
Made list of add'l metrics collapsible.
kayousterhout ef05ccd
Added tooltips
kayousterhout 0940d61
Style updates based on Andrew's review
kayousterhout 08dee73
Josh's usability comments
kayousterhout 6015913
Added comment
kayousterhout File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
core/src/main/resources/org/apache/spark/ui/static/additional-metrics.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /* Register functions to show/hide columns based on checkboxes. These need | ||
| * to be registered after the page loads. */ | ||
| $(function() { | ||
| $("span.expand-additional-metrics").click(function(){ | ||
| // Expand the list of additional metrics. | ||
| var additionalMetricsDiv = $(this).parent().find('.additional-metrics'); | ||
| $(additionalMetricsDiv).toggleClass('collapsed'); | ||
|
|
||
| // Switch the class of the arrow from open to closed. | ||
| $(this).find('.expand-additional-metrics-arrow').toggleClass('arrow-open'); | ||
| $(this).find('.expand-additional-metrics-arrow').toggleClass('arrow-closed'); | ||
|
|
||
| // If clicking caused the metrics to expand, automatically check all options for additional | ||
| // metrics (don't trigger a click when collapsing metrics, because it leads to weird | ||
| // toggling behavior). | ||
| if (!$(additionalMetricsDiv).hasClass('collapsed')) { | ||
| $(this).parent().find('input:checkbox:not(:checked)').trigger('click'); | ||
| } | ||
| }); | ||
|
|
||
| $("input:checkbox:not(:checked)").each(function() { | ||
| var column = "table ." + $(this).attr("name"); | ||
| $(column).hide(); | ||
| }); | ||
|
|
||
| $("input:checkbox").click(function() { | ||
| var column = "table ." + $(this).attr("name"); | ||
| $(column).toggle(); | ||
| stripeTables(); | ||
| }); | ||
|
|
||
| // Trigger a click on the checkbox if a user clicks the label next to it. | ||
| $("span.additional-metric-title").click(function() { | ||
| $(this).parent().find('input:checkbox').trigger('click'); | ||
| }); | ||
| }); |
35 changes: 35 additions & 0 deletions
35
core/src/main/resources/org/apache/spark/ui/static/table.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /* Adds background colors to stripe table rows. This is necessary (instead of using css or the | ||
| * table striping provided by bootstrap) to appropriately stripe tables with hidden rows. */ | ||
| function stripeTables() { | ||
| $("table.table-striped-custom").each(function() { | ||
| $(this).find("tr:not(:hidden)").each(function (index) { | ||
| if (index % 2 == 1) { | ||
| $(this).css("background-color", "#f9f9f9"); | ||
| } else { | ||
| $(this).css("background-color", "#ffffff"); | ||
| } | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| /* Stripe all tables after pages finish loading. */ | ||
| $(function() { | ||
| stripeTables(); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just inline this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could but then it becomes a n^2 computation on the headers, because it has to scan through all of the headers each time it adds new header content. n is not huge so maybe a non-issue; would you still prefer inlining it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, don't worry about it then. I thought it's just a coding style thing.