Disable editing crawl config of running crawls (#620)
This commit is contained in:
parent
567e851235
commit
e8b835df34
@ -112,18 +112,27 @@ export class CrawlTemplatesDetail extends LiteElement {
|
||||
${when(
|
||||
this.crawlConfig && !this.crawlConfig.inactive,
|
||||
() => html`
|
||||
<sl-button
|
||||
href=${`/orgs/${this.orgId}/crawl-configs/config/${
|
||||
this.crawlConfig!.id
|
||||
}?edit`}
|
||||
variant="primary"
|
||||
size="small"
|
||||
class="mr-2"
|
||||
@click=${this.navLink}
|
||||
<sl-tooltip
|
||||
content=${msg(
|
||||
"Crawl config cannot be edited while crawl is running."
|
||||
)}
|
||||
?disabled=${!this.crawlConfig!.currCrawlId}
|
||||
>
|
||||
<sl-icon slot="prefix" name="gear"></sl-icon>
|
||||
${msg("Edit Crawl Config")}
|
||||
</sl-button>
|
||||
<sl-button
|
||||
href=${`/orgs/${this.orgId}/crawl-configs/config/${
|
||||
this.crawlConfig!.id
|
||||
}?edit`}
|
||||
variant="primary"
|
||||
size="small"
|
||||
class="mr-2"
|
||||
@click=${this.navLink}
|
||||
?disabled=${this.crawlConfig!.currCrawlId}
|
||||
>
|
||||
<sl-icon slot="prefix" name="gear"></sl-icon>
|
||||
${msg("Edit Crawl Config")}
|
||||
</sl-button>
|
||||
</sl-tooltip>
|
||||
|
||||
${this.renderMenu()}
|
||||
`,
|
||||
() =>
|
||||
@ -143,16 +152,16 @@ export class CrawlTemplatesDetail extends LiteElement {
|
||||
</div>
|
||||
</header>
|
||||
|
||||
${this.renderCurrentlyRunningNotice()}
|
||||
|
||||
<section class="col-span-1 border rounded-lg py-2">
|
||||
${this.renderDetails()}
|
||||
</section>
|
||||
|
||||
${this.renderLastCrawl()} ${this.renderCurrentlyRunningNotice()}
|
||||
${this.renderLastCrawl()}
|
||||
|
||||
<div class="col-span-1">
|
||||
<h3 class="text-lg font-semibold mb-2">
|
||||
${msg("Crawl Settings")}
|
||||
</h3>
|
||||
<h3 class="text-lg font-semibold mb-2">${msg("Crawl Settings")}</h3>
|
||||
<main class="border rounded-lg py-3 px-5">
|
||||
<btrix-config-details
|
||||
.crawlConfig=${this.crawlConfig}
|
||||
@ -237,7 +246,7 @@ export class CrawlTemplatesDetail extends LiteElement {
|
||||
`,
|
||||
];
|
||||
|
||||
if (!this.crawlConfig.inactive) {
|
||||
if (!this.crawlConfig.inactive && !this.crawlConfig.currCrawlId) {
|
||||
menuItems.unshift(html`
|
||||
<li
|
||||
class="p-2 hover:bg-purple-50 cursor-pointer text-purple-600"
|
||||
@ -257,7 +266,11 @@ export class CrawlTemplatesDetail extends LiteElement {
|
||||
`);
|
||||
}
|
||||
|
||||
if (this.crawlConfig.crawlCount && !this.crawlConfig.inactive) {
|
||||
if (
|
||||
this.crawlConfig.crawlCount &&
|
||||
!this.crawlConfig.inactive &&
|
||||
!this.crawlConfig.currCrawlId
|
||||
) {
|
||||
menuItems.push(html`
|
||||
<li
|
||||
class="p-2 text-danger hover:bg-danger hover:text-white cursor-pointer"
|
||||
@ -279,7 +292,7 @@ export class CrawlTemplatesDetail extends LiteElement {
|
||||
`);
|
||||
}
|
||||
|
||||
if (!this.crawlConfig.crawlCount) {
|
||||
if (!this.crawlConfig.crawlCount && !this.crawlConfig.currCrawlId) {
|
||||
menuItems.push(html`
|
||||
<li
|
||||
class="p-2 text-danger hover:bg-danger hover:text-white cursor-pointer"
|
||||
@ -299,7 +312,9 @@ export class CrawlTemplatesDetail extends LiteElement {
|
||||
|
||||
return html`
|
||||
<sl-dropdown placement="bottom-end" distance="4">
|
||||
<sl-button slot="trigger" size="small" caret>${msg("Actions")}</sl-button>
|
||||
<sl-button slot="trigger" size="small" caret
|
||||
>${msg("Actions")}</sl-button
|
||||
>
|
||||
|
||||
<ul
|
||||
class="text-left text-sm text-neutral-800 bg-white whitespace-nowrap"
|
||||
|
||||
@ -448,7 +448,7 @@ export class CrawlTemplatesList extends LiteElement {
|
||||
`,
|
||||
];
|
||||
|
||||
if (!t.inactive) {
|
||||
if (!t.inactive && !this.runningCrawlsMap[t.id]) {
|
||||
menuItems.unshift(html`
|
||||
<li
|
||||
class="p-2 hover:bg-zinc-100 cursor-pointer"
|
||||
|
||||
@ -212,12 +212,22 @@ export class CrawlDetail extends LiteElement {
|
||||
html`
|
||||
<div class="flex items-center justify-between">
|
||||
${msg("Metadata")}
|
||||
<sl-icon-button
|
||||
class="text-base"
|
||||
name="pencil"
|
||||
@click=${this.openMetadataEditor}
|
||||
aria-label=${msg("Edit Metadata")}
|
||||
></sl-icon-button>
|
||||
<sl-tooltip
|
||||
content=${msg(
|
||||
"Metadata cannot be edited while crawl is running."
|
||||
)}
|
||||
?disabled=${!this.isActive}
|
||||
>
|
||||
<sl-icon-button
|
||||
class=${`text-base${
|
||||
this.isActive ? " cursor-not-allowed" : ""
|
||||
}`}
|
||||
name="pencil"
|
||||
@click=${this.openMetadataEditor}
|
||||
aria-label=${msg("Edit Metadata")}
|
||||
?disabled=${this.isActive}
|
||||
></sl-icon-button>
|
||||
</sl-tooltip>
|
||||
</div>
|
||||
`,
|
||||
this.renderMetadata()
|
||||
@ -429,38 +439,43 @@ export class CrawlDetail extends LiteElement {
|
||||
${msg("Re-run crawl")}
|
||||
</span>
|
||||
</li>
|
||||
<li
|
||||
class="p-2 hover:bg-zinc-100 cursor-pointer"
|
||||
role="menuitem"
|
||||
@click=${(e: any) => {
|
||||
this.openMetadataEditor();
|
||||
e.target.closest("sl-dropdown").hide();
|
||||
}}
|
||||
>
|
||||
<sl-icon
|
||||
class="inline-block align-middle mr-1"
|
||||
name="pencil"
|
||||
></sl-icon>
|
||||
<span class="inline-block align-middle">
|
||||
${msg("Edit Metadata")}
|
||||
</span>
|
||||
</li>
|
||||
`
|
||||
)}
|
||||
${when(
|
||||
!this.isActive,
|
||||
() => html`
|
||||
<hr />
|
||||
<li
|
||||
class="p-2 hover:bg-zinc-100 cursor-pointer"
|
||||
role="menuitem"
|
||||
@click=${() => {
|
||||
this.navTo(
|
||||
`/orgs/${this.crawl?.oid}/crawl-configs/config/${this.crawlTemplateId}?edit`
|
||||
);
|
||||
}}
|
||||
>
|
||||
<span class="inline-block align-middle">
|
||||
${msg("Edit Crawl Config")}
|
||||
</span>
|
||||
</li>
|
||||
`
|
||||
)}
|
||||
<li
|
||||
class="p-2 hover:bg-zinc-100 cursor-pointer"
|
||||
role="menuitem"
|
||||
@click=${(e: any) => {
|
||||
this.openMetadataEditor();
|
||||
e.target.closest("sl-dropdown").hide();
|
||||
}}
|
||||
>
|
||||
<sl-icon
|
||||
class="inline-block align-middle mr-1"
|
||||
name="pencil"
|
||||
></sl-icon>
|
||||
<span class="inline-block align-middle">
|
||||
${msg("Edit Metadata")}
|
||||
</span>
|
||||
</li>
|
||||
<hr />
|
||||
<li
|
||||
class="p-2 hover:bg-zinc-100 cursor-pointer"
|
||||
role="menuitem"
|
||||
@click=${() => {
|
||||
this.navTo(
|
||||
`/orgs/${this.crawl?.oid}/crawl-configs/config/${this.crawlTemplateId}?edit`
|
||||
);
|
||||
}}
|
||||
>
|
||||
<span class="inline-block align-middle">
|
||||
${msg("Edit Crawl Config")}
|
||||
</span>
|
||||
</li>
|
||||
`
|
||||
)}
|
||||
<li
|
||||
|
||||
Loading…
Reference in New Issue
Block a user