Files
firezone/rust/gui-client/src-frontend/components/AdvancedSettingsPage.tsx
Thomas Eizinger 3e849ae852 fix(gui-client): use Wayland rendering backend on Linux (#10849)
Previously, we opted into the X11 GTK backend when rendering the GUI
Client's window. This is causing issues on newer Linux distributions
such as Fedora 43 where Wayland is now the only available compositor.

Removing the X11 GTK requires us to draw our own CSDs such as titlebars
and a close button. This PR does exactly that by adding a minimalistic
title bar. To make better use of the space, we move the section headers
into there.

|Before|After|
|---|---|
|<img width="1900" height="1174" alt="Screenshot From 2025-11-11
11-14-11"
src="https://github.com/user-attachments/assets/9439a69b-65ba-41d6-b1f8-4448e0f80728"
/>|<img width="1800" height="1000" alt="Screenshot From 2025-11-11
11-40-55"
src="https://github.com/user-attachments/assets/7884b2cc-3d9c-4b47-9a1e-c6462aef36ab"
/>|
|<img width="1900" height="1174" alt="Screenshot From 2025-11-11
11-14-16"
src="https://github.com/user-attachments/assets/2cfea825-5c08-45a5-873c-5afcbc1dbf16"
/>|<img width="1800" height="1000" alt="Screenshot From 2025-11-11
11-40-58"
src="https://github.com/user-attachments/assets/43ddd7c9-ce65-42f7-b972-28c6b172b70d"
/>|
|<img width="1900" height="1174" alt="Screenshot From 2025-11-11
11-14-19"
src="https://github.com/user-attachments/assets/446873a7-9023-4266-9377-ea7b8b4353ee"
/>|<img width="1800" height="1000" alt="Screenshot From 2025-11-11
11-41-01"
src="https://github.com/user-attachments/assets/64439383-f33f-461d-9b4a-6b4138bd675b"
/>|
|<img width="1900" height="1174" alt="Screenshot From 2025-11-11
11-14-22"
src="https://github.com/user-attachments/assets/6c39e06c-1d77-471f-91f1-32a78b90a21c"
/>|<img width="1800" height="1000" alt="Screenshot From 2025-11-11
11-41-04"
src="https://github.com/user-attachments/assets/b56912cb-9c85-4b5a-9295-dae6139b25c6"
/>|
|<img width="1900" height="1174" alt="Screenshot From 2025-11-11
11-14-26"
src="https://github.com/user-attachments/assets/5a5d638c-15bf-4523-8466-2e0977a03e22"
/>|<img width="1800" height="1000" alt="Screenshot From 2025-11-11
11-41-06"
src="https://github.com/user-attachments/assets/ed169b52-ef86-4dc4-8f25-852da622eaa1"
/>|
2025-11-11 05:51:08 +00:00

128 lines
3.5 KiB
TypeScript

import React, { useEffect, useId, useState } from "react";
import { Button, Label } from "flowbite-react";
import { ManagedTextInput } from "./ManagedInput";
import { AdvancedSettingsViewModel } from "../generated/bindings";
interface Props {
settings: AdvancedSettingsViewModel | null;
saveSettings: (settings: AdvancedSettingsViewModel) => void;
resetSettings: () => void;
}
export default function AdvancedSettingsPage({
settings,
saveSettings,
resetSettings,
}: Props) {
// Local settings can be edited without affecting the global state.
const [localSettings, setLocalSettings] = useState<AdvancedSettingsViewModel>(
settings ?? {
api_url: "",
api_url_is_managed: false,
auth_url: "",
auth_url_is_managed: false,
log_filter: "",
log_filter_is_managed: false,
}
);
useEffect(() => {
setLocalSettings(
settings ?? {
api_url: "",
api_url_is_managed: false,
auth_url: "",
auth_url_is_managed: false,
log_filter: "",
log_filter_is_managed: false,
}
);
}, [settings]);
const authBaseUrlId = useId();
const apiUrlId = useId();
const logFilterInput = useId();
return (
<div className="container p-4">
<p className="text-neutral-900 mb-6">
<strong>WARNING</strong>: These settings are intended for internal debug
purposes <strong>only</strong>. Changing these is not supported and will
disrupt access to your resources.
</p>
<form
onSubmit={(e) => {
e.preventDefault();
saveSettings(localSettings);
}}
className="max-w flex flex-col gap-2"
>
<div>
<Label className="text-neutral-600" htmlFor={authBaseUrlId}>
Auth Base URL
</Label>
<ManagedTextInput
name="auth_base_url"
id={authBaseUrlId}
managed={localSettings.auth_url_is_managed}
value={localSettings.auth_url}
onChange={(e) =>
setLocalSettings({
...localSettings,
auth_url: e.target.value,
})
}
required
/>
</div>
<div>
<Label className="text-neutral-600" htmlFor={apiUrlId}>
API URL
</Label>
<ManagedTextInput
name="api_url"
id={apiUrlId}
managed={localSettings.api_url_is_managed}
value={localSettings.api_url}
onChange={(e) =>
setLocalSettings({
...localSettings,
api_url: e.target.value,
})
}
required
/>
</div>
<div>
<Label className="text-neutral-600" htmlFor={logFilterInput}>
Log Filter
</Label>
<ManagedTextInput
name="log_filter"
id={logFilterInput}
managed={localSettings.log_filter_is_managed}
value={localSettings.log_filter}
onChange={(e) =>
setLocalSettings({
...localSettings,
log_filter: e.target.value,
})
}
required
/>
</div>
<div className="flex justify-end gap-4 mt-4">
<Button type="reset" onClick={resetSettings} color="alternative">
Reset to Defaults
</Button>
<Button type="submit">Apply</Button>
</div>
</form>
</div>
);
}