diff --git a/component/DevkitDistribute/devkit_distribute/config/perf_report.html b/component/DevkitDistribute/devkit_distribute/config/perf_report.html index e530a71340e5457e909e03867ba1a70d7eeab06b..de4f036eed1e78749a3ec09a8fa08fc179bbac8d 100644 --- a/component/DevkitDistribute/devkit_distribute/config/perf_report.html +++ b/component/DevkitDistribute/devkit_distribute/config/perf_report.html @@ -46,15 +46,16 @@ }, } - - - - - - - - + + + + + + @@ -117,7 +118,7 @@ return `

DevKit Performance Test Info

-
+
`; }; @@ -125,15 +126,15 @@ return `

DevKit Performance Summary - +

-
-
-
-
+
- +
+
+
+
`; }; @@ -141,7 +142,7 @@ return `

Today's Git Log

-
+
`; }; @@ -151,7 +152,7 @@
- +
`; @@ -161,63 +162,71 @@ const colsCount = pipelineData[target]?.[`${target}_tb_cols`]; const originDataRef = pipelineData[target]?.[`${target}_tb_data`]; if (colsCount > 0 && originDataRef.length % colsCount === 0) { - const columns = []; - for (let i = 0; i < colsCount; ++i) { - columns.push({title: dataCopy.shift()}); - } - const dataSet = []; - for (let i = 0; i < originDataRef.length / colsCount - 1; ++i) { - const row = []; - for (let j = 0; j < colsCount; ++j) { - row.push(dataCopy.shift()); - } - dataSet.push(row); - } - dataSet.forEach(r => { - let div1 = document.createElement('div'); - div1.innerHTML = r[1]; - r[1] = div1; - let div3 = document.createElement('div'); - div3.innerHTML = r[3]; - r[3] = div3; - }); - new DataTable('#example', { + const columns = Array.from({length: colsCount}).map((_, i) => {name: dataCopy.shift()}); + const dataSet = Array.from({length: originDataRef.length / colsCount - 1}).map((_, i) => dataCopy.slice(i * colsCount, (i+1) * colsCount)); + let curPage = 1; + $('div#tb-wrapper').Grid({ columns, data: dataSet, - searching: true, - lengthChange: false, - info: false, - paging: true, + style: { + td: { + 'white-space': 'nowrap', + 'text-overflow': 'ellipsis', + 'overflow': 'hidden', + } + }, + pagination: true, + search: true, + resizable: true, }); if (collect) { const labels = pipelineData[target]?.[`${target}_chart_labels`]; - const chartData = {}; + const xAxisData = new Map(); + const yAxisData = new Map(); for (const label of labels) { const idx = originDataRef.indexOf(label); const singleCol = []; for (let i = idx + colsCount; i < originDataRef.length; i += colsCount) { singleCol.push(Number(originDataRef[i])); } - chartData[label] = singleCol; + if (idx === 0) { + xAxisData.set(label, singleCol); + } else { + yAxisData.set(label, singleCol); + } } - return chartData; + return [xAxisData, yAxisData]; } } } + + const makeChart = (containerId, xAxisMap, yAxisMap, title = '') => { + const ect = echarts.init(document.getElementById(containerId)); + let xAxisName = undefined; + let xAxisData = xAxisMap; + if (!Array.isArray(xAxisMap)) { + xAxisName = xAxisMap.keys().next().value; + xAxisData = xAxisMap.values().next().value; + } + const option = { + title: {text: title}, + tooltip: {trigger: 'axis'}, + legend: {data: Array.from(yAxisMap.keys())}, + xAxis: {data: xAxisData, name: xAxisName}, + yAxis: {type: 'value'}, + series: Array.from(yAxisMap.keys()).map((key) => ({ + name: key, + type: 'line', + data: yAxisMap.get(key) + })) + }; + ect.setOption(option); + } const reportScript = (target) => { consumeTableData(target); } const trendScript = (target) => { - const chartData = consumeTableData(target, true); - const canvasContainer = document.getElementById('chart-container'); - const canvas = document.getElementById('cvs'); - canvasContainer.removeChild(canvas); - const newCanvas = document.createElement('canvas'); - newCanvas.id = 'cvs'; - canvasContainer.appendChild(newCanvas); - newCanvas.width = newCanvas.clientWidth * devicePixelRatio; - newCanvas.height = newCanvas.clientHeight * devicePixelRatio; - processData(chartData, pipelineData[target]?.[`${target}_chart_labels`][0]); + makeChart('echarts-wrapper', ...consumeTableData(target, true)); }; const gitScript = (target) => { @@ -239,15 +248,7 @@ for (const path of pathArray) { ptr = ptr[path]; } - const canvasContainer = document.getElementById('chart-container'); - const canvas = document.getElementById('cvs'); - canvasContainer.removeChild(canvas); - const newCanvas = document.createElement('canvas'); - newCanvas.id = 'cvs'; - canvasContainer.appendChild(newCanvas); - newCanvas.width = newCanvas.clientWidth * devicePixelRatio; - newCanvas.height = newCanvas.clientHeight * devicePixelRatio; - processData(ptr); + makeChart('echarts-wrapper', Array.from({length: ptr[Object.keys(ptr)[0]].length}).map((_,i) => i), new Map(Object.entries(ptr)), pathArray[pathArray.length-1]); } } });