-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
[SPARK-21809] : Change Stage Page to use datatables to support sorting columns and searching #21688
Changes from 2 commits
5450258
dadc55f
fc88dec
495caaf
c1d41d8
567d22b
649e95b
590e93f
d79eb80
6a0622e
132fce9
573390d
af83b6e
07c1f19
cbfbd07
af11138
20ef5e5
51c0622
2e88030
b233dad
204c708
2bd0fcf
a91b306
930a261
2a39374
a1d4317
1ba30ce
8cf0e34
a4ed19d
3a1f274
7e486f1
a4661fe
258e81b
052f706
0ed3309
66a14bc
24e6b45
c26a9ff
a8b5862
d6b41ca
73a5451
271de2d
b438af5
3111166
a696dcc
b3e2370
672b12a
8f6efbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,7 +117,7 @@ private[v1] class StagesResource extends BaseAppResource { | |
val uriQueryParameters = uriInfo.getQueryParameters(true) | ||
val totalRecords = uriQueryParameters.getFirst("numTasks") | ||
var isSearch = false | ||
var searchValue: Option[String] = None | ||
var searchValue: String = null | ||
var filteredRecords = totalRecords | ||
// The datatables client API sends a list of query parameters to the server which contain | ||
// information like the columns to be sorted, search value typed by the user in the search | ||
|
@@ -126,15 +126,15 @@ private[v1] class StagesResource extends BaseAppResource { | |
if (uriQueryParameters.getFirst("search[value]") != null && | ||
uriQueryParameters.getFirst("search[value]").length > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we easily point somewhere for the datatable api so if someone tries to read this they can see the values? Or put an example here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
isSearch = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we set isSearch and pass in true above, just set this above and pass into doPagination. Really I think you could simplify this and do the if then set isSearch and only have 1 call to doPagination outside the if. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
searchValue = Some(uriQueryParameters.getFirst("search[value]")) | ||
searchValue = uriQueryParameters.getFirst("search[value]") | ||
} | ||
val _tasksToShow: Seq[TaskData] = doPagination(uriQueryParameters, stageId, stageAttemptId, | ||
isSearch, totalRecords.toInt) | ||
val ret = new HashMap[String, Object]() | ||
if (_tasksToShow.nonEmpty) { | ||
// Performs server-side search based on input from user | ||
if (isSearch) { | ||
val filteredTaskList = filterTaskList(_tasksToShow, searchValue.get) | ||
val filteredTaskList = filterTaskList(_tasksToShow, searchValue) | ||
filteredRecords = filteredTaskList.length.toString | ||
if (filteredTaskList.length > 0) { | ||
val pageStartIndex = uriQueryParameters.getFirst("start").toInt | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,14 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We | |
val parameterTaskSortDesc = UIUtils.stripXSS(request.getParameter("task.desc")) | ||
val parameterTaskPageSize = UIUtils.stripXSS(request.getParameter("task.pageSize")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to clean this up as its not really used anymore, can you file a jira to change the timeline to use rest api or the data from the other tables.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
val eventTimelineParameterTaskPage = UIUtils.stripXSS( | ||
request.getParameter("task.eventTimelinePageNumber")) | ||
val eventTimelineParameterTaskPageSize = UIUtils.stripXSS( | ||
request.getParameter("task.eventTimelinePageSize")) | ||
var eventTimelineTaskPage = Option(eventTimelineParameterTaskPage).map(_.toInt).getOrElse(1) | ||
var eventTimelineTaskPageSize = Option( | ||
eventTimelineParameterTaskPageSize).map(_.toInt).getOrElse(100) | ||
|
||
val taskPage = Option(parameterTaskPage).map(_.toInt).getOrElse(1) | ||
val taskSortColumn = Option(parameterTaskSortColumn).map { sortColumn => | ||
UIUtils.decodeURLParameter(sortColumn) | ||
|
@@ -132,6 +140,14 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We | |
} else { | ||
s"$totalTasks, showing $storedTasks" | ||
} | ||
if (eventTimelineTaskPageSize < 1 || eventTimelineTaskPageSize > totalTasks) { | ||
eventTimelineTaskPageSize = totalTasks | ||
} | ||
val eventTimelineTotalPages = | ||
(totalTasks + eventTimelineTaskPageSize - 1) / eventTimelineTaskPageSize | ||
if (eventTimelineTaskPage < 1 || eventTimelineTaskPage > eventTimelineTotalPages) { | ||
eventTimelineTaskPage = 1 | ||
} | ||
|
||
val summary = | ||
<div> | ||
|
@@ -247,9 +263,12 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We | |
makeTimeline( | ||
// Only show the tasks in the table | ||
Option(taskTable).map({ taskPagedTable => | ||
val from = (taskPage - 1) * taskPageSize | ||
val to = taskPagedTable.dataSource.dataSize.min(taskPage * taskPageSize) | ||
taskPagedTable.dataSource.sliceData(from, to)}).getOrElse(Nil), currentTime) ++ | ||
val from = (eventTimelineTaskPage - 1) * eventTimelineTaskPageSize | ||
val to = taskPagedTable.dataSource.dataSize.min( | ||
eventTimelineTaskPage * eventTimelineTaskPageSize) | ||
taskPagedTable.dataSource.sliceData(from, to)}).getOrElse(Nil), currentTime, | ||
eventTimelineTaskPage, eventTimelineTaskPageSize, eventTimelineTotalPages, stageId, | ||
stageAttemptId, totalTasks) ++ | ||
<div id="parent-container"> | ||
<script src={UIUtils.prependBaseUri(request, "/static/utils.js")}></script> | ||
<script src={UIUtils.prependBaseUri(request, "/static/stagepage.js")}></script> | ||
|
@@ -259,7 +278,8 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We | |
|
||
} | ||
|
||
def makeTimeline(tasks: Seq[TaskData], currentTime: Long): Seq[Node] = { | ||
def makeTimeline(tasks: Seq[TaskData], currentTime: Long, page: Int, pageSize: Int, | ||
totalPages: Int, stageId: Int, stageAttemptId: Int, totalTasks: Int): Seq[Node] = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix format of arguments to be multi-line style like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
val executorsSet = new HashSet[(String, String)] | ||
var minLaunchTime = Long.MaxValue | ||
var maxFinishTime = Long.MinValue | ||
|
@@ -418,6 +438,31 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We | |
<input type="checkbox"></input> | ||
<span>Enable zooming</span> | ||
</div> | ||
<div> | ||
<form id={s"form-event-timeline-page"} | ||
method="get" | ||
action="" | ||
class="form-inline pull-right" | ||
style="margin-bottom: 0px;"> | ||
<label>Tasks: {totalTasks}. {totalPages} Pages. Jump to</label> | ||
<input type="hidden" name="id" value={stageId.toString} /> | ||
<input type="hidden" name="attempt" value={stageAttemptId.toString} /> | ||
<input type="text" | ||
name="task.eventTimelinePageNumber" | ||
id={s"form-event-timeline-page-no"} | ||
value={page.toString} class="span1" /> | ||
|
||
<label>. Show </label> | ||
<input type="text" | ||
id={s"form-event-timeline-page-size"} | ||
name="task.eventTimelinePageSize" | ||
value={pageSize.toString} | ||
class="span1" /> | ||
<label>items in a page.</label> | ||
|
||
<button type="submit" class="btn">Go</button> | ||
</form> | ||
</div> | ||
</div> | ||
{TIMELINE_LEGEND} | ||
</div> ++ | ||
|
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.
use Option instead of null
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.
Done