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`
|
(crawl: Crawl) => html`
|
||||||
<btrix-crawl-status
|
<btrix-crawl-status
|
||||||
state=${crawl.state}
|
state=${crawl.state}
|
||||||
|
?stopping=${crawl.stopping}
|
||||||
?shouldPause=${crawl.shouldPause}
|
?shouldPause=${crawl.shouldPause}
|
||||||
hideLabel
|
hideLabel
|
||||||
hoist
|
hoist
|
||||||
|
@ -5,7 +5,7 @@ import { customElement, property } from "lit/decorators.js";
|
|||||||
import startCase from "lodash/fp/startCase";
|
import startCase from "lodash/fp/startCase";
|
||||||
|
|
||||||
import { TailwindElement } from "@/classes/TailwindElement";
|
import { TailwindElement } from "@/classes/TailwindElement";
|
||||||
import type { CrawlState } from "@/types/crawlState";
|
import { RUNNING_STATES, type CrawlState } from "@/types/crawlState";
|
||||||
import { animatePulse } from "@/utils/css";
|
import { animatePulse } from "@/utils/css";
|
||||||
|
|
||||||
type CrawlType = "crawl" | "upload" | "qa";
|
type CrawlType = "crawl" | "upload" | "qa";
|
||||||
@ -325,7 +325,10 @@ export class CrawlStatus extends TailwindElement {
|
|||||||
if (this.stopping && this.state === "running") {
|
if (this.stopping && this.state === "running") {
|
||||||
return "stopping";
|
return "stopping";
|
||||||
}
|
}
|
||||||
if (this.shouldPause && this.state !== "paused") {
|
if (
|
||||||
|
this.shouldPause &&
|
||||||
|
(RUNNING_STATES as readonly string[]).includes(this.state || "")
|
||||||
|
) {
|
||||||
return "pausing";
|
return "pausing";
|
||||||
}
|
}
|
||||||
if (!this.shouldPause && this.state === "paused") {
|
if (!this.shouldPause && this.state === "paused") {
|
||||||
|
@ -28,7 +28,7 @@ import { pageNav, type Breadcrumb } from "@/layouts/pageHeader";
|
|||||||
import { WorkflowTab } from "@/routes";
|
import { WorkflowTab } from "@/routes";
|
||||||
import { deleteConfirmation, noData, notApplicable } from "@/strings/ui";
|
import { deleteConfirmation, noData, notApplicable } from "@/strings/ui";
|
||||||
import type { APIPaginatedList, APIPaginationQuery } from "@/types/api";
|
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 { isApiError } from "@/utils/api";
|
||||||
import {
|
import {
|
||||||
DEFAULT_MAX_SCALE,
|
DEFAULT_MAX_SCALE,
|
||||||
@ -317,6 +317,13 @@ export class WorkflowDetail extends BtrixElement {
|
|||||||
return this.workflow?.isCrawlRunning && !this.isPaused;
|
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
|
// Crawl is explicitly running
|
||||||
private get isCrawling() {
|
private get isCrawling() {
|
||||||
return (
|
return (
|
||||||
@ -1395,7 +1402,7 @@ export class WorkflowDetail extends BtrixElement {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private readonly renderLatestCrawl = () => {
|
private readonly renderLatestCrawl = () => {
|
||||||
if (!this.lastCrawlId) {
|
if (!this.lastCrawlId || this.isUnsuccessfullyFinished) {
|
||||||
return this.renderInactiveCrawlMessage();
|
return this.renderInactiveCrawlMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1832,7 +1839,7 @@ export class WorkflowDetail extends BtrixElement {
|
|||||||
if (this.workflow.lastCrawlState === "canceled") {
|
if (this.workflow.lastCrawlState === "canceled") {
|
||||||
message = msg("This crawl can’t be replayed since it was canceled.");
|
message = msg("This crawl can’t be replayed since it was canceled.");
|
||||||
} else {
|
} 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