Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop

This commit is contained in:
prepheadrus committed 2021-11-22 17:44:15 +03:00
commit 1c438848cd
10 files changed
+13233 -9700

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -39,6 +39,13 @@
"actionFunction": "payload.executeAction",
"relatedUiObjectProject": "Foundations"
},
{
"action": "Add Specified Workspace Project",
"label": "Add Specified Workspace Project",
"relatedUiObject": "Workspace",
"actionFunction": "payload.executeAction",
"relatedUiObjectProject": "Foundations"
},
{
"action": "Check For Missing References",
"label": "Check For Missing References",
@@ -58,7 +65,8 @@
"config": "{\"docsLanguage\": \"EN\"}"
},
"editors": {
"config": true
"config": true,
"list": true
},
"isTitleAllwaysVisible": true,
"addLeftIcons": false,
@@ -407,6 +407,11 @@ function newFoundationsActionSwitch() {
UI.projects.foundations.functionLibraries.workspaceFunctions.addMissingWorkspaceProjects(action.node, action.rootNodes)
}
break
case 'Add Specified Workspace Project':
{
UI.projects.foundations.functionLibraries.workspaceFunctions.addSpecifiedWorkspaceProject(action.node, action.rootNodes)
}
break
case 'Check For Missing References':
{
UI.projects.foundations.functionLibraries.workspaceFunctions.checkForMissingReferences(action.rootNodes)
@@ -1,6 +1,7 @@
function newFoundationsFunctionLibraryWorkspaceFunctions() {
let thisObject = {
addMissingWorkspaceProjects: addMissingWorkspaceProjects,
addSpecifiedWorkspaceProject: addSpecifiedWorkspaceProject,
checkForMissingReferences: checkForMissingReferences,
fixMissingReferences: fixMissingReferences
}
@@ -32,6 +33,42 @@ function newFoundationsFunctionLibraryWorkspaceFunctions() {
}
}
function addSpecifiedWorkspaceProject(node, rootNodes) {
let action = { node: node }
let validProjects = PROJECTS_SCHEMA
// Find the Projects not already part of the Workspace
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
let projectDefinition = PROJECTS_SCHEMA[i]
let project = projectDefinition.name
for (let k = 0; k < rootNodes.length; k++) {
let rootNode = rootNodes[k]
if (rootNode.type === project + ' Project') {
validProjects = validProjects.filter(function(val) {
return val.name + ' Project' !== rootNode.type
})
}
}
}
// Create the Projects as an Array
let projectList = []
for (let i = 0; i < validProjects.length; i++) {
projectList.push(validProjects[i].name)
}
let eventSubscriptionId = node.payload.uiObject.container.eventHandler.listenToEvent('listSelectorClicked', onListSelect)
node.payload.uiObject.listSelector.activate(action, projectList, eventSubscriptionId)
function onListSelect(event) {
UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(node, event.selectedNode + ' Project', rootNodes, event.selectedNode)
node.payload.uiObject.container.eventHandler.stopListening('listSelectorClicked')
}
}
// This function scales the current workspace and highlights any nodes that have unresolved references
function checkForMissingReferences(rootNodes) {
let nodes
@@ -285,9 +285,21 @@ function newListSelector() {
let index = i + selected
let label = ''
let subLabel = ''
if (index >= 0 && index < optionsList.length) {
if (typeof(optionsList[index]) !== "string") {
let path = UI.projects.visualScripting.utilities.hierarchy.getNodeNameTypePath(optionsList[index].payload.parentNode)
for (let i = 0; i < path.length; i++) {
path[i].splice(1, 3)
}
label = optionsList[index].name
subLabel = path.join("->")
if (label.length > 65) { label = label.substring(0,65) + " (cont...)" }
if (subLabel.length > 65) { subLabel = subLabel.substring(0,65) + " (cont...)" }
if (optionsList[index].payload.uiObject.icon !== undefined) {
icon = optionsList[index].payload.uiObject.icon
@@ -333,13 +345,19 @@ function newListSelector() {
let middleValue = Math.floor(VISIBLE_LABELS / 2)
let evenOffset = 0
let subOffset = 0
if (VISIBLE_LABELS % 2 === 0) {
evenOffset = rowHeight / 2
}
if (subLabel !== '') {
subOffset = 10
}
UI.projects.foundations.utilities.drawPrint.drawIcon(icon, 1 / 2, 1 / 2, - offset + SIZE, (i - middleValue) * rowHeight + evenOffset, SIZE, thisObject.container)
UI.projects.foundations.utilities.drawPrint.drawLabel(label, 1 / 2, 1 / 2, 0, (SIZE - fontSize) / 2 + (i - middleValue) * rowHeight + evenOffset, fontSize, thisObject.container, fontColor, undefined, undefined, opacity)
UI.projects.foundations.utilities.drawPrint.drawLabel(label, 1 / 2, 1 / 2, 0, (SIZE - fontSize) / 2 + (i - middleValue) * rowHeight + evenOffset - subOffset, fontSize, thisObject.container, fontColor, undefined, undefined, opacity)
UI.projects.foundations.utilities.drawPrint.drawLabel(subLabel, 1 / 2, 1 / 2, 0, (SIZE - fontSize) / 2 + (i - middleValue) * rowHeight + evenOffset + subOffset, fontSize / 2, thisObject.container, fontColor, undefined, undefined, opacity)
}
}
}