App Schema Auto Fix Feature

This commit is contained in:
Luis Fernando Molina committed 2021-10-11 20:07:37 +02:00
1 parent 9bbabb14ca
commit 23f13fa0c3
6 files changed
+212 -41

No files matched your search

@@ -27,6 +27,7 @@ function newFoundationsDocsCommmandInterface() {
function detectAppCommands() {
if (checkContributeCommand() === undefined) { return true }
if (checkUpdateCommand() === undefined) { return true }
if (fixAppSchema() === undefined) { return true }
function checkContributeCommand() {
if (UI.projects.education.spaces.docsSpace.commandInterface.command.toLowerCase() === 'app.help app.contribute') {
@@ -130,6 +131,19 @@ function newFoundationsDocsCommmandInterface() {
}
}
}
function fixAppSchema() {
if (UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf('App.fix') !== 0 && UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf('app.fix') !== 0) { return 'Not Update Commands' }
httpRequest(undefined, 'App/FixAppSchema', onResponse)
return
function onResponse(err, data) {
}
}
}
function detectDocsCommands() {
@@ -5,12 +5,13 @@
"action": "Add UI Object",
"label": "Add LAN Network Node",
"relatedUiObject": "LAN Network Node",
"relatedUiObjectProject": "Foundations",
"actionFunction": "payload.executeAction",
"actionProject": "Visual-Scripting"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
@@ -1,4 +1,4 @@
function newFoundationsActionSwitch() {
function newVisualScriptingActionSwitch() {
let thisObject = {
executeAction: executeAction,
@@ -186,7 +186,7 @@ function newVisualScritingFunctionLibraryUiObjectsFromNodes() {
for (let i = 0; i < node.rootNodes.length; i++) {
let rootNode = node.rootNodes[i]
if (rootNode.id === receivedNode.id) {
console.log('[WARN] The node with name "' + rootNode.name + '" and type "' + rootNode.type + '" will be replaced by the node with name "' + receivedNode.name + '" and type "' + receivedNode.type +'" because they both have the same node.id')
console.log('[WARN] The node with name "' + rootNode.name + '" and type "' + rootNode.type + '" will be replaced by the node with name "' + receivedNode.name + '" and type "' + receivedNode.type + '" because they both have the same node.id')
node.rootNodes.splice(i, 1)
break
}
@@ -601,8 +601,11 @@ function newVisualScritingFunctionLibraryUiObjectsFromNodes() {
let schemaDocument = getSchemaDocument(object, project)
if (schemaDocument === undefined) {
console.log('Cannot addUIOBject of type "' + type + '" and project "' + project + '" because that type it is not defined at the APP_SCHEMA.')
return
schemaDocument = getSchemaDocument(object, 'Foundations') // TODO: This is provisional until all actions can have the relatedUiObject project explicitly set.
if (schemaDocument === undefined) {
console.log('Cannot addUIOBject of type "' + type + '" and project "' + project + '" because that type it is not defined at the APP_SCHEMA.')
return
}
}
if (schemaDocument.initialValues !== undefined) {
@@ -767,7 +770,7 @@ function newVisualScritingFunctionLibraryUiObjectsFromNodes() {
if (property.type === 'node') {
if (property.name !== previousPropertyName) {
if (node[property.name] === undefined) {
let currenAngleToParent = node.payload.floatingObject.angleToParent
let currenAngleToParent = node.payload.floatingObject.angleToParent
node.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
let uiObject = addUIObject(node, property.childType, rootNodes, property.project)
node.payload.floatingObject.angleToParent = currenAngleToParent