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,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,182 +0,0 @@
{
"isSidebarOpen": true,
"isElementsSidebarOpen": false,
"isHistoryOpen": false,
"configuration": {
"AvailableContainers": [
{
"Type": "Chassis",
"Width": 500,
"Style": {
"fillOpacity": 0,
"borderWidth": 2,
"stroke": "red"
}
},
{
"Type": "Trou",
"Width": 300,
"Style": {
"fillOpacity": 0,
"borderWidth": 2,
"stroke": "green"
}
},
{
"Type": "Montant",
"Width": 100,
"Style": {
"fillOpacity": 0,
"borderWidth": 2,
"stroke": "blue",
"transform": "translateX(-50%)",
"transformOrigin": "center",
"transformBox": "fill-box"
}
}
],
"AvailableSymbols": [
{
"Height": 0,
"Image": {
"Base64Image": null,
"Name": null,
"Svg": null,
"Url": "https://www.manutan.fr/img/S/GRP/ST/AIG3930272.jpg"
},
"Name": "Poteau structure",
"Width": 0,
"XPositionReference": 1
},
{
"Height": 0,
"Image": {
"Base64Image": null,
"Name": null,
"Svg": null,
"Url": "https://e7.pngegg.com/pngimages/647/127/png-clipart-svg-working-group-information-world-wide-web-internet-structure.png"
},
"Name": "Joint de structure",
"Width": 0,
"XPositionReference": 0
}
],
"MainContainer": {
"Height": 200,
"Width": 1000
}
},
"history": [
{
"MainContainer": {
"children": [],
"properties": {
"id": "main",
"parentId": "null",
"x": 0,
"y": 0,
"width": 1000,
"height": 200,
"fillOpacity": 0,
"stroke": "black"
},
"userData": {}
},
"TypeCounters": {}
},
{
"MainContainer": {
"children": [
{
"children": [],
"properties": {
"id": "Chassis-0",
"parentId": "main",
"x": 0,
"y": 0,
"width": 500,
"height": 200,
"fillOpacity": 0,
"borderWidth": 2,
"stroke": "red"
},
"userData": {
"type": "Chassis"
}
}
],
"properties": {
"id": "main",
"parentId": "null",
"x": 0,
"y": 0,
"width": 1000,
"height": 200,
"fillOpacity": 0,
"stroke": "black"
},
"userData": {}
},
"TypeCounters": {
"Chassis": 0
},
"SelectedContainerId": "main"
},
{
"MainContainer": {
"children": [
{
"children": [],
"properties": {
"id": "Chassis-0",
"parentId": "main",
"x": 0,
"y": 0,
"width": 500,
"height": 200,
"fillOpacity": 0,
"borderWidth": 2,
"stroke": "red"
},
"userData": {
"type": "Chassis"
}
},
{
"children": [],
"properties": {
"id": "Chassis-1",
"parentId": "main",
"x": 500,
"y": 0,
"width": 500,
"height": 200,
"fillOpacity": 0,
"borderWidth": 2,
"stroke": "red"
},
"userData": {
"type": "Chassis"
}
}
],
"properties": {
"id": "main",
"parentId": "null",
"x": 0,
"y": 0,
"width": 1000,
"height": 200,
"fillOpacity": 0,
"stroke": "black"
},
"userData": {}
},
"TypeCounters": {
"Chassis": 1
},
"SelectedContainerId": "main"
}
],
"historyCurrentStep": 2
}