From 0940f968e6e2cbcb54500d1f4198240531a95f94 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 22 Dec 2020 14:01:32 +0100 Subject: [PATCH] bugs fixed --- Client/httpInterface.js | 33 ++++++++++++++----- .../UI/Spaces/Docs-Space/DocsSpace.js | 10 +++--- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 64f5baab4..d5bd55eac 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -325,8 +325,8 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE } catch (err) { console.log('[ERROR] httpInterface -> Docs -> Save-Node-Schema -> Method call produced an error.') - console.log('[ERROR] httpInterface -> WEB3s -> Save-Node-Schema -> err.stack = ' + err.stack) - console.log('[ERROR] httpInterface -> WEB3s -> Save-Node-Schema -> Params Received = ' + body) + console.log('[ERROR] httpInterface -> Docs -> Save-Node-Schema -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> Docs -> Save-Node-Schema -> Params Received = ' + body) let error = { result: 'Fail Because', @@ -347,11 +347,28 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE let project = requestParameters[3] const fs = require('fs') + console.log('docsSchema', docsSchema) + console.log('project', project) + for (let i = 0; i < docsSchema.length; i++) { let schemaDocument = docsSchema[i] let fileContent = JSON.stringify(schemaDocument) - let fileName = schemaDocument.type.toLowerCase().replaceAll(' ', '-') + '.json' + + console.log('schemaDocument', schemaDocument) + console.log('fileContent', fileContent) + console.log('schemaDocument.type', schemaDocument.type) + console.log('schemaDocument.type.toLowerCase()', schemaDocument.type.toLowerCase()) + + let fileName = schemaDocument.type.toLowerCase() + for (let j = 0; j < 10; j++) { + fileName = fileName.replaceAll(' ', '-') + } + fileName = fileName + '.json' let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Concepts' + + + console.log('fileName', filename) + console.log('filePath', filePath) fs.writeFileSync(filePath + '/' + fileName, fileContent) } @@ -359,8 +376,8 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE } catch (err) { console.log('[ERROR] httpInterface -> Docs -> Save-Concept-Schema -> Method call produced an error.') - console.log('[ERROR] httpInterface -> WEB3s -> Save-Concept-Schema -> err.stack = ' + err.stack) - console.log('[ERROR] httpInterface -> WEB3s -> Save-Concept-Schema -> Params Received = ' + body) + console.log('[ERROR] httpInterface -> Docs -> Save-Concept-Schema -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> Docs -> Save-Concept-Schema -> Params Received = ' + body) let error = { result: 'Fail Because', @@ -390,11 +407,11 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE } respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) - + } catch (err) { console.log('[ERROR] httpInterface -> Docs -> Save-Topic-Schema -> Method call produced an error.') - console.log('[ERROR] httpInterface -> WEB3s -> Save-Topic-Schema -> err.stack = ' + err.stack) - console.log('[ERROR] httpInterface -> WEB3s -> Save-Topic-Schema -> Params Received = ' + body) + console.log('[ERROR] httpInterface -> Docs -> Save-Topic-Schema -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> Docs -> Save-Topic-Schema -> Params Received = ' + body) let error = { result: 'Fail Because', diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js index ddb8d2ccf..3f1e5aba6 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js @@ -1006,23 +1006,23 @@ function newSuperalgosDocSpace() { for (let j = 0; j < PROJECTS_ARRAY.length; j++) { let docsSchema let project = PROJECTS_ARRAY[j] - +/* docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Node-Schema/' + project, onResponse) requestsSent++ - +*/ docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Concept-Schema/' + project, onResponse) requestsSent++ - +/* docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Topic-Schema/' + project, onResponse) requestsSent++ - } + */ } function onResponse(err, data) { /* Lets check the result of the call through the http interface */ - if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { + if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { okResponses++ } responseCount++