Fix QA run downloads as a single WACZ (#1993)

Follow up to #1412, fix QA run downloads as a single (multi) WACZ,
containing other WACZ files from all workers.
This commit is contained in:
Ilya Kreymer 2024-08-06 09:44:17 -07:00 committed by GitHub
parent 4a2725aaa6
commit ec29928b28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,10 +1,6 @@
import { localized, msg, str } from "@lit/localize"; import { localized, msg, str } from "@lit/localize";
import { Task } from "@lit/task"; import { Task } from "@lit/task";
import type { import type { SlChangeEvent, SlSelect } from "@shoelace-style/shoelace";
SlChangeEvent,
SlSelect,
SlShowEvent,
} from "@shoelace-style/shoelace";
import { import {
css, css,
html, html,
@ -21,8 +17,6 @@ import { QA_RUNNING_STATES } from "../archived-item-detail";
import { TailwindElement } from "@/classes/TailwindElement"; import { TailwindElement } from "@/classes/TailwindElement";
import { type Dialog } from "@/components/ui/dialog"; import { type Dialog } from "@/components/ui/dialog";
import type { MenuItemLink } from "@/components/ui/menu-item-link";
import type { OverflowDropdown } from "@/components/ui/overflow-dropdown";
import type { PageChangeEvent } from "@/components/ui/pagination"; import type { PageChangeEvent } from "@/components/ui/pagination";
import { APIController } from "@/controllers/api"; import { APIController } from "@/controllers/api";
import { NavigateController } from "@/controllers/navigate"; import { NavigateController } from "@/controllers/navigate";
@ -353,6 +347,7 @@ export class ArchivedItemDetailQA extends TailwindElement {
</div> </div>
`; `;
} }
const authToken = this.authState!.headers.Authorization.split(" ")[1];
return qaRuns.map( return qaRuns.map(
(run, idx) => html` (run, idx) => html`
<btrix-table-row class=${idx > 0 ? "border-t" : ""}> <btrix-table-row class=${idx > 0 ? "border-t" : ""}>
@ -391,28 +386,15 @@ export class ArchivedItemDetailQA extends TailwindElement {
<btrix-table-cell>${run.userName}</btrix-table-cell> <btrix-table-cell>${run.userName}</btrix-table-cell>
<btrix-table-cell class="p-0"> <btrix-table-cell class="p-0">
<div class="col action"> <div class="col action">
<btrix-overflow-dropdown <btrix-overflow-dropdown>
@sl-show=${async (e: SlShowEvent) => {
const dropdown = e.currentTarget as OverflowDropdown;
const downloadLink = dropdown.querySelector<MenuItemLink>(
"btrix-menu-item-link",
);
if (!downloadLink) {
console.debug("no download link");
return;
}
downloadLink.loading = true;
downloadLink.disabled = false;
downloadLink.href = `/orgs/${this.orgId}/crawls/${this.crawlId}/qa/${run.id}/download`;
}}
>
<sl-menu> <sl-menu>
${run.state === "canceled" ${run.state === "canceled"
? nothing ? nothing
: html` : html`
<btrix-menu-item-link href="#" download> <btrix-menu-item-link
href=${`/api/orgs/${this.orgId}/crawls/${this.crawlId}/qa/${run.id}/download?auth_bearer=${authToken}`}
download
>
<sl-icon <sl-icon
name="cloud-download" name="cloud-download"
slot="prefix" slot="prefix"