This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new e5565b21a [Bug] Fix the wrong duration (#1577)
e5565b21a is described below
commit e5565b21a205fbe2c59c3565450e9e56b280aaea
Author: 1996fanrui <[email protected]>
AuthorDate: Mon Sep 12 14:09:42 2022 +0800
[Bug] Fix the wrong duration (#1577)
---
.../streampark-console-webapp/src/utils/filter.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/streampark-console/streampark-console-webapp/src/utils/filter.js
b/streampark-console/streampark-console-webapp/src/utils/filter.js
index 04999e5b0..fa86e13b0 100644
--- a/streampark-console/streampark-console-webapp/src/utils/filter.js
+++ b/streampark-console/streampark-console-webapp/src/utils/filter.js
@@ -37,7 +37,7 @@ Vue.filter('moment', function (dataStr, pattern = 'YYYY-MM-DD
HH:mm:ss') {
})
Vue.filter('duration', function duration (ms) {
- if (ms === 0 || ms === undefined || ms === null) {
+ if (ms === '0' || ms === undefined || ms === null) {
return ''
}
const ss = 1000
@@ -45,10 +45,10 @@ Vue.filter('duration', function duration (ms) {
const hh = mi * 60
const dd = hh * 24
- const day = parseInt(ms / dd)
- const hour = parseInt((ms - day * dd) / hh)
- const minute = parseInt((ms - day * dd - hour * hh) / mi)
- const seconds = parseInt((ms - day * dd - hour * hh - minute * mi) / ss)
+ const day = parseFloat(ms / dd).toFixed(0)
+ const hour = parseFloat((ms - day * dd) / hh).toFixed(0)
+ const minute = parseFloat((ms - day * dd - hour * hh) / mi).toFixed(0)
+ const seconds = parseFloat((ms - day * dd - hour * hh - minute * mi) /
ss).toFixed(0)
if (day > 0) {
return day + 'd ' + hour + 'h ' + minute + 'm ' + seconds + 's'
} else if (hour > 0) {