UI - add missing null handling on team settings (#17548)

This commit is contained in:
Jacob Shandling 2024-03-11 17:05:30 -05:00 committed by GitHub
parent 14be6a0fc8
commit eaf8f41dd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -214,6 +214,7 @@ export interface IConfig {
export interface IWebhookSettings {
failing_policies_webhook: IWebhookFailingPolicies;
// TODO - this can be null
host_status_webhook: IWebhookHostStatus;
vulnerabilities_webhook: IWebhookSoftwareVulnerabilities;
}

View file

@ -190,7 +190,8 @@ const TeamSettings = ({ location, router }: ITeamSubnavProps) => {
setPercentageHostsDropdownOptions(
getCustomDropdownOptions(
HOST_STATUS_WEBHOOK_HOST_PERCENTAGE_DROPDOWN_OPTIONS,
teamConfig?.webhook_settings.host_status_webhook.host_percentage ?? 1,
teamConfig?.webhook_settings?.host_status_webhook?.host_percentage ??
1,
(val) => `${val}%`
)
);
@ -198,7 +199,7 @@ const TeamSettings = ({ location, router }: ITeamSubnavProps) => {
setWindowDropdownOptions(
getCustomDropdownOptions(
HOST_STATUS_WEBHOOK_WINDOW_DROPDOWN_OPTIONS,
teamConfig?.webhook_settings.host_status_webhook.days_count ?? 1,
teamConfig?.webhook_settings?.host_status_webhook?.days_count ?? 1,
(val) => `${val} day${val !== 1 ? "s" : ""}`
)
);