Add swals + Remove incompatible saves + add new tests
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Siklos 2022-08-18 12:13:51 +02:00
parent f34ba64f7e
commit 4971ec7e5d
8 changed files with 8936 additions and 185 deletions

View file

@ -6,6 +6,7 @@
* If the contraints fails, an error message will be returned
*/
import Swal from 'sweetalert2';
import { IContainerModel } from '../../../Interfaces/IContainerModel';
import { ISizePointer } from '../../../Interfaces/ISizePointer';
@ -126,8 +127,13 @@ export function constraintBodyInsideUnallocatedWidth(
// Check if there is still some space
if (availableWidths.length === 0) {
Swal.fire({
icon: 'error',
title: 'Not enough space!',
text: 'Try to free the parent a little bit!'
});
throw new Error(
'No available space found on the parent container. Try to free the parent a little before placing it inside.'
'No available space found on the parent container. Try to free the parent a bit.'
);
}
@ -169,6 +175,14 @@ export function constraintBodyInsideUnallocatedWidth(
if (availableWidth === undefined) {
console.warn(`Container ${container.properties.id} cannot fit in any space due to its minimum width being to large. Consequently, its rigid body property is disabled.`);
Swal.fire({
position: 'top-end',
title: `Container ${container.properties.id} cannot fit!`,
text: 'Its rigid body property is now disabled. Change its the minimum width or free the parent container.',
timerProgressBar: true,
showConfirmButton: false,
timer: 5000
});
container.properties.isRigidBody = false;
return container;
}

View file

@ -233,7 +233,7 @@ export function AddContainer(
// Update the state
history.push({
LastAction: `Add ${type} in ${parentClone.properties.id}`,
LastAction: `Add ${newContainer.properties.id} in ${parentClone.properties.id}`,
MainContainer: clone,
SelectedContainer: parentClone,
SelectedContainerId: parentClone.properties.id,