Votes Distribution and Contribution Claims

This commit is contained in:
Luis Fernando Molina committed 2021-06-03 18:50:12 +02:00
1 parent 537da88983
commit 41dce98191
11 files changed
+176 -65

No files matched your search

@@ -63,7 +63,7 @@
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->Civic Contributions->"
"compatibleTypes": "->Votes Distribution->Civic Contributions->"
},
"propertyNameAtParent": "civicContributions",
"childrenNodesProperties": [
@@ -39,7 +39,7 @@
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->Community Contributions->"
"compatibleTypes": "->Contribution Claims->Community Contributions->"
},
"propertyNameAtParent": "communityContributions",
"childrenNodesProperties": [
@@ -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"
}
@@ -39,7 +39,7 @@
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->Marketing Contributions->"
"compatibleTypes": "->Contribution Claims->Marketing Contributions->"
},
"propertyNameAtParent": "marketingContributions",
"childrenNodesProperties": [
@@ -39,7 +39,7 @@
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->Software Contributions->"
"compatibleTypes": "->Contribution Claims->Software Contributions->"
},
"propertyNameAtParent": "softwareContributions",
"childrenNodesProperties": [
@@ -39,7 +39,7 @@
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->Time Contributions->"
"compatibleTypes": "->Contribution Claims->Time Contributions->"
},
"propertyNameAtParent": "timeContributions",
"childrenNodesProperties": [
@@ -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": {
@@ -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
},
{
@@ -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"
}
@@ -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
@@ -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
)