From 335637cb09db279f8de965a541794ec01e1e2ca3 Mon Sep 17 00:00:00 2001 From: Smidy13 <77650800+Smidy13@users.noreply.github.com> Date: Sun, 21 Nov 2021 17:45:37 +1300 Subject: [PATCH 1/2] Improvement: Adding List Selector for Missing Projects --- .../Schemas/App-Schema/workspace.json | 10 ++++- .../UI/Function-Libraries/ActionSwitch.js | 5 +++ .../Function-Libraries/WorkspaceFunctions.js | 37 +++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/Projects/Foundations/Schemas/App-Schema/workspace.json b/Projects/Foundations/Schemas/App-Schema/workspace.json index b6ed175c7..a177c8088 100644 --- a/Projects/Foundations/Schemas/App-Schema/workspace.json +++ b/Projects/Foundations/Schemas/App-Schema/workspace.json @@ -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, diff --git a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js index cd96f06f0..39c5c771c 100644 --- a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js +++ b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js @@ -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) diff --git a/Projects/Foundations/UI/Function-Libraries/WorkspaceFunctions.js b/Projects/Foundations/UI/Function-Libraries/WorkspaceFunctions.js index bfb539aaf..7eeb1eae7 100644 --- a/Projects/Foundations/UI/Function-Libraries/WorkspaceFunctions.js +++ b/Projects/Foundations/UI/Function-Libraries/WorkspaceFunctions.js @@ -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 From af79109a0e526b64a494c50250daee041ce5caed Mon Sep 17 00:00:00 2001 From: Smidy13 <77650800+Smidy13@users.noreply.github.com> Date: Mon, 22 Nov 2021 12:01:56 +1300 Subject: [PATCH 2/2] Improvement: Adding Path to Create Reference --- .../UI/Spaces/Floating-Space/ListSelector.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Projects/Foundations/UI/Spaces/Floating-Space/ListSelector.js b/Projects/Foundations/UI/Spaces/Floating-Space/ListSelector.js index f88bbc83a..7768995ef 100644 --- a/Projects/Foundations/UI/Spaces/Floating-Space/ListSelector.js +++ b/Projects/Foundations/UI/Spaces/Floating-Space/ListSelector.js @@ -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) } } }