[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/19640 --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user ajbozarth commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r151253170 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -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); +} + +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 { --- End diff -- 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. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r151213417 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -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); +} + +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 { --- End diff -- cc @srowen does Spark have a guarantee about which version of which browser to support? --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r151197868 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -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); +} + +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 { --- End diff -- Some old browser doesn't support this function. so I surround with try catch. Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari -- | -- | -- | -- | -- | -- | -- Basic support | 24 | 12 | 29 | 11 | 15 | 10 computed timeZone | 35 | 14 | 53 | No | 30 | 10 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/resolvedOptions --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r151186737 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -46,3 +46,29 @@ 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); +} + +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 { +return Intl.DateTimeFormat().resolvedOptions().timeZone; + } catch(ex) { +return new Date().toString().match(/\((.*)\)/)[1]; --- End diff -- if you really want to keep this code, please add comment to explain this regex. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r151099589 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -46,3 +46,25 @@ 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); +} + +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() { + return new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]; --- End diff -- did you have proxy on your chrome? It works fine at my Chrome. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r151034910 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -46,3 +46,25 @@ 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); +} + +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() { + return new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]; --- End diff -- This timeZone seems incorrect. Safari gets `Asia/Shanghai`, but Chrome gets `America/Chicago` on the same computer. How about just include this change to release notes. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r151033625 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -46,3 +46,25 @@ 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); --- End diff -- [TagNameQuery("a") ](https://github.com/apache/spark/blob/4a78965c22f11fbda7c9ba843ee266048bf6d319/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala#L349) gets result from [WebBrowser](https://github.com/apache/spark/blob/4a78965c22f11fbda7c9ba843ee266048bf6d319/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala#L43), This browser doesn't support this function. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150869830 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -46,3 +46,25 @@ 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); --- End diff -- what does the test use? --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150869426 --- Diff: core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala --- @@ -56,6 +56,10 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("") } { +Client local time zone: --- End diff -- any more feedback on the naming? --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150868951 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -46,3 +46,25 @@ 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); +} + +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() { + return new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]; --- End diff -- how about `Intl.DateTimeFormat().resolvedOptions().timeZone` --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150863877 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -46,3 +46,25 @@ 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); --- End diff -- `padStart` with poor compatibility: Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari -- | -- | -- | -- | -- | -- | -- Basic support | 57 | 15 | 48 | No | 44 | 10 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 --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150849659 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -46,3 +46,25 @@ 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); --- End diff -- do you know why? --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150842538 --- Diff: core/src/main/resources/org/apache/spark/ui/static/historypage.js --- @@ -37,11 +37,6 @@ function makeIdNumeric(id) { return resl; } -function formatDate(date) { --- End diff -- Move to utils.js --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150842384 --- Diff: core/src/main/resources/org/apache/spark/ui/static/utils.js --- @@ -46,3 +46,25 @@ 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); --- End diff -- `num.toString().padStart(2, "0")` cause [org.apache.spark.deploy.history.HistoryServerSuite](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83813/testReport/) test failed. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150841579 --- Diff: core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala --- @@ -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, --- End diff -- Fix a typo --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150561867 --- Diff: core/src/main/resources/org/apache/spark/ui/static/historypage.js --- @@ -38,8 +38,17 @@ function makeIdNumeric(id) { } function formatDate(date) { - if (date <= 0) return "-"; - else return date.split(".")[0].replace("T", " "); + if (date <= 0) { +return "-"; + } else { +var dt = new Date(date); +return dt.getFullYear() + "-" + + ("0" + (dt.getMonth() + 1)).slice(-2) + "-" + --- End diff -- yea much better, `.toString().padStart(2, "0")` can be a method. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150538938 --- Diff: core/src/main/resources/org/apache/spark/ui/static/historypage.js --- @@ -38,8 +38,17 @@ function makeIdNumeric(id) { } function formatDate(date) { - if (date <= 0) return "-"; - else return date.split(".")[0].replace("T", " "); + if (date <= 0) { +return "-"; + } else { +var dt = new Date(date); +return dt.getFullYear() + "-" + + ("0" + (dt.getMonth() + 1)).slice(-2) + "-" + --- End diff -- How about this: ```javascript function formatDate(date) { if (date <= 0) { return "-"; } else { var dt = new Date(date); return dt.getFullYear() + "-" + (dt.getMonth() + 1).toString().padStart(2, "0") + "-" + (dt.getDate()).toString().padStart(2, "0") + " " + (dt.getHours()).toString().padStart(2, "0") + ":" + (dt.getMinutes()).toString().padStart(2, "0") + ":" + (dt.getSeconds()).toString().padStart(2, "0"); } } ``` --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150493195 --- Diff: core/src/main/resources/org/apache/spark/ui/static/historypage.js --- @@ -38,8 +38,17 @@ function makeIdNumeric(id) { } function formatDate(date) { - if (date <= 0) return "-"; - else return date.split(".")[0].replace("T", " "); + if (date <= 0) { +return "-"; + } else { +var dt = new Date(date); +return dt.getFullYear() + "-" + + ("0" + (dt.getMonth() + 1)).slice(-2) + "-" + --- End diff -- this looks a bit hacky, is there any way in js to print a number to 2 letters? --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150430610 --- Diff: core/src/main/resources/org/apache/spark/ui/static/historypage.js --- @@ -38,8 +38,17 @@ function makeIdNumeric(id) { } function formatDate(date) { - if (date <= 0) return "-"; - else return date.split(".")[0].replace("T", " "); + if (date <= 0) { +return "-"; + } else { +var dt = new Date(date); +return dt.getFullYear() + "-" + --- End diff -- Native Javascript does not support. https://www.w3schools.com/js/js_date_formats.asp --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150430605 --- Diff: core/src/main/resources/org/apache/spark/ui/static/historypage.js --- @@ -38,8 +38,17 @@ function makeIdNumeric(id) { } function formatDate(date) { - if (date <= 0) return "-"; - else return date.split(".")[0].replace("T", " "); + if (date <= 0) { +return "-"; --- End diff -- Yes, invalid value. Maybe we can remove this. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r15042 --- Diff: core/src/main/resources/org/apache/spark/ui/static/historypage.js --- @@ -38,8 +38,17 @@ function makeIdNumeric(id) { } function formatDate(date) { - if (date <= 0) return "-"; - else return date.split(".")[0].replace("T", " "); + if (date <= 0) { +return "-"; + } else { +var dt = new Date(date); +return dt.getFullYear() + "-" + --- End diff -- not familiar with js, does js have something like java `SimpleDateFormat`? --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19640: [SPARK-16986][WEB-UI] Converter Started, Complete...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19640#discussion_r150428853 --- Diff: core/src/main/resources/org/apache/spark/ui/static/historypage.js --- @@ -38,8 +38,17 @@ function makeIdNumeric(id) { } function formatDate(date) { - if (date <= 0) return "-"; - else return date.split(".")[0].replace("T", " "); + if (date <= 0) { +return "-"; --- End diff -- just for curious, what does a single `-` mean here? invalid value? --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org