mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
Fleet UI: Disable save host status without required dropdowns selected (#7759)
This commit is contained in:
parent
486b67caca
commit
7a5663bebf
1
changes/bug-7752-save-host-status-webhook
Normal file
1
changes/bug-7752-save-host-status-webhook
Normal file
@ -0,0 +1 @@
|
|||||||
|
* Users cannot save host status webhook without choosing required percent of hosts and days count in the app settings page
|
@ -57,8 +57,18 @@ const HostStatusWebhook = ({
|
|||||||
const validateForm = () => {
|
const validateForm = () => {
|
||||||
const errors: IAppConfigFormErrors = {};
|
const errors: IAppConfigFormErrors = {};
|
||||||
|
|
||||||
if (enableHostStatusWebhook && !hostStatusWebhookDestinationURL) {
|
if (enableHostStatusWebhook) {
|
||||||
errors.destination_url = "Destination URL must be present";
|
if (!hostStatusWebhookDestinationURL) {
|
||||||
|
errors.destination_url = "Destination URL must be present";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hostStatusWebhookDaysCount) {
|
||||||
|
errors.days_count = "Number of days must be present";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hostStatusWebhookDaysCount) {
|
||||||
|
errors.host_percentage = "Percentage of hosts must be present";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFormErrors(errors);
|
setFormErrors(errors);
|
||||||
@ -180,6 +190,7 @@ const HostStatusWebhook = ({
|
|||||||
name="hostStatusWebhookHostPercentage"
|
name="hostStatusWebhookHostPercentage"
|
||||||
value={hostStatusWebhookHostPercentage}
|
value={hostStatusWebhookHostPercentage}
|
||||||
parseTarget
|
parseTarget
|
||||||
|
onBlur={validateForm}
|
||||||
tooltip={
|
tooltip={
|
||||||
"\
|
"\
|
||||||
<p>Select the minimum percentage of hosts that<br/>must fail to check into Fleet in order to trigger<br/>the webhook request.</p>\
|
<p>Select the minimum percentage of hosts that<br/>must fail to check into Fleet in order to trigger<br/>the webhook request.</p>\
|
||||||
@ -195,6 +206,7 @@ const HostStatusWebhook = ({
|
|||||||
name="hostStatusWebhookDaysCount"
|
name="hostStatusWebhookDaysCount"
|
||||||
value={hostStatusWebhookDaysCount}
|
value={hostStatusWebhookDaysCount}
|
||||||
parseTarget
|
parseTarget
|
||||||
|
onBlur={validateForm}
|
||||||
tooltip={
|
tooltip={
|
||||||
"\
|
"\
|
||||||
<p>Select the minimum number of days that the<br/>configured <b>Percentage of hosts</b> must fail to<br/>check into Fleet in order to trigger the<br/>webhook request.</p>\
|
<p>Select the minimum number of days that the<br/>configured <b>Percentage of hosts</b> must fail to<br/>check into Fleet in order to trigger the<br/>webhook request.</p>\
|
||||||
|
@ -28,6 +28,8 @@ export interface IAppConfigFormErrors {
|
|||||||
user_name?: string | null;
|
user_name?: string | null;
|
||||||
password?: string | null;
|
password?: string | null;
|
||||||
destination_url?: string | null;
|
destination_url?: string | null;
|
||||||
|
days_count?: string | null;
|
||||||
|
host_percentage?: string | null;
|
||||||
host_expiry_window?: string | null;
|
host_expiry_window?: string | null;
|
||||||
agent_options?: string | null;
|
agent_options?: string | null;
|
||||||
transparency_url?: string | null;
|
transparency_url?: string | null;
|
||||||
|
Loading…
Reference in New Issue
Block a user