Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop
This commit is contained in:
commit
f6269c2ecd
21 files changed
+643
-113
No files matched your search
@@ -816,7 +816,7 @@ width: 100%;
|
||||
|
||||
.docs-search-results-header-tabs-container {
|
||||
display: table;
|
||||
padding-left: 240px;
|
||||
padding-left: 180px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
@@ -848,7 +848,7 @@ width: 100%;
|
||||
/* Search Results Page Content */
|
||||
.docs-search-result-content {
|
||||
border-top: 1px solid #0295aa;
|
||||
margin-left: -240px;
|
||||
margin-left: -180px;
|
||||
}
|
||||
|
||||
.docs-search-result-content > div {
|
||||
|
||||
+70
-8
@@ -424,6 +424,36 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'Save-Review-Schema': {
|
||||
getBody(processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestParameters[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Reviews'
|
||||
|
||||
if (checkAllSchmemaDocuments('Review', docsSchema, filePath) === true) {
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
} else {
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> Docs -> Save-Review-Schema -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> Docs -> Save-Review-Schema -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> Docs -> Save-Review-Schema -> Params Received = ' + body)
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
message: err.message,
|
||||
stack: err.stack
|
||||
}
|
||||
respondWithContent(JSON.stringify(error), httpResponse)
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'Save-Book-Schema': {
|
||||
getBody(processRequest)
|
||||
|
||||
@@ -479,6 +509,11 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
fileName = cleanFileName(fileName)
|
||||
break
|
||||
}
|
||||
case 'Review': {
|
||||
fileName = schemaDocument.review.toLowerCase() + '-' + pageNumber.substring(pageNumber.length - 3, pageNumber.length) + '-' + schemaDocument.type.toLowerCase()
|
||||
fileName = cleanFileName(fileName)
|
||||
break
|
||||
}
|
||||
}
|
||||
fileName = fileName + '.json'
|
||||
|
||||
@@ -504,7 +539,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
fs.mkdirSync(filePath)
|
||||
} catch (err) {
|
||||
if (err.message.indexOf('file already exists') < 0) {
|
||||
throw(err)
|
||||
throw (err)
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(filePath + '/' + fileName, fileContent)
|
||||
@@ -564,8 +599,14 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
contribute()
|
||||
|
||||
async function contribute() {
|
||||
await doGit()
|
||||
await doGithub()
|
||||
if (await doGit() === false) {
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
|
||||
return
|
||||
}
|
||||
if (await doGithub() === false) {
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
|
||||
return
|
||||
}
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
}
|
||||
|
||||
@@ -582,10 +623,14 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
await git.add('./*')
|
||||
await git.commit(commitMessage)
|
||||
await git.push('origin', currentBranch)
|
||||
return true
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Error running Contribute.')
|
||||
console.log(err.stack)
|
||||
throw (err)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> commitMessage = ' + commitMessage)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> currentBranch = ' + currentBranch)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> contributionsBranch = ' + contributionsBranch)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,9 +657,20 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
head,
|
||||
base,
|
||||
});
|
||||
return true
|
||||
} catch (err) {
|
||||
if (err.stack.indexOf('A pull request already exists') < 0) {
|
||||
throw (err)
|
||||
if (err.stack.indexOf('A pull request already exists') >= 0) {
|
||||
return true
|
||||
} else {
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> commitMessage = ' + commitMessage)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token starts with = ' + token.substring(0, 10) + '...')
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10))
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> currentBranch = ' + currentBranch)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> contributionsBranch = ' + contributionsBranch)
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -625,6 +681,8 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> commitMessage = ' + commitMessage)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> token = ' + token)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> currentBranch = ' + currentBranch)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> contributionsBranch = ' + contributionsBranch)
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
@@ -1370,6 +1428,10 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
folder = 'Docs-Tutorials'
|
||||
break
|
||||
}
|
||||
case 'DocsReviewSchema': {
|
||||
folder = 'Docs-Reviews'
|
||||
break
|
||||
}
|
||||
case 'DocsBookSchema': {
|
||||
folder = 'Docs-Books'
|
||||
break
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"review": "Superalgos Project Review",
|
||||
"pageNumber": "1",
|
||||
"type": "Superalgos Review - Leave Your Feedback!",
|
||||
"definition": {
|
||||
"text": "This is the place where you can leave your feedback and impressions about the project, for others to find and read.",
|
||||
"updated": 1610701752995
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "After you create your own review page as part of this collection, you will be able to edit it over time, and add more info as your experience evolves with the system. So, don't worry is right now you can just write your first impressions. You will allways be able to come back and extend your page.",
|
||||
"updated": 1610701884353
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "How to add your own Review",
|
||||
"updated": 1610702480960
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "In order to add your own review page of the Superalgos Project, copy and paste the following code at the search bar:"
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.add Review to Superalgos: Superalgos Project Review->Superalgos Review - YOUR REVIEW TITLE",
|
||||
"updated": 1610702550459
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "YOUR REVIEW TITLE: Replace this placeholder text for a short title for your Review Page."
|
||||
},
|
||||
{
|
||||
"style": "Important",
|
||||
"text": "You need to sign your Review Page. At the en of the text, type your Github.com username. This needs to be present in order for the Review to be added to the next release of Superalgos.",
|
||||
"updated": 1610702866522
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Your review will be merged into the main repository once you send it as a contribution. For that you need to execute:"
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.save"
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "app.contribute"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -14,16 +14,8 @@
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.update Message"
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Parameters"
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "Message: This is optional. It is the message that is going to be recorded at Github.com when we merge for you the branch of the main repository into the branch of your fork.",
|
||||
"updated": 1610449466750
|
||||
"text": "docs.update",
|
||||
"updated": 1610710006400
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "There is no further action from you required. Someone will review your changes and merge them into the latest version of the software. If your changes are rejected for any reason, you will have to follow the issue at the Github.com web site.",
|
||||
"updated": 1610478538194
|
||||
"text": "There is no further action from you required. Someone will review your changes and merge them into the latest version of the software. If your changes are rejected for any reason, you will have to follow the issue at the Github.com web site. ",
|
||||
"updated": 1610712264828
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -13,26 +13,26 @@
|
||||
"updated": 1609150474236
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Option 1: ",
|
||||
"updated": 1609149432117
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"style": "Json",
|
||||
"text": "docs.add Node to Project: Docs Page Name",
|
||||
"updated": 1609149799453
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Example: ",
|
||||
"updated": 1609149442319
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"style": "Json",
|
||||
"text": "docs.add Node to Superalgos"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Option 2: ",
|
||||
"updated": 1609149450546
|
||||
},
|
||||
@@ -42,7 +42,7 @@
|
||||
"updated": 1609149807897
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Example: ",
|
||||
"updated": 1609149457691
|
||||
},
|
||||
@@ -51,7 +51,7 @@
|
||||
"text": "docs.add Concept to Superalgos"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Option 3: ",
|
||||
"updated": 1609149464103
|
||||
},
|
||||
@@ -61,7 +61,7 @@
|
||||
"updated": 1609149846658
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Example: ",
|
||||
"updated": 1609149471266
|
||||
},
|
||||
@@ -71,31 +71,68 @@
|
||||
"updated": 1609149878993
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Parameters",
|
||||
"updated": 1609150484701
|
||||
"style": "Subtitle",
|
||||
"text": "Option 4:",
|
||||
"updated": 1610706520317
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Json",
|
||||
"text": "docs.add Topic to Project: Docs Tutorial Name->Docs Page Name->Docs Page Number",
|
||||
"updated": 1610706514194
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Example:"
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.add Tutorial to Superalgos: How to Build Indicators->Intro",
|
||||
"updated": 1610706570716
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Option 5:",
|
||||
"updated": 1610706652124
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.add Review to Project: Docs Review Name->Docs Page Name->Docs Page Number",
|
||||
"updated": 1610706722998
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Example:"
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.add Review to Project: Superalgos Project Review->Superalgos Review - Great Project!",
|
||||
"updated": 1610706675495
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Parameters"
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "Project : Is the project where the Node, Concept or Topic is defined."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "List",
|
||||
"text": "Docs Page Category : Node, Concept or Topic."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "List",
|
||||
"text": "Docs Topic Name: The name of the topic which the new page will belong to.",
|
||||
"updated": 1609149944222
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "List",
|
||||
"text": "Docs Page Name : For Nodes it is the type of node, for Concepts, the concept name, for topics, the topic's page name."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Docs Page Numer: A page number that you would like to assing the new page. This will impact only at the position of the Topic Index.",
|
||||
"updated": 1609149987475
|
||||
"style": "List",
|
||||
"text": "Docs Page Numer: Optional. A page number that you would like to assing the new page. This will impact only at the position of the Topic Index. If you don't provide one, it will be automatically assigned the last page number in the collection plus 1.",
|
||||
"updated": 1610706305834
|
||||
}
|
||||
]
|
||||
}
|
||||
+48
-10
@@ -13,7 +13,7 @@
|
||||
"updated": 1609152160707
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Option 1:",
|
||||
"updated": 1609152344322
|
||||
},
|
||||
@@ -23,7 +23,7 @@
|
||||
"updated": 1609152359725
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Example:"
|
||||
},
|
||||
{
|
||||
@@ -32,16 +32,16 @@
|
||||
"updated": 1609152405379
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Option 2:"
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"style": "Json",
|
||||
"text": "docs.delete Concept from Project: Docs Page Name",
|
||||
"updated": 1609152445366
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Example:"
|
||||
},
|
||||
{
|
||||
@@ -50,7 +50,7 @@
|
||||
"updated": 1609152464312
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Option 3:"
|
||||
},
|
||||
{
|
||||
@@ -59,7 +59,7 @@
|
||||
"updated": 1609152484236
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Subtitle",
|
||||
"text": "Example:"
|
||||
},
|
||||
{
|
||||
@@ -67,20 +67,58 @@
|
||||
"text": "docs.delete Topic from Superalgos: Docs Styles->Docs Text Style->1",
|
||||
"updated": 1609152521245
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Option 4:",
|
||||
"updated": 1610706965604
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.delete Tutorial from Project: Docs Tutorial Name->Docs Page Name->Docs Page Number",
|
||||
"updated": 1610706951438
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Example:"
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.delete Tutorial from Superalgos: How to Build Indicatiors->Intro->1",
|
||||
"updated": 1610707006603
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Option 5:",
|
||||
"updated": 1610707021714
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.delete Review from Project: Docs Review Name->Docs Page Name->Docs Page Number",
|
||||
"updated": 1610707068615
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Example:"
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "docs.delete Review from Project: Superalgos Project Review->Awasome!->2",
|
||||
"updated": 1610707101903
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Parameters"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "List",
|
||||
"text": "Project : Is the project where the Node, Concept or Topic is defined."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "List",
|
||||
"text": "Docs Page Category : Node, Concept or Topic."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "List",
|
||||
"text": "Docs Page Name : For Nodes it is the type of node, for Concepts, the concept name, for topics, the topic's page name."
|
||||
}
|
||||
]
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"topic": "Docs Commands Errors",
|
||||
"pageNumber": "17",
|
||||
"type": "No Matching Topic Or Tutorial Found",
|
||||
"type": "No Matching Topic, Tutorial or Review Found",
|
||||
"definition": {
|
||||
"text": "The Topic or Tutorial you specified did not produce any match of pages within that Topic or Tutorial.",
|
||||
"updated": 1610398888306
|
||||
|
||||
+33
-25
@@ -87,7 +87,8 @@
|
||||
This variable tell us which day we are standing at, specially while working
|
||||
with Daily Files. From this Date is that we are going to load the Daily Files.
|
||||
*/
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingEngine.current.episode.processDate.value = TS.projects.superalgos.utilities.dateTimeFunctions.removeTime(TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange.config.initialDatetime).valueOf()
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingEngine.current.episode.processDate.value =
|
||||
TS.projects.superalgos.utilities.dateTimeFunctions.removeTime(TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange.config.initialDatetime).valueOf()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -483,35 +484,47 @@
|
||||
continue
|
||||
}
|
||||
|
||||
/*
|
||||
If it is not a dependency then we pass..
|
||||
*/
|
||||
if (dataDependenciesModule.isItADepenency(timeFrameLabel, datasetModule.node.parentNode.config.singularVariableName) !== true) {
|
||||
if (!(TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeFrame.config.label === timeFrameLabel && datasetModule.node.parentNode.config.pluralVariableName === 'candles')) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
let dateForPath = tradingProcessDate.getUTCFullYear() + '/' + TS.projects.superalgos.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCMonth() + 1, 2) + '/' + TS.projects.superalgos.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCDate(), 2);
|
||||
let filePath
|
||||
if (dependency.referenceParent.config.codeName === "Multi-Period-Daily") {
|
||||
filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + timeFrameLabel + "/" + dateForPath;
|
||||
} else {
|
||||
filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + dateForPath;
|
||||
}
|
||||
let fileName = "Data.json";
|
||||
/*
|
||||
We will need to fetch the data of the current day and the previous day, in order for .previous properties in conditions and formulas to work well.
|
||||
*/
|
||||
let previousDate = new Date(tradingProcessDate.valueOf() - TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
let currentDate = new Date(tradingProcessDate.valueOf())
|
||||
|
||||
/* We cut the async calls via callBacks at this point, so as to have a clearer code upstream */
|
||||
let response = await asyncGetDatasetFile(datasetModule, filePath, fileName)
|
||||
let previousFile = await getDataFileFromDate(previousDate)
|
||||
if (previousFile === false) { return false }
|
||||
let currentFile = await getDataFileFromDate(currentDate)
|
||||
if (currentFile === false) { return false }
|
||||
let bothFiles = previousFile.concat(currentFile)
|
||||
dataFiles.set(dependency.id, bothFiles)
|
||||
|
||||
if (response.err.message === 'File does not exist.') {
|
||||
return false
|
||||
}
|
||||
if (response.err.result !== TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
|
||||
throw (response.err)
|
||||
}
|
||||
async function getDataFileFromDate(processDate) {
|
||||
|
||||
let dataFile = JSON.parse(response.text);
|
||||
dataFiles.set(dependency.id, dataFile);
|
||||
let dateForPath = processDate.getUTCFullYear() + '/' + TS.projects.superalgos.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '/' + TS.projects.superalgos.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2);
|
||||
let filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + timeFrameLabel + "/" + dateForPath
|
||||
let fileName = "Data.json";
|
||||
|
||||
/* We cut the async calls via callBacks at this point, so as to have a clearer code upstream */
|
||||
let response = await asyncGetDatasetFile(datasetModule, filePath, fileName)
|
||||
|
||||
if (response.err.message === 'File does not exist.') {
|
||||
return false
|
||||
}
|
||||
if (response.err.result !== TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
|
||||
throw (response.err)
|
||||
}
|
||||
|
||||
return JSON.parse(response.text)
|
||||
}
|
||||
}
|
||||
|
||||
let mapKey = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1];
|
||||
multiPeriodDataFiles.set(mapKey, dataFiles)
|
||||
}
|
||||
@@ -757,11 +770,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function pad(str, max) {
|
||||
str = str.toString();
|
||||
return str.length < max ? pad(" " + str, max) : str;
|
||||
}
|
||||
|
||||
async function asyncGetDatasetFile(datasetModule, filePath, fileName) {
|
||||
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
|
||||
+21
-3
@@ -45,6 +45,23 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) {
|
||||
let propertyName = 'at' + sessionParameters.timeFrame.config.label.replace('-', '')
|
||||
let candles = chart[propertyName].candles
|
||||
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) {
|
||||
/*
|
||||
We need to purge from the candles array all the candles from the previous day
|
||||
that comes when processing daily files.
|
||||
*/
|
||||
let dailyCandles = []
|
||||
for (let i = 0; i < candles.length; i++) {
|
||||
let candle = candles[i]
|
||||
if (candle.begin >= TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingEngine.current.episode.processDate.value) {
|
||||
dailyCandles.push(candle)
|
||||
}
|
||||
}
|
||||
candles = dailyCandles
|
||||
} else {
|
||||
candles = chart[propertyName].candles
|
||||
}
|
||||
|
||||
/* Variables needed for heartbeat functionality */
|
||||
let heartBeatDate
|
||||
let previousHeartBeatDate
|
||||
@@ -55,7 +72,8 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) {
|
||||
if (
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).IS_SESSION_FIRST_LOOP === true &&
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).IS_SESSION_RESUMING === false) {
|
||||
/* Estimate Initial Candle based on the timeRage configured for the session. */
|
||||
|
||||
/* Estimate Initial Candle based on the timeRange configured for the session. */
|
||||
let firstEnd = candles[0].end
|
||||
let targetEnd = sessionParameters.timeRange.config.initialDatetime
|
||||
let diff = targetEnd - firstEnd
|
||||
@@ -73,8 +91,8 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) {
|
||||
'[IMPORTANT] runSimulation -> Data is not up-to-date enough. Stopping the Session now. ')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
|
||||
} else {
|
||||
/*
|
||||
In this case we already have at the last candle index the next candle to be
|
||||
processed. We will just continue with this candle.
|
||||
@@ -545,7 +563,7 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) {
|
||||
return true
|
||||
}
|
||||
} catch (err) {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
'[ERROR] runSimulation -> err = ' + err.stack)
|
||||
throw (TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE)
|
||||
}
|
||||
|
||||
@@ -202,6 +202,10 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsTutorialSchema.get(type)
|
||||
break
|
||||
}
|
||||
case 'review': {
|
||||
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
|
||||
break
|
||||
}
|
||||
case 'book': {
|
||||
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsBookSchema.get(type)
|
||||
break
|
||||
@@ -272,7 +276,7 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
}
|
||||
case 'topic': {
|
||||
let splittedSecondaryCommand = secondaryCommand.split('->')
|
||||
if (splittedSecondaryCommand.length < 3) {
|
||||
if (splittedSecondaryCommand.length < 2) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Too Few Parameters', 'Anchor Too Few Paramenters')
|
||||
return
|
||||
}
|
||||
@@ -281,13 +285,22 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
}
|
||||
case 'tutorial': {
|
||||
let splittedSecondaryCommand = secondaryCommand.split('->')
|
||||
if (splittedSecondaryCommand.length < 3) {
|
||||
if (splittedSecondaryCommand.length < 2) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Too Few Parameters', 'Anchor Too Few Paramenters')
|
||||
return
|
||||
}
|
||||
addTutorial(splittedPrimaryCommand[3], splittedSecondaryCommand[0], splittedSecondaryCommand[1], splittedSecondaryCommand[2])
|
||||
return
|
||||
}
|
||||
case 'review': {
|
||||
let splittedSecondaryCommand = secondaryCommand.split('->')
|
||||
if (splittedSecondaryCommand.length < 2) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Too Few Parameters', 'Anchor Too Few Paramenters')
|
||||
return
|
||||
}
|
||||
addReview(splittedPrimaryCommand[3], splittedSecondaryCommand[0], splittedSecondaryCommand[1], splittedSecondaryCommand[2])
|
||||
return
|
||||
}
|
||||
case 'book': {
|
||||
addBook(splittedPrimaryCommand[3], secondaryCommand)
|
||||
return
|
||||
@@ -366,6 +379,15 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
deleteTutorial(splittedPrimaryCommand[3], splittedSecondaryCommand[0], splittedSecondaryCommand[1], splittedSecondaryCommand[2])
|
||||
return
|
||||
}
|
||||
case 'review': {
|
||||
let splittedSecondaryCommand = secondaryCommand.split('->')
|
||||
if (splittedSecondaryCommand.length < 3) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Too Few Parameters', 'Anchor Too Few Paramenters')
|
||||
return
|
||||
}
|
||||
deleteReview(splittedPrimaryCommand[3], splittedSecondaryCommand[0], splittedSecondaryCommand[1], splittedSecondaryCommand[2])
|
||||
return
|
||||
}
|
||||
case 'book': {
|
||||
deleteBook(splittedPrimaryCommand[3], secondaryCommand)
|
||||
return
|
||||
@@ -429,6 +451,10 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
repaginate(splittedPrimaryCommand[3], 'Tutorial', secondaryCommand)
|
||||
return
|
||||
}
|
||||
case 'review': {
|
||||
repaginate(splittedPrimaryCommand[3], 'Review', secondaryCommand)
|
||||
return
|
||||
}
|
||||
case 'book': {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Category Not Valid', 'Anchor Category Not Valid')
|
||||
return
|
||||
@@ -488,6 +514,10 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Tutorial-Schema/' + project, onResponse)
|
||||
requestsSent++
|
||||
|
||||
docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema
|
||||
httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Review-Schema/' + project, onResponse)
|
||||
requestsSent++
|
||||
|
||||
docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema
|
||||
httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Book-Schema/' + project, onResponse)
|
||||
requestsSent++
|
||||
@@ -580,6 +610,21 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
}
|
||||
SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema = documents
|
||||
|
||||
/* Reviews */
|
||||
documents = []
|
||||
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema.length; i++) {
|
||||
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema[i]
|
||||
docsSchemaDocument.updated = undefined
|
||||
docsSchemaDocument.created = undefined
|
||||
|
||||
if (docsSchemaDocument.deleted === true) {
|
||||
SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.delete(docsSchemaDocument.type)
|
||||
} else {
|
||||
documents.push(docsSchemaDocument)
|
||||
}
|
||||
}
|
||||
SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema = documents
|
||||
|
||||
/* Books */
|
||||
documents = []
|
||||
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema.length; i++) {
|
||||
@@ -611,7 +656,7 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
)
|
||||
|
||||
if (orderedArray.length = 0) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'No Matching Topic Or Tutorial Found')
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'No Matching Topic, Tutorial or Review Found')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -681,6 +726,17 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
}
|
||||
|
||||
function addTopic(project, topic, type, pageNumber) {
|
||||
if (pageNumber === undefined) {
|
||||
|
||||
let orderedArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
|
||||
project,
|
||||
'Topic',
|
||||
review
|
||||
)
|
||||
|
||||
pageNumber = orderedArray.length + 1
|
||||
}
|
||||
|
||||
let template = {
|
||||
created: true,
|
||||
topic: topic,
|
||||
@@ -710,6 +766,17 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
}
|
||||
|
||||
function addTutorial(project, tutorial, type, pageNumber) {
|
||||
if (pageNumber === undefined) {
|
||||
|
||||
let orderedArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
|
||||
project,
|
||||
'Tutorial',
|
||||
review
|
||||
)
|
||||
|
||||
pageNumber = orderedArray.length + 1
|
||||
}
|
||||
|
||||
let template = {
|
||||
created: true,
|
||||
tutorial: tutorial,
|
||||
@@ -738,6 +805,46 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo(project, 'Tutorial', type)
|
||||
}
|
||||
|
||||
function addReview(project, review, type, pageNumber) {
|
||||
if (pageNumber === undefined) {
|
||||
|
||||
let orderedArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
|
||||
project,
|
||||
'Review',
|
||||
review
|
||||
)
|
||||
|
||||
pageNumber = orderedArray.length + 1
|
||||
}
|
||||
|
||||
let template = {
|
||||
created: true,
|
||||
review: review,
|
||||
pageNumber: pageNumber,
|
||||
type: type,
|
||||
definition: { text: "Write here a summary for this review page." },
|
||||
paragraphs: [
|
||||
{
|
||||
style: "Text",
|
||||
text: UI.projects.superalgos.globals.docs.NEW_PARAGRAPH_TEXT
|
||||
}
|
||||
]
|
||||
}
|
||||
if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Project Does Not Exist', 'Anchor Project Does Not Exist')
|
||||
return
|
||||
}
|
||||
let exist = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
|
||||
if (exist !== undefined) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Page Already Exists', 'Anchor Page Already Exists')
|
||||
return
|
||||
}
|
||||
|
||||
SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema.push(template)
|
||||
SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.set(type, template)
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo(project, 'Review', type)
|
||||
}
|
||||
|
||||
function addBook(project, type) {
|
||||
let template = {
|
||||
created: true,
|
||||
@@ -852,6 +959,32 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Message - Deleting Succeed')
|
||||
}
|
||||
|
||||
function deleteReview(project, review, type, pageNumber) {
|
||||
if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Project Does Not Exist', 'Anchor Project Does Not Exist')
|
||||
return
|
||||
}
|
||||
let exist = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
|
||||
if (exist === undefined) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Page Does Not Exist', 'Anchor Page Does Not Exist')
|
||||
return
|
||||
} else {
|
||||
if (exist.pageNumber !== pageNumber) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Page Number Mismatch', 'Anchor Page Number Mismatch')
|
||||
return
|
||||
}
|
||||
if (exist.review !== review) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Review Mismatch', 'Anchor Review Mismatch')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
let schemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
|
||||
schemaDocument.deleted = true
|
||||
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Message - Deleting Succeed')
|
||||
}
|
||||
|
||||
function deleteBook(project, type) {
|
||||
if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Project Does Not Exist', 'Anchor Project Does Not Exist')
|
||||
|
||||
@@ -2,7 +2,7 @@ function newSuperalgosDocsContextMenu() {
|
||||
let thisObject = {
|
||||
selectedParagraph: undefined,
|
||||
getSelection: getSelection,
|
||||
forceOutClick: forceOutClick,
|
||||
removeContextMenuFromScreen: removeContextMenuFromScreen,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
@@ -53,7 +53,7 @@ function newSuperalgosDocsContextMenu() {
|
||||
}
|
||||
|
||||
function editParagraph() {
|
||||
forceOutClick()
|
||||
removeContextMenuFromScreen()
|
||||
showHTMLTextArea()
|
||||
|
||||
function showHTMLTextArea() {
|
||||
@@ -107,7 +107,7 @@ function newSuperalgosDocsContextMenu() {
|
||||
UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.appendChild(UI.projects.superalgos.spaces.docsSpace.textArea)
|
||||
UI.projects.superalgos.spaces.docsSpace.textArea.style.display = 'block'
|
||||
UI.projects.superalgos.spaces.docsSpace.textArea.focus()
|
||||
forceOutClick()
|
||||
removeContextMenuFromScreen()
|
||||
UI.projects.superalgos.spaces.docsSpace.enterEditMode()
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ function newSuperalgosDocsContextMenu() {
|
||||
if (selectedParagraphIndex === undefined) { return }
|
||||
if (selectedParagraphIndex === 0) { return }
|
||||
UI.projects.superalgos.spaces.docsSpace.documentPage.docsSchemaDocument.paragraphs.splice(selectedParagraphIndex, 1)
|
||||
forceOutClick()
|
||||
removeContextMenuFromScreen()
|
||||
UI.projects.superalgos.spaces.docsSpace.documentPage.docsSchemaDocument.updated = true
|
||||
UI.projects.superalgos.spaces.docsSpace.documentPage.render()
|
||||
}
|
||||
@@ -260,20 +260,20 @@ function newSuperalgosDocsContextMenu() {
|
||||
}
|
||||
|
||||
UI.projects.superalgos.utilities.clipboard.copyTextToClipboard(clipboard)
|
||||
forceOutClick()
|
||||
removeContextMenuFromScreen()
|
||||
}
|
||||
|
||||
function replaceStyle(docSchemaParagraph, style) {
|
||||
if (docSchemaParagraph.style !== style) {
|
||||
UI.projects.superalgos.spaces.docsSpace.documentPage.docsSchemaDocument.updated = true
|
||||
docSchemaParagraph.style = style
|
||||
forceOutClick()
|
||||
removeContextMenuFromScreen()
|
||||
UI.projects.superalgos.spaces.docsSpace.documentPage.render()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function forceOutClick() {
|
||||
function removeContextMenuFromScreen() {
|
||||
const outClick = document.getElementById('docs-space-div')
|
||||
const menu = document.getElementById('menu')
|
||||
menu.classList.remove('show')
|
||||
|
||||
@@ -18,7 +18,7 @@ function newSuperalgosDocSpace() {
|
||||
currentDocumentBeingRendered: undefined,
|
||||
previousDocumentBeingRendered: undefined,
|
||||
currentBookBeingRendered: undefined,
|
||||
paragraphMap: undefined, // Here we will store a map of paragraphs from the Docs Node, Concept, Topics, Tutorials or Books Schema in order to find it when we need to update them.
|
||||
paragraphMap: undefined, // Here we will store a map of paragraphs from the Docs Node, Concept, Topics, Tutorials, Reviews or Books Schema in order to find it when we need to update them.
|
||||
textArea: undefined,
|
||||
changeLanguage: changeLanguage,
|
||||
changeActiveBranch: changeActiveBranch,
|
||||
|
||||
@@ -49,6 +49,10 @@ function newSuperalgosDocsDocumentPage() {
|
||||
thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsTutorialSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type)
|
||||
break
|
||||
}
|
||||
case 'Review': {
|
||||
thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsReviewSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type)
|
||||
break
|
||||
}
|
||||
case 'Workspace': {
|
||||
thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.workspaceSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId)
|
||||
break
|
||||
@@ -124,6 +128,7 @@ function newSuperalgosDocsDocumentPage() {
|
||||
let hierarchyImagesArray = []
|
||||
let orderedTopicPageIndexArray = []
|
||||
let orderedTutorialPageIndexArray = []
|
||||
let orderedReviewPageIndexArray = []
|
||||
let HTML = ''
|
||||
|
||||
HTML = HTML + '<section id="docs-search-results-div" class="docs-search-page-container">'
|
||||
@@ -181,7 +186,7 @@ function newSuperalgosDocsDocumentPage() {
|
||||
*/
|
||||
generateTopicPreviousAndNextPageNavigation()
|
||||
|
||||
HTML = HTML = HTML + '<div class="docs-topic-index">' // Container for Topic Navigation including buttons, title and index
|
||||
HTML = HTML + '<div class="docs-topic-index">' // Container for Topic Navigation including buttons, title and index
|
||||
|
||||
HTML = HTML + '<h3 class="docs-h3">' + thisObject.docsSchemaDocument.topic + ' — TOC</h3>'
|
||||
|
||||
@@ -189,7 +194,7 @@ function newSuperalgosDocsDocumentPage() {
|
||||
|
||||
generateTopicMultiPageIndex()
|
||||
|
||||
HTML = HTML = HTML + '</div>' // END Container for Topic Navigation
|
||||
HTML = HTML + '</div>' // END Container for Topic Navigation
|
||||
}
|
||||
|
||||
if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category === 'Tutorial') {
|
||||
@@ -207,7 +212,7 @@ function newSuperalgosDocsDocumentPage() {
|
||||
|
||||
generateTutorialPreviousAndNextPageNavigation()
|
||||
|
||||
HTML = HTML = HTML + '<div class="docs-topic-index">' // Container for Tutorial Navigation including buttons, title and index
|
||||
HTML = HTML + '<div class="docs-topic-index">' // Container for Tutorial Navigation including buttons, title and index
|
||||
|
||||
HTML = HTML + '<h3 class="docs-h3">' + thisObject.docsSchemaDocument.tutorial + ' — TOC</h3>'
|
||||
|
||||
@@ -215,7 +220,33 @@ function newSuperalgosDocsDocumentPage() {
|
||||
|
||||
generateTutorialMultiPageIndex()
|
||||
|
||||
HTML = HTML = HTML + '</div>' // END Container for Tutorial Navigation
|
||||
HTML = HTML + '</div>' // END Container for Tutorial Navigation
|
||||
}
|
||||
|
||||
if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category === 'Review') {
|
||||
|
||||
orderedReviewPageIndexArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
|
||||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project,
|
||||
'Review',
|
||||
thisObject.docsSchemaDocument.review
|
||||
)
|
||||
|
||||
/* Review Title
|
||||
titleLabel = thisObject.docsSchemaDocument.review + ' Review Navigation'
|
||||
HTML = HTML + '<div id="docs-main-title-div" class="docs-title-table"><div class="docs-table-cell"><h2 class="docs-h2" id="' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type.toLowerCase().replace(' ', '-') + '" > ' + titleLabel + '</h2></div><div id="projectImageDiv" class="docs-image-container"/></div></div>'
|
||||
*/
|
||||
|
||||
generateReviewPreviousAndNextPageNavigation()
|
||||
|
||||
HTML = HTML + '<div class="docs-topic-index">' // Container for Review Navigation including buttons, title and index
|
||||
|
||||
HTML = HTML + '<h3 class="docs-h3">' + thisObject.docsSchemaDocument.review + ' — TOC</h3>'
|
||||
|
||||
HTML = HTML + '<p style="margin-bottom: 15px;">You just read page <strong>' + thisObject.docsSchemaDocument.pageNumber + '</strong> of this review collection.</p>'
|
||||
|
||||
generateReviewMultiPageIndex()
|
||||
|
||||
HTML = HTML + '</div>' // END Container for Review Navigation
|
||||
}
|
||||
|
||||
HTML = HTML + '</div>' // Common Style Container Ends
|
||||
@@ -258,7 +289,7 @@ function newSuperalgosDocsDocumentPage() {
|
||||
each node will have an icon. For the rest only if we could load an
|
||||
image we use a table, otherwise we will render the definitaion as a Summary.
|
||||
*/
|
||||
if ((category === 'Topic' || category === 'Tutorial' || category === 'Concept' || category === 'Book') && testElement === undefined) {
|
||||
if ((category === 'Topic' || category === 'Tutorial' || category === 'Review' || category === 'Concept' || category === 'Book') && testElement === undefined) {
|
||||
HTML = HTML + '<div id="definition-summary-editable-paragraph" class="docs-summary"><b>Summary:</b> ' + UI.projects.superalgos.utilities.docs.addToolTips(definitionText, UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) + '</div>'
|
||||
} else {
|
||||
HTML = HTML + '<div class="docs-definition-table">'
|
||||
@@ -310,14 +341,11 @@ function newSuperalgosDocsDocumentPage() {
|
||||
the documents that share the same key thatn the document we are rendering now.
|
||||
With the info on those picked document we will build the index.
|
||||
*/
|
||||
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
|
||||
let paragraph
|
||||
|
||||
|
||||
|
||||
for (let i = 0; i < orderedTopicPageIndexArray.length; i++) {
|
||||
let arrayItem = orderedTopicPageIndexArray[i]
|
||||
key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
|
||||
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
|
||||
paragraph = {
|
||||
style: "Title",
|
||||
text: "" + arrayItem.type + ""
|
||||
@@ -359,12 +387,11 @@ function newSuperalgosDocsDocumentPage() {
|
||||
the documents that share the same key thatn the document we are rendering now.
|
||||
With the info on those picked document we will build the index.
|
||||
*/
|
||||
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
|
||||
let paragraph
|
||||
|
||||
for (let i = 0; i < orderedTutorialPageIndexArray.length; i++) {
|
||||
let arrayItem = orderedTutorialPageIndexArray[i]
|
||||
key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
|
||||
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
|
||||
paragraph = {
|
||||
style: "Title",
|
||||
text: "" + arrayItem.type + ""
|
||||
@@ -374,6 +401,51 @@ function newSuperalgosDocsDocumentPage() {
|
||||
}
|
||||
}
|
||||
|
||||
function generateReviewPreviousAndNextPageNavigation() {
|
||||
let previousPage
|
||||
let nextPage
|
||||
|
||||
for (let i = 0; i < orderedReviewPageIndexArray.length; i++) {
|
||||
let arrayItem = orderedReviewPageIndexArray[i]
|
||||
|
||||
if (thisObject.docsSchemaDocument.type === arrayItem.type) {
|
||||
previousPage = orderedReviewPageIndexArray[i - 1]
|
||||
nextPage = orderedReviewPageIndexArray[i + 1]
|
||||
|
||||
HTML = HTML + '<div class="docs-topic-navigation"><div>'
|
||||
if (previousPage !== undefined) {
|
||||
HTML = HTML + '<span" onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project + '\', \'' + 'Review' + '\', \'' + previousPage.type.replace(/'/g, 'AMPERSAND') + '\')"><button> Previous </button></span><br/>' + previousPage.type
|
||||
}
|
||||
HTML = HTML + '</div><div>'
|
||||
if (nextPage !== undefined) {
|
||||
HTML = HTML + '<span" onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project + '\', \'' + 'Review' + '\', \'' + nextPage.type.replace(/'/g, 'AMPERSAND') + '\')"><button> Next </button></span><br/>' + nextPage.type
|
||||
}
|
||||
HTML = HTML + '</div></div>'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateReviewMultiPageIndex() {
|
||||
/*
|
||||
We will go through all the schema docuents array for the current project and pick
|
||||
the documents that share the same key thatn the document we are rendering now.
|
||||
With the info on those picked document we will build the index.
|
||||
*/
|
||||
let paragraph
|
||||
|
||||
for (let i = 0; i < orderedReviewPageIndexArray.length; i++) {
|
||||
let arrayItem = orderedReviewPageIndexArray[i]
|
||||
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
|
||||
paragraph = {
|
||||
style: "Title",
|
||||
text: "" + arrayItem.type + ""
|
||||
}
|
||||
autoGeneratedParagraphIndex++
|
||||
HTML = HTML + '<p>' + arrayItem.pageNumber + '. ' + '<a onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project + '\', \'' + 'Review' + '\', \'' + arrayItem.type.replace(/'/g, 'AMPERSAND') + '\')">' + paragraph.text + '</a></p>'
|
||||
}
|
||||
}
|
||||
|
||||
function addContent() {
|
||||
HTML = HTML + '<div id="docs-content">'
|
||||
if (thisObject.docsSchemaDocument.paragraphs !== undefined) {
|
||||
@@ -458,11 +530,15 @@ function newSuperalgosDocsDocumentPage() {
|
||||
includedSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsTutorialSchema.get(type)
|
||||
break
|
||||
}
|
||||
case 'Review': {
|
||||
includedSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
|
||||
break
|
||||
}
|
||||
case 'Book': {
|
||||
includedSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsBookSchema.get(type)
|
||||
break
|
||||
}
|
||||
default: return 'Category provided (' + category + ') not valid. Use Node, Concept, Topic, Tutorial or Book instead.'
|
||||
default: return 'Category provided (' + category + ') not valid. Use Node, Concept, Topic, Review or Book instead.'
|
||||
}
|
||||
if (includedSchemaDocument === undefined) {
|
||||
return category + ' document ' + type + ' not found at project ' + project
|
||||
@@ -531,8 +607,8 @@ function newSuperalgosDocsDocumentPage() {
|
||||
return 'Chapter paragraph style Syntax Error. The Project <i>' + project + '</i> could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.'
|
||||
}
|
||||
|
||||
if (category !== 'Topic' && category !== 'Tutorial') {
|
||||
return 'Category must be either Topic or Tutorial. Found: <i>' + category + '</i>'
|
||||
if (category !== 'Topic' && category !== 'Tutorial' && category !== 'Review') {
|
||||
return 'Category must be either Topic, Tutorial or Review. Found: <i>' + category + '</i>'
|
||||
}
|
||||
|
||||
switch (category) {
|
||||
@@ -560,9 +636,21 @@ function newSuperalgosDocsDocumentPage() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'Review': {
|
||||
orderedReviewPageIndexArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
|
||||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project,
|
||||
'Review',
|
||||
chapterName
|
||||
)
|
||||
|
||||
if (orderedReviewPageIndexArray.length === 0) {
|
||||
return 'Chapter paragraph style Syntax Error. The Review <i>' + chapterName + '</i> could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.'
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
HTML = HTML = HTML + '<div class="docs-topic-index">' // Container for Topic Index
|
||||
HTML = HTML + '<div class="docs-topic-index">' // Container for Topic Index
|
||||
|
||||
let key = 'auto-generated-paragraph-' + autoGeneratedParagraphIndex
|
||||
paragraph = {
|
||||
@@ -598,9 +686,13 @@ function newSuperalgosDocsDocumentPage() {
|
||||
generateTutorialMultiPageIndex()
|
||||
break
|
||||
}
|
||||
case 'Review': {
|
||||
generateReviewMultiPageIndex()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
HTML = HTML = HTML + '</div>' // Container for Topic Index
|
||||
HTML = HTML + '</div>' // Container for Topic Index
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1841,7 +1933,7 @@ function newSuperalgosDocsDocumentPage() {
|
||||
|
||||
outClick.addEventListener('click', () => {
|
||||
if (EDITOR_ON_FOCUS !== true) {
|
||||
UI.projects.superalgos.spaces.docsSpace.contextMenu.forceOutClick()
|
||||
UI.projects.superalgos.spaces.docsSpace.contextMenu.removeContextMenuFromScreen()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
function newSuperalgosDocsMainSearchPage() {
|
||||
let thisObject = {
|
||||
addSearchHeader: addSearchHeader,
|
||||
addSearchHeader: addSearchHeader,
|
||||
detectEnterOnSearchBox: detectEnterOnSearchBox,
|
||||
setFocusOnSearchBox: setFocusOnSearchBox,
|
||||
render: render,
|
||||
render: render,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
@@ -51,9 +51,10 @@ function newSuperalgosDocsMainSearchPage() {
|
||||
}
|
||||
element.addEventListener("keyup", function (event) {
|
||||
if (event.key === "Enter" || event.keyCode === 13) {
|
||||
UI.projects.superalgos.spaces.docsSpace.exitEditMode()
|
||||
UI.projects.superalgos.spaces.docsSpace.currentBookBeingRendered = undefined
|
||||
UI.projects.superalgos.spaces.docsSpace.contextMenu.forceOutClick()
|
||||
UI.projects.superalgos.spaces.docsSpace.commandInterface.command = element.value
|
||||
UI.projects.superalgos.spaces.docsSpace.contextMenu.removeContextMenuFromScreen()
|
||||
UI.projects.superalgos.spaces.docsSpace.commandInterface.command = element.value.trim()
|
||||
UI.projects.superalgos.spaces.docsSpace.commandInterface.detectCommands()
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ function newSuperalgosDocsSearchEngine() {
|
||||
|
||||
function setUpSearchEngine() {
|
||||
|
||||
setUpWorkspaceSchemas()
|
||||
setUpWorkspaceSchemas()
|
||||
thisObject.docsIndex = []
|
||||
|
||||
for (let j = 0; j < PROJECTS_ARRAY.length; j++) {
|
||||
@@ -70,6 +70,17 @@ function newSuperalgosDocsSearchEngine() {
|
||||
indexDocument(documentIndex)
|
||||
thisObject.docsIndex.push(documentIndex)
|
||||
}
|
||||
/* Search in Reviews */
|
||||
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema.length; i++) {
|
||||
documentIndex = {
|
||||
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
|
||||
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema[i],
|
||||
category: 'Review',
|
||||
project: project
|
||||
}
|
||||
indexDocument(documentIndex)
|
||||
thisObject.docsIndex.push(documentIndex)
|
||||
}
|
||||
/* Search in Books */
|
||||
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema.length; i++) {
|
||||
documentIndex = {
|
||||
@@ -114,6 +125,13 @@ function newSuperalgosDocsSearchEngine() {
|
||||
}
|
||||
indexParagraph(paragraph)
|
||||
}
|
||||
if (documentIndex.docsSchemaDocument.review !== undefined) {
|
||||
let paragraph = {
|
||||
style: 'Review',
|
||||
text: documentIndex.docsSchemaDocument.review
|
||||
}
|
||||
indexParagraph(paragraph)
|
||||
}
|
||||
if (documentIndex.docsSchemaDocument.type !== undefined) {
|
||||
let paragraph = {
|
||||
style: 'Type',
|
||||
|
||||
@@ -49,6 +49,11 @@ function newSuperalgosDocsSearchResultsPage() {
|
||||
documentPoints = documentPoints + thisPhraseCount * 200
|
||||
}
|
||||
}
|
||||
if (documentIndex.docsSchemaDocument.review !== undefined) {
|
||||
if (key === UI.projects.superalgos.utilities.strings.cleanTextOfCommonWordEndings(documentIndex.docsSchemaDocument.review.toLowerCase())) {
|
||||
documentPoints = documentPoints + thisPhraseCount * 200
|
||||
}
|
||||
}
|
||||
|
||||
switch (style) {
|
||||
case 'topic': {
|
||||
@@ -59,6 +64,10 @@ function newSuperalgosDocsSearchResultsPage() {
|
||||
documentPoints = documentPoints + thisPhraseCount * 100
|
||||
break
|
||||
}
|
||||
case 'review': {
|
||||
documentPoints = documentPoints + thisPhraseCount * 100
|
||||
break
|
||||
}
|
||||
case 'type': {
|
||||
documentPoints = documentPoints + thisPhraseCount * 50
|
||||
break
|
||||
@@ -194,7 +203,7 @@ function newSuperalgosDocsSearchResultsPage() {
|
||||
}
|
||||
|
||||
function buildHTML() {
|
||||
const tabs = ['All', 'Nodes', 'Concepts', 'Topics', 'Tutorials', 'Books', 'Workspace']
|
||||
const tabs = ['All', 'Nodes', 'Concepts', 'Topics', 'Tutorials', 'Reviews', 'Books', 'Workspace']
|
||||
let HTML = ''
|
||||
HTML = HTML + '<section id="docs-search-results-div" class="docs-search-page-container">'
|
||||
HTML = HTML + UI.projects.superalgos.spaces.docsSpace.mainSearchPage.addSearchHeader()
|
||||
@@ -265,6 +274,10 @@ function newSuperalgosDocsSearchResultsPage() {
|
||||
mainLink = result.documentIndex.docsSchemaDocument.tutorial + ' - Page ' + result.documentIndex.docsSchemaDocument.pageNumber + ' - ' + result.documentIndex.docsSchemaDocument.type
|
||||
break
|
||||
}
|
||||
case 'Review': {
|
||||
mainLink = result.documentIndex.docsSchemaDocument.review + ' - Page ' + result.documentIndex.docsSchemaDocument.pageNumber + ' - ' + result.documentIndex.docsSchemaDocument.type
|
||||
break
|
||||
}
|
||||
default: {
|
||||
mainLink = result.documentIndex.docsSchemaDocument.type
|
||||
}
|
||||
|
||||
@@ -1142,6 +1142,37 @@ function newSuperalgosTutorialSpace() {
|
||||
|
||||
let schemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsTutorialSchema.get(nodeConfig.docs.type)
|
||||
|
||||
if (schemaDocument === undefined) {
|
||||
schemaDocument = {
|
||||
type: 'Tutorial',
|
||||
definition: {
|
||||
text: "You need to reference a page at the docs at the config of this node. Use the docs property for that."
|
||||
},
|
||||
icon: {
|
||||
project: "Superalgos",
|
||||
name: "warning"
|
||||
},
|
||||
paragraphs: [
|
||||
{
|
||||
style: "Title",
|
||||
text: "Example"
|
||||
},
|
||||
{
|
||||
style: "Json",
|
||||
text: ' \"docs\": { \n' +
|
||||
'\"project\": \"Superalgos\",\n' +
|
||||
'\"category\": \"Tutorial\",\n' +
|
||||
'\"type\": \"Tutorial Step - Bla Bla\"\n' +
|
||||
'}'
|
||||
},
|
||||
{
|
||||
style: "Note",
|
||||
text: "If you did, then that page was not found."
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
newConfig = currentNode.config
|
||||
newDocument = JSON.stringify(schemaDocument) + ' - ' + UI.projects.superalgos.spaces.docsSpace.language
|
||||
|
||||
|
||||
@@ -40,6 +40,10 @@ function newSuperalgosUtilitiesDocs() {
|
||||
schemaArray = SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema
|
||||
break
|
||||
}
|
||||
case 'Review': {
|
||||
schemaArray = SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < schemaArray.length; i++) {
|
||||
@@ -54,6 +58,10 @@ function newSuperalgosUtilitiesDocs() {
|
||||
if (arrayItem.tutorial !== query) { continue }
|
||||
break
|
||||
}
|
||||
case 'Review': {
|
||||
if (arrayItem.review !== query) { continue }
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let itemAdded = false
|
||||
@@ -563,6 +571,11 @@ function newSuperalgosUtilitiesDocs() {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
|
||||
if (docsSchemaDocument !== undefined) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsBookSchema.get(type)
|
||||
if (docsSchemaDocument !== undefined) {
|
||||
found = true
|
||||
@@ -645,6 +658,7 @@ function newSuperalgosUtilitiesDocs() {
|
||||
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsConceptSchema)
|
||||
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsTopicSchema)
|
||||
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsTutorialSchema)
|
||||
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema)
|
||||
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsBookSchema)
|
||||
|
||||
function searchInSchema(docSchema) {
|
||||
|
||||
File renamed without changes.
@@ -44,6 +44,7 @@ function newAppPostLoader() {
|
||||
docsConceptSchema: [],
|
||||
docsTopicSchema: [],
|
||||
docsTutorialSchema: [],
|
||||
docsReviewSchema: [],
|
||||
docsBookSchema: []
|
||||
},
|
||||
map: {
|
||||
@@ -52,6 +53,7 @@ function newAppPostLoader() {
|
||||
docsConceptSchema: new Map(),
|
||||
docsTopicSchema: new Map(),
|
||||
docsTutorialSchema: new Map(),
|
||||
docsReviewSchema: new Map(),
|
||||
docsBookSchema: new Map()
|
||||
}
|
||||
}
|
||||
@@ -157,6 +159,26 @@ function newAppPostLoader() {
|
||||
if (webServerResponses === totalWebServerCalls) { startCanvas() }
|
||||
}
|
||||
|
||||
totalWebServerCalls++
|
||||
httpRequest(undefined, 'Schema/' + project + '/DocsReviewSchema', onResponseReviewSchema)
|
||||
|
||||
function onResponseReviewSchema(err, schema) {
|
||||
try {
|
||||
schemas.array.docsReviewSchema = JSON.parse(schema)
|
||||
|
||||
for (let j = 0; j < schemas.array.docsReviewSchema.length; j++) {
|
||||
let schemaDocument = schemas.array.docsReviewSchema[j]
|
||||
let key = schemaDocument.type
|
||||
schemas.map.docsReviewSchema.set(key, schemaDocument)
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err.stack)
|
||||
}
|
||||
|
||||
webServerResponses++
|
||||
if (webServerResponses === totalWebServerCalls) { startCanvas() }
|
||||
}
|
||||
|
||||
totalWebServerCalls++
|
||||
httpRequest(undefined, 'Schema/' + project + '/DocsBookSchema', onResponseBookSchema)
|
||||
|
||||
|
||||
Reference in new issue
Block a user