fix issue with single agent schedule upgrade (#144604)

This commit is contained in:
Julia Bardi 2022-11-04 14:17:30 +01:00 committed by GitHub
parent 3d7a5bb021
commit cb2f4ba9d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -162,15 +162,16 @@ export const AgentUpgradeAgentModal: React.FunctionComponent<AgentUpgradeAgentMo
try {
setIsSubmitting(true);
const { error } = isSingleAgent
? await sendPostAgentUpgrade((agents[0] as Agent).id, {
version,
})
: await sendPostBulkAgentUpgrade({
version,
agents: Array.isArray(agents) ? agents.map((agent) => agent.id) : agents,
...rolloutOptions,
});
const { error } =
isSingleAgent && !isScheduled
? await sendPostAgentUpgrade((agents[0] as Agent).id, {
version,
})
: await sendPostBulkAgentUpgrade({
version,
agents: Array.isArray(agents) ? agents.map((agent) => agent.id) : agents,
...rolloutOptions,
});
if (error) {
if (error?.statusCode === 400) {
setErrors(error?.message);