提交 cfd66df6 编写于 作者: P pissang

test(visual): better time formatting

上级 ccfa1ad9
...@@ -269,7 +269,7 @@ iframe { ...@@ -269,7 +269,7 @@ iframe {
#tests-runs-dialog .el-dialog { #tests-runs-dialog .el-dialog {
width: 90%; width: 90%;
max-width: 1400px; max-width: 1200px;
} }
......
...@@ -290,7 +290,7 @@ under the License. ...@@ -290,7 +290,7 @@ under the License.
<el-table-column property="expectedVersion" label="Expected" width="160"></el-table-column> <el-table-column property="expectedVersion" label="Expected" width="160"></el-table-column>
<el-table-column property="actualVersion" label="Actual" width="160"></el-table-column> <el-table-column property="actualVersion" label="Actual" width="160"></el-table-column>
<el-table-column property="renderer" label="Renderer" width="100"></el-table-column> <el-table-column property="renderer" label="Renderer" width="100"></el-table-column>
<el-table-column property="lastRunTime" label="Last Run"></el-table-column> <el-table-column property="lastRunTime" label="Last Run" width="160"></el-table-column>
<el-table-column property="diskSize" label="Disk Size" width="100"></el-table-column> <el-table-column property="diskSize" label="Disk Size" width="100"></el-table-column>
<el-table-column property="total" label="Total Tests" width="100"></el-table-column> <el-table-column property="total" label="Total Tests" width="100"></el-table-column>
<el-table-column property="finished" label="Finished" width="100"></el-table-column> <el-table-column property="finished" label="Finished" width="100"></el-table-column>
......
...@@ -234,6 +234,14 @@ async function getFolderSize(dir) { ...@@ -234,6 +234,14 @@ async function getFolderSize(dir) {
module.exports.getAllTestsRuns = async function () { module.exports.getAllTestsRuns = async function () {
const dirs = await globby('*', { cwd: RESULTS_ROOT_DIR, onlyDirectories: true }); const dirs = await globby('*', { cwd: RESULTS_ROOT_DIR, onlyDirectories: true });
const results = []; const results = [];
function f(number) {
return number < 10 ? '0' + number : number;
}
function formatDate(lastRunTime) {
const date = new Date(lastRunTime);
return `${date.getFullYear()}-${f(date.getMonth() + 1)}-${f(date.getDate())} ${f(date.getHours())}:${f(date.getMinutes())}:${f(date.getSeconds())}`;
}
for (let dir of dirs) { for (let dir of dirs) {
const params = parseRunHash(dir); const params = parseRunHash(dir);
const resultJson = JSON.parse(fs.readFileSync(path.join( const resultJson = JSON.parse(fs.readFileSync(path.join(
...@@ -265,7 +273,7 @@ module.exports.getAllTestsRuns = async function () { ...@@ -265,7 +273,7 @@ module.exports.getAllTestsRuns = async function () {
} }
}); });
params.lastRunTime = lastRunTime > 0 ? new Date(lastRunTime).toISOString() : 'N/A'; params.lastRunTime = lastRunTime > 0 ? formatDate(lastRunTime) : 'N/A';
params.total = total; params.total = total;
params.passed = passedCount; params.passed = passedCount;
params.finished = finishedCount; params.finished = finishedCount;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册