Update node-http.js
This commit is contained in:
parent
54d0504c90
commit
1af5b45dbb
1 changed files with 110 additions and 35 deletions
|
@ -28,8 +28,23 @@ const requestListener = async(request, response) => {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (url === '/GetFeedback') {
|
||||||
|
const buffers = [];
|
||||||
|
for await (const chunk of request) {
|
||||||
|
buffers.push(chunk);
|
||||||
|
}
|
||||||
|
const data = Buffer.concat(buffers).toString();
|
||||||
|
const bodyParsed = JSON.parse(data);
|
||||||
|
console.log(bodyParsed);
|
||||||
|
json = {
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
text: `${new Date()}`,
|
||||||
|
type: 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: Return 404 rather than this
|
|
||||||
json = GetSVGLayoutConfiguration();
|
json = GetSVGLayoutConfiguration();
|
||||||
}
|
}
|
||||||
response.writeHead(200);
|
response.writeHead(200);
|
||||||
|
@ -54,32 +69,45 @@ const GetSVGLayoutConfiguration = () => {
|
||||||
AvailableContainers: [
|
AvailableContainers: [
|
||||||
{
|
{
|
||||||
Type: 'Chassis',
|
Type: 'Chassis',
|
||||||
Width: 500,
|
DisplayedText: 'Chassis?',
|
||||||
|
Whitelist: ["Trou"],
|
||||||
|
MaxWidth: 500,
|
||||||
MinWidth: 200,
|
MinWidth: 200,
|
||||||
|
Width: 200,
|
||||||
DefaultChildType: 'Trou',
|
DefaultChildType: 'Trou',
|
||||||
Style: {
|
Style: {
|
||||||
fillOpacity: 1,
|
fillOpacity: 1,
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
stroke: 'red',
|
stroke: 'red',
|
||||||
fill: '#d3c9b7',
|
fill: '#d3c9b7',
|
||||||
}
|
},
|
||||||
|
ShowSelfDimensions: true,
|
||||||
|
IsDimensionBorrower: true,
|
||||||
|
Category: "Stuff"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: 'Trou',
|
Type: 'Trou',
|
||||||
DefaultX: 10,
|
Blacklist: ["Chassis"],
|
||||||
DefaultY: 10,
|
DefaultX: 0,
|
||||||
Width: 480,
|
DefaultY: 0,
|
||||||
Height: 180,
|
Margin: {
|
||||||
|
left: 10,
|
||||||
|
bottom: 10,
|
||||||
|
top: 10,
|
||||||
|
right: 10,
|
||||||
|
},
|
||||||
DefaultChildType: 'Remplissage',
|
DefaultChildType: 'Remplissage',
|
||||||
Style: {
|
Style: {
|
||||||
fillOpacity: 1,
|
fillOpacity: 1,
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
stroke: 'green',
|
stroke: 'green',
|
||||||
fill: 'white'
|
fill: 'white'
|
||||||
}
|
},
|
||||||
|
Category: "Stuff"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: 'Remplissage',
|
Type: 'Remplissage',
|
||||||
|
Category: "Other stuff",
|
||||||
CustomSVG: `
|
CustomSVG: `
|
||||||
<rect width="{width}" height="{height}" style="{style}"></rect>
|
<rect width="{width}" height="{height}" style="{style}"></rect>
|
||||||
<rect width="{width}" height="{height}" stroke="black" fill-opacity="0"></rect>
|
<rect width="{width}" height="{height}" stroke="black" fill-opacity="0"></rect>
|
||||||
|
@ -87,6 +115,17 @@ const GetSVGLayoutConfiguration = () => {
|
||||||
<line x1="{width}" y1="0" x2="0" y2="{height}" stroke="black" style='{userData.styleLine}'></line>
|
<line x1="{width}" y1="0" x2="0" y2="{height}" stroke="black" style='{userData.styleLine}'></line>
|
||||||
`
|
`
|
||||||
,
|
,
|
||||||
|
Actions: [
|
||||||
|
{
|
||||||
|
Action: "SplitRemplissage",
|
||||||
|
Label: "Diviser le remplissage",
|
||||||
|
Description: "Diviser le remplissage en insérant un montant",
|
||||||
|
CustomLogo: {
|
||||||
|
Url: ""
|
||||||
|
},
|
||||||
|
AddingBehavior: 2
|
||||||
|
}
|
||||||
|
],
|
||||||
Style: {
|
Style: {
|
||||||
fillOpacity: 1,
|
fillOpacity: 1,
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
|
@ -103,17 +142,53 @@ const GetSVGLayoutConfiguration = () => {
|
||||||
Type: 'Montant',
|
Type: 'Montant',
|
||||||
Width: 10,
|
Width: 10,
|
||||||
XPositionReference: 1,
|
XPositionReference: 1,
|
||||||
|
MarkPositionToDimensionBorrower: true,
|
||||||
Style: {
|
Style: {
|
||||||
fillOpacity: 0,
|
fillOpacity: 0,
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
stroke: '#713f12',
|
stroke: '#713f12',
|
||||||
fill: '#713f12',
|
fill: '#713f12',
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: 'Dilatation',
|
||||||
|
Width: 4,
|
||||||
|
XPositionReference: 1,
|
||||||
|
MarkPositionToDimensionBorrower: true,
|
||||||
|
Style: {
|
||||||
|
fillOpacity: 0,
|
||||||
|
strokeWidth: 2,
|
||||||
|
stroke: '#713f12',
|
||||||
|
fill: '#713f12',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: '200',
|
||||||
|
MaxWidth: 500,
|
||||||
|
MinWidth: 200,
|
||||||
|
Style: {
|
||||||
|
fillOpacity: 1,
|
||||||
|
strokeWidth: 2,
|
||||||
|
stroke: 'blue',
|
||||||
|
fill: 'blue',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: '400',
|
||||||
|
MaxWidth: 500,
|
||||||
|
MinWidth: 400,
|
||||||
|
Style: {
|
||||||
|
fillOpacity: 1,
|
||||||
|
strokeWidth: 2,
|
||||||
|
stroke: 'red',
|
||||||
|
fill: 'red',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
AvailableSymbols: [
|
AvailableSymbols: [
|
||||||
{
|
{
|
||||||
Height: 0,
|
Width: 32,
|
||||||
|
Height: 32,
|
||||||
Image: {
|
Image: {
|
||||||
Base64Image: null,
|
Base64Image: null,
|
||||||
Name: null,
|
Name: null,
|
||||||
|
@ -121,11 +196,11 @@ const GetSVGLayoutConfiguration = () => {
|
||||||
Url: 'https://www.manutan.fr/img/S/GRP/ST/AIG3930272.jpg'
|
Url: 'https://www.manutan.fr/img/S/GRP/ST/AIG3930272.jpg'
|
||||||
},
|
},
|
||||||
Name: 'Poteau structure',
|
Name: 'Poteau structure',
|
||||||
Width: 0,
|
|
||||||
XPositionReference: 1
|
XPositionReference: 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Height: 0,
|
Width: 32,
|
||||||
|
Height: 32,
|
||||||
Image: {
|
Image: {
|
||||||
Base64Image: null,
|
Base64Image: null,
|
||||||
Name: null,
|
Name: null,
|
||||||
|
@ -133,28 +208,22 @@ const GetSVGLayoutConfiguration = () => {
|
||||||
Url: 'https://e7.pngegg.com/pngimages/647/127/png-clipart-svg-working-group-information-world-wide-web-internet-structure.png'
|
Url: 'https://e7.pngegg.com/pngimages/647/127/png-clipart-svg-working-group-information-world-wide-web-internet-structure.png'
|
||||||
},
|
},
|
||||||
Name: 'Joint de structure',
|
Name: 'Joint de structure',
|
||||||
Width: 0,
|
|
||||||
XPositionReference: 0
|
XPositionReference: 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
Categories: [
|
||||||
|
{
|
||||||
|
Type: "Stuff",
|
||||||
|
DisplayedText: "Stuff made here"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: "Other stuff",
|
||||||
|
DisplayedText: "Stuff not made here"
|
||||||
|
}
|
||||||
|
],
|
||||||
MainContainer: {
|
MainContainer: {
|
||||||
BodyColor: null,
|
|
||||||
BorderColor: '#FFFFFF',
|
|
||||||
BorderWidth: 0,
|
|
||||||
ContainerActions: null,
|
|
||||||
ContainerDimensionning: null,
|
|
||||||
DefaultChildrenContainers: null,
|
|
||||||
Height: 200,
|
Height: 200,
|
||||||
IsPositionFixed: false,
|
Width: 800
|
||||||
IsWidthFixed: false,
|
|
||||||
MaxHeight: 0,
|
|
||||||
MaxWidth: 0,
|
|
||||||
MinHeight: 0,
|
|
||||||
MinWidth: 0,
|
|
||||||
Type: 'Trou',
|
|
||||||
TypeChildContainerDefault: null,
|
|
||||||
Width: 1000,
|
|
||||||
XPositionReference: 0
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -176,20 +245,26 @@ const FillHoleWithChassis = (request) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
ApplicationState: {
|
Containers: lstModels
|
||||||
Containers: lstModels
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const SplitRemplissage = (request) => {
|
const SplitRemplissage = (request) => {
|
||||||
const lstModels = [
|
const lstModels = [
|
||||||
{ Type: 'Remplissage' },
|
{
|
||||||
{ Type: 'Montant' },
|
Type: 'Remplissage'
|
||||||
{ Type: 'Remplissage' }
|
},
|
||||||
|
{
|
||||||
|
Type: 'Montant'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: 'Remplissage'
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ApplicationState: { Containers: lstModels }
|
Containers: lstModels
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue