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(
{"_id": crawl_id, "oid": org.id}, {"$set": {"config": new_config}}
{"_id": crawl_id, "oid": org.id}, {"$set": {"config": new_config.dict()}}
)
resp = {"success": True}

View File

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

View File

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

View File

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