Continue to watch crawl while stopping (#316)

* show when running

* redirect after done

* show banner that crawl is stopping
This commit is contained in:
sua yoo 2022-09-21 12:39:00 -07:00 committed by GitHub
parent 6b63b72a13
commit 2ebd1eb2f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,7 +98,10 @@ export class CrawlDetail extends LiteElement {
const prevCrawl = changedProperties.get("crawl");
if (prevCrawl && this.crawl) {
if (prevCrawl.state === "running" && this.crawl.state !== "running") {
if (
(prevCrawl.state === "running" || prevCrawl.state === "stopping") &&
!this.isActive
) {
this.crawlDone();
}
}
@ -478,6 +481,7 @@ export class CrawlDetail extends LiteElement {
const isStarting = this.crawl.state === "starting";
const isRunning = this.crawl.state === "running";
const isStopping = this.crawl.state === "stopping";
const authToken = this.authState.headers.Authorization.split(" ")[1];
return html`
@ -500,9 +504,22 @@ export class CrawlDetail extends LiteElement {
${msg("Crawl starting...")}
</p>
</div>`
: isRunning
: this.isActive
? html`
<div id="screencast-crawl">
${isStopping
? html`
<div class="mb-4">
<btrix-alert type="warning" class="text-sm">
${msg("Crawl stopping...")}
</btrix-alert>
</div>
`
: ""}
<div
id="screencast-crawl"
class="${isStopping ? "opacity-40" : ""} transition-opacity"
>
<btrix-screencast
authToken=${authToken}
archiveId=${this.crawl.aid}