Fix QA run deletion (#1721)
Fixes unable to delete QA run from the QA tab "Analysis Runs" list.
This commit is contained in:
parent
1844e761dc
commit
db6091b09c
@ -272,6 +272,7 @@ export class ArchivedItemDetail extends TailwindElement {
|
|||||||
.qaRuns=${this.qaRuns}
|
.qaRuns=${this.qaRuns}
|
||||||
.qaRunId=${this.qaRunId}
|
.qaRunId=${this.qaRunId}
|
||||||
.mostRecentNonFailedQARun=${this.mostRecentNonFailedQARun}
|
.mostRecentNonFailedQARun=${this.mostRecentNonFailedQARun}
|
||||||
|
@btrix-qa-runs-update=${() => void this.fetchQARuns()}
|
||||||
></btrix-archived-item-detail-qa>
|
></btrix-archived-item-detail-qa>
|
||||||
`,
|
`,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -105,6 +105,9 @@ function statusWithIcon(
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fires btrix-qa-runs-update
|
||||||
|
*/
|
||||||
@localized()
|
@localized()
|
||||||
@customElement("btrix-archived-item-detail-qa")
|
@customElement("btrix-archived-item-detail-qa")
|
||||||
export class ArchivedItemDetailQA extends TailwindElement {
|
export class ArchivedItemDetailQA extends TailwindElement {
|
||||||
@ -376,6 +379,16 @@ export class ArchivedItemDetailQA extends TailwindElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly renderQARunRows = (qaRuns: QARun[]) => {
|
private readonly renderQARunRows = (qaRuns: QARun[]) => {
|
||||||
|
if (!qaRuns.length) {
|
||||||
|
return html`
|
||||||
|
<div
|
||||||
|
class="col-span-4 flex h-full flex-col items-center justify-center gap-2 p-3 text-xs text-neutral-500"
|
||||||
|
>
|
||||||
|
<sl-icon name="slash-circle"></sl-icon>
|
||||||
|
${msg("No analysis runs found")}
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
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" : ""}>
|
||||||
@ -511,6 +524,7 @@ export class ArchivedItemDetailQA extends TailwindElement {
|
|||||||
variant="danger"
|
variant="danger"
|
||||||
@click=${async () => {
|
@click=${async () => {
|
||||||
await this.deleteQARun(runToBeDeleted.id);
|
await this.deleteQARun(runToBeDeleted.id);
|
||||||
|
this.dispatchEvent(new CustomEvent("btrix-qa-runs-update"));
|
||||||
this.deleting = null;
|
this.deleting = null;
|
||||||
void this.deleteQADialog?.hide();
|
void this.deleteQADialog?.hide();
|
||||||
}}
|
}}
|
||||||
@ -768,7 +782,7 @@ export class ArchivedItemDetailQA extends TailwindElement {
|
|||||||
async deleteQARun(id: string) {
|
async deleteQARun(id: string) {
|
||||||
try {
|
try {
|
||||||
await this.api.fetch(
|
await this.api.fetch(
|
||||||
`/orgs/${this.orgId}/crawls/${this.crawlId}`,
|
`/orgs/${this.orgId}/crawls/${this.crawlId}/qa/delete`,
|
||||||
this.authState!,
|
this.authState!,
|
||||||
{ method: "POST", body: JSON.stringify({ qa_run_ids: [id] }) },
|
{ method: "POST", body: JSON.stringify({ qa_run_ids: [id] }) },
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user