From 48e5e11259bdf6bcf54accca528f4f1626247a0f Mon Sep 17 00:00:00 2001 From: tomtian Date: Wed, 4 Dec 2024 16:04:56 +0800 Subject: [PATCH] feat: opt statis html,issue: #327 --- .../dashboard/static/stats/js/index.js | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/backend/booster/bk_dist/dashboard/static/stats/js/index.js b/src/backend/booster/bk_dist/dashboard/static/stats/js/index.js index f36846ca..83980c0b 100644 --- a/src/backend/booster/bk_dist/dashboard/static/stats/js/index.js +++ b/src/backend/booster/bk_dist/dashboard/static/stats/js/index.js @@ -1177,11 +1177,22 @@ function initConcurrencyChart(target) { } let localPostData = calculate_concurrency(localPostList) + // 用最后的结束时间,模拟未执行完的任务的结束时间 + let max_leave_time = 0 + for (let i = 0; i < vue.jobs_data.length; i++) { + if (vue.jobs_data[i].leave_time > max_leave_time) { + max_leave_time = vue.jobs_data[i].leave_time + } + } let localTotalList = [] for (let i = 0; i < vue.jobs_data.length; i++) { - localTotalList.push([vue.jobs_data[i].enter_time, vue.jobs_data[i].leave_time]) + if (vue.jobs_data[i].leave_time > 0 ) { + localTotalList.push([vue.jobs_data[i].enter_time, vue.jobs_data[i].leave_time]) + } else { + localTotalList.push([vue.jobs_data[i].enter_time, max_leave_time]) + } } - let localTotalData = calculate_concurrency(localTotalList) + let localTotalData = calculate_concurrency_instant(localTotalList) let categories = [] let delta = (vue.work_data.end_time - vue.work_data.start_time) / line_scale @@ -1307,9 +1318,20 @@ function initConcurrencyChartInstant(target) { } let localPostData = calculate_concurrency_instant(localPostList) + // 用最后的结束时间,模拟未执行完的任务的结束时间 + let max_leave_time = 0 + for (let i = 0; i < vue.jobs_data.length; i++) { + if (vue.jobs_data[i].leave_time > max_leave_time) { + max_leave_time = vue.jobs_data[i].leave_time + } + } let localTotalList = [] for (let i = 0; i < vue.jobs_data.length; i++) { - localTotalList.push([vue.jobs_data[i].enter_time, vue.jobs_data[i].leave_time]) + if (vue.jobs_data[i].leave_time > 0 ) { + localTotalList.push([vue.jobs_data[i].enter_time, vue.jobs_data[i].leave_time]) + } else { + localTotalList.push([vue.jobs_data[i].enter_time, max_leave_time]) + } } let localTotalData = calculate_concurrency_instant(localTotalList) @@ -1387,6 +1409,7 @@ function initConcurrencyChartInstant(target) { }); } +/* function initConcurrencyChartInstant(target) { let lockList = [] for (let i = 0; i < vue.jobs_data.length; i++) { @@ -1430,9 +1453,20 @@ function initConcurrencyChartInstant(target) { } let localPostData = calculate_concurrency_instant(localPostList) + // 用最后的结束时间,模拟未执行完的任务的结束时间 + let max_leave_time = 0 + for (let i = 0; i < vue.jobs_data.length; i++) { + if (vue.jobs_data[i].leave_time > max_leave_time) { + max_leave_time = vue.jobs_data[i].leave_time + } + } let localTotalList = [] for (let i = 0; i < vue.jobs_data.length; i++) { - localTotalList.push([vue.jobs_data[i].enter_time, vue.jobs_data[i].leave_time]) + if (vue.jobs_data[i].leave_time > 0 ) { + localTotalList.push([vue.jobs_data[i].enter_time, vue.jobs_data[i].leave_time]) + } else { + localTotalList.push([vue.jobs_data[i].enter_time, max_leave_time]) + } } let localTotalData = calculate_concurrency_instant(localTotalList) @@ -1509,6 +1543,7 @@ function initConcurrencyChartInstant(target) { } }); } +*/ function initSumChart(target) { let processList = []