Preparing for Docs Concpts
This commit is contained in:
1 parent
7baf404999
commit
7f96a878d1
6 files changed
+48
-15
No files matched your search
+22
-5
@@ -454,7 +454,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
|
||||
case 'Schema':
|
||||
{
|
||||
sendSchema(global.env.PATH_TO_PROJECTS + '/' + requestParameters[2] + '/Schemas/', requestParameters[3] + '.json')
|
||||
sendSchema(global.env.PATH_TO_PROJECTS + '/' + requestParameters[2] + '/Schemas/', requestParameters[3])
|
||||
}
|
||||
break
|
||||
|
||||
@@ -889,10 +889,11 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
lsWithGrep();
|
||||
}
|
||||
|
||||
function sendSchema(filePath, fileName) {
|
||||
function sendSchema(filePath, schemaType) {
|
||||
let fs = require('fs')
|
||||
|
||||
if (fileName === 'AppSchema.json') {
|
||||
if (schemaType === 'AppSchema') {
|
||||
let fileName = 'AppSchema.json'
|
||||
try {
|
||||
filePath = filePath + fileName
|
||||
fs.readFile(filePath, onFileRead)
|
||||
@@ -909,11 +910,27 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
let folder = ''
|
||||
switch (schemaType) {
|
||||
case 'DocsNodeSchema': {
|
||||
folder = 'Docs-Nodes'
|
||||
break
|
||||
}
|
||||
case 'DocsConceptSchema': {
|
||||
folder = 'Docs-Concepts'
|
||||
break
|
||||
}
|
||||
case 'DocsTopictSchema': {
|
||||
folder = 'Docs-Topics'
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let schemaArray = []
|
||||
let fileList = fs.readdirSync(filePath + '/Docs-Nodes')
|
||||
let fileList = fs.readdirSync(filePath + '/' + folder)
|
||||
for (let k = 0; k < fileList.length; k++) {
|
||||
let name = fileList[k]
|
||||
let fileContent = fs.readFileSync(filePath + '/Docs-Nodes/' + name)
|
||||
let fileContent = fs.readFileSync(filePath + '/' + folder + '/' + name)
|
||||
let nodeDefinition = JSON.parse(fileContent)
|
||||
schemaArray.push(nodeDefinition)
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type": "Concept 1",
|
||||
"definition": "This is concept 1 definition"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
{
|
||||
"type": "Attaching",
|
||||
"definition": "Nodes can be attached"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
{
|
||||
"type": "Referencing",
|
||||
"definition": "Nodes can reference other nodes"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
{
|
||||
"type": "Contributing",
|
||||
"definition": "There are many ways to contribute"
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ function newAppPostLoader() {
|
||||
}
|
||||
|
||||
totalWebServerCalls++
|
||||
httpRequest(undefined, 'Schema/' + project + '/DocSchema', onResponseDocSchema)
|
||||
httpRequest(undefined, 'Schema/' + project + '/DocsNodeSchema', onResponseDocSchema)
|
||||
|
||||
function onResponseDocSchema(err, schema) {
|
||||
try {
|
||||
@@ -92,7 +92,7 @@ function newAppPostLoader() {
|
||||
}
|
||||
|
||||
totalWebServerCalls++
|
||||
httpRequest(undefined, 'Schema/' + project + '/ConceptSchema', onResponseConceptSchema)
|
||||
httpRequest(undefined, 'Schema/' + project + '/DocsConceptSchema', onResponseConceptSchema)
|
||||
|
||||
function onResponseConceptSchema(err, schema) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user