Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
61b4782
Add ESLint support.
sarutak Apr 21, 2021
e2fcd9e
Add a newline at the end of .gitignore.
sarutak Apr 21, 2021
990e538
Modify .rat-exclude.
sarutak Apr 22, 2021
d6eb61a
Add docs/js for a lint target.
sarutak Apr 25, 2021
c1afc31
npm install -> npm ci to avoid package-lock.json being changed.
sarutak May 6, 2021
d858aa8
Upgrade eslint.
sarutak May 6, 2021
e459d90
Add switch-case rule.
sarutak May 6, 2021
1ad98a5
Fix style for webui.js.
sarutak May 6, 2021
feb6d76
Disable indentation rule for member expressions.
sarutak May 6, 2021
0a1a461
Fix style for utils.js.
sarutak May 6, 2021
71ea913
Fix style for timeline-view.js.
sarutak May 6, 2021
5ec9eea
Fix style for table.js.
sarutak May 6, 2021
701514a
Fix style for structured-streaming-page.js.
sarutak May 6, 2021
5b18e69
Fix style for streaming-page.js.
sarutak May 6, 2021
1d209ca
Add ignored argument rule.
sarutak May 6, 2021
4c8cb17
Fix style for stagepage.js.
sarutak May 6, 2021
4884b8e
Fix style for spark-dag-viz.js.
sarutak May 6, 2021
da34039
Fix style for log-view.js.
sarutak May 6, 2021
896b475
Modify indentation in eslint.json.
sarutak May 6, 2021
e8170eb
Fix style for initialize-tooltips.js.
sarutak May 6, 2021
e3847db
Fix style for historypage.js.
sarutak May 6, 2021
b129c4e
Fix style for historypage-common.js.
sarutak May 6, 2021
d174384
Fix style for executorspage.js.
sarutak May 6, 2021
1d67631
Revert "Fix style for stagepage.js."
sarutak May 6, 2021
82a9947
Merge branch 'master' of https://github.com/apache/spark into introdu…
sarutak May 6, 2021
5bda9fc
Fix style for stagepage.js.
sarutak May 6, 2021
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
Prev Previous commit
Next Next commit
Fix style for table.js.
  • Loading branch information
sarutak committed May 6, 2021
commit 5ec9eead07e17416197758e97d561e9053b8eb62
130 changes: 68 additions & 62 deletions core/src/main/resources/org/apache/spark/ui/static/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,91 +15,97 @@
* limitations under the License.
*/

/* global $ */
/* eslint-disable no-unused-vars */
/* Adds background colors to stripe table rows in the summary table (on the stage page). This is
* necessary (instead of using css or the table striping provided by bootstrap) because the summary
* table has hidden rows.
*
* An ID selector (rather than a class selector) is used to ensure this runs quickly even on pages
* with thousands of task rows (ID selectors are much faster than class selectors). */
function stripeSummaryTable() {
$("#task-summary-table").find("tr:not(:hidden)").each(function (index) {
if (index % 2 == 1) {
$(this).css("background-color", "#f9f9f9");
} else {
$(this).css("background-color", "#ffffff");
}
});
$("#task-summary-table").find("tr:not(:hidden)").each(function (index) {
if (index % 2 == 1) {
$(this).css("background-color", "#f9f9f9");
} else {
$(this).css("background-color", "#ffffff");
}
});
}
/* eslint-enable no-unused-vars */

