From eaf26ba0b305d1ac6f9df49bb5b03b11433e9eea Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 8 Apr 2021 00:05:35 +0200 Subject: [PATCH] Add preliminary support for grouping columns by lang Closes https://github.com/kaitai-io/kaitai_struct/issues/823 --- src/App.vue | 89 +++++++++++++++++++++++++++++++++++++-- src/components/CiCell.vue | 17 +++++--- 2 files changed, 95 insertions(+), 11 deletions(-) diff --git a/src/App.vue b/src/App.vue index 7a25869..b77bfd6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,17 +15,22 @@ Only failures + + :skip-passed="skipPassed" + :group-by-lang="groupByLang"> @@ -64,6 +69,7 @@ export default { gridData: [], gridMeta: {}, skipPassed: false, + groupByLang: true, }; }, created: function () { @@ -104,6 +110,81 @@ export default { ]; pairs.forEach(pair => this.addOneJson(pair[0], pair[1], pairs)); }, + computed: { + groupedGridColumns: function () { + if (!this.groupByLang) { + return this.gridColumns; + } + return Array.from( + new Set( + this.gridColumns.map(pair => pair.split('/')[0]) + ) + ); + }, + groupedGridData: function () { + if (!this.groupByLang) { + return this.gridData; + } + return this.gridData.map(testRow => { + const newTestRow = {}; + Object.entries(testRow).forEach(([key, value]) => { + if (key === 'name') { + newTestRow[key] = value; + return; + } + const lang = key.split('/')[0]; + if (!Object.prototype.hasOwnProperty.call(newTestRow, lang)) { + newTestRow[lang] = { + status: value.status, + is_kst: value.is_kst, + }; + return; + } + const langData = newTestRow[lang]; + if (langData.status !== 'mixed' && value.status !== langData.status) { + langData.status = 'mixed'; + } + if (value.is_kst !== langData.is_kst) { + langData.is_kst = false; + } + }); + return newTestRow; + }); + }, + groupedGridMeta: function () { + if (!this.groupByLang) { + return this.gridMeta; + } + const newGridMeta = {}; + Object.entries(this.gridMeta).forEach(([pair, meta]) => { + const lang = pair.split('/')[0]; + if (!Object.prototype.hasOwnProperty.call(newGridMeta, lang)) { + newGridMeta[lang] = { + lang: meta.lang, + timestamp: meta.timestamp, + ci: {}, + kst: 0, + passed: 0, + }; + return; + } + const langMeta = newGridMeta[lang]; + if (meta.timestamp > langMeta.timestamp) { + langMeta.timestamp = meta.timestamp; + } + }); + this.groupedGridData.forEach(testRow => { + Object.entries(testRow).forEach(([key, value]) => { + if (key === 'name' || !Object.prototype.hasOwnProperty.call(newGridMeta, key)) return; + if (value.status === 'passed') + newGridMeta[key].passed++; + if (value.is_kst) + newGridMeta[key].kst++; + }); + }); + return newGridMeta; + }, + }, methods: { addOneJson: function (lang, version, allPairs) { var pair = lang + "/" + version; diff --git a/src/components/CiCell.vue b/src/components/CiCell.vue index 2405bc0..5b116f4 100644 --- a/src/components/CiCell.vue +++ b/src/components/CiCell.vue @@ -2,13 +2,16 @@ {{ data.status || "unknown" }}
-
- Message: -
{{ data.failure.message }}
-
-
- Stack trace: -
{{ data.failure.trace }}
+
+

{{ data.status }}

+ +