mirror of
https://github.com/fleetdm/fleet
synced 2026-05-21 16:08:47 +00:00
Fleet UI fix: Input is treated as strings but send number to API (#18652)
This commit is contained in:
parent
28742fccb3
commit
55f005c8e3
2 changed files with 11 additions and 4 deletions
1
changes/18605-host-expiry-window-setting
Normal file
1
changes/18605-host-expiry-window-setting
Normal file
|
|
@ -0,0 +1 @@
|
|||
- UI: Fix host expiry window setting to be able to save
|
||||
|
|
@ -20,7 +20,7 @@ interface IAdvancedConfigFormData {
|
|||
verifySSLCerts: boolean;
|
||||
enableStartTLS?: boolean;
|
||||
enableHostExpiry: boolean;
|
||||
hostExpiryWindow: number;
|
||||
hostExpiryWindow: string;
|
||||
deleteActivities: boolean;
|
||||
activityExpiryWindow: number;
|
||||
disableLiveQuery: boolean;
|
||||
|
|
@ -43,7 +43,10 @@ const Advanced = ({
|
|||
enableStartTLS: appConfig.smtp_settings?.enable_start_tls,
|
||||
enableHostExpiry:
|
||||
appConfig.host_expiry_settings.host_expiry_enabled || false,
|
||||
hostExpiryWindow: appConfig.host_expiry_settings.host_expiry_window || 0,
|
||||
hostExpiryWindow:
|
||||
(appConfig.host_expiry_settings.host_expiry_window &&
|
||||
appConfig.host_expiry_settings.host_expiry_window.toString()) ||
|
||||
"0",
|
||||
deleteActivities:
|
||||
appConfig.activity_expiry_settings?.activity_expiry_enabled || false,
|
||||
activityExpiryWindow:
|
||||
|
|
@ -90,7 +93,10 @@ const Advanced = ({
|
|||
// validate desired form fields
|
||||
const errors: IAdvancedConfigFormErrors = {};
|
||||
|
||||
if (enableHostExpiry && (!hostExpiryWindow || hostExpiryWindow <= 0)) {
|
||||
if (
|
||||
enableHostExpiry &&
|
||||
(!hostExpiryWindow || parseInt(hostExpiryWindow, 10) <= 0)
|
||||
) {
|
||||
errors.host_expiry_window =
|
||||
"Host expiry window must be a positive number";
|
||||
}
|
||||
|
|
@ -116,7 +122,7 @@ const Advanced = ({
|
|||
},
|
||||
host_expiry_settings: {
|
||||
host_expiry_enabled: enableHostExpiry,
|
||||
host_expiry_window: hostExpiryWindow || undefined,
|
||||
host_expiry_window: parseInt(hostExpiryWindow, 10) || undefined,
|
||||
},
|
||||
activity_expiry_settings: {
|
||||
activity_expiry_enabled: deleteActivities,
|
||||
|
|
|
|||
Loading…
Reference in a new issue