function toggleThreadStackTrace(threadId, forceAdd) {
var stackTrace = $("#" + threadId + "_stacktrace")
if (stackTrace.length == 0) {
var stackTraceText = $('#' + threadId + "_td_stacktrace").html()
var threadCell = $("#thread_" + threadId + "_tr")
threadCell.after("<tr id=\"" + threadId +"_stacktrace\" class=\"accordion-body\"><td colspan=\"4\"><pre>" +
stackTraceText + "</pre></td></tr>")
} else {
if (!forceAdd) {
stackTrace.remove()
}
var stackTrace = $("#" + threadId + "_stacktrace");
if (stackTrace.length == 0) {
var stackTraceText = $('#' + threadId + "_td_stacktrace").html();
var threadCell = $("#thread_" + threadId + "_tr");
threadCell.after("<tr id=\"" + threadId +"_stacktrace\" class=\"accordion-body\"><td colspan=\"4\"><pre>" +
stackTraceText + "</pre></td></tr>")
} else {
if (!forceAdd) {
stackTrace.remove()
}
}
}

/* eslint-disable no-unused-vars */
function expandAllThreadStackTrace(toggleButton) {
$('.accordion-heading').each(function() {
//get thread ID
if (!$(this).hasClass("d-none")) {
var trId = $(this).attr('id').match(/thread_([0-9]+)_tr/m)[1]
toggleThreadStackTrace(trId, true)
}
})
if (toggleButton) {
$('.expandbutton').toggleClass('d-none')
$('.accordion-heading').each(function() {
//get thread ID
if (!$(this).hasClass("d-none")) {
var trId = $(this).attr('id').match(/thread_([0-9]+)_tr/m)[1];
toggleThreadStackTrace(trId, true)
}
});
if (toggleButton) {
$('.expandbutton').toggleClass('d-none')
}
}
/* eslint-enable no-unused-vars */

function collapseAllThreadStackTrace(toggleButton) {
$('.accordion-body').each(function() {
$(this).remove()
})
if (toggleButton) {
$('.expandbutton').toggleClass('d-none');
}
$('.accordion-body').each(function() {
$(this).remove()
});
if (toggleButton) {
$('.expandbutton').toggleClass('d-none');
}
}


/* eslint-disable no-unused-vars */
// inOrOut - true: over, false: out
function onMouseOverAndOut(threadId) {
$("#" + threadId + "_td_id").toggleClass("threaddump-td-mouseover");
$("#" + threadId + "_td_name").toggleClass("threaddump-td-mouseover");
$("#" + threadId + "_td_state").toggleClass("threaddump-td-mouseover");
$("#" + threadId + "_td_locking").toggleClass("threaddump-td-mouseover");
$("#" + threadId + "_td_id").toggleClass("threaddump-td-mouseover");
$("#" + threadId + "_td_name").toggleClass("threaddump-td-mouseover");
$("#" + threadId + "_td_state").toggleClass("threaddump-td-mouseover");
$("#" + threadId + "_td_locking").toggleClass("threaddump-td-mouseover");
}

function onSearchStringChange() {
var searchString = $('#search').val().toLowerCase();
//remove the stacktrace
collapseAllThreadStackTrace(false)
if (searchString.length == 0) {
$('tr').each(function() {
$(this).removeClass('d-none')
})
} else {
$('tr').each(function(){
if($(this).attr('id') && $(this).attr('id').match(/thread_[0-9]+_tr/) ) {
var children = $(this).children()
var found = false
for (var i = 0; i < children.length; i++) {
if (children.eq(i).text().toLowerCase().indexOf(searchString) >= 0) {
found = true
}
}
if (found) {
$(this).removeClass('d-none')
} else {
$(this).addClass('d-none')
}
}
});
}
var searchString = $('#search').val().toLowerCase();
//remove the stacktrace
collapseAllThreadStackTrace(false);
if (searchString.length == 0) {
$('tr').each(function() {
$(this).removeClass('d-none')
})
} else {
$('tr').each(function(){
if($(this).attr('id') && $(this).attr('id').match(/thread_[0-9]+_tr/) ) {
var children = $(this).children();
var found = false;
for (var i = 0; i < children.length; i++) {
if (children.eq(i).text().toLowerCase().indexOf(searchString) >= 0) {
found = true;
}
}
if (found) {
$(this).removeClass('d-none')
} else {
$(this).addClass('d-none')
}
}
});
}
}
/* eslint-enable no-unused-vars */