Skip to content

Commit 9044b27

Browse files
committed
ungroup proxy setting
1 parent f703cb4 commit 9044b27

File tree

3 files changed

+60
-67
lines changed

3 files changed

+60
-67
lines changed

frontend/src/components/ui/select-crawler-proxy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export class SelectCrawlerProxy extends BtrixElement {
137137
</div>
138138
`
139139
: ``}
140+
<slot name="help-text" slot="help-text"></slot>
140141
</sl-select>
141142
`;
142143
}

frontend/src/features/browser-profiles/new-browser-profile-dialog.ts

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,28 @@ export class NewBrowserProfileDialog extends BtrixElement {
116116
>
117117
</btrix-url-input>
118118
119+
${showProxies
120+
? html`
121+
<div class="mt-4">
122+
<btrix-select-crawler-proxy
123+
defaultProxyId=${ifDefined(
124+
this.defaultProxyId || undefined,
125+
)}
126+
.proxyServers=${proxyServers}
127+
.proxyId="${this.proxyId || ""}"
128+
@btrix-change=${(e: SelectCrawlerProxyChangeEvent) =>
129+
(this.proxyId = e.detail.value)}
130+
>
131+
<div slot="help-text">
132+
${msg(
133+
"When a proxy is selected, websites will see traffic as coming from the IP address of the proxy rather than where the Browsertrix Crawler node is deployed.",
134+
)}
135+
</div>
136+
</btrix-select-crawler-proxy>
137+
</div>
138+
`
139+
: nothing}
140+
119141
<sl-input
120142
class="mt-4"
121143
label=${msg("Profile Name")}
@@ -127,39 +149,18 @@ export class NewBrowserProfileDialog extends BtrixElement {
127149
>
128150
</sl-input>
129151
130-
${when(
131-
showChannels || showProxies,
132-
() => html`
133-
<btrix-details class="mt-4" open>
152+
${showChannels
153+
? html`<btrix-details class="mt-4">
134154
<span slot="title">${msg("Crawler Settings")}</span>
135-
136-
${showChannels
137-
? html`<div class="mt-4">
138-
<btrix-select-crawler
139-
.crawlerChannel=${this.crawlerChannel}
140-
@on-change=${(e: SelectCrawlerChangeEvent) =>
141-
(this.crawlerChannel = e.detail.value!)}
142-
></btrix-select-crawler>
143-
</div>`
144-
: nothing}
145-
${showProxies
146-
? html`
147-
<div class="mt-4">
148-
<btrix-select-crawler-proxy
149-
defaultProxyId=${ifDefined(
150-
this.defaultProxyId || undefined,
151-
)}
152-
.proxyServers=${proxyServers}
153-
.proxyId="${this.proxyId || ""}"
154-
@btrix-change=${(e: SelectCrawlerProxyChangeEvent) =>
155-
(this.proxyId = e.detail.value)}
156-
></btrix-select-crawler-proxy>
157-
</div>
158-
`
159-
: nothing}
160-
</btrix-details>
161-
`,
162-
)}
155+
<div class="mt-4">
156+
<p>${msg("These settings will be applied")}</p>
157+
<btrix-select-crawler
158+
.crawlerChannel=${this.crawlerChannel}
159+
@on-change=${(e: SelectCrawlerChangeEvent) =>
160+
(this.crawlerChannel = e.detail.value!)}
161+
></btrix-select-crawler></div
162+
></btrix-details>`
163+
: nothing}
163164
164165
<input class="invisible block size-0" type="submit" />
165166
</form>

frontend/src/features/browser-profiles/start-browser-dialog.ts

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -223,48 +223,39 @@ export class StartBrowserDialog extends BtrixElement {
223223
name="exclamation-triangle"
224224
></sl-icon>
225225
${msg(
226-
"Data and browsing activity of all previously saved sites will be removed upon saving this browser profile session.",
226+
"Data, proxy settings, and browsing activity of all previously saved sites will be removed upon saving this browser profile session.",
227227
)}
228228
</div>
229229
`,
230230
)}
231231
</sl-checkbox>
232232
233-
${when(
234-
this.open && (showChannels || showProxies),
235-
() => html`
236-
<btrix-details
237-
class="mt-4"
238-
?open=${this.details?.open || this.replaceBrowser}
239-
>
233+
${showProxies
234+
? html`<div class="mt-4">
235+
<btrix-select-crawler-proxy
236+
defaultProxyId=${ifDefined(
237+
this.org?.crawlingDefaults?.profileid ||
238+
proxies.default_proxy_id ||
239+
undefined,
240+
)}
241+
.proxyServers=${proxyServers}
242+
.proxyId=${profile.proxyId || ""}
243+
>
244+
</btrix-select-crawler-proxy>
245+
</div>`
246+
: nothing}
247+
${this.open && showChannels
248+
? html`<btrix-details class="mt-4" ?open=${this.details?.open}>
240249
<span slot="title">${msg("Crawler Settings")}</span>
241-
242-
${showChannels
243-
? html`<div class="mt-4">
244-
<btrix-select-crawler
245-
.crawlerChannel=${profile.crawlerChannel ||
246-
this.org?.crawlingDefaults?.crawlerChannel}
247-
>
248-
</btrix-select-crawler>
249-
</div>`
250-
: nothing}
251-
${showProxies
252-
? html`<div class="mt-4">
253-
<btrix-select-crawler-proxy
254-
defaultProxyId=${ifDefined(
255-
this.org?.crawlingDefaults?.profileid ||
256-
proxies.default_proxy_id ||
257-
undefined,
258-
)}
259-
.proxyServers=${proxyServers}
260-
.proxyId=${profile.proxyId || ""}
261-
>
262-
</btrix-select-crawler-proxy>
263-
</div>`
264-
: nothing}
265-
</btrix-details>
266-
`,
267-
)}
250+
<div class="mt-4">
251+
<btrix-select-crawler
252+
.crawlerChannel=${profile.crawlerChannel ||
253+
this.org?.crawlingDefaults?.crawlerChannel}
254+
>
255+
</btrix-select-crawler>
256+
</div>
257+
</btrix-details>`
258+
: nothing}
268259
</form>
269260
<div slot="footer" class="flex justify-between">
270261
<sl-button size="small" @click=${() => void this.dialog?.hide()}

0 commit comments

Comments
 (0)