Fleet UI: Surface how to override modifying agent options that are invalid (#8561)

This commit is contained in:
RachelElysia 2022-11-04 09:21:37 -04:00 committed by GitHub
parent caf3a6e5ef
commit 9f160c058f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 2 deletions

View File

@ -0,0 +1 @@
- When submitting invalid agent options, inform user how to override agent options using fleetctl force flag

View File

@ -82,9 +82,24 @@ const OrgSettingsForm = ({
"Could not connect to SMTP server. Please try again."
);
} else if (response?.data.errors) {
const agentOptionsInvalid =
response.data.errors[0].reason.includes(
"unsupported key provided"
) ||
response.data.errors[0].reason.includes("invalid value type");
renderFlash(
"error",
`Could not update settings. ${response.data.errors[0].reason}`
<>
Could not update settings. {response.data.errors[0].reason}
{agentOptionsInvalid && (
<>
<br />
If youre not using the latest osquery, use the fleetctl
apply --force command to override validation.
</>
)}
</>
);
}
})

View File

@ -109,9 +109,24 @@ const AgentOptionsPage = ({
})
.catch((response: { data: IApiError }) => {
console.error(response);
const agentOptionsInvalid =
response.data.errors[0].reason.includes("unsupported key provided") ||
response.data.errors[0].reason.includes("invalid value type");
return renderFlash(
"error",
`Could not update ${teamName} team agent options. ${response.data.errors[0].reason}`
<>
Could not update {teamName} team agent options.{" "}
{response.data.errors[0].reason}
{agentOptionsInvalid && (
<>
<br />
If youre not using the latest osquery, use the fleetctl apply
--force command to override validation.
</>
)}
</>
);
})
.finally(() => {