From 16d88f11b074ff81a95aeef58eb12c1847c195fe Mon Sep 17 00:00:00 2001 From: Siklos Date: Mon, 1 Aug 2022 09:51:49 +0200 Subject: [PATCH] test-server: Reimplement add whole api example --- test-server/http.js | 121 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 94 insertions(+), 27 deletions(-) diff --git a/test-server/http.js b/test-server/http.js index a37e9b2..85e28a2 100644 --- a/test-server/http.js +++ b/test-server/http.js @@ -6,33 +6,7 @@ serve({ fetch(request) { console.log(`${request.method}: ${request.url}`); if (request.method === 'POST') { - const json = JSON.stringify( - { - AvailableContainers: [ - { - Type: 'Chassis', - BorderColor: '#ff0000', - TypeChildContainerDefault: 'Trou', - BorderWidth: 48, - MinWidth: 500, - MaxWidth: 3000, - Width: 500, - Style: { - fillOpacity: 0, - borderWidth: 2, - stroke: 'red' - } - } - ], - AvailableSymbols: [], - MainContainer: { - Type: 'Trou', - BorderColor: '#ffffff', - Height: 300, - Width: 2000 - } - } - ); + const json = JSON.stringify(getBody()); return new Response(json, { status: 200, headers: { @@ -51,3 +25,96 @@ serve({ }); } }); + +const getBody = () => { + return { + AvailableContainers: [ + { + Type: 'Chassis', + BorderColor: '#ff0000', + TypeChildContainerDefault: 'Trou', + BorderWidth: 48, + MinWidth: 500, + MaxWidth: 3000, + Width: 500, + Style: { + fillOpacity: 0, + borderWidth: 2, + stroke: 'red' + } + }, + { + Type: 'Trou', + BorderColor: '#FFFFFF', + TypeChildContainerDefault: 'Remplissage' + }, + { + Type: 'Remplissage', + BodyColor: '#99C8FF', + BorderColor: '#00FF00', + ContainerDimensionning: { + DimensionningStyle: 1 + }, + ContainerActions: [ + { + Action: 'SplitRemplissage', + Label: 'Diviser le remplissage', + Description: 'Diviser le remplissage en insérant un montant', + CustomLogo: { + Url: '' + } + } + ] + }, + { + Type: 'Montant', + BorderColor: '#FFA947', + BodyColor: '#FFA947', + Width: 50, + XPositionReference: 1 + }, + { + Type: 'Ouverture', + BorderColor: '#FF6DE6', + BodyColor: '#FFA3D1', + ContainerDimensionning: { ShowDimensionning: false } + }, + { + Type: 'Dilatation', + BodyColor: '#000000', + Width: 8, + ContainerDimensionning: { ShowLabel: false } + }, + { + Type: '', + BorderColor: '#54616c', + BodyColor: '#dee2e4', + ContainerActions: [{ + ContainerActions: { + Action: 'FillHoleWithChassis', + Label: 'Calepiner', + Description: 'Remplir le trou avec des châssis', + CustomLogo: { Url: '' }, + AddingBehavior: 0 + } + }] + } + ], + AvailableSymbols: [ + { + Name: 'Poteau structure', + Image: { Url: 'https://www.manutan.fr/img/S/GRP/ST/AIG3930272.jpg' } + }, + { + Name: 'Joint de structure', + Image: { Url: 'https://e7.pngegg.com/pngimages/647/127/png-clipart-svg-working-group-information-world-wide-web-internet-structure.png' } + } + ], + MainContainer: { + Type: 'Trou', + BorderColor: '#ffffff', + Height: 300, + Width: 2000 + } + }; +};