Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
-->

<script id="history-summary-template" type="text/html">
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-12">
<label for="log-path-filter" style="margin-right: 10px;">Filter by Log Source:</label>
<select id="log-path-filter" class="form-control" style="display: inline-block; width: auto;">
<option value="">All Sources</option>
</select>
</div>
</div>
<table id="history-summary-table" class="table table-striped compact">
<thead>
<tr>
Expand All @@ -34,6 +42,11 @@
App Name
</span>
</th>
<th>
<span data-toggle="tooltip" data-placement="top" title="Log directory where this application's event log is stored.">
Log Source
</span>
</th>
{{#hasMultipleAttempts}}
<th>
<span data-bs-toggle="tooltip" data-bs-placement="top" title="The attempt ID of this application since one application might be launched several times">
Expand Down
53 changes: 50 additions & 3 deletions core/src/main/resources/org/apache/spark/ui/static/historypage.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ $(document).ready(function() {
var startedColumnName = 'started';
var completedColumnName = 'completed';
var durationColumnName = 'duration';
var logPathColumnName = 'logPath';
var conf = {
"data": array,
"columns": [
Expand All @@ -203,6 +204,18 @@ $(document).ready(function() {
data: 'name',
render: (name) => stringAbbreviate(name, 60)
},
{
name: logPathColumnName,
data: 'logSourceName',
render: (logSourceName, type, row) => {
if (logSourceName && row && row.logSourceFullPath) {
const safeName = escapeHtml(logSourceName);
const safePath = escapeHtml(row.logSourceFullPath);
return `<span title="${safePath}">${safeName}</span>`;
}
return '';
}
},
{
name: attemptIdColumnName,
data: 'attemptId',
Expand Down Expand Up @@ -230,7 +243,7 @@ $(document).ready(function() {
],
"aoColumnDefs": [
{
aTargets: [0, 1, 2],
aTargets: [0, 1, 2, 3],
fnCreatedCell: (nTd, _ignored_sData, _ignored_oData, _ignored_iRow, _ignored_iCol) => {
if (hasMultipleAttempts) {
$(nTd).css('background-color', '#fff');
Expand All @@ -246,7 +259,8 @@ $(document).ready(function() {
conf.rowsGroup = [
'appId:name',
'version:name',
'appName:name'
'appName:name',
'logPath:name'
];
} else {
conf.columns = removeColumnByName(conf.columns, attemptIdColumnName);
Expand All @@ -263,8 +277,41 @@ $(document).ready(function() {
{"searchable": false, "targets": [getColumnIndex(conf.columns, durationColumnName)]}
];
historySummary.append(apps);
apps.DataTable(conf);
var dataTable = apps.filter("table").DataTable(conf);
sibling.after(historySummary);

// Populate log path filter dropdown
var logPathNames = new Set();
array.forEach(function(row) {
if (row.logSourceName) {
logPathNames.add(row.logSourceName);
}
});

var logPathFilter = $('#log-path-filter');
Array.from(logPathNames).sort().forEach(function(name) {
logPathFilter.append($('<option></option>').val(name).text(name));
});

// Add custom filter function
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex, rowData) {
if (settings.nTable.id !== 'history-summary-table') {
return true; // Don't filter other tables
}
var selectedPath = logPathFilter.val();
if (!selectedPath) {
return true; // Show all if no filter selected
}
return rowData && typeof rowData.logSourceName === 'string' &&
rowData.logSourceName === selectedPath;
});

// Trigger filter on dropdown change
logPathFilter.on('change', function() {
dataTable.draw();
});

$('#history-summary [data-toggle="tooltip"]').tooltip();
});
});
});
Loading