fix(xo-web/proxies): fix "invalid parameters" error on canceling proxy deploy (#5649)

Issue: fetchProxyUpgrades called with an undefined proxy in the proxies collection.

Solution: Interrupt the deployment process on cancel, in order to not fetch updates in this case.
This commit is contained in:
badrAZ 2021-03-09 10:37:59 +01:00 committed by GitHub
parent b7603e109d
commit 9601ad13ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,6 @@
import _, { messages } from 'intl' import _, { messages } from 'intl'
import decorate from 'apply-decorators' import decorate from 'apply-decorators'
import Icon from 'icon' import Icon from 'icon'
import noop from 'lodash/noop'
import React from 'react' import React from 'react'
import SingleLineRow from 'single-line-row' import SingleLineRow from 'single-line-row'
import Tooltip from 'tooltip' import Tooltip from 'tooltip'
@ -249,8 +248,8 @@ const deployProxy = async ({ proxy } = {}) => {
const title = isRedeployMode ? _('redeployProxy') : _('deployProxy') const title = isRedeployMode ? _('redeployProxy') : _('deployProxy')
if (license === undefined) { if (license === undefined) {
const value = 'trial' // it rejects with undefined when the start trial option isn't chosen
const choice = await chooseAction({ await chooseAction({
body: ( body: (
<div className='text-muted'> <div className='text-muted'>
<Icon icon='info' /> {_('noLicenseAvailable')} <Icon icon='info' /> {_('noLicenseAvailable')}
@ -261,15 +260,11 @@ const deployProxy = async ({ proxy } = {}) => {
btnStyle: 'success', btnStyle: 'success',
icon: 'trial', icon: 'trial',
label: _('trialStartButton'), label: _('trialStartButton'),
value,
}, },
], ],
icon: 'proxy', icon: 'proxy',
title, title,
}).catch(noop) })
if (choice !== value) {
return
}
try { try {
license = await createProxyTrialLicense() license = await createProxyTrialLicense()