From 8214c0ce4c46ee50776e3ca84e35e8751575e502 Mon Sep 17 00:00:00 2001 From: Stanislav Popov Date: Wed, 26 Aug 2020 07:07:10 +0500 Subject: [PATCH] fix: yes/no in table stats for boolean fields --- README.md | 3 +++ components/Stats.vue | 9 +++++++-- pages/index.vue | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 26d9f36..0563f9a 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,6 @@ Demo: - [Default report](https://viasite.github.io/site-audit-seo-viewer/?url=https://site-audit.viasite.ru/reports/blog.popstas.ru-default.json) - [Lighthouse report](https://viasite.github.io/site-audit-seo-viewer/?url=https://site-audit.viasite.ru/reports/blog.popstas.ru-lighthouse.json) - [Default + Basic Lighthouse report](https://viasite.github.io/site-audit-seo-viewer/?url=https://site-audit.viasite.ru/reports/blog.popstas.ru-default-plus-lighthouse.json) + +# TODO +- show diff between reports diff --git a/components/Stats.vue b/components/Stats.vue index 92748da..a4aeabf 100644 --- a/components/Stats.vue +++ b/components/Stats.vue @@ -159,10 +159,15 @@ export default { for (let valName in vals) { const count = vals[valName]; let valClass = this.getColumnValidateClass(valName, field.validate); - if (valClass == 'danger') validateClass = valClass; - else if (valClass == 'warning' && validateClass != 'danger') validateClass = valClass; + if (valClass === 'danger') validateClass = valClass; + else if (valClass === 'warning' && validateClass !== 'danger') validateClass = valClass; else if (!validateClass) validateClass = valClass; + // TODO: universal renderItemValue, getColumnValue + if (field.type === 'boolean') { + valName = parseInt(valName) ? 'yes' : 'no'; // tolang + } + subvalues.push({ validateClass: valClass, value: valName, diff --git a/pages/index.vue b/pages/index.vue index 5d16b69..3ee7b80 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -533,7 +533,7 @@ export default { valueText = `error loading image`; } - if (field.type == "boolean") { + if (field.type === 'boolean') { valueText = parseInt(valueText) ? "yes" : "no"; // tolang }