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({
form: 'scale-service',
destroyOnUnmount: true,
@ -41,15 +55,6 @@ class ServiceScale extends Component {
}
})(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 (
<Modal width={460} onCloseClick={handleCloseClick}>
<ServiceScaleForm