[SPARK-35127][UI] When we switch between different stage-detail pages, the entry item in the newly-opened page may be blank

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

To make sure that pageSize shoud not be shared between different stage pages.
The screenshots of the problem are placed in the attachment of [JIRA](https://issues.apache.org/jira/browse/SPARK-35127)

### Why are the changes needed?
fix the bug.

according to reference:`https://datatables.net/reference/option/lengthMenu`
`-1` represents display all rows, but now we use `totalTasksToShow`, it will cause the select item show as empty when we swich between different stage-detail pages.

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

### How was this patch tested?
manual test, it is a small io problem, and the modification does not affect the function, but just an adjustment of js configuration

the gif below shows how the problem can be reproduced:
![reproduce](https://user-images.githubusercontent.com/52202080/115204351-f7060f80-a12a-11eb-8900-a009ad0c8870.gif)

![微信截图_20210419162849](https://user-images.githubusercontent.com/52202080/115205675-629cac80-a12c-11eb-9cb8-1939c7450e99.png)

the gif below shows the result after modified:

![after_modified](https://user-images.githubusercontent.com/52202080/115204886-91fee980-a12b-11eb-9ccb-d5900a99095d.gif)

Closes #32223 from kyoty/stages-task-empty-pagesize.

Authored-by: kyoty <echohlne@gmail.com>
Signed-off-by: Kousuke Saruta <sarutak@oss.nttdata.com>
This commit is contained in:
kyoty 2021-04-22 21:00:04 +09:00 committed by Kousuke Saruta
parent c0972dec1d
commit 7242d7f774

View file

@ -746,7 +746,7 @@ $(document).ready(function () {
"paging": true, "paging": true,
"info": true, "info": true,
"processing": true, "processing": true,
"lengthMenu": [[20, 40, 60, 100, totalTasksToShow], [20, 40, 60, 100, "All"]], "lengthMenu": [[20, 40, 60, 100, -1], [20, 40, 60, 100, "All"]],
"orderMulti": false, "orderMulti": false,
"bAutoWidth": false, "bAutoWidth": false,
"ajax": { "ajax": {
@ -762,6 +762,9 @@ $(document).ready(function () {
data.numTasks = totalTasksToShow; data.numTasks = totalTasksToShow;
data.columnIndexToSort = columnIndexToSort; data.columnIndexToSort = columnIndexToSort;
data.columnNameToSort = columnNameToSort; data.columnNameToSort = columnNameToSort;
if (data.length === -1) {
data.length = totalTasksToShow;
}
}, },
"dataSrc": function (jsons) { "dataSrc": function (jsons) {
var jsonStr = JSON.stringify(jsons); var jsonStr = JSON.stringify(jsons);