1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-28 14:10:04 +02:00

fix(cp-frontend): handle non existing service in scale

This commit is contained in:
Sérgio Ramos 2017-07-27 17:13:03 +01:00
parent db58882a15
commit d4877e8bb9

View File

@ -31,6 +31,20 @@ class ServiceScale extends Component {
} }
}; };
const handleCloseClick = evt => {
const closeUrl = match.url.split('/').slice(0, -2).join('/');
history.replace(closeUrl);
};
const handleSubmitClick = values => {
scale(service.id, values.replicas).then(handleCloseClick);
};
if (!service) {
setTimeout(handleCloseClick, 33);
return null;
}
const ServiceScaleForm = reduxForm({ const ServiceScaleForm = reduxForm({
form: 'scale-service', form: 'scale-service',
destroyOnUnmount: true, destroyOnUnmount: true,
@ -41,15 +55,6 @@ class ServiceScale extends Component {
} }
})(ServiceScaleComponent); })(ServiceScaleComponent);
const handleCloseClick = evt => {
const closeUrl = match.url.split('/').slice(0, -2).join('/');
history.replace(closeUrl);
};
const handleSubmitClick = values => {
scale(service.id, values.replicas).then(handleCloseClick);
};
return ( return (
<Modal width={460} onCloseClick={handleCloseClick}> <Modal width={460} onCloseClick={handleCloseClick}>
<ServiceScaleForm <ServiceScaleForm