crawl status related fixes: (#2662)
- only set state to 'paused' if shoudPause is true and crawl is still running (using FAILED_STATES list) - treat failed/canceled crawl as inactive, don't show replay (using RUNNING_STATES list) --------- Co-authored-by: sua yoo <sua@webrecorder.org>
This commit is contained in:
parent
0e0e663363
commit
3fa0c68922
@ -131,6 +131,7 @@ export class CrawlListItem extends BtrixElement {
|
||||
(crawl: Crawl) => html`
|
||||
<btrix-crawl-status
|
||||
state=${crawl.state}
|
||||
?stopping=${crawl.stopping}
|
||||
?shouldPause=${crawl.shouldPause}
|
||||
hideLabel
|
||||
hoist
|
||||
|
@ -5,7 +5,7 @@ import { customElement, property } from "lit/decorators.js";
|
||||
import startCase from "lodash/fp/startCase";
|
||||
|
||||
import { TailwindElement } from "@/classes/TailwindElement";
|
||||
import type { CrawlState } from "@/types/crawlState";
|
||||
import { RUNNING_STATES, type CrawlState } from "@/types/crawlState";
|
||||
import { animatePulse } from "@/utils/css";
|
||||
|
||||
type CrawlType = "crawl" | "upload" | "qa";
|
||||
@ -325,7 +325,10 @@ export class CrawlStatus extends TailwindElement {
|
||||
if (this.stopping && this.state === "running") {
|
||||
return "stopping";
|
||||
}
|
||||
if (this.shouldPause && this.state !== "paused") {
|
||||
if (
|
||||
this.shouldPause &&
|
||||
(RUNNING_STATES as readonly string[]).includes(this.state || "")
|
||||
) {
|
||||
return "pausing";
|
||||
}
|
||||
if (!this.shouldPause && this.state === "paused") {
|
||||
|
@ -28,7 +28,7 @@ import { pageNav, type Breadcrumb } from "@/layouts/pageHeader";
|
||||
import { WorkflowTab } from "@/routes";
|
||||
import { deleteConfirmation, noData, notApplicable } from "@/strings/ui";
|
||||
import type { APIPaginatedList, APIPaginationQuery } from "@/types/api";
|
||||
import { type CrawlState } from "@/types/crawlState";
|
||||
import { FAILED_STATES, type CrawlState } from "@/types/crawlState";
|
||||
import { isApiError } from "@/utils/api";
|
||||
import {
|
||||
DEFAULT_MAX_SCALE,
|
||||
@ -317,6 +317,13 @@ export class WorkflowDetail extends BtrixElement {
|
||||
return this.workflow?.isCrawlRunning && !this.isPaused;
|
||||
}
|
||||
|
||||
// Workflow is for a crawl that has failed or canceled
|
||||
private get isUnsuccessfullyFinished() {
|
||||
return (FAILED_STATES as readonly string[]).includes(
|
||||
this.workflow?.lastCrawlState || "",
|
||||
);
|
||||
}
|
||||
|
||||
// Crawl is explicitly running
|
||||
private get isCrawling() {
|
||||
return (
|
||||
@ -1395,7 +1402,7 @@ export class WorkflowDetail extends BtrixElement {
|
||||
};
|
||||
|
||||
private readonly renderLatestCrawl = () => {
|
||||
if (!this.lastCrawlId) {
|
||||
if (!this.lastCrawlId || this.isUnsuccessfullyFinished) {
|
||||
return this.renderInactiveCrawlMessage();
|
||||
}
|
||||
|
||||
@ -1832,7 +1839,7 @@ export class WorkflowDetail extends BtrixElement {
|
||||
if (this.workflow.lastCrawlState === "canceled") {
|
||||
message = msg("This crawl can’t be replayed since it was canceled.");
|
||||
} else {
|
||||
message = msg("Replay is not enabled on this crawl.");
|
||||
message = msg("Replay is not available for this crawl.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user