exclusions editor fix: (#692)

- backend: fix updating model after exclusions change
- frontend: don't check for new_cid, just success
- fixes #691
This commit is contained in:
Ilya Kreymer 2023-03-10 22:36:10 -08:00 committed by GitHub
parent 7528f2ec6d
commit de9212eec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 11 deletions

View File

@ -619,7 +619,7 @@ class CrawlOps:
) )
await self.crawls.find_one_and_update( await self.crawls.find_one_and_update(
{"_id": crawl_id, "oid": org.id}, {"$set": {"config": new_config}} {"_id": crawl_id, "oid": org.id}, {"$set": {"config": new_config.dict()}}
) )
resp = {"success": True} resp = {"success": True}

View File

@ -157,7 +157,7 @@ export class ExclusionEditor extends LiteElement {
} }
); );
if (data.new_cid) { if (data.success) {
this.notify({ this.notify({
message: msg(html`Removed exclusion: <code>${regex}</code>`), message: msg(html`Removed exclusion: <code>${regex}</code>`),
variant: "success", variant: "success",
@ -165,9 +165,7 @@ export class ExclusionEditor extends LiteElement {
}); });
this.dispatchEvent( this.dispatchEvent(
new CustomEvent("on-success", { new CustomEvent("on-success")
detail: { cid: data.new_cid },
})
); );
} else { } else {
throw data; throw data;
@ -229,7 +227,7 @@ export class ExclusionEditor extends LiteElement {
} }
); );
if (data.new_cid) { if (data.success) {
this.notify({ this.notify({
message: msg("Exclusion added."), message: msg("Exclusion added."),
variant: "success", variant: "success",
@ -242,9 +240,7 @@ export class ExclusionEditor extends LiteElement {
onSuccess(); onSuccess();
this.dispatchEvent( this.dispatchEvent(
new CustomEvent("on-success", { new CustomEvent("on-success")
detail: { cid: data.new_cid },
})
); );
} else { } else {
throw data; throw data;

View File

@ -22,7 +22,7 @@ const defaultValue = {
}, },
tags: [], tags: [],
crawlTimeout: null, crawlTimeout: null,
jobType: "custom", jobType: undefined,
scale: 1, scale: 1,
} as WorkflowParams; } as WorkflowParams;

View File

@ -31,7 +31,7 @@ export type SeedConfig = Pick<
export type JobType = "url-list" | "seed-crawl" | "custom"; export type JobType = "url-list" | "seed-crawl" | "custom";
export type WorkflowParams = { export type WorkflowParams = {
jobType: JobType; jobType?: JobType;
name: string; name: string;
schedule: string; schedule: string;
scale: number; scale: number;