-
Notifications
You must be signed in to change notification settings - Fork 28k
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-16986][WEB-UI] Converter Started, Completed and Last Updated to client time zone in history page #19640
Changes from all commits
17bddef
c7339c8
f36023a
5291d16
d9994ea
7b04e08
9a40da0
cb1db11
4a78965
40ec67e
08f5e68
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 | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -46,3 +46,31 @@ function formatBytes(bytes, type) { | ||||||||||||||||||||||
var i = Math.floor(Math.log(bytes) / Math.log(k)); | |||||||||||||||||||||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; | |||||||||||||||||||||||
} | |||||||||||||||||||||||
|
|||||||||||||||||||||||
function padZeroes(num) { | |||||||||||||||||||||||
return ("0" + num).slice(-2); | |||||||||||||||||||||||
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.
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. do you know why? 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.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice 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. what does the test use? 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. TagNameQuery("a") gets result from WebBrowser, This browser doesn't support this function. |
|||||||||||||||||||||||
} | |||||||||||||||||||||||
|
|||||||||||||||||||||||
function formatTimeMillis(timeMillis) { | |||||||||||||||||||||||
if (timeMillis <= 0) { | |||||||||||||||||||||||
return "-"; | |||||||||||||||||||||||
} else { | |||||||||||||||||||||||
var dt = new Date(timeMillis); | |||||||||||||||||||||||
return dt.getFullYear() + "-" + | |||||||||||||||||||||||
padZeroes(dt.getMonth() + 1) + "-" + | |||||||||||||||||||||||
padZeroes(dt.getDate()) + " " + | |||||||||||||||||||||||
padZeroes(dt.getHours()) + ":" + | |||||||||||||||||||||||
padZeroes(dt.getMinutes()) + ":" + | |||||||||||||||||||||||
padZeroes(dt.getSeconds()); | |||||||||||||||||||||||
} | |||||||||||||||||||||||
} | |||||||||||||||||||||||
|
|||||||||||||||||||||||
function getTimeZone() { | |||||||||||||||||||||||
try { | |||||||||||||||||||||||
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. Some old browser doesn't support this function. so I surround with try catch.
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. cc @srowen does Spark have a guarantee about which version of which browser to support? 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. Spark does not have a list of supported browsers, from my experience most of us just test new UI changes on whatever browsers we have (In my case the latest Safari, Chrome and Firefox ESR). Though I'd like to think we don't have any IE users, we can't make that assumption while IE 11 is still supported by MS. |
|||||||||||||||||||||||
return Intl.DateTimeFormat().resolvedOptions().timeZone; | |||||||||||||||||||||||
} catch(ex) { | |||||||||||||||||||||||
// Get time zone from a string representing the date, | |||||||||||||||||||||||
// eg. "Thu Nov 16 2017 01:13:32 GMT+0800 (CST)" -> "CST" | |||||||||||||||||||||||
return new Date().toString().match(/\((.*)\)/)[1]; | |||||||||||||||||||||||
} | |||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,10 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("") | |
} | ||
} | ||
|
||
{ | ||
<p>Client local time zone: <span id="time-zone"></span></p> | ||
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. any more feedback on the naming? |
||
} | ||
|
||
{ | ||
if (allAppsSize > 0) { | ||
<script src={UIUtils.prependBaseUri("/static/dataTables.rowsGroup.js")}></script> ++ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,7 +352,7 @@ class HistoryServerSuite extends SparkFunSuite with BeforeAndAfter with Matchers | |
.map(_.get) | ||
.filter(_.startsWith(url)).toList | ||
|
||
// there are atleast some URL links that were generated via javascript, | ||
// there are at least some URL links that were generated via javascript, | ||
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 a typo |
||
// and they all contain the spark.ui.proxyBase (uiRoot) | ||
links.length should be > 4 | ||
all(links) should startWith(url + uiRoot) | ||
|
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.
Move to utils.js