diff --git a/frontend/src/features/crawl-workflows/workflow-editor.ts b/frontend/src/features/crawl-workflows/workflow-editor.ts
index c0cba778c6..6ac6f4bcda 100644
--- a/frontend/src/features/crawl-workflows/workflow-editor.ts
+++ b/frontend/src/features/crawl-workflows/workflow-editor.ts
@@ -1,3 +1,4 @@
+import { consume } from "@lit/context";
import { localized, msg, str } from "@lit/localize";
import type {
SlChangeEvent,
@@ -43,6 +44,7 @@ import type { SelectCrawlerProxyChangeEvent } from "@/components/ui/select-crawl
import type { Tab } from "@/components/ui/tab-list";
import type { TagInputEvent, TagsChangeEvent } from "@/components/ui/tag-input";
import type { TimeInputChangeEvent } from "@/components/ui/time-input";
+import { proxiesContext, type ProxiesContext } from "@/context/org";
import { type SelectBrowserProfileChangeEvent } from "@/features/browser-profiles/select-browser-profile";
import type { CollectionsChangeEvent } from "@/features/collections/collections-add";
import type { QueueExclusionTable } from "@/features/crawl-workflows/queue-exclusion-table";
@@ -188,6 +190,9 @@ type CrawlConfigResponse = {
@localized()
@customElement("btrix-workflow-editor")
export class WorkflowEditor extends BtrixElement {
+ @consume({ context: proxiesContext, subscribe: true })
+ private readonly proxies?: ProxiesContext;
+
@property({ type: String })
configId?: string;
@@ -1329,17 +1334,24 @@ https://archiveweb.page/images/${"logo.svg"}`}
>
`)}
${this.renderHelpTextCol(infoTextStrings["browserProfile"])}
- ${inputCol(html`
-
- this.updateFormState({
- proxyId: e.detail.value,
- })}
- >
- `)}
- ${this.renderHelpTextCol(infoTextStrings["proxyId"])}
+ ${this.proxies?.servers.length
+ ? [
+ inputCol(html`
+
+ this.updateFormState({
+ proxyId: e.detail.value,
+ })}
+ >
+ `),
+ this.renderHelpTextCol(infoTextStrings["proxyId"]),
+ ]
+ : nothing}
${inputCol(html`
{
+ return this.api.fetch(
+ `/orgs/${orgId}/crawlconfigs/crawler-proxies`,
+ );
+ }
+
private async onOrgRemoveMember(e: OrgRemoveMemberEvent) {
void this.removeMember(e.detail.member);
}
@@ -682,9 +705,15 @@ export class Org extends BtrixElement {
icon: "check2-circle",
id: "user-updated-status",
});
+
const org = await this.getOrg(this.orgId);
- AppStateService.updateOrg(org);
+ if (org) {
+ AppStateService.partialUpdateOrg({
+ id: org.id,
+ users: org.users,
+ });
+ }
} catch (e) {
console.debug(e);
@@ -742,7 +771,12 @@ export class Org extends BtrixElement {
} else {
const org = await this.getOrg(this.orgId);
- AppStateService.updateOrg(org);
+ if (org) {
+ AppStateService.partialUpdateOrg({
+ id: org.id,
+ users: org.users,
+ });
+ }
}
} catch (e) {
console.debug(e);
diff --git a/frontend/src/pages/org/settings/components/crawling-defaults.ts b/frontend/src/pages/org/settings/components/crawling-defaults.ts
index c79f8ef08c..bf4d5ef3e1 100644
--- a/frontend/src/pages/org/settings/components/crawling-defaults.ts
+++ b/frontend/src/pages/org/settings/components/crawling-defaults.ts
@@ -1,3 +1,4 @@
+import { consume } from "@lit/context";
import { localized, msg } from "@lit/localize";
import type { SlButton } from "@shoelace-style/shoelace";
import { serialize } from "@shoelace-style/shoelace/dist/utilities/form.js";
@@ -9,6 +10,8 @@ import { ifDefined } from "lit/directives/if-defined.js";
import { BtrixElement } from "@/classes/BtrixElement";
import type { LanguageSelect } from "@/components/ui/language-select";
+import type { SelectCrawlerProxy } from "@/components/ui/select-crawler-proxy";
+import { proxiesContext, type ProxiesContext } from "@/context/org";
import type { QueueExclusionTable } from "@/features/crawl-workflows/queue-exclusion-table";
import { columns, type Cols } from "@/layouts/columns";
import infoTextStrings from "@/strings/crawl-workflows/infoText";
@@ -25,7 +28,7 @@ import {
} from "@/utils/workflow";
type FieldName = keyof FormState;
-type Field = Record>;
+type Field = Record | undefined>;
const PLACEHOLDER_EXCLUSIONS = [""]; // Add empty slot
@@ -51,6 +54,9 @@ export class OrgSettingsCrawlWorkflows extends BtrixElement {
}
`;
+ @consume({ context: proxiesContext, subscribe: true })
+ private readonly proxies?: ProxiesContext;
+
@state()
private defaults: WorkflowDefaults = appDefaults;
@@ -60,6 +66,9 @@ export class OrgSettingsCrawlWorkflows extends BtrixElement {
@query("btrix-language-select")
languageSelect?: LanguageSelect | null;
+ @query("btrix-select-crawler-proxy")
+ proxySelect?: SelectCrawlerProxy | null;
+
@query('sl-button[type="submit"]')
submitButton?: SlButton | null;
@@ -195,10 +204,16 @@ export class OrgSettingsCrawlWorkflows extends BtrixElement {
size="small"
>
`,
- proxyId: html` `,
+ proxyId: this.proxies?.servers.length
+ ? html` `
+ : undefined,
crawlerChannel: html`
section(
sectionName as SectionsEnum,
- Object.entries(fields).map(([fieldName, field]) => [
- field,
- infoTextStrings[fieldName as FieldName],
- ]),
+ Object.entries(fields)
+ .filter(([, field]) => field as unknown)
+ .map(([fieldName, field]) => [
+ field,
+ infoTextStrings[fieldName as FieldName],
+ ]),
),
),
)}
@@ -291,7 +308,7 @@ export class OrgSettingsCrawlWorkflows extends BtrixElement {
blockAds: values.blockAds === "on",
profileid: values.profileid,
crawlerChannel: values.crawlerChannel,
- proxyId: values.proxyId,
+ proxyId: this.proxySelect?.value || undefined,
userAgent: values.userAgent,
lang: this.languageSelect?.value || undefined,
exclude: this.exclusionTable?.exclusions?.filter((v) => v) || [],
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index 6328f5cb86..a92b29318c 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -1161,6 +1161,13 @@
resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.0.tgz#353ce4a76c83fadec272ea5674ede767650762fd"
integrity sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==
+"@lit/context@^1.1.3":
+ version "1.1.3"
+ resolved "https://registry.yarnpkg.com/@lit/context/-/context-1.1.3.tgz#66f8832e57f760f51f39c9d658ca6bd78f809e19"
+ integrity sha512-Auh37F4S0PZM93HTDfZWs97mmzaQ7M3vnTc9YvxAGyP3UItSK/8Fs0vTOGT+njuvOwbKio/l8Cx/zWL4vkutpQ==
+ dependencies:
+ "@lit/reactive-element" "^1.6.2 || ^2.0.0"
+
"@lit/localize-tools@^0.8.0":
version "0.8.0"
resolved "https://registry.yarnpkg.com/@lit/localize-tools/-/localize-tools-0.8.0.tgz#8a14b3961aa63ef801c9f63274cb1d58821a3552"
@@ -1197,7 +1204,7 @@
dependencies:
"@lit-labs/ssr-dom-shim" "^1.0.0"
-"@lit/reactive-element@^1.0.0 || ^2.0.0":
+"@lit/reactive-element@^1.0.0 || ^2.0.0", "@lit/reactive-element@^1.6.2 || ^2.0.0":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-2.0.4.tgz#8f2ed950a848016383894a26180ff06c56ae001b"
integrity sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==