Skip to content

Commit

Permalink
exclusions editor fix: (#692)
Browse files Browse the repository at this point in the history
- backend: fix updating model after exclusions change
- frontend: don't check for new_cid, just success
- fixes #691
  • Loading branch information
ikreymer authored Mar 11, 2023
1 parent 7528f2e commit de9212e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion backend/btrixcloud/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ async def add_or_remove_exclusion(self, crawl_id, regex, org, user, add):
)

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}
Expand Down
12 changes: 4 additions & 8 deletions frontend/src/components/exclusion-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,15 @@ export class ExclusionEditor extends LiteElement {
}
);

if (data.new_cid) {
if (data.success) {
this.notify({
message: msg(html`Removed exclusion: <code>${regex}</code>`),
variant: "success",
icon: "check2-circle",
});

this.dispatchEvent(
new CustomEvent("on-success", {
detail: { cid: data.new_cid },
})
new CustomEvent("on-success")
);
} else {
throw data;
Expand Down Expand Up @@ -229,7 +227,7 @@ export class ExclusionEditor extends LiteElement {
}
);

if (data.new_cid) {
if (data.success) {
this.notify({
message: msg("Exclusion added."),
variant: "success",
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/org/workflows-new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const defaultValue = {
},
tags: [],
crawlTimeout: null,
jobType: "custom",
jobType: undefined,
scale: 1,
} as WorkflowParams;

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types/crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit de9212e

Please sign in to comment.