diff --git a/Projects/Governance/Schemas/App-Schema/civic-contributions.json b/Projects/Governance/Schemas/App-Schema/civic-contributions.json index e73c1cdda..d368147f5 100644 --- a/Projects/Governance/Schemas/App-Schema/civic-contributions.json +++ b/Projects/Governance/Schemas/App-Schema/civic-contributions.json @@ -63,7 +63,7 @@ "addLeftIcons": true, "level": 2, "attachingRules": { - "compatibleTypes": "->User Profile->Civic Contributions->" + "compatibleTypes": "->Votes Distribution->Civic Contributions->" }, "propertyNameAtParent": "civicContributions", "childrenNodesProperties": [ diff --git a/Projects/Governance/Schemas/App-Schema/community-contributions.json b/Projects/Governance/Schemas/App-Schema/community-contributions.json index b34bfa6f0..36c8ec2d6 100644 --- a/Projects/Governance/Schemas/App-Schema/community-contributions.json +++ b/Projects/Governance/Schemas/App-Schema/community-contributions.json @@ -39,7 +39,7 @@ "addLeftIcons": true, "level": 2, "attachingRules": { - "compatibleTypes": "->User Profile->Community Contributions->" + "compatibleTypes": "->Contribution Claims->Community Contributions->" }, "propertyNameAtParent": "communityContributions", "childrenNodesProperties": [ diff --git a/Projects/Governance/Schemas/App-Schema/contribution-claims.json b/Projects/Governance/Schemas/App-Schema/contribution-claims.json new file mode 100644 index 000000000..9d27188c4 --- /dev/null +++ b/Projects/Governance/Schemas/App-Schema/contribution-claims.json @@ -0,0 +1,82 @@ +{ + "type": "Contribution Claims", + "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration" + }, + { + "action": "Add UI Object", + "label": "Add Software Contributions", + "relatedUiObject": "Software Contributions", + "actionFunction": "payload.executeAction" + }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Marketing Contributions", + "relatedUiObject": "Marketing Contributions" + }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Community Contributions", + "relatedUiObject": "Community Contributions" + }, + { + "action": "Add UI Object", + "actionFunction": "payload.executeAction", + "label": "Add Time Contributions", + "relatedUiObject": "Time Contributions" + }, + { + "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\"codeName\": \"\"\n}" + }, + "isTitleAllwaysVisible": false, + "addLeftIcons": true, + "level": 1, + "propertyNameAtParent": "contributionClaims", + "childrenNodesProperties": [ + { + "name": "softwareContributions", + "type": "array", + "childType": "Software Contributions", + "autoAdd": false + }, + { + "name": "marketingContributions", + "type": "array", + "childType": "Marketing Contributions", + "autoAdd": false + }, + { + "name": "communityContributions", + "type": "array", + "childType": "Community Contributions", + "autoAdd": false + }, + { + "name": "timeContributions", + "type": "array", + "childType": "Time Contributions", + "autoAdd": false + } + ], + "icon": "bitcoin" +} \ No newline at end of file diff --git a/Projects/Governance/Schemas/App-Schema/marketing-contributions.json b/Projects/Governance/Schemas/App-Schema/marketing-contributions.json index af618182b..76b3030c7 100644 --- a/Projects/Governance/Schemas/App-Schema/marketing-contributions.json +++ b/Projects/Governance/Schemas/App-Schema/marketing-contributions.json @@ -39,7 +39,7 @@ "addLeftIcons": true, "level": 2, "attachingRules": { - "compatibleTypes": "->User Profile->Marketing Contributions->" + "compatibleTypes": "->Contribution Claims->Marketing Contributions->" }, "propertyNameAtParent": "marketingContributions", "childrenNodesProperties": [ diff --git a/Projects/Governance/Schemas/App-Schema/software-contributions.json b/Projects/Governance/Schemas/App-Schema/software-contributions.json index 4d849c93b..86083a8ed 100644 --- a/Projects/Governance/Schemas/App-Schema/software-contributions.json +++ b/Projects/Governance/Schemas/App-Schema/software-contributions.json @@ -39,7 +39,7 @@ "addLeftIcons": true, "level": 2, "attachingRules": { - "compatibleTypes": "->User Profile->Software Contributions->" + "compatibleTypes": "->Contribution Claims->Software Contributions->" }, "propertyNameAtParent": "softwareContributions", "childrenNodesProperties": [ diff --git a/Projects/Governance/Schemas/App-Schema/governance-contributions.json b/Projects/Governance/Schemas/App-Schema/time-contributions.json similarity index 95% rename from Projects/Governance/Schemas/App-Schema/governance-contributions.json rename to Projects/Governance/Schemas/App-Schema/time-contributions.json index 6971afbe7..a6a362501 100644 --- a/Projects/Governance/Schemas/App-Schema/governance-contributions.json +++ b/Projects/Governance/Schemas/App-Schema/time-contributions.json @@ -39,7 +39,7 @@ "addLeftIcons": true, "level": 2, "attachingRules": { - "compatibleTypes": "->User Profile->Time Contributions->" + "compatibleTypes": "->Contribution Claims->Time Contributions->" }, "propertyNameAtParent": "timeContributions", "childrenNodesProperties": [ diff --git a/Projects/Governance/Schemas/App-Schema/time-vote.json b/Projects/Governance/Schemas/App-Schema/time-vote.json index 45984f061..dd017b283 100644 --- a/Projects/Governance/Schemas/App-Schema/time-vote.json +++ b/Projects/Governance/Schemas/App-Schema/time-vote.json @@ -19,7 +19,7 @@ } ], "title": [ - "Reference Parent Find Node Type->User Profile", + "Reference Parent Find In Parents Node Type->User Profile", "Use Reference Parent" ], "editors": { diff --git a/Projects/Governance/Schemas/App-Schema/user-profile.json b/Projects/Governance/Schemas/App-Schema/user-profile.json index 937d36785..e23848ce0 100644 --- a/Projects/Governance/Schemas/App-Schema/user-profile.json +++ b/Projects/Governance/Schemas/App-Schema/user-profile.json @@ -10,33 +10,19 @@ }, { "action": "Add UI Object", - "label": "Add Software Contributions", - "relatedUiObject": "Software Contributions", - "actionFunction": "payload.executeAction" + "disableIfPropertyIsDefined": true, + "propertyToCheckFor": "contributionClaims", + "actionFunction": "payload.executeAction", + "label": "Add Contribution Claims", + "relatedUiObject": "Contribution Claims" }, { "action": "Add UI Object", + "disableIfPropertyIsDefined": true, + "propertyToCheckFor": "votesDistribution", "actionFunction": "payload.executeAction", - "label": "Add Marketing Contributions", - "relatedUiObject": "Marketing Contributions" - }, - { - "action": "Add UI Object", - "actionFunction": "payload.executeAction", - "label": "Add Community Contributions", - "relatedUiObject": "Community Contributions" - }, - { - "action": "Add UI Object", - "actionFunction": "payload.executeAction", - "label": "Add Time Contributions", - "relatedUiObject": "Time Contributions" - }, - { - "action": "Add UI Object", - "actionFunction": "payload.executeAction", - "label": "Add Civic Contributions", - "relatedUiObject": "Civic Contributions" + "label": "Add Votes Distribution", + "relatedUiObject": "Votes Distribution" }, { "action": "Add UI Object", @@ -68,33 +54,15 @@ "level": 0, "childrenNodesProperties": [ { - "name": "softwareContributions", - "type": "array", - "childType": "Software Contributions", + "name": "contributionClaims", + "type": "node", + "childType": "Contribution Claims", "autoAdd": false }, { - "name": "marketingContributions", - "type": "array", - "childType": "Marketing Contributions", - "autoAdd": false - }, - { - "name": "communityContributions", - "type": "array", - "childType": "Community Contributions", - "autoAdd": false - }, - { - "name": "timeContributions", - "type": "array", - "childType": "Time Contributions", - "autoAdd": false - }, - { - "name": "civicContributions", - "type": "array", - "childType": "Civic Contributions", + "name": "votesDistribution", + "type": "node", + "childType": "Votes Distribution", "autoAdd": false }, { diff --git a/Projects/Governance/Schemas/App-Schema/votes-distribution.json b/Projects/Governance/Schemas/App-Schema/votes-distribution.json new file mode 100644 index 000000000..33209a758 --- /dev/null +++ b/Projects/Governance/Schemas/App-Schema/votes-distribution.json @@ -0,0 +1,55 @@ +{ + "type": "Votes Distribution", + "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", + "disableIfPropertyIsDefined": true, + "propertyToCheckFor": "referrer", + "actionFunction": "payload.executeAction", + "label": "Add Referrer", + "relatedUiObject": "Referrer" + }, + { + "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\"codeName\": \"\"\n}" + }, + "isTitleAllwaysVisible": false, + "isHierarchyHead": false, + "addLeftIcons": true, + "level": 1, + "propertyNameAtParent": "votesDistribution", + "childrenNodesProperties": [ + { + "name": "civicContributions", + "type": "array", + "childType": "Civic Contributions", + "autoAdd": false + } + ], + "icon": "bitcoin" +} \ No newline at end of file diff --git a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js index e3c73abc6..adb6ce26f 100644 --- a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js +++ b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js @@ -91,19 +91,22 @@ function newGovernanceUserProfileSpace() { for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) { let property = schemaDocument.childrenNodesProperties[i] - if (node.type === 'User Profile' && property.name !== "civicContributions") { continue } + if (node.type === 'User Profile' && property.name !== "votesDistribution") { continue } switch (property.type) { case 'node': { - // We will not follow this path. + if (node.type === 'User Profile' && property.name === "votesDistribution") { + let childNode = node[property.name] + resetVotingPower(childNode) + } } break case 'array': { let propertyArray = node[property.name] if (propertyArray !== undefined) { for (let m = 0; m < propertyArray.length; m++) { - childNde = propertyArray[m] - resetVotingPower(childNde) + let childNode = propertyArray[m] + resetVotingPower(childNode) } } break @@ -144,19 +147,22 @@ function newGovernanceUserProfileSpace() { for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) { let property = schemaDocument.childrenNodesProperties[i] - if (node.type === 'User Profile' && property.name !== "civicContributions") { continue } + if (node.type === 'User Profile' && property.name !== "votesDistribution") { continue } switch (property.type) { case 'node': { - // We will not follow this path. + if (node.type === 'User Profile' && property.name === "votesDistribution") { + let childNode = node[property.name] + distributeVotingPower(childNode, votingPower) + } } break case 'array': { let propertyArray = node[property.name] if (propertyArray !== undefined) { for (let m = 0; m < propertyArray.length; m++) { - childNde = propertyArray[m] - distributeVotingPower(childNde, votingPower / propertyArray.length) + let childNode = propertyArray[m] + distributeVotingPower(childNode, votingPower / propertyArray.length) } } break diff --git a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectTitle.js b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectTitle.js index 5c3b91cda..3b39944a8 100644 --- a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectTitle.js +++ b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectTitle.js @@ -189,14 +189,14 @@ 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) { + if (titleReference.indexOf('Find In Parents 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, + false, true, false ) @@ -204,14 +204,14 @@ function newUiObjectTitle() { 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) { + if (titleReference.indexOf('Reference Parent Find In Parents 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, + false, true, false )