diff --git a/core/src/main/resources/org/apache/spark/ui/static/historypage-template.html b/core/src/main/resources/org/apache/spark/ui/static/historypage-template.html
index 33eb7bfa671bc..7e9927d40c191 100644
--- a/core/src/main/resources/org/apache/spark/ui/static/historypage-template.html
+++ b/core/src/main/resources/org/apache/spark/ui/static/historypage-template.html
@@ -77,12 +77,12 @@
{{#applications}}
+ {{#attempts}}
| {{version}} |
- {{id}} |
+ {{id}} |
{{name}} |
- {{#attempts}}
{{#hasMultipleAttempts}}
- {{attemptId}} |
+ {{attemptId}} |
{{/hasMultipleAttempts}}
{{startTime}} |
{{#showCompletedColumns}}
diff --git a/core/src/main/resources/org/apache/spark/ui/static/historypage.js b/core/src/main/resources/org/apache/spark/ui/static/historypage.js
index 4df5f07f077d7..3a4c815029f6d 100644
--- a/core/src/main/resources/org/apache/spark/ui/static/historypage.js
+++ b/core/src/main/resources/org/apache/spark/ui/static/historypage.js
@@ -130,7 +130,7 @@ $(document).ready(function() {
if (app["attempts"].length > 1) {
hasMultipleAttempts = true;
}
- var num = app["attempts"].length;
+
for (var j in app["attempts"]) {
var attempt = app["attempts"][j];
attempt["startTime"] = formatTimeMillis(attempt["startTimeEpoch"]);
@@ -140,7 +140,8 @@ $(document).ready(function() {
(attempt.hasOwnProperty("attemptId") ? attempt["attemptId"] + "/" : "") + "logs";
attempt["durationMillisec"] = attempt["duration"];
attempt["duration"] = formatDuration(attempt["duration"]);
- var app_clone = {"id" : id, "name" : name, "version": version, "num" : num, "attempts" : [attempt]};
+ var hasAttemptId = attempt.hasOwnProperty("attemptId");
+ var app_clone = {"id" : id, "name" : name, "version": version, "hasAttemptId" : hasAttemptId, "attempts" : [attempt]};
array.push(app_clone);
}
}