From d55e7c952b9a23de7137b89255f7388fd4258094 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 2 Jun 2021 01:28:36 +0200 Subject: [PATCH 1/2] App Schemas Added --- .../App-Schema/community-contributions.json | 12 ++++ .../Schemas/App-Schema/contributed-time.json | 40 +++++++++++++ .../App-Schema/governance-contributions.json | 60 +++++++++++++++++++ .../App-Schema/marketing-contributions.json | 12 ++++ 4 files changed, 124 insertions(+) create mode 100644 Projects/Superalgos/Schemas/App-Schema/contributed-time.json create mode 100644 Projects/Superalgos/Schemas/App-Schema/governance-contributions.json diff --git a/Projects/Superalgos/Schemas/App-Schema/community-contributions.json b/Projects/Superalgos/Schemas/App-Schema/community-contributions.json index 6d5fea2de..e41ce60b7 100644 --- a/Projects/Superalgos/Schemas/App-Schema/community-contributions.json +++ b/Projects/Superalgos/Schemas/App-Schema/community-contributions.json @@ -14,6 +14,12 @@ "label": "Add Community Contributions", "relatedUiObject": "Community Contributions" }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Contributed Asset", + "relatedUiObject": "Contributed Asset" + }, { "action": "Delete UI Object", "askConfirmation": true, @@ -42,6 +48,12 @@ "type": "array", "childType": "Community Contributions", "autoAdd": false + }, + { + "name": "contributedAssets", + "type": "array", + "childType": "Contributed Asset", + "autoAdd": false } ], "icon": "bitcoin" diff --git a/Projects/Superalgos/Schemas/App-Schema/contributed-time.json b/Projects/Superalgos/Schemas/App-Schema/contributed-time.json new file mode 100644 index 000000000..3c171cca6 --- /dev/null +++ b/Projects/Superalgos/Schemas/App-Schema/contributed-time.json @@ -0,0 +1,40 @@ +{ + "type": "Contributed Time", + "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "title": [ + "Use Reference Parent" + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{\n \"description\": \"\"\n}" + }, + "addLeftIcons": true, + "level": 2, + "attachingRules": { + "compatibleTypes": "->Governance Contributions->" + }, + "referencingRules": { + "compatibleTypes": "->Project Rank->" + }, + "propertyNameAtParent": "contributedTimes", + "icon": "dogecoin" +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/App-Schema/governance-contributions.json b/Projects/Superalgos/Schemas/App-Schema/governance-contributions.json new file mode 100644 index 000000000..f2cd13a2f --- /dev/null +++ b/Projects/Superalgos/Schemas/App-Schema/governance-contributions.json @@ -0,0 +1,60 @@ +{ + "type": "Governance Contributions", + "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration" + }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Governance Contributions", + "relatedUiObject": "Governance Contributions" + }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Contributed Time", + "relatedUiObject": "Contributed Time" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{\n \"description\": \"\"\n}" + }, + "addLeftIcons": true, + "level": 2, + "attachingRules": { + "compatibleTypes": "->User Contributions->Governance Contributions->" + }, + "propertyNameAtParent": "governanceContributions", + "childrenNodesProperties": [ + { + "name": "governanceContributions", + "type": "array", + "childType": "Governance Contributions", + "autoAdd": false + }, + { + "name": "contributedTimes", + "type": "array", + "childType": "Contributed Time", + "autoAdd": false + } + ], + "icon": "bitcoin" +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/App-Schema/marketing-contributions.json b/Projects/Superalgos/Schemas/App-Schema/marketing-contributions.json index 4238c91c1..cfec4a2c0 100644 --- a/Projects/Superalgos/Schemas/App-Schema/marketing-contributions.json +++ b/Projects/Superalgos/Schemas/App-Schema/marketing-contributions.json @@ -14,6 +14,12 @@ "label": "Add Marketing Contributions", "relatedUiObject": "Marketing Contributions" }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Contributed Asset", + "relatedUiObject": "Contributed Asset" + }, { "action": "Delete UI Object", "askConfirmation": true, @@ -42,6 +48,12 @@ "type": "array", "childType": "Marketing Contributions", "autoAdd": false + }, + { + "name": "contributedAssets", + "type": "array", + "childType": "Contributed Asset", + "autoAdd": false } ], "icon": "bitcoin" From 34695c333b7312a6b88f955c4ab70a8fe05cebe6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 2 Jun 2021 02:50:12 +0200 Subject: [PATCH 2/2] Reference Parent Find Node Type implemented --- .../App-Schema/civic-contributions.json | 60 +++++++++++++++++++ .../Schemas/App-Schema/contributed-vote.json | 41 +++++++++++++ .../App-Schema/user-contributions.json | 12 ++++ .../UI/Spaces/Floating-Space/UiObjectTitle.js | 30 ++++++++++ Projects/Superalgos/UI/Utilities/Meshes.js | 10 +++- 5 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 Projects/Superalgos/Schemas/App-Schema/civic-contributions.json create mode 100644 Projects/Superalgos/Schemas/App-Schema/contributed-vote.json diff --git a/Projects/Superalgos/Schemas/App-Schema/civic-contributions.json b/Projects/Superalgos/Schemas/App-Schema/civic-contributions.json new file mode 100644 index 000000000..e20684084 --- /dev/null +++ b/Projects/Superalgos/Schemas/App-Schema/civic-contributions.json @@ -0,0 +1,60 @@ +{ + "type": "Civic Contributions", + "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration" + }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Civic Contributions", + "relatedUiObject": "Civic Contributions" + }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Contributed Vote", + "relatedUiObject": "Contributed Vote" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{\n \"description\": \"\"\n}" + }, + "addLeftIcons": true, + "level": 2, + "attachingRules": { + "compatibleTypes": "->User Contributions->Civic Contributions->" + }, + "propertyNameAtParent": "civicContributions", + "childrenNodesProperties": [ + { + "name": "civicContributions", + "type": "array", + "childType": "Civic Contributions", + "autoAdd": false + }, + { + "name": "contributedVotes", + "type": "array", + "childType": "Contributed Vote", + "autoAdd": false + } + ], + "icon": "bitcoin" +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/App-Schema/contributed-vote.json b/Projects/Superalgos/Schemas/App-Schema/contributed-vote.json new file mode 100644 index 000000000..7493466a7 --- /dev/null +++ b/Projects/Superalgos/Schemas/App-Schema/contributed-vote.json @@ -0,0 +1,41 @@ +{ + "type": "Contributed Vote", + "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "title": [ + "Reference Parent Find Node Type->User Contributions", + "Use Reference Parent" + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{\n \"description\": \"\"\n}" + }, + "addLeftIcons": true, + "level": 2, + "attachingRules": { + "compatibleTypes": "->Civic Contributions->" + }, + "referencingRules": { + "compatibleTypes": "->Contributed Time->Governance Contributions->" + }, + "propertyNameAtParent": "contributedVotes", + "icon": "ethereum" +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/App-Schema/user-contributions.json b/Projects/Superalgos/Schemas/App-Schema/user-contributions.json index 99e33343e..df67e3757 100644 --- a/Projects/Superalgos/Schemas/App-Schema/user-contributions.json +++ b/Projects/Superalgos/Schemas/App-Schema/user-contributions.json @@ -32,6 +32,12 @@ "label": "Add Governance Contributions", "relatedUiObject": "Governance Contributions" }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Civic Contributions", + "relatedUiObject": "Civic Contributions" + }, { "action": "Delete UI Object", "askConfirmation": true, @@ -76,6 +82,12 @@ "type": "array", "childType": "Governance Contributions", "autoAdd": false + }, + { + "name": "civicContributions", + "type": "array", + "childType": "Civic Contributions", + "autoAdd": false } ], "icon": "bitcoin" diff --git a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectTitle.js b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectTitle.js index dc360f32c..de9dff365 100644 --- a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectTitle.js +++ b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectTitle.js @@ -172,6 +172,36 @@ function newUiObjectTitle() { thisObject.payload.title = thisObject.payload.title + separator + childNode.name thisObject.payload.node.name = thisObject.payload.node.name + separator + childNode.name } + if (titleReference.indexOf('Find Node Type->') === 0) { + let nodeType = titleReference.substring(titleReference.indexOf('->') + 2, titleReference.length) + let nodeToUse = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh( + thisObject.payload.node, + nodeType, + undefined, + true, + true, + true, + false + ) + if (nodeToUse === undefined) { break } + thisObject.payload.title = thisObject.payload.title + separator + nodeToUse.name + thisObject.payload.node.name = thisObject.payload.node.name + separator + nodeToUse.name + } + if (titleReference.indexOf('Reference Parent Find Node Type->') === 0) { + let nodeType = titleReference.substring(titleReference.indexOf('->') + 2, titleReference.length) + let nodeToUse = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh( + thisObject.payload.referenceParent, + nodeType, + undefined, + true, + true, + true, + false + ) + if (nodeToUse === undefined) { break } + thisObject.payload.title = thisObject.payload.title + separator + nodeToUse.name + thisObject.payload.node.name = thisObject.payload.node.name + separator + nodeToUse.name + } } } separator = ' ' diff --git a/Projects/Superalgos/UI/Utilities/Meshes.js b/Projects/Superalgos/UI/Utilities/Meshes.js index c05b120fa..356bff0b0 100644 --- a/Projects/Superalgos/UI/Utilities/Meshes.js +++ b/Projects/Superalgos/UI/Utilities/Meshes.js @@ -5,7 +5,15 @@ function newSuperalgosUtilitiesMeshes() { return thisObject - function findNodeInNodeMesh(node, nodeType, nodeName, connectedViaPayload, findInChildren, findInParents, findInReferenceParents) { + function findNodeInNodeMesh( + node, + nodeType, + nodeName, + connectedViaPayload, + findInChildren, + findInParents, + findInReferenceParents + ) { /* This function scans a node mesh for a certain node type and returns the first instance found. Please specify either nodeType