minor frontend-tweaks: (#196)
* frontend-tweaks: - treat 'starting' state same as 'running' - default to no schedule instead of weekly for default - add 'Domain' scopeType * backend: also allow 'domain' as a scopeType
This commit is contained in:
parent
8863776c54
commit
9e45dc35d2
@ -27,6 +27,7 @@ class ScopeType(str, Enum):
|
||||
PAGE_SPA = "page-spa"
|
||||
PREFIX = "prefix"
|
||||
HOST = "host"
|
||||
DOMAIN = "domain"
|
||||
ANY = "any"
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ export class CrawlDetail extends LiteElement {
|
||||
private get isRunning(): boolean | null {
|
||||
if (!this.crawl) return null;
|
||||
|
||||
return this.crawl.state === "running";
|
||||
return this.crawl.state === "running" || this.crawl.state === "starting";
|
||||
}
|
||||
|
||||
async firstUpdated() {
|
||||
@ -87,7 +87,7 @@ export class CrawlDetail extends LiteElement {
|
||||
switch (this.sectionName) {
|
||||
case "watch": {
|
||||
if (this.crawl) {
|
||||
if (this.crawl.state === "running") {
|
||||
if (this.isRunning) {
|
||||
sectionContent = this.renderWatch();
|
||||
} else {
|
||||
sectionContent = this.renderReplay();
|
||||
@ -408,8 +408,7 @@ export class CrawlDetail extends LiteElement {
|
||||
</header>
|
||||
|
||||
${this.crawl
|
||||
? html`
|
||||
<div id="screencast-crawl">
|
||||
? html` <div id="screencast-crawl">
|
||||
<btrix-screencast
|
||||
authToken=${authToken}
|
||||
archiveId=${this.archiveId!}
|
||||
@ -422,7 +421,7 @@ export class CrawlDetail extends LiteElement {
|
||||
}
|
||||
|
||||
private renderReplay() {
|
||||
const isRunning = this.crawl?.state === "running";
|
||||
const isRunning = this.isRunning;
|
||||
|
||||
const bearer = this.authState?.headers?.Authorization?.split(" ", 2)[1];
|
||||
|
||||
@ -652,7 +651,7 @@ export class CrawlDetail extends LiteElement {
|
||||
try {
|
||||
this.crawl = await this.getCrawl();
|
||||
|
||||
if (this.crawl.state === "running") {
|
||||
if (this.isRunning) {
|
||||
// Start timer for next poll
|
||||
this.timerId = window.setTimeout(() => {
|
||||
this.fetchCrawl();
|
||||
|
@ -963,6 +963,7 @@ export class CrawlTemplatesDetail extends LiteElement {
|
||||
<sl-menu-item value="page-spa">Page SPA</sl-menu-item>
|
||||
<sl-menu-item value="prefix">Prefix</sl-menu-item>
|
||||
<sl-menu-item value="host">Host</sl-menu-item>
|
||||
<sl-menu-item value="domain">Domain</sl-menu-item>
|
||||
<sl-menu-item value="any">Any</sl-menu-item>
|
||||
</sl-select>
|
||||
<sl-checkbox
|
||||
|
@ -61,7 +61,7 @@ export class CrawlTemplatesNew extends LiteElement {
|
||||
private isRunNow: boolean = initialValues.runNow;
|
||||
|
||||
@state()
|
||||
private scheduleInterval: "" | "daily" | "weekly" | "monthly" = "weekly";
|
||||
private scheduleInterval: "" | "daily" | "weekly" | "monthly" = "";
|
||||
|
||||
/** Schedule local time */
|
||||
@state()
|
||||
@ -408,6 +408,7 @@ export class CrawlTemplatesNew extends LiteElement {
|
||||
<sl-menu-item value="page-spa">Page SPA</sl-menu-item>
|
||||
<sl-menu-item value="prefix">Prefix</sl-menu-item>
|
||||
<sl-menu-item value="host">Host</sl-menu-item>
|
||||
<sl-menu-item value="domain">Domain</sl-menu-item>
|
||||
<sl-menu-item value="any">Any</sl-menu-item>
|
||||
</sl-select>
|
||||
|
||||
|
@ -31,7 +31,7 @@ const sortableFieldLabels = {
|
||||
};
|
||||
|
||||
function isRunning(crawl: Crawl) {
|
||||
return crawl.state === "running";
|
||||
return crawl.state === "running" || crawl.state === "starting";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -284,7 +284,7 @@ export class CrawlsList extends LiteElement {
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
class="whitespace-nowrap mb-1 capitalize${crawl.state === "running"
|
||||
class="whitespace-nowrap mb-1 capitalize${isRunning(crawl)
|
||||
? " motion-safe:animate-pulse"
|
||||
: ""}"
|
||||
>
|
||||
|
@ -1,4 +1,5 @@
|
||||
type CrawlState =
|
||||
| "starting"
|
||||
| "running"
|
||||
| "complete"
|
||||
| "failed"
|
||||
|
Loading…
Reference in New Issue
Block a user