From 1af5b45dbb2f35caa37a3d55d6cd478167e080dd Mon Sep 17 00:00:00 2001 From: Eric NGUYEN Date: Wed, 21 Sep 2022 16:12:27 +0200 Subject: [PATCH] Update node-http.js --- test-server/node-http.js | 145 +++++++++++++++++++++++++++++---------- 1 file changed, 110 insertions(+), 35 deletions(-) diff --git a/test-server/node-http.js b/test-server/node-http.js index 7a31253..84d8e89 100644 --- a/test-server/node-http.js +++ b/test-server/node-http.js @@ -28,8 +28,23 @@ const requestListener = async(request, response) => { default: 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 { - // TODO: Return 404 rather than this json = GetSVGLayoutConfiguration(); } response.writeHead(200); @@ -54,32 +69,45 @@ const GetSVGLayoutConfiguration = () => { AvailableContainers: [ { Type: 'Chassis', - Width: 500, + DisplayedText: 'Chassis?', + Whitelist: ["Trou"], + MaxWidth: 500, MinWidth: 200, + Width: 200, DefaultChildType: 'Trou', Style: { fillOpacity: 1, strokeWidth: 2, stroke: 'red', fill: '#d3c9b7', - } + }, + ShowSelfDimensions: true, + IsDimensionBorrower: true, + Category: "Stuff" }, { Type: 'Trou', - DefaultX: 10, - DefaultY: 10, - Width: 480, - Height: 180, + Blacklist: ["Chassis"], + DefaultX: 0, + DefaultY: 0, + Margin: { + left: 10, + bottom: 10, + top: 10, + right: 10, + }, DefaultChildType: 'Remplissage', Style: { fillOpacity: 1, strokeWidth: 2, stroke: 'green', fill: 'white' - } + }, + Category: "Stuff" }, { Type: 'Remplissage', + Category: "Other stuff", CustomSVG: ` @@ -87,6 +115,17 @@ const GetSVGLayoutConfiguration = () => { ` , + Actions: [ + { + Action: "SplitRemplissage", + Label: "Diviser le remplissage", + Description: "Diviser le remplissage en insérant un montant", + CustomLogo: { + Url: "" + }, + AddingBehavior: 2 + } + ], Style: { fillOpacity: 1, strokeWidth: 1, @@ -103,17 +142,53 @@ const GetSVGLayoutConfiguration = () => { Type: 'Montant', Width: 10, XPositionReference: 1, + MarkPositionToDimensionBorrower: true, Style: { fillOpacity: 0, strokeWidth: 2, stroke: '#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: [ { - Height: 0, + Width: 32, + Height: 32, Image: { Base64Image: null, Name: null, @@ -121,11 +196,11 @@ const GetSVGLayoutConfiguration = () => { Url: 'https://www.manutan.fr/img/S/GRP/ST/AIG3930272.jpg' }, Name: 'Poteau structure', - Width: 0, XPositionReference: 1 }, { - Height: 0, + Width: 32, + Height: 32, Image: { Base64Image: 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' }, Name: 'Joint de structure', - Width: 0, XPositionReference: 0 } ], + Categories: [ + { + Type: "Stuff", + DisplayedText: "Stuff made here" + }, + { + Type: "Other stuff", + DisplayedText: "Stuff not made here" + } + ], MainContainer: { - BodyColor: null, - BorderColor: '#FFFFFF', - BorderWidth: 0, - ContainerActions: null, - ContainerDimensionning: null, - DefaultChildrenContainers: null, Height: 200, - IsPositionFixed: false, - IsWidthFixed: false, - MaxHeight: 0, - MaxWidth: 0, - MinHeight: 0, - MinWidth: 0, - Type: 'Trou', - TypeChildContainerDefault: null, - Width: 1000, - XPositionReference: 0 + Width: 800 } }; }; @@ -176,20 +245,26 @@ const FillHoleWithChassis = (request) => { } } return { - ApplicationState: { - Containers: lstModels - } + Containers: lstModels }; }; const SplitRemplissage = (request) => { const lstModels = [ - { Type: 'Remplissage' }, - { Type: 'Montant' }, - { Type: 'Remplissage' } + { + Type: 'Remplissage' + }, + { + Type: 'Montant' + }, + { + Type: 'Remplissage' + }, ]; return { - ApplicationState: { Containers: lstModels } + Containers: lstModels }; }; + +