mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
UI: Fix bug with policy automations (#11781)
## Addresses #11714 - Allow saving policy automations to Ticket integrations without defining a webhook URL https://www.loom.com/share/208169b6081846809dc170fcfb43f689 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/` - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
parent
791183bb66
commit
0c13d8f2a9
2 changed files with 9 additions and 12 deletions
1
changes/11714-policy-automations-bug
Normal file
1
changes/11714-policy-automations-bug
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
- Fix a bug where policy automations couldn't be updated without a webhook URL
|
||||||
|
|
@ -173,12 +173,6 @@ const ManageAutomationsModal = ({
|
||||||
policyItems?.forEach((p) => p.isChecked && newPolicyIds.push(p.id));
|
policyItems?.forEach((p) => p.isChecked && newPolicyIds.push(p.id));
|
||||||
|
|
||||||
const newErrors = { ...errors };
|
const newErrors = { ...errors };
|
||||||
// if (isPolicyAutomationsEnabled && !newPolicyIds.length) {
|
|
||||||
// newErrors.policyItems =
|
|
||||||
// "Please choose at least one policy you want to listen to:";
|
|
||||||
// } else {
|
|
||||||
// delete newErrors.policyItems;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isPolicyAutomationsEnabled &&
|
isPolicyAutomationsEnabled &&
|
||||||
|
|
@ -191,12 +185,14 @@ const ManageAutomationsModal = ({
|
||||||
delete newErrors.integration;
|
delete newErrors.integration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWebhookEnabled && !destinationUrl) {
|
if (isWebhookEnabled) {
|
||||||
newErrors.url = "Please add a destination URL";
|
if (!destinationUrl) {
|
||||||
} else if (!validUrl({ url: destinationUrl })) {
|
newErrors.url = "Please add a destination URL";
|
||||||
newErrors.url = `${destinationUrl} is not a valid URL`;
|
} else if (!validUrl({ url: destinationUrl })) {
|
||||||
} else {
|
newErrors.url = `${destinationUrl} is not a valid URL`;
|
||||||
delete newErrors.url;
|
} else {
|
||||||
|
delete newErrors.url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmpty(newErrors)) {
|
if (!isEmpty(newErrors)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue