From f0921feb7095454be7477913d790e87ac6ac6717 Mon Sep 17 00:00:00 2001 From: sua yoo Date: Wed, 17 Apr 2024 19:43:34 -0700 Subject: [PATCH] Display QA resources as table (#1692) - Renders QA resource data as a basic table - Updates screenshot and resource tab icons --- .../org/archived-item-qa/archived-item-qa.ts | 4 +- .../org/archived-item-qa/ui/resources.ts | 156 +++++++++--------- 2 files changed, 84 insertions(+), 76 deletions(-) diff --git a/frontend/src/pages/org/archived-item-qa/archived-item-qa.ts b/frontend/src/pages/org/archived-item-qa/archived-item-qa.ts index fd6037c3..4da83915 100644 --- a/frontend/src/pages/org/archived-item-qa/archived-item-qa.ts +++ b/frontend/src/pages/org/archived-item-qa/archived-item-qa.ts @@ -426,7 +426,7 @@ export class ArchivedItemQA extends TailwindElement { ?active=${this.tab === "screenshots"} @click=${this.onTabNavClick} > - + ${msg("Screenshots")} ${when(this.page?.qa || currentPage?.qa, (qa) => renderSeverityBadge(qa.screenshotMatch), @@ -450,7 +450,7 @@ export class ArchivedItemQA extends TailwindElement { ?active=${this.tab === "resources"} @click=${this.onTabNavClick} > - + ${msg("Resources")} { - const diff = diffJson(crawlResources, qaResources); - - const addedText = tw`bg-red-100 text-red-700`; - const removedText = tw`bg-red-100 text-red-100`; - - return html` -
${msg("All Resources")}`, + html`${crawlResources[TOTAL].good.toLocaleString()}`, + html`${crawlResources[TOTAL].bad.toLocaleString()}`, + html` + ${qaResources[TOTAL].good.toLocaleString()} + `, + html` + ${qaResources[TOTAL].bad.toLocaleString()} + `, + ], + ...Object.keys(crawlResources) + .filter((key) => key !== TOTAL) + .map((key) => [ + html`${key}`, + html`${crawlResources[key].good.toLocaleString()}`, + html`${crawlResources[key].bad.toLocaleString()}`, + html` - ${diff.map((part) => { - return html` - ${part.value} - `; - })} -
-
`, + html` - ${diff.map((part) => { - return html` - ${part.value} - `; - })} -
- `; - }), - ); + ${qaResources[key].bad.toLocaleString()} + `, + ]), + ]; + + return html` + + `; } export function renderResources(crawlData: ReplayData, qaData: ReplayData) { const noData = html`
${msg("Resources data not available")} @@ -73,33 +86,28 @@ export function renderResources(crawlData: ReplayData, qaData: ReplayData) { return html`
-
-

- ${msg("Resources loaded during crawl")} -

-

- ${msg("Resources loaded in replay")} -

-
-
- ${guard([crawlData, qaData], () => - when( - crawlData && qaData, - () => html` -
- ${crawlData?.resources && qaData?.resources - ? renderDiff(crawlData.resources, qaData.resources) - : noData} -
- `, - renderSpinner, - ), - )} +
+ ${crawlData && qaData + ? crawlData.resources && qaData.resources + ? renderDiff(crawlData.resources, qaData.resources) + : noData + : renderSpinner()}
+
`; }