diff --git a/frontend/src/components/crawl-status.ts b/frontend/src/components/crawl-status.ts index 1029c5cb..914fad29 100644 --- a/frontend/src/components/crawl-status.ts +++ b/frontend/src/components/crawl-status.ts @@ -15,6 +15,9 @@ export class CrawlStatus extends LitElement { @property({ type: Boolean }) hideLabel = false; + @property({ type: Boolean }) + stopping = false; + static styles = [ animatePulse, css` @@ -173,7 +176,8 @@ export class CrawlStatus extends LitElement { } render() { - const { icon, label } = CrawlStatus.getContent(this.state); + const state = this.stopping && this.state === "running" ? "stopping" : this.state; + const { icon, label } = CrawlStatus.getContent(state); if (this.hideLabel) { return html`
` )} diff --git a/frontend/src/pages/org/workflow-detail.ts b/frontend/src/pages/org/workflow-detail.ts index 20120bc6..2181dc2b 100644 --- a/frontend/src/pages/org/workflow-detail.ts +++ b/frontend/src/pages/org/workflow-detail.ts @@ -398,7 +398,7 @@ export class WorkflowDetail extends LiteElement { @click=${() => this.stop()} ?disabled=${!this.workflow?.currCrawlId || this.isCancelingOrStoppingCrawl || - this.workflow?.currCrawlState === "stopping"} + this.workflow?.currCrawlStopping} > ${msg("Stop")} @@ -480,7 +480,7 @@ export class WorkflowDetail extends LiteElement { () => html` this.stop()} - ?disabled=${workflow.currCrawlState === "stopping" || + ?disabled=${workflow.currCrawlStopping || this.isCancelingOrStoppingCrawl} > @@ -586,6 +586,7 @@ export class WorkflowDetail extends LiteElement { state=${this.workflow!.currCrawlState || this.workflow!.lastCrawlState || msg("No Crawls Yet")} + ?stopping=${this.workflow?.currCrawlStopping} > ` )} @@ -796,7 +797,7 @@ export class WorkflowDetail extends LiteElement { const isStarting = this.workflow.currCrawlState === "starting"; const isWaiting = this.workflow.currCrawlState === "waiting"; const isRunning = this.workflow.currCrawlState === "running"; - const isStopping = this.workflow.currCrawlState === "stopping"; + const isStopping = this.workflow.currCrawlStopping; const authToken = this.authState.headers.Authorization.split(" ")[1]; return html` diff --git a/frontend/src/pages/org/workflows-list.ts b/frontend/src/pages/org/workflows-list.ts index 643358d3..688fd8d2 100644 --- a/frontend/src/pages/org/workflows-list.ts +++ b/frontend/src/pages/org/workflows-list.ts @@ -361,7 +361,7 @@ export class WorkflowsList extends LiteElement { () => html` this.stop(workflow.currCrawlId)} - ?disabled=${workflow.currCrawlState === "stopping"} + ?disabled=${workflow.currCrawlStopping} > ${msg("Stop Crawl")} diff --git a/frontend/src/types/crawler.ts b/frontend/src/types/crawler.ts index 3083ebe8..9024d36e 100644 --- a/frontend/src/types/crawler.ts +++ b/frontend/src/types/crawler.ts @@ -71,6 +71,7 @@ export type Workflow = CrawlConfig & { currCrawlState: CrawlState | null; currCrawlStartTime: string | null; currCrawlSize: number | null; + currCrawlStopping: boolean | null; totalSize: string | null; inactive: boolean; firstSeed: string; @@ -119,4 +120,5 @@ export type Crawl = CrawlConfig & { notes: string | null; firstSeed: string; seedCount: number; + stopping: boolean; };