Function to migrate Tutorials Removed

This commit is contained in:
Luis Fernando Molina committed 2021-01-10 10:06:52 +01:00
1 parent 8b706aa0ed
commit 8f9d37972f
1 file changed
+1 -209
@@ -277,7 +277,7 @@ function newSuperalgosTutorialSpace() {
if (newDocumentationURL === currentDocumentationURL) { return }
currentDocumentationURL = newDocumentationURL
console.log('Trying to navigate to: ' + currentDocumentationURL + ' at ' + config.subTitle)
console.log('Trying to navigate to: ' + currentDocumentationURL + ' at ' + config.docs.type)
// TODO UI.projects.superalgos.spaces.docsSpace.openSpaceAreaAndNavigateTo('Superalgos', 'Node', currentDocumentationURL)
}
}
@@ -1109,212 +1109,6 @@ function newSuperalgosTutorialSpace() {
}
}
function buildDocument() {
let nodeConfig = JSON.parse(currentNode.config)
if (nodeConfig.docs !== undefined) { return }
if (
(nodeConfig.title === undefined || nodeConfig.title === "") &&
(nodeConfig.subTitle === undefined || nodeConfig.subTitle === "") &&
(nodeConfig.gif === undefined || nodeConfig.gif === "") &&
(nodeConfig.warning === undefined || nodeConfig.warning === "")
) {
return
}
PAGE_NUMBER = PAGE_NUMBER + 1
const project = 'Superalgos'
let type = 'Page Name'
let template = {
tutorial: TUTORIAL_NAME,
pageNumber: PAGE_NUMBER,
type: '',
definition: {
icon: {
project: 'Superalgos',
name: nodeConfig.image
},
text: "Write here a summary for this tutorial page."
},
paragraphs: [
]
}
/**DEFINITION */
if (nodeConfig.definition !== undefined && nodeConfig.definition !== "") {
template.definition.text = clean(nodeConfig.definition)
}
if (nodeConfig.summary !== undefined && nodeConfig.summary !== "") {
if (template.definition.text === 'Write here a summary for this tutorial page.') {
template.definition.text = nodeConfig.summary
} else {
template.definition.text = template.definition.text + ' ' + clean(nodeConfig.summary)
}
}
template.definition.text = template.definition.text.trim()
/* TITLE and SUBTITLE HANDLING */
if (nodeConfig.title !== undefined && nodeConfig.title !== "") {
template.type = currentNode.type + ' - ' + nodeConfig.title
if (nodeConfig.subTitle !== undefined && nodeConfig.subTitle !== '') {
let paragraph = {
style: 'Title',
text: clean(nodeConfig.subTitle)
}
template.paragraphs.push(paragraph)
}
} else {
template.type = currentNode.type + ' - ' + nodeConfig.subTitle
}
if (nodeConfig.bulletListIntro !== undefined && nodeConfig.bulletListIntro !== '') {
let paragraph = {
style: 'Text',
text: clean(nodeConfig.bulletListIntro)
}
template.paragraphs.push(paragraph)
}
if (nodeConfig.bulletArray !== undefined) {
for (let i = 0; i < nodeConfig.bulletArray.length; i++) {
let bullet = nodeConfig.bulletArray[i]
let paragraph = {
style: 'List',
text: clean(bullet[0]) + ' ' + clean(bullet[1])
}
template.paragraphs.push(paragraph)
}
}
if (nodeConfig.paragraph1 !== undefined && nodeConfig.paragraph1 !== '') {
let paragraph = {
style: 'Text',
text: clean(nodeConfig.paragraph1)
}
template.paragraphs.push(paragraph)
}
if (nodeConfig.callOut !== undefined && nodeConfig.callOut !== '') {
let paragraph = {
style: 'Callout',
text: clean(nodeConfig.callOut)
}
template.paragraphs.push(paragraph)
}
if (nodeConfig.externalLink !== undefined && nodeConfig.externalLink[0] !== "" && nodeConfig.externalLink[1] !== "") {
let paragraph = {
style: 'Link',
text: nodeConfig.externalLink[0] + '->' + nodeConfig.externalLink[1]
}
template.paragraphs.push(paragraph)
}
if (nodeConfig.paragraph2 !== undefined && nodeConfig.paragraph2 !== '') {
let paragraph = {
style: 'Text',
text: clean(nodeConfig.paragraph2)
}
template.paragraphs.push(paragraph)
}
if (nodeConfig.note !== undefined && nodeConfig.note !== '') {
let paragraph = {
style: 'Note',
text: clean(nodeConfig.note)
}
template.paragraphs.push(paragraph)
}
if (nodeConfig.tip !== undefined && nodeConfig.tip !== '') {
let paragraph = {
style: 'Success',
text: clean(nodeConfig.tip)
}
template.paragraphs.push(paragraph)
}
if (nodeConfig.important !== undefined && nodeConfig.important !== '') {
let paragraph = {
style: 'Important',
text: clean(nodeConfig.important)
}
template.paragraphs.push(paragraph)
}
if (nodeConfig.warning !== undefined && nodeConfig.warning !== '') {
let paragraph = {
style: 'Warning',
text: clean(nodeConfig.warning)
}
template.paragraphs.push(paragraph)
}
/**FULL SCREEN GIF */
if (nodeConfig.gif !== undefined && nodeConfig.gif !== "") {
let type = nodeConfig.gif.replaceAll("-", " ")
type = UI.projects.superalgos.utilities.strings.allWordsToUpper(type)
template.type = currentNode.type + ' - ' + type
template.definition.text = "This step will play a video in full screen mode."
let paragraph = {
style: 'Gif',
text: 'GIFs/Superalgos/Tutorials/' + nodeConfig.gif + '.gif'
}
template.paragraphs.push(paragraph)
}
SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema.push(template)
UI.projects.superalgos.spaces.docsSpace.navigateTo(project, 'Tutorial', template.type)
/* Here we will store the keys to access the Content from the Docs */
nodeConfig.docs = {
project: project,
category: 'Tutorial',
type: template.type
}
/* Deleting all the in-configuration content */
nodeConfig.title = undefined
nodeConfig.subTitle = undefined
nodeConfig.gif = undefined
nodeConfig.definition = undefined
nodeConfig.summary = undefined
nodeConfig.bulletListIntro = undefined
nodeConfig.bulletArray = undefined
nodeConfig.paragraph1 = undefined
nodeConfig.paragraph2 = undefined
nodeConfig.note = undefined
nodeConfig.warning = undefined
nodeConfig.tip = undefined
nodeConfig.important = undefined
nodeConfig.callOut = undefined
currentNode.config = JSON.stringify(nodeConfig, undefined, 4)
function clean(text) {
let result = text
result = result
.replaceAll('->', '')
.replaceAll('<b>', '')
.replaceAll('</b>', '')
.replaceAll('<i>', '')
.replaceAll('</i>', '')
.replaceAll('<kbd>', '')
.replaceAll('</kbd>', '')
.replaceAll('<code>', '')
.replaceAll('</code>', '')
.trim()
return result
}
}
function buildHTML() {
newConfig = currentNode.config
@@ -1331,8 +1125,6 @@ function newSuperalgosTutorialSpace() {
transformDocsInfoIntoTutorialInfo()
createTheHTML()
UI.projects.superalgos.spaces.docsSpace.navigateTo(nodeConfig.docs.project, 'Tutorial', nodeConfig.docs.type)
function transformDocsInfoIntoTutorialInfo() {
if (schemaDocument === undefined) {
title = "Configuration Error"