Merge remote-tracking branch 'origin/develop' into plugins-docs

This commit is contained in:
Luis Fernando Molina committed 2021-07-26 21:46:01 +02:00
commit 89aa3585ff
103 files changed
+186396 -30806

No files matched your search

+12 -10
View File
@@ -828,7 +828,8 @@ width: 100%;
.docs-search-results-header-tabs-container {
display: table;
padding-left: 180px;
text-align: right;
align-content: right;
margin-top: 20px;
caret-color: transparent;
}
@@ -860,22 +861,23 @@ border-bottom: 3px solid #0295aa;
/* Search Results Page Content */
.docs-search-result-content {
border-top: 1px solid #0295aa;
margin-left: -180px;
caret-color: transparent;
text-align: left;
align-content: left;
}
.docs-search-result-content > div {
display: none;
}
#tab1:checked ~ .docs-search-result-content #content1,
#tab2:checked ~ .docs-search-result-content #content2,
#tab3:checked ~ .docs-search-result-content #content3,
#tab4:checked ~ .docs-search-result-content #content4,
#tab5:checked ~ .docs-search-result-content #content5,
#tab6:checked ~ .docs-search-result-content #content6,
#tab7:checked ~ .docs-search-result-content #content7,
#tab8:checked ~ .docs-search-result-content #content8 {
#docs-tab1:checked ~ .docs-search-result-content #content1,
#docs-tab2:checked ~ .docs-search-result-content #content2,
#docs-tab3:checked ~ .docs-search-result-content #content3,
#docs-tab4:checked ~ .docs-search-result-content #content4,
#docs-tab5:checked ~ .docs-search-result-content #content5,
#docs-tab6:checked ~ .docs-search-result-content #content6,
#docs-tab7:checked ~ .docs-search-result-content #content7,
#docs-tab8:checked ~ .docs-search-result-content #content8 {
display: block;
}
File diff suppressed because it is too large. Load diff
+27 -16
View File
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="credits.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="tutorial.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="docs.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="governance.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="context-menu.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="font-awasome.css" type="text/css" />
<link rel="stylesheet" href="prism.css" type="text/css" />
@@ -52,40 +53,47 @@
function drawSplashText() {
const splashTextArray = [
{
"splashTextLine1Html": 'Superalgos is <span class="credits-red">open source</span>, <span class="credits-red">forever free</span> for <span class="credits-red">everyone</span>, and is <spanclass="credits-red">constantly improving</span> thanks to the involvement of contributors:'
{
"splashTextLine1Html": '<span class="credits-red">Superalgos is open source, forever free for everyone, and is constantly improving thanks to the involvement of contributors!</span>'
,
"splashTextLine2Html": 'Luis Fernando Molina, Julian Molina, Andreja Cobeljic, Ira Miller, matbenitez, bearcanrun, nikolabjelo, 9808us, pmmax, suttridge, Basalt09, Mhnramin, 0xperez, infin1t3, benitezme, whtv, cozed-gh, Eduardo678-dotcom, Smidy13, teehanming, 64bittuning, joenij, apronotti, Noeljarillo, ssplatt, rico4dev, DougJCook, mane, Cordo-van-Saviour, CarnivalBen, Sil3ntLight, pisukesoramame, Edodi, harrellbm, CaptainJeff, Jeff Braun, Francisco J. Santillán, Norman, Viktoria B., Guillermo V., Daniel J., Javier A., Gustavo J., Romina GS, Pedro P., Thais M., Andrey M., Loui M., Natalia, M., Bashar A., Carlos V., Diego M., Sebastian E., Bogdan P., Marko V., Igor S., Niksa K., Rodrigo M., Nicanor M., Mateo H., Lan T., Leon A., Uroš R., Filip M., Vladimir J. and Pavle B.'
"splashTextLine2Html": 'You may contribute, earn tokens, and participate in the governance of the project, no matter what your set of skills may be! It\'s as simple as sharing what you build for yourself, submitting a review, fixing a bug, or even a typo in the Docs!'
,
"splashTextLine3Html": 'Please, <span class="credits-red">give a star to the Superalgos repo at GitHub.com...</span> It helps other devs find the project!'
"splashTextLine3Html": ''
},
{
"splashTextLine1Html": 'Superalgos is a Community of <span class="credits-red">Algo-Traders</span>, sharing knoleadge, experience and tools between each other.'
"splashTextLine1Html": '<span class="credits-red">Superalgos is a community of algo traders, sharing knowleadge, experience, and tools.</span>'
,
"splashTextLine2Html": 'The Superalgos Community is capable of collective bargaining with Crypto Exchanges to get better trading fees for all members.'
"splashTextLine2Html": 'We negotiate with exchanges and pass on benefits to all members. Become part of the Superalgos Community by making a small contribution to the open-source project!'
,
"splashTextLine3Html": 'Become part of the <span class="credits-red">Superalgos Community</span> by making a small contribution to the open source project!'
"splashTextLine3Html": ''
},
{
"splashTextLine1Html": 'Superalgos is built on <span class="credits-red">Core Values</span> that we are never going to change.'
"splashTextLine1Html": '<span class="credits-red">Superalgos is built on core values that we embrace wholeheartedly.</span>'
,
"splashTextLine2Html": 'Superalgos software <span class="credits-red">does not include Ads</span> of any kind, and it will never do it. Superalgos software <span class="credits-red">does not collect user information</span> of any kind, and it will never do it. Superalgos software <span class="credits-red">is Free of Charge</span> for all community members, and it will allways be. We value <span class="credits-red">Education</span> that is why we build into the software educational tools and content.'
"splashTextLine2Html": 'The software features no ads and does not collect user or usage information of any kind. Our products and services are free of charge for everyone, and always will be.'
,
"splashTextLine3Html": 'We build this together and it belongs to us. Become part of the <span class="credits-red">Superalgos Community</span> by making a small contribution to the open source project!'
"splashTextLine3Html": 'Superalgos puts humans first. We respect your privacy, your freedom to use and contribute to our open-source project, and your freedom to innovate.'
},
{
"splashTextLine1Html": 'Superalgos is <span class="credits-red">Permissionless</span>. Don\'t like the UI? Don\'t like the icons used? Don\'t like the Charting System? Don\'t like the Visual Designer? Don\'t like the Visual Debugger? Don\'t like the Docs? Don\'t like the Trading Bot? Don\'t like the Indicators? Don\'t like the Plotters? Don\'t like any other part of the system?'
"splashTextLine1Html": '<span class="credits-red">Superalgos is permissionless.</span>'
,
"splashTextLine2Html": 'No problem, code or integrate libraries with your own version of any component and we promise we will merge your work and provide it as an alternative to users. We believe in <span class="credits-red">Permissionless Innovation</span> and that users, not team members, are the final judges and the ones who decide what they prefer to use. You are free to create an alternative for any part of the system that you believe that should work or should have been done in a different way. We will help you integrate your vision into the next release and enable a way for users to choose between different implementations of the same functionality. You will also be granted the title of maintainer of the functionality you provide and have decision power on how it evolves in the future.'
"splashTextLine2Html": 'Don\'t like the UI, the icons, the Charting System, the Visual Designer, the Visual Debugger, the Docs, the Trading Bot, Indicators, Plotters? No problem!'
,
"splashTextLine3Html": 'We are strong belieavers in <span class="credits-red">Permissionless Innovation</span>. You don\'t need to ask for permission to become one of us. Make a small contribution to the open source project and you will become a member of the <span class="credits-red">Superalgos Community</span>'
"splashTextLine3Html": 'Code or integrate libraries with your version of any component! We promise we will merge your work and provide it as an alternative to users. We believe in permissionless innovation! Users, not team members, are the final judges!'
},
{
"splashTextLine1Html": 'Would you like to join the <span class="credits-red">Superalgos\'s Developer Team</span>?.'
"splashTextLine1Html": '<span class="credits-red">Give Superalgos a star on GitHub!</span>'
,
"splashTextLine2Html": 'Just look around, find something that is missing and start coding it. If you need help ask at the chat groups. If the feature you want to add is big or difficult to integrate, look for a mentor to help you out.'
"splashTextLine2Html": 'Stars make the repository easier to find on GitHub.com search. The more developers find us, the more people contribute to the project, and the better the system gets for everyone!'
,
"splashTextLine3Html": 'If Bitcoin\'s motto is <span class="credits-red">Don\'t trust. Verify.</span>, ours is: <span class="credits-red">Just code it.</span>'
"splashTextLine3Html": ''
},
{
"splashTextLine1Html": '<span class="credits-red">Would you like to join the Superalgos\'s Developer Team?.</span>'
,
"splashTextLine2Html": 'Look around, find something that is missing and start coding! If you need help, ask in the chat groups to find a mentor!'
,
"splashTextLine3Html": 'Follow our motto: Just code it!'
}
]
@@ -115,6 +123,9 @@
<div id="docs-space-div" class="docs-page" style="position:fixed; top:100000px; left:100000px">
<div id="docs-content-div"></div>
</div>
<div id="governance-reports-space-div" class="governance-page" style="position:fixed; top:100000px; left:100000px">
<div id="governance-content-div"></div>
</div>
<div id="chatApp" style="position:fixed; top:100000px; left:100000px">
<iframe id="chatIFrame" style="border:none; " height="2000" width="900"></iframe>
</div>
+6
View File
@@ -16,6 +16,12 @@ process.on('uncaughtException', function (err) {
})
process.on('unhandledRejection', (reason, p) => {
// Signal user that a necissary node module is missing
if (reason.code == 'MODULE_NOT_FOUND') {
console.log("[ERROR] Node Modules not found. Running the node setup command and then restart")
console.log('[ERROR] Client -> client-> reason = ' + JSON.stringify(reason))
process.exit(1)
}
console.log('[ERROR] Client -> client-> unhandledRejection -> reason = ' + JSON.stringify(reason))
console.log('[ERROR] Client -> client-> unhandledRejection -> p = ' + JSON.stringify(p))
process.exit(1)
+100 -70
View File
@@ -666,37 +666,43 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
contribute()
async function contribute() {
await doGit()
if (error !== undefined) {
const { lookpath } = require('lookpath');
const gitpath = await lookpath('git');
if (gitpath === undefined) {
console.log('[ERROR] `git` not installed.')
} else {
await doGit()
if (error !== undefined) {
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'App Error - Contribution Not Sent',
anchor: undefined,
placeholder: {}
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'App Error - Contribution Not Sent',
anchor: undefined,
placeholder: {}
}
respondWithDocsObject(docs, error)
return
}
respondWithDocsObject(docs, error)
return
}
await doGithub()
if (error !== undefined) {
await doGithub()
if (error !== undefined) {
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'App Error - Contribution Not Sent',
anchor: undefined,
placeholder: {}
}
console.log('respond with docs ')
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'App Error - Contribution Not Sent',
anchor: undefined,
placeholder: {}
respondWithDocsObject(docs, error)
return
}
console.log('respond with docs ')
respondWithDocsObject(docs, error)
return
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
}
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
}
async function doGit() {
@@ -787,26 +793,32 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
update()
async function update() {
let result = await doGit()
if (result.error === undefined) {
let customResponse = {
result: global.CUSTOM_OK_RESPONSE.result,
message: result.message
}
respondWithContent(JSON.stringify(customResponse), httpResponse)
const { lookpath } = require('lookpath');
const gitpath = await lookpath('git');
if (gitpath === undefined) {
console.log('[ERROR] `git` not installed.')
} else {
let result = await doGit()
if (result.error === undefined) {
let customResponse = {
result: global.CUSTOM_OK_RESPONSE.result,
message: result.message
}
respondWithContent(JSON.stringify(customResponse), httpResponse)
} else {
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'App Error - Update Failed',
anchor: undefined,
placeholder: {}
}
respondWithDocsObject(docs, result.error)
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'App Error - Update Failed',
anchor: undefined,
placeholder: {}
}
respondWithDocsObject(docs, result.error)
}
}
@@ -852,20 +864,26 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
checkout()
async function checkout() {
await doGit()
if (error === undefined) {
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
const { lookpath } = require('lookpath');
const gitpath = await lookpath('git');
if (gitpath === undefined) {
console.log('[ERROR] `git` not installed.')
} else {
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'Switching Branches - Current Branch Not Changed',
anchor: undefined,
placeholder: {}
}
await doGit()
respondWithDocsObject(docs, error)
if (error === undefined) {
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
} else {
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'Switching Branches - Current Branch Not Changed',
anchor: undefined,
placeholder: {}
}
respondWithDocsObject(docs, error)
}
}
}
@@ -905,24 +923,30 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
branch()
async function branch() {
let result = await doGit()
if (result.error === undefined) {
let customResponse = {
result: global.CUSTOM_OK_RESPONSE.result,
message: result
}
respondWithContent(JSON.stringify(customResponse), httpResponse)
const { lookpath } = require('lookpath');
const gitpath = await lookpath('git');
if (gitpath === undefined) {
console.log('[ERROR] `git` not installed.')
} else {
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'App Error - Could Not Get Current Branch',
anchor: undefined,
placeholder: {}
}
let result = await doGit()
respondWithDocsObject(docs, error)
if (result.error === undefined) {
let customResponse = {
result: global.CUSTOM_OK_RESPONSE.result,
message: result
}
respondWithContent(JSON.stringify(customResponse), httpResponse)
} else {
let docs = {
project: 'Foundations',
category: 'Topic',
type: 'App Error - Could Not Get Current Branch',
anchor: undefined,
placeholder: {}
}
respondWithDocsObject(docs, error)
}
}
}
@@ -1547,6 +1571,12 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
break
case 'governance.css':
{
sendStyleSheet('governance.css')
}
break
case 'context-menu.css':
{
sendStyleSheet('context-menu.css')
@@ -1932,4 +1962,4 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
return files.reduce((a, f) => a.concat(f), []);
}
}
}
}
+3632 -1
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -10,6 +10,7 @@
"@octokit/rest": "^18.0.12",
"ccxt": "^1.51.98",
"child_process": "^1.0.2",
"lookpath": "^1.2.1",
"open": "^6.4.0",
"rimraf": "^3.0.2",
"simple-git": "^2.31.0",
+2 -2
View File
@@ -14,6 +14,6 @@ services:
- ../Log-Files:/app/Log-Files
- ../My-Workspaces:/app/My-Workspaces
environment:
- PUID: '1000'
- GUID: '1000'
PUID: '1000'
PGID: '1000'
restart: on-failure
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

@@ -171,9 +171,8 @@ function newEducationDocSpace() {
}
function setupSidePanelTab() {
thisObject.sidePanelTab = newSidePanelTab()
thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false)
thisObject.sidePanelTab.initialize('right')
thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Education', 'docs-tab', 'Docs', 'right')
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', onOpening)
closingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closing', onClosing)
@@ -435,7 +434,6 @@ function newEducationDocSpace() {
}
function physics() {
thisObject.sidePanelTab.physics()
docsAppDivPhysics()
function docsAppDivPhysics() {
@@ -459,7 +457,6 @@ function newEducationDocSpace() {
if (CAN_SPACES_DRAW === false) { return }
if (isInitialized === false) { return }
borders()
thisObject.sidePanelTab.draw()
}
function borders() {
@@ -217,7 +217,7 @@ function newFoundationsDocsSearchResultsPage() {
let checked = ' checked=""'
for (let i = 0; i < tabs.length; i++) {
let tab = tabs[i]
HTML = HTML + '<input id="tab' + (i + 1) + '" type="radio" name="tabs"' + checked + '><label for="tab' + (i + 1) + '">' + tab + '</label>'
HTML = HTML + '<input id="docs-tab' + (i + 1) + '" type="radio" name="tabs"' + checked + '><label for="docs-tab' + (i + 1) + '">' + tab + '</label>'
checked = ''
}
@@ -363,7 +363,7 @@ function newEducationTutorialSpace() {
This forces the tutorial to close the workspaces panel and to keep it closed.
*/
if (workspacesCounter === 5) {
UI.projects.foundations.spaces.sideSpace.sidePanelTab.close()
UI.projects.foundations.spaces.workspaceSpace.sidePanelTab.close()
}
return
}
@@ -372,7 +372,7 @@ function newEducationTutorialSpace() {
This forces the tutorial to open the workspaces panel and to keep it closed.
*/
if (workspacesCounter === 5) {
UI.projects.foundations.spaces.sideSpace.sidePanelTab.open()
UI.projects.foundations.spaces.workspaceSpace.sidePanelTab.open()
}
return
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1748,7 +1748,7 @@
"timeRange": {
"type": "Time Range",
"name": "New Time Range",
"config": "{\n \"initialDatetime\": \"2020-09-01\",\n \"finalDatetime\": \"2020-09-02\"\n}",
"config": "{ \n\"initialDatetime\": \"2020-09-01\",\n\"finalDatetime\": \"2020-09-02\" \n}",
"project": "Foundations",
"id": "88cbd256-3b11-4be6-b9c1-9d2dac6f0e02",
"savedPayload": {
@@ -3675,7 +3675,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -4053,7 +4053,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -4304,7 +4304,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -8367,7 +8367,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -13874,12 +13874,12 @@
"id": "01713f1d-91b8-44f9-9c5d-a0c12fd09037",
"savedPayload": {
"position": {
"x": 19873.306237131383,
"y": 29028.85640053908
"x": 19870.306237131383,
"y": 29027.85640053908
},
"targetPosition": {
"x": 19573.306237131383,
"y": 29028.85640053908
"x": 19570.306237131383,
"y": 29027.85640053908
},
"floatingObject": {
"isPinned": false,
@@ -13912,12 +13912,12 @@
"id": "65aa985b-19cc-4dbe-8988-b0d7a1adee35",
"savedPayload": {
"position": {
"x": 19061.17420277542,
"y": 29240.988434895044
"x": 19058.17420277542,
"y": 29239.988434895044
},
"targetPosition": {
"x": 19273.306237131383,
"y": 29028.85640053908
"x": 19270.306237131383,
"y": 29027.85640053908
},
"floatingObject": {
"isPinned": false,
@@ -28455,12 +28455,12 @@
"id": "72a1f250-0d0e-4354-8fdf-741866b9c16c",
"savedPayload": {
"position": {
"x": 18673.306237131383,
"y": 29028.85640053908
"x": 18670.306237131383,
"y": 29027.85640053908
},
"targetPosition": {
"x": 18973.306237131383,
"y": 29028.85640053908
"x": 18970.306237131383,
"y": 29027.85640053908
},
"floatingObject": {
"isPinned": false,
@@ -28493,12 +28493,12 @@
"id": "b10709c9-2150-4055-a06e-1b9b8db2af55",
"savedPayload": {
"position": {
"x": 18973.306237131383,
"y": 29028.85640053908
"x": 18970.306237131383,
"y": 29027.85640053908
},
"targetPosition": {
"x": 19273.306237131383,
"y": 29028.85640053908
"x": 19270.306237131383,
"y": 29027.85640053908
},
"floatingObject": {
"isPinned": false,
@@ -43036,12 +43036,12 @@
"id": "987baa7c-457b-4884-b3fa-b43b43558e38",
"savedPayload": {
"position": {
"x": 18849.042168419455,
"y": 28604.592331827153
"x": 18846.042168419455,
"y": 28603.592331827153
},
"targetPosition": {
"x": 19061.17420277542,
"y": 28816.724366183116
"x": 19058.17420277542,
"y": 28815.724366183116
},
"floatingObject": {
"isPinned": false,
@@ -43074,12 +43074,12 @@
"id": "26c596fe-7a86-47c5-ac4a-f92db9a594e2",
"savedPayload": {
"position": {
"x": 19061.17420277542,
"y": 28816.724366183116
"x": 19058.17420277542,
"y": 28815.724366183116
},
"targetPosition": {
"x": 19273.306237131383,
"y": 29028.85640053908
"x": 19270.306237131383,
"y": 29027.85640053908
},
"floatingObject": {
"isPinned": false,
@@ -43103,12 +43103,12 @@
"id": "2f92dce8-f804-40b6-9f4d-e605f4b4a55e",
"savedPayload": {
"position": {
"x": 19273.306237131383,
"y": 29028.85640053908
"x": 19270.306237131383,
"y": 29027.85640053908
},
"targetPosition": {
"x": 19573.306237131383,
"y": 29028.85640053908
"x": 19570.306237131383,
"y": 29027.85640053908
},
"floatingObject": {
"isPinned": false,
@@ -43132,12 +43132,12 @@
"id": "21d2ec55-9e56-4652-8e96-c7e451262c36",
"savedPayload": {
"position": {
"x": 19573.306237131383,
"y": 29028.85640053908
"x": 19570.306237131383,
"y": 29027.85640053908
},
"targetPosition": {
"x": 19573.306237131383,
"y": 29028.85640053908
"x": 19570.306237131383,
"y": 29027.85640053908
},
"floatingObject": {
"isPinned": true,
@@ -43170,18 +43170,18 @@
"pluginFiles": [
{
"type": "Plugin File",
"name": "Masters",
"config": "{\n\"codeName\": \"\"\n}",
"name": "Candles",
"config": "{\"project\":\"Foundations\",\"fileName\":\"Candles\",\"folderName\":\"Data-Mines\",\"nodeType\":\"Data Mine\"}",
"project": "Foundations",
"pluginFilePosition": {
"type": "Plugin File Position",
"name": "Masters",
"name": "Candles",
"project": "Foundations",
"id": "d5234bd2-ef4e-4856-a6a0-ce7659653a48",
"id": "29558ca6-d412-44a3-a6d7-7396badf4ad0",
"savedPayload": {
"position": {
"x": 14663.352187356151,
"y": 19699.05301821844
"x": 14637.069268429528,
"y": 10937.341121162674
},
"targetPosition": {
"x": 30270.371225686038,
@@ -43191,7 +43191,7 @@
"isPinned": true,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
@@ -43200,7 +43200,7 @@
}
}
},
"id": "ecc1a524-de9b-4e73-8874-b99a7ea0402b",
"id": "ff25c769-f0f1-406d-9d84-e2d5033f3d0d",
"savedPayload": {
"position": {
"x": 30270.371225686038,
@@ -43225,18 +43225,18 @@
},
{
"type": "Plugin File",
"name": "Sparta",
"config": "{\n\"codeName\": \"\"\n}",
"name": "Masters",
"config": "{\"project\":\"Foundations\",\"fileName\":\"Masters\",\"folderName\":\"Data-Mines\",\"nodeType\":\"Data Mine\"}",
"project": "Foundations",
"pluginFilePosition": {
"type": "Plugin File Position",
"name": "Sparta",
"name": "Masters",
"project": "Foundations",
"id": "449f1832-f5b8-4e7e-a010-d892d721d3bc",
"id": "55e11219-35d9-4034-8a73-a17d409a0b57",
"savedPayload": {
"position": {
"x": 14673.067482786275,
"y": 29093.63150649338
"x": 14651.262986317583,
"y": 19722.60151122931
},
"targetPosition": {
"x": 30444.968084630065,
@@ -43246,7 +43246,7 @@
"isPinned": true,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
@@ -43255,7 +43255,7 @@
}
}
},
"id": "0486ca8b-855a-4295-ba63-6f63421b4a13",
"id": "170f0588-298b-450d-b104-dafba1260ad7",
"savedPayload": {
"position": {
"x": 30444.968084630065,
@@ -43269,7 +43269,7 @@
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
@@ -43280,18 +43280,18 @@
},
{
"type": "Plugin File",
"name": "Candles",
"config": "{\n\"codeName\": \"\"\n}",
"name": "Sparta",
"config": "{\"project\":\"Foundations\",\"fileName\":\"Sparta\",\"folderName\":\"Data-Mines\",\"nodeType\":\"Data Mine\"}",
"project": "Foundations",
"pluginFilePosition": {
"type": "Plugin File Position",
"name": "Candles",
"name": "Sparta",
"project": "Foundations",
"id": "56de3162-efa3-4402-bd90-8bcaa2391305",
"id": "71713419-b024-49a1-97dc-b48b9fbdb77c",
"savedPayload": {
"position": {
"x": 14642.151546757865,
"y": 10925.348525719965
"x": 14665.067482786275,
"y": 29107.38150649338
},
"targetPosition": {
"x": 30673.87033286441,
@@ -43301,7 +43301,7 @@
"isPinned": true,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
@@ -43310,7 +43310,7 @@
}
}
},
"id": "3e6bfb2f-4d6d-4b3f-9b0c-944ad4c0fd91",
"id": "5fd4a53a-673f-4590-a2f4-0045b3996127",
"savedPayload": {
"position": {
"x": 30673.87033286441,
@@ -43347,7 +43347,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -43365,17 +43365,17 @@
{
"type": "Plugin File",
"name": "Masters",
"config": "{\n\"codeName\": \"\"\n}",
"config": "{\n \"project\": \"Foundations\",\n \"fileName\": \"Masters\",\n \"folderName\": \"Trading-Mines\",\n \"nodeType\": \"Trading Mine\"\n}",
"project": "Foundations",
"pluginFilePosition": {
"type": "Plugin File Position",
"name": "Masters",
"project": "Foundations",
"id": "ad1ce785-858f-4cfc-ba68-108b5e0c54d9",
"id": "65a1052e-ffa7-498a-8571-1583e4f994db",
"savedPayload": {
"position": {
"x": 30316.217404066585,
"y": 10859.643045797242
"x": 30304.99357619248,
"y": 10874.545648831718
},
"targetPosition": {
"x": 31115.788477879996,
@@ -43394,7 +43394,7 @@
}
}
},
"id": "8a64c00e-4f8c-49bf-b57d-4e2e388bae41",
"id": "735cb138-8e6d-4093-a5bb-e515aa4262fe",
"savedPayload": {
"position": {
"x": 31115.788477879996,
@@ -43449,17 +43449,17 @@
{
"type": "Plugin File",
"name": "Masters-Lightning-Strike",
"config": "{\n\"codeName\": \"\"\n}",
"config": "{\n \"project\": \"Foundations\",\n \"fileName\": \"Masters-Lightning-Strike\",\n \"folderName\": \"Trading-Systems\",\n \"nodeType\": \"Trading System\"\n}",
"project": "Foundations",
"pluginFilePosition": {
"type": "Plugin File Position",
"name": "Masters-Lightning-Strike",
"project": "Foundations",
"id": "37ab4b0d-6bd8-46b6-9778-e193c32669a4",
"id": "ae5c2e13-5b5c-456b-9c96-41ccf5d63823",
"savedPayload": {
"position": {
"x": 24926.365708673427,
"y": 19688.576468868458
"x": 24917.49357619248,
"y": 19698.559102958174
},
"targetPosition": {
"x": 31115.788477879996,
@@ -43469,7 +43469,7 @@
"isPinned": true,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
@@ -43478,7 +43478,7 @@
}
}
},
"id": "5fdcecee-8c8f-4e0f-b36b-81e9231970a6",
"id": "f0fe3aed-15d4-495f-a7c5-86a7d6768827",
"savedPayload": {
"position": {
"x": 31115.788477879996,
@@ -43491,8 +43491,8 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"angleToParent": 2,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
@@ -43533,17 +43533,17 @@
{
"type": "Plugin File",
"name": "Low-Frequency",
"config": "{\n\"codeName\": \"\"\n}",
"config": "{\n \"project\": \"Foundations\",\n \"fileName\": \"Low-Frequency\",\n \"folderName\": \"Trading-Engines\",\n \"nodeType\": \"Trading Engine\"\n}",
"project": "Foundations",
"pluginFilePosition": {
"type": "Plugin File Position",
"name": "Low-Frequency",
"project": "Foundations",
"id": "e117a2a4-09b3-4181-8455-e680de3bdeb3",
"id": "43bd7bf4-c32d-4584-a9fc-db11f100f51e",
"savedPayload": {
"position": {
"x": 30325.55093774257,
"y": 19653.049392142086
"x": 30315.262986317583,
"y": 19661.00324056058
},
"targetPosition": {
"x": 30444.968084630065,
@@ -43562,7 +43562,7 @@
}
}
},
"id": "e9270d67-4630-4ac9-91ca-1dec4fb5aa38",
"id": "6d63590b-76ce-48df-9d5a-6fe0abc70ad0",
"savedPayload": {
"position": {
"x": 30444.968084630065,
@@ -43976,7 +43976,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -44026,8 +44026,8 @@
},
"referenceParent": {
"type": "Workspace",
"name": "Creating Custom Charts",
"id": "fb6f90e4-fe6d-4f40-8392-c4f3b8f214e1"
"name": "Custom Charts Tutorials",
"id": "7f5b5bd1-ed0d-4fc9-a4e9-42e69e57f351"
}
}
},
@@ -44124,7 +44124,9 @@
"uiObject": {
"isRunning": false
},
"tutorial": {},
"tutorial": {
"status": "Done"
},
"referenceParent": {
"type": "Market",
"name": "BTC/USDT",
@@ -44325,7 +44327,9 @@
"uiObject": {
"isRunning": false
},
"tutorial": {}
"tutorial": {
"status": "Done"
}
}
},
{
@@ -44395,8 +44399,8 @@
},
"referenceParent": {
"type": "Time Machine",
"name": "Lighting Strike Backtesting Session",
"id": "499eac86-6c40-4362-a36a-5f2002081866"
"name": "Lightning Strike Backtesting Session My Computer Binanceus BTC/USDT",
"id": "72a1f250-0d0e-4354-8fdf-741866b9c16c"
}
}
}
@@ -44473,7 +44477,7 @@
"referenceParent": {
"type": "Project Dashboards",
"name": "Foundations",
"id": "84a1b1ba-4888-4eac-8762-7084f0ee5de7"
"id": "2f92dce8-f804-40b6-9f4d-e605f4b4a55e"
}
}
},
@@ -44653,7 +44657,7 @@
{
"type": "Tutorial Step",
"name": "Add a Timeline Chart",
"config": "{\n \"icon\": {\n \"name\": \"Time/timeline-chart\",\n \"project\": \"Foundations\"\n },\n \"position\": \"Left\",\n \"slider\": \"toTop\",\n \"pressButton\": \"\",\n \"docs\": {\n \"project\": \"Foundations\",\n \"category\": \"Tutorial\",\n \"type\": \"Tutorial Step - Add a Timeline Chart\"\n },\n \"controlDocs\": {\n \"panel\": \"\",\n \"closeTutorialEditor\": false,\n \"page\": {\n \"project\": \"Foundations\",\n \"category\": \"\",\n \"type\": \"\"\n }\n },\n \"positionAtReferenceParent\": true\n}",
"config": "{\n \"icon\": {\n \"name\": \"Time/timeline-chart\",\n \"project\": \"Foundations\"\n },\n \"position\": \"Left\",\n \"slider\": \"toTop\",\n \"pressButton\": \"\",\n \"docs\": {\n \"project\": \"Foundations\",\n \"category\": \"Tutorial\",\n \"type\": \"Tutorial Step - Add a Timeline Chart\"\n },\n \"controlDocs\": {\n \"panel\": \"\",\n \"closeTutorialEditor\": false,\n \"page\": {\n \"project\": \"Foundations\",\n \"category\": \"\",\n \"type\": \"\"\n }\n }\n}",
"project": "Education",
"id": "db25291f-ef20-4cc9-8bfe-a477ad73d1d4",
"savedPayload": {
@@ -44689,7 +44693,7 @@
{
"type": "Tutorial Step",
"name": "Why is it blank?",
"config": "{\n \"icon\": {\n \"name\": \"Charting-Space/chart-points\",\n \"project\": \"Foundations\"\n },\n \"position\": \"Right\",\n \"slider\": \"toBottom\",\n \"repositionAtTimeMachineNoZoomReferenceParent\": true,\n \"docs\": {\n \"project\": \"Foundations\",\n \"category\": \"Tutorial\",\n \"type\": \"Tutorial Step - Why Is It Blank?\"\n },\n \"controlDocs\": {\n \"panel\": \"\",\n \"closeTutorialEditor\": false,\n \"page\": {\n \"project\": \"Foundations\",\n \"category\": \"\",\n \"type\": \"\"\n }\n },\n \"positionAtReferenceParent\": true\n}",
"config": "{\n \"icon\": {\n \"name\": \"Charting-Space/chart-points\",\n \"project\": \"Foundations\"\n },\n \"position\": \"Right\",\n \"slider\": \"toBottom\",\n \"repositionAtTimeMachineNoZoomReferenceParent\": true,\n \"docs\": {\n \"project\": \"Foundations\",\n \"category\": \"Tutorial\",\n \"type\": \"Tutorial Step - Why Is It Blank?\"\n },\n \"controlDocs\": {\n \"panel\": \"\",\n \"closeTutorialEditor\": false,\n \"page\": {\n \"project\": \"Foundations\",\n \"category\": \"\",\n \"type\": \"\"\n }\n }\n}",
"project": "Education",
"id": "a2131ede-c79b-4313-bd85-40fbd29287e7",
"savedPayload": {
@@ -44813,7 +44817,9 @@
"uiObject": {
"isRunning": false
},
"tutorial": {}
"tutorial": {
"status": "Done"
}
}
},
{
@@ -44912,7 +44918,9 @@
"uiObject": {
"isRunning": false
},
"tutorial": {},
"tutorial": {
"status": "Done"
},
"referenceParent": {
"type": "Data Storage",
"name": "New Data Storage",
@@ -44946,9 +44954,7 @@
"uiObject": {
"isRunning": false
},
"tutorial": {
"status": "Done"
},
"tutorial": {},
"referenceParent": {
"type": "Data Mines Data",
"name": "New Data Mines Data",
@@ -44982,7 +44988,9 @@
"uiObject": {
"isRunning": false
},
"tutorial": {},
"tutorial": {
"status": "Done"
},
"referenceParent": {
"type": "Data Mine Products",
"name": "Candles",
@@ -45032,7 +45040,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -45054,7 +45062,7 @@
{
"type": "Tutorial Step",
"name": "Link Chart to Data Products",
"config": "{\n \"icon\": {\n \"name\": \"Data/data-mine-products\",\n \"project\": \"Foundations\"\n },\n \"position\": \"Right\",\n \"slider\": \"toTop\",\n \"pressButton\": \"\",\n \"docs\": {\n \"project\": \"Foundations\",\n \"category\": \"Tutorial\",\n \"type\": \"Tutorial Step - Link Chart to Data Products\"\n },\n \"controlDocs\": {\n \"panel\": \"\",\n \"closeTutorialEditor\": false,\n \"page\": {\n \"project\": \"Foundations\",\n \"category\": \"\",\n \"type\": \"\"\n }\n },\n \"positionAtReferenceParent\": true\n}",
"config": "{\n \"icon\": {\n \"name\": \"Data/data-mine-products\",\n \"project\": \"Foundations\"\n },\n \"position\": \"Right\",\n \"slider\": \"toTop\",\n \"pressButton\": \"\",\n \"docs\": {\n \"project\": \"Foundations\",\n \"category\": \"Tutorial\",\n \"type\": \"Tutorial Step - Link Chart to Data Products\"\n },\n \"controlDocs\": {\n \"panel\": \"\",\n \"closeTutorialEditor\": false,\n \"page\": {\n \"project\": \"Foundations\",\n \"category\": \"\",\n \"type\": \"\"\n }\n }\n}",
"project": "Education",
"id": "cc2794e2-9140-4ca5-89d0-c812eee41f6d",
"savedPayload": {
@@ -45077,9 +45085,7 @@
"uiObject": {
"isRunning": false
},
"tutorial": {
"status": "Done"
},
"tutorial": {},
"referenceParent": {
"type": "Time Machine",
"name": "Lighting Strike Backtesting Session",
@@ -45520,7 +45526,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -45565,7 +45571,9 @@
"uiObject": {
"isRunning": false
},
"tutorial": {},
"tutorial": {
"status": "Done"
},
"referenceParent": {
"type": "Time Machine",
"name": "Lighting Strike Backtesting Session",
@@ -45646,7 +45654,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -45775,7 +45783,6 @@
"arrangementStyle": 1
},
"uiObject": {
"isPlaying": false,
"isRunning": false
},
"tutorial": {
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -48,7 +48,7 @@
"config": true
},
"initialValues": {
"config": "{\n\"codeName\": \"\"\n}"
"config": "{\"project\": \"\",\"fileName\": \"\",\"folderName\": \"\",\"nodeType\": \"\"}"
},
"addLeftIcons": true,
"level": 2,
@@ -12,9 +12,16 @@ exports.newFoundationsGlobalsProcessVariables = function () {
/*
VARIABLES_BY_PROCESS_INDEX_MAP
At the Task Server, a Task run Procesess, potentially many of them, depending on definitions external to the
Task Server. Each process is independent from each other and have a set of process level variables that help
the process do its job. You can consider these variables as the process state. All the modules running inside
a process know the processIndex, and with that index they can get this Map that contains all the needed variables
of that represent the process state. It was implemented as a Map and not just an object with properties for no
particular reason.
What it is stored here depends very much on what the process is about and what it needs to do. Following
is a list of known properties of this object.
is a list of known keys of this map.
PROCESS_KEY This is the key used in events related to the Process
SESSION_KEY This is the key used in events related to the Session
@@ -32,7 +39,7 @@ exports.newFoundationsGlobalsProcessVariables = function () {
TRADING_PROCESSING_DAILY_FILES When in a trading process, this tell us if we are processing Daily Files or not.
FILE_PATH_ROOT Stores the prefix of the path of any data or log file.
WAIT_FOR_EXECUTION_FINISHED_EVENT This boolean flag tell us if the process waits for an event to continue.
UNEXPECTED_ERROR: When we encounter an error that will produce the Process to be stopped, we store the err object here so that is properties can be extracted for logging purposes.
UNEXPECTED_ERROR When we encounter an error that will produce the Process to be stopped, we store the err object here so that is properties can be extracted for logging purposes.
*/
return thisObject
@@ -31,10 +31,9 @@ function newFoundationsChatSpace() {
return thisObject
function initialize() {
thisObject.sidePanelTab = newSidePanelTab()
thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false)
thisObject.sidePanelTab.initialize('right', 1)
return
thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Education', 'docs-tab', 'Docs', 'right')
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', onOpening)
closingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closing', onClosing)
@@ -89,15 +88,14 @@ function newFoundationsChatSpace() {
return thisObject.container
} else {
UI.projects.foundations.spaces.chartingSpace.viewport.onMouseWheel(event)
return
return
}
} else {
return
return
}
}
function physics() {
thisObject.sidePanelTab.physics()
chatAppDivPhysics()
iFramePhysics()
@@ -108,18 +106,18 @@ function newFoundationsChatSpace() {
y: 0
}
chatAppDivPosition = thisObject.container.frame.frameThisPoint(chatAppDivPosition)
chatAppDiv.style = ' ' +
'position:fixed; top:' + chatAppDivPosition.y + 'px; ' +
'left:' + chatAppDivPosition.x + 'px; z-index:1; ' +
'width: ' + thisObject.container.frame.width + 'px;' +
'height: ' + thisObject.container.frame.height + 'px'
chatAppDiv.style = ' ' +
'position:fixed; top:' + chatAppDivPosition.y + 'px; ' +
'left:' + chatAppDivPosition.x + 'px; z-index:1; ' +
'width: ' + thisObject.container.frame.width + 'px;' +
'height: ' + thisObject.container.frame.height + 'px'
}
function iFramePhysics() {
let docIFrame = document.getElementById('chatIFrame')
docIFrame.style = ' ' +
'width: ' + thisObject.container.frame.width + 'px;' +
'height: ' + thisObject.container.frame.height + 'px'
docIFrame.style = ' ' +
'width: ' + thisObject.container.frame.width + 'px;' +
'height: ' + thisObject.container.frame.height + 'px'
}
}
@@ -127,7 +125,6 @@ function newFoundationsChatSpace() {
if (CAN_SPACES_DRAW === false) { return }
if (isInitialized === false) { return }
borders()
thisObject.sidePanelTab.draw()
}
function borders() {
@@ -16,6 +16,7 @@ function newWorkspace() {
save: saveWorkspace,
backup: backupWorkspace,
share: shareWorkspace,
getNodesByTypeAndHierarchyHeadsType: getNodesByTypeAndHierarchyHeadsType,
getProjectsHeads: getProjectsHeads,
getHierarchyHeads: getHierarchyHeads,
getHierarchyHeadsById: getHierarchyHeadsById,
@@ -197,8 +198,8 @@ function newWorkspace() {
function onResponse(err) {
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
window.localStorage.setItem('Last Used Workspace', workspace.name)
window.localStorage.setItem('Session Timestamp', sessionTimestamp)
setLastUsedWorkspace()
if (ARE_WE_RECORDING_A_MARKET_PANORAMA === false) {
UI.projects.foundations.spaces.cockpitSpace.setStatus(workspace.name + ' Saved.', 50, UI.projects.foundations.spaces.cockpitSpace.statusTypes.ALL_GOOD)
}
@@ -211,6 +212,11 @@ function newWorkspace() {
}
}
function setLastUsedWorkspace() {
window.localStorage.setItem('Last Used Workspace', UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.name)
window.localStorage.setItem('Session Timestamp', sessionTimestamp)
}
function savePlugins() {
/*
Here we will scan the workspace for all Plugins and we will try to save them.
@@ -240,7 +246,9 @@ function newWorkspace() {
let pluginFile = childNode.pluginFiles[k]
let saveWithWorkspace = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(pluginFile.payload, 'saveWithWorkspace')
//UI.projects.foundations.utilities.plugins.savePluginFile(pluginFile)
if (saveWithWorkspace === true) {
UI.projects.foundations.utilities.plugins.savePluginFile(pluginFile)
}
}
}
break
@@ -306,7 +314,7 @@ function newWorkspace() {
workingAtTask = 0
UI.projects.education.spaces.docsSpace.sidePanelTab.close()
UI.projects.foundations.spaces.sideSpace.sidePanelTab.close()
UI.projects.foundations.spaces.workspaceSpace.sidePanelTab.close()
UI.projects.foundations.spaces.floatingSpace.inMapMode = true
workingAtTask = 2
break
@@ -408,10 +416,13 @@ function newWorkspace() {
UI.projects.foundations.spaces.floatingSpace.inMapMode = false
thisObject.isInitialized = true
UI.projects.governance.spaces.reportsSpace.reset()
await UI.projects.education.spaces.docsSpace.reset()
await UI.projects.education.spaces.tutorialSpace.reset()
runTasksAndSessions()
setLastUsedWorkspace()
break
}
}
@@ -575,6 +586,20 @@ function newWorkspace() {
return resultArray
}
function getNodesByTypeAndHierarchyHeadsType(nodeType, hierarchyHeadsType) {
let hierarchyHeads = getHierarchyHeads()
let resultArray = []
if (hierarchyHeads === undefined) { return }
for (let i = 0; i < hierarchyHeads.length; i++) {
let hierarchyHead = hierarchyHeads[i]
if (hierarchyHead.type === hierarchyHeadsType) {
let nodeArray = UI.projects.foundations.utilities.branches.nodeBranchToArray(hierarchyHead, nodeType)
resultArray = resultArray.concat(nodeArray)
}
}
return resultArray
}
function replaceWorkspaceByLoadingOne(project, name) {
@@ -163,6 +163,8 @@ function newUiObject() {
let warningRingDirectionAnimation = 1
let infoRingDirectionAnimation = 1
thisObject.isRunning = false
return thisObject
function finalize() {
@@ -6,6 +6,8 @@ function newSidePanelTab() {
container: undefined,
isOpen: false,
isClosed: true,
tabIcon: undefined,
tabLabel: undefined,
index: 0,
open: open,
close: close,
@@ -13,10 +15,11 @@ function newSidePanelTab() {
physics: physics,
draw: draw,
getContainer: getContainer,
initialize: initialize
initialize: initialize,
finalize: finalize
}
const TAB_WIDTH = 25
const TAB_WIDTH = 60
const TAB_HEIGHT = TOP_SPACE_HEIGHT * 2
const ANIMATION_STEP = 100
@@ -24,6 +27,7 @@ function newSidePanelTab() {
let animation = 'none'
let ORIGINAL_PARENT_POSITON
let xOffset = 0
let onMouseClickEventSubscriptionId
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
@@ -33,12 +37,17 @@ function newSidePanelTab() {
return thisObject
function finalize() {
thisObject.pointerDirection = undefined
thisObject.container.eventHandler.stopListening(onMouseClickEventSubscriptionId)
}
function initialize(screenside, index) {
thisObject.screenside = screenside
if (index !== undefined) {
thisObject.index = index
}
switch (thisObject.screenside) {
case 'left': {
thisObject.pointerDirection = 'left'
@@ -52,7 +61,7 @@ function newSidePanelTab() {
thisObject.container.frame.width = TAB_WIDTH
thisObject.container.frame.height = TAB_HEIGHT
thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
onMouseClickEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
resize()
isInitialized = true
}
@@ -124,15 +133,15 @@ function newSidePanelTab() {
}
function positionPhysics() {
if (UI.projects.foundations.spaces.chartingSpace.viewport !== undefined) {
thisObject.container.frame.position.y = browserCanvas.height / 2 - TAB_HEIGHT / 2 // TOP_SPACE_HEIGHT + UI.projects.foundations.spaces.chartingSpace.viewport.marginAmount + TAB_HEIGHT * thisObject.index
}
thisObject.container.frame.position.y = browserCanvas.height / 2 - TAB_HEIGHT / 2 + (thisObject.index - 1) * TAB_HEIGHT
}
function draw() {
if (isInitialized === false) { return }
borders()
arrow()
tabIcon()
tabLabel()
}
function animate() {
@@ -198,6 +207,7 @@ function newSidePanelTab() {
}
}
}
function setClosed() {
thisObject.isClosed = true
animation = 'none'
@@ -224,33 +234,33 @@ function newSidePanelTab() {
if (thisObject.pointerDirection === 'left') {
point1 = {
x: TAB_WIDTH * 3.5 / 10,
y: TAB_HEIGHT * 12.5 / 30
x: TAB_WIDTH * 4.0 / 10,
y: TAB_HEIGHT * 2.5 / 30
}
point2 = {
x: TAB_WIDTH * 6.5 / 10,
y: TAB_HEIGHT * 15 / 30
x: TAB_WIDTH * 6.0 / 10,
y: TAB_HEIGHT * 5 / 30
}
point3 = {
x: TAB_WIDTH * 3.5 / 10,
y: TAB_HEIGHT * 17.5 / 30
x: TAB_WIDTH * 4.0 / 10,
y: TAB_HEIGHT * 7.5 / 30
}
} else {
point1 = {
x: TAB_WIDTH * 6.5 / 10,
y: TAB_HEIGHT * 12.5 / 30
x: TAB_WIDTH * 6.0 / 10,
y: TAB_HEIGHT * 2.5 / 30
}
point2 = {
x: TAB_WIDTH * 3.5 / 10,
y: TAB_HEIGHT * 15 / 30
x: TAB_WIDTH * 4.0 / 10,
y: TAB_HEIGHT * 5 / 30
}
point3 = {
x: TAB_WIDTH * 6.5 / 10,
y: TAB_HEIGHT * 17.5 / 30
x: TAB_WIDTH * 6.0 / 10,
y: TAB_HEIGHT * 7.5 / 30
}
}
@@ -343,4 +353,47 @@ function newSidePanelTab() {
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.stroke()
}
function tabIcon() {
if (thisObject.tabIcon === undefined) { return }
if (thisObject.tabIcon.canDrawIcon !== true) { return }
let imageSize = 30
let imagePosition = {
x: TAB_WIDTH * 1 / 2,
y: TAB_HEIGHT * 1 / 2
}
imagePosition = thisObject.container.frame.frameThisPoint(imagePosition)
browserCanvasContext.drawImage(
thisObject.tabIcon,
imagePosition.x - imageSize / 2,
imagePosition.y - imageSize / 2,
imageSize,
imageSize)
}
function tabLabel() {
if (thisObject.tabLabel === undefined) { return }
let labelPosition = {
x: TAB_WIDTH * 1 / 2,
y: TAB_HEIGHT * 7 / 8
}
labelPosition = thisObject.container.frame.frameThisPoint(labelPosition)
browserCanvasContext.font = 12 + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREY + ', 1)'
browserCanvasContext.fillText(
thisObject.tabLabel,
labelPosition.x - getTextWidth(thisObject.tabLabel) / 2,
labelPosition.y
)
browserCanvasContext.stroke()
}
}
@@ -1,171 +1,129 @@
function newFoundationsSideSpace() {
const MODULE_NAME = 'Side Space'
let thisObject = {
sidePanelTab: undefined,
container: undefined,
leftTabs: undefined,
rightTabs: undefined,
physics: physics,
draw: draw,
createSidePanelTab: createSidePanelTab,
deleteSidePanelTab: deleteSidePanelTab,
getContainer: getContainer,
initialize: initialize,
finalize: finalize
}
let isInitialized = false
let existingTabs = new Map()
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize()
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.detectMouseOver = true
thisObject.container.status = 'hidden'
let listView
resize()
let openingEventSubscriptionId
let closedEventSubscriptionId
let browserResizedEventSubscriptionId
return thisObject
function initialize() {
thisObject.sidePanelTab = newSidePanelTab()
thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false)
thisObject.sidePanelTab.initialize('left')
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
initializeListView()
isInitialized = true
thisObject.leftTabs = []
thisObject.rightTabs = []
}
function finalize() {
canvas.eventHandler.stopListening(browserResizedEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(openingEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(closedEventSubscriptionId)
thisObject.leftTabs = undefined
thisObject.rightTabs = undefined
existingTabs = undefined
}
function initializeListView() {
listView = newListView()
listView.initialize()
listView.container.connectToParent(thisObject.container, false, false)
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', listView.turnOn)
closedEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closed', listView.turnOff)
}
function createSidePanelTab(container, porject, iconName, label, side) {
function resize() {
thisObject.container.frame.width = SIDE_PANEL_WIDTH
thisObject.container.frame.height = browserCanvas.height // - TOP_SPACE_HEIGHT
thisObject.container.frame.position.x = -SIDE_PANEL_WIDTH
thisObject.container.frame.position.y = 0 // TOP_SPACE_HEIGHT
let sidePanel
if (listView !== undefined) {
listView.resize()
sidePanel = newSidePanelTab()
sidePanel.container.connectToParent(container, false, false)
sidePanel.tabIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName(porject, iconName)
sidePanel.tabLabel = label
sidePanel.initialize(side)
let key = porject + '-' + iconName + '-' + label + '-' + side
if (existingTabs.get(key) !== undefined) { return existingTabs.get(key) }
switch (side) {
case 'left': {
thisObject.leftTabs.push(sidePanel)
sidePanel.index = thisObject.leftTabs.length
existingTabs.set(key, sidePanel)
break
}
case 'right': {
thisObject.rightTabs.push(sidePanel)
sidePanel.index = thisObject.rightTabs.length
existingTabs.set(key, sidePanel)
break
}
}
if (thisObject.sidePanelTab !== undefined) {
thisObject.sidePanelTab.resize()
return sidePanel
}
function deleteSidePanelTab(porject, iconName, label, side) {
let key = porject + '-' + iconName + '-' + label + '-' + side
if (existingTabs.get(key) !== undefined) {
let sidePanelTab = existingTabs.get(key)
switch (side) {
case 'left': {
thisObject.leftTabs.splice(sidePanelTab.index - 1, 1)
break
}
case 'right': {
thisObject.rightTabs.splice(sidePanelTab.index - 1, 1)
break
}
}
sidePanelTab.finalize()
existingTabs.delete(key)
/*
Reindex Remaining SidTabs
*/
let indexLeft = 1
let indexRight = 1
existingTabs.forEach(reindex)
function reindex(sideTab, key, map) {
switch (sideTab.screenside) {
case 'left': {
sideTab.index = indexLeft
indexLeft++
break
}
case 'right': {
sideTab.index = indexRight
indexRight++
break
}
}
}
}
}
function getContainer(point, purpose) {
if (thisObject.sidePanelTab === undefined) { return }
let container
container = thisObject.sidePanelTab.getContainer(point, purpose)
if (container !== undefined) { return container }
container = listView.getContainer(point, purpose)
if (container !== undefined) { return container }
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container
} else {
return undefined
}
}
function physics() {
thisObject.sidePanelTab.physics()
listView.physics()
existingTabs.forEach(sideTabPhysics)
function sideTabPhysics(sideTab, key, map) {
sideTab.physics()
}
}
function draw() {
if (CAN_SPACES_DRAW === false) { return }
if (isInitialized === false) { return }
borders()
thisObject.sidePanelTab.draw()
listView.draw()
}
existingTabs.forEach(sideTabDraw)
function borders() {
let point1
let point2
let point3
let point4
point1 = {
x: 0,
y: 0
}
point2 = {
x: thisObject.container.frame.width,
y: 0
}
point3 = {
x: thisObject.container.frame.width,
y: thisObject.container.frame.height
}
point4 = {
x: 0,
y: thisObject.container.frame.height
}
point1 = thisObject.container.frame.frameThisPoint(point1)
point2 = thisObject.container.frame.frameThisPoint(point2)
point3 = thisObject.container.frame.frameThisPoint(point3)
point4 = thisObject.container.frame.frameThisPoint(point4)
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(point1.x, point1.y)
browserCanvasContext.lineTo(point2.x, point2.y)
browserCanvasContext.lineTo(point3.x, point3.y)
browserCanvasContext.lineTo(point4.x, point4.y)
browserCanvasContext.lineTo(point1.x, point1.y)
browserCanvasContext.closePath()
let opacity = 1
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + opacity + ''
browserCanvasContext.fill()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GREY + ', ' + opacity + ''
browserCanvasContext.lineWidth = 0.3
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.stroke()
/* Shadow */
if (thisObject.container.status !== 'hidden') {
for (let i = 0; i <= 30; i++) {
opacity = 1 - (i / 300) - 0.95
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(point2.x + i, point2.y)
browserCanvasContext.lineTo(point3.x + i, point3.y)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.BLACK + ', ' + opacity + ''
browserCanvasContext.lineWidth = 1
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.stroke()
}
function sideTabDraw(sideTab, key, map) {
sideTab.draw()
}
}
}
@@ -0,0 +1,168 @@
function newFoundationsWorkspaceSpace() {
const MODULE_NAME = 'Workspace Space'
let thisObject = {
sidePanelTab: undefined,
container: undefined,
physics: physics,
draw: draw,
getContainer: getContainer,
initialize: initialize,
finalize: finalize
}
let isInitialized = false
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize()
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.detectMouseOver = true
thisObject.container.status = 'hidden'
let listView
resize()
let openingEventSubscriptionId
let closedEventSubscriptionId
let browserResizedEventSubscriptionId
return thisObject
function initialize() {
thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Foundations', 'workspace', 'Workspaces', 'left')
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
initializeListView()
isInitialized = true
}
function finalize() {
canvas.eventHandler.stopListening(browserResizedEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(openingEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(closedEventSubscriptionId)
}
function initializeListView() {
listView = newListView()
listView.initialize()
listView.container.connectToParent(thisObject.container, false, false)
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', listView.turnOn)
closedEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closed', listView.turnOff)
}
function resize() {
thisObject.container.frame.width = SIDE_PANEL_WIDTH
thisObject.container.frame.height = browserCanvas.height // - TOP_SPACE_HEIGHT
thisObject.container.frame.position.x = -SIDE_PANEL_WIDTH
thisObject.container.frame.position.y = 0 // TOP_SPACE_HEIGHT
if (listView !== undefined) {
listView.resize()
}
if (thisObject.sidePanelTab !== undefined) {
thisObject.sidePanelTab.resize()
}
}
function getContainer(point, purpose) {
if (thisObject.sidePanelTab === undefined) { return }
let container
container = thisObject.sidePanelTab.getContainer(point, purpose)
if (container !== undefined) { return container }
container = listView.getContainer(point, purpose)
if (container !== undefined) { return container }
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container
} else {
return undefined
}
}
function physics() {
listView.physics()
}
function draw() {
if (CAN_SPACES_DRAW === false) { return }
if (isInitialized === false) { return }
borders()
listView.draw()
}
function borders() {
let point1
let point2
let point3
let point4
point1 = {
x: 0,
y: 0
}
point2 = {
x: thisObject.container.frame.width,
y: 0
}
point3 = {
x: thisObject.container.frame.width,
y: thisObject.container.frame.height
}
point4 = {
x: 0,
y: thisObject.container.frame.height
}
point1 = thisObject.container.frame.frameThisPoint(point1)
point2 = thisObject.container.frame.frameThisPoint(point2)
point3 = thisObject.container.frame.frameThisPoint(point3)
point4 = thisObject.container.frame.frameThisPoint(point4)
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(point1.x, point1.y)
browserCanvasContext.lineTo(point2.x, point2.y)
browserCanvasContext.lineTo(point3.x, point3.y)
browserCanvasContext.lineTo(point4.x, point4.y)
browserCanvasContext.lineTo(point1.x, point1.y)
browserCanvasContext.closePath()
let opacity = 1
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + opacity + ''
browserCanvasContext.fill()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GREY + ', ' + opacity + ''
browserCanvasContext.lineWidth = 0.3
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.stroke()
/* Shadow */
if (thisObject.container.status !== 'hidden') {
for (let i = 0; i <= 30; i++) {
opacity = 1 - (i / 300) - 0.95
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(point2.x + i, point2.y)
browserCanvasContext.lineTo(point3.x + i, point3.y)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.BLACK + ', ' + opacity + ''
browserCanvasContext.lineWidth = 1
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.stroke()
}
}
}
}
+1 -1
View File
@@ -94,7 +94,7 @@ function newFoundationsUtilitiesPlugins() {
/* Lets check the result of the call through the http interface */
data = JSON.parse(data)
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
pluginFile.payload.uiObject.setInfoMessage('Plugin Saved.', 250)
pluginFile.payload.uiObject.setInfoMessage('Plugin Saved.', 5)
return
}
console.log('[ERROR] Saving Plugin File: ' + JSON.stringify(data))
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because it is too large. Load diff
@@ -415,12 +415,12 @@
"id": "4cd7e133-2763-4108-b6fb-c96d6aea718f",
"savedPayload": {
"position": {
"x": 18681.895713530757,
"y": 31939.290306978855
"x": 24670.364562175448,
"y": 38242.89207786629
},
"targetPosition": {
"x": 18604.25,
"y": 31649.512559092134
"x": 24717.294901687517,
"y": 37946.58557568774
},
"floatingObject": {
"isPinned": false,
@@ -445,12 +445,12 @@
"id": "9a8d3673-3085-4cc7-8487-28d5af438f13",
"savedPayload": {
"position": {
"x": 18454.25,
"y": 31909.320180227467
"x": 24474.589803375035,
"y": 38122.921151375485
},
"targetPosition": {
"x": 18604.25,
"y": 31649.512559092134
"x": 24717.294901687517,
"y": 37946.58557568774
},
"floatingObject": {
"isPinned": false,
@@ -475,12 +475,12 @@
"id": "a0e3e42c-61a8-4b11-a745-9f5f732895d9",
"savedPayload": {
"position": {
"x": 18314.47225211328,
"y": 31727.15827262289
"x": 24420.988399508977,
"y": 37899.65523617568
},
"targetPosition": {
"x": 18604.25,
"y": 31649.512559092134
"x": 24717.294901687517,
"y": 37946.58557568774
},
"floatingObject": {
"isPinned": false,
@@ -509,7 +509,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -748,12 +748,12 @@
"id": "65124b42-5039-46d1-96a2-20005056950f",
"savedPayload": {
"position": {
"x": 18242.117965644036,
"y": 31601.836972312765
"x": 24916.50794839062,
"y": 37217.63108785494
},
"targetPosition": {
"x": 18454.25,
"y": 31389.7049379568
"x": 25052.705098312483,
"y": 37484.93304511145
},
"floatingObject": {
"isPinned": false,
@@ -778,12 +778,12 @@
"id": "532260c8-ae9d-4f3a-94a2-fd736a556c63",
"savedPayload": {
"position": {
"x": 18154.25,
"y": 31389.7049379568
"x": 25145.410196624965,
"y": 37199.6160902229
},
"targetPosition": {
"x": 18454.25,
"y": 31389.7049379568
"x": 25052.705098312483,
"y": 37484.93304511145
},
"floatingObject": {
"isPinned": false,
@@ -808,12 +808,12 @@
"id": "a66e89c5-6e9b-4f79-8fbb-42ed70b51e09",
"savedPayload": {
"position": {
"x": 18242.117965644036,
"y": 31177.572903600838
"x": 25320.007055568993,
"y": 37348.73589518959
},
"targetPosition": {
"x": 18454.25,
"y": 31389.7049379568
"x": 25052.705098312483,
"y": 37484.93304511145
},
"floatingObject": {
"isPinned": false,
@@ -843,7 +843,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -868,7 +868,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
File diff suppressed because it is too large. Load diff
@@ -3,20 +3,50 @@
"name": "Superalgos",
"config": "{\"codeName\":\"Superalgos\"}",
"project": "Governance",
"positionClasss": [],
"positions": [
"positionClasss": [
{
"type": "Position",
"name": "Project Leader",
"config": "{\n \"description\": \"\", \"relativeWeight\": 0 \n}",
"type": "Position Class",
"name": "Community Management",
"config": "{}",
"project": "Governance",
"positions": [],
"positions": [
{
"type": "Position",
"name": "Moderator",
"config": "{}",
"project": "Governance",
"positions": [],
"positionClasss": [],
"id": "6e141ab6-cc79-44b6-a58a-60b6480f706e",
"savedPayload": {
"position": {
"x": 30831,
"y": 37770
},
"targetPosition": {
"x": 30531,
"y": 37770
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"positionClasss": [],
"id": "5f694173-4568-46b2-a52c-4244320919f7",
"id": "35b790f0-c567-498c-83fd-ac0aacd8720b",
"savedPayload": {
"position": {
"x": 30231,
"y": 38070
"x": 30531,
"y": 37770
},
"targetPosition": {
"x": 30231,
@@ -26,7 +56,282 @@
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Position Class",
"name": "Marketing",
"config": "{}",
"project": "Governance",
"positions": [
{
"type": "Position",
"name": "Marketing Lead",
"config": "{}",
"project": "Governance",
"positions": [],
"positionClasss": [],
"id": "59369731-0766-4d13-aec2-db218b5455e4",
"savedPayload": {
"position": {
"x": 30546.6485459557,
"y": 38256.05613679621
},
"targetPosition": {
"x": 30323.705098312483,
"y": 38055.31695488855
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Position",
"name": "Advisor",
"config": "{}",
"project": "Governance",
"positions": [],
"positionClasss": [],
"id": "da7c7b94-d675-402e-9178-b219ff9a672c",
"savedPayload": {
"position": {
"x": 30261.331591067155,
"y": 38348.761235108694
},
"targetPosition": {
"x": 30323.705098312483,
"y": 38055.31695488855
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"positionClasss": [],
"id": "93b22245-d3a2-42d7-9743-8d8a681842e6",
"savedPayload": {
"position": {
"x": 30323.705098312483,
"y": 38055.31695488855
},
"targetPosition": {
"x": 30231,
"y": 37770
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Position Class",
"name": "Business",
"config": "{}",
"project": "Governance",
"positions": [
{
"type": "Position",
"name": "Business Lead",
"config": "{}",
"project": "Governance",
"positions": [],
"positionClasss": [],
"id": "b29c3581-089f-41fd-9421-3e9b518a9c7b",
"savedPayload": {
"position": {
"x": 29866.27390876478,
"y": 38220.39921298053
},
"targetPosition": {
"x": 29988.294901687517,
"y": 37946.33557568774
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Position",
"name": "Advisor",
"config": "{}",
"project": "Governance",
"positions": [],
"positionClasss": [],
"id": "88a25b7c-df9f-4268-8216-5cb4a90a72dc",
"savedPayload": {
"position": {
"x": 29689.938333077036,
"y": 37977.69411466804
},
"targetPosition": {
"x": 29988.294901687517,
"y": 37946.33557568774
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"positionClasss": [],
"id": "520de537-9ab0-41d6-8bd0-950fe9524e4d",
"savedPayload": {
"position": {
"x": 29988.294901687517,
"y": 37946.33557568774
},
"targetPosition": {
"x": 30231,
"y": 37770
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Position Class",
"name": "Core Team",
"config": "{}",
"project": "Governance",
"positions": [
{
"type": "Position",
"name": "Member",
"config": "{}",
"project": "Governance",
"positions": [],
"positionClasss": [],
"id": "63bbf7f7-2d71-4075-8498-f09f754d8c0b",
"savedPayload": {
"position": {
"x": 29745.589803375035,
"y": 37417.328848624515
},
"targetPosition": {
"x": 29988.294901687517,
"y": 37593.66442431226
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"positionClasss": [],
"id": "0dc6759d-459b-45ff-83c5-220b7a323f75",
"savedPayload": {
"position": {
"x": 29988.294901687517,
"y": 37593.66442431226
},
"targetPosition": {
"x": 30231,
"y": 37770
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"positions": [
{
"type": "Position",
"name": "Project Lead",
"config": "{\n \"description\": \"\", \"relativeWeight\": 0 \n}",
"project": "Governance",
"positions": [],
"positionClasss": [],
"id": "5f694173-4568-46b2-a52c-4244320919f7",
"savedPayload": {
"position": {
"x": 30323.705098312483,
"y": 37484.68304511145
},
"targetPosition": {
"x": 30231,
"y": 37770
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,23 +1,971 @@
{
"type": "User Profile",
"name": "harrellbm",
"config": "{\n \"signature\": {\n \"message\": \"harrellbm\",\n \"messageHash\": \"0xc21e0ff12bbf9bb7af1e4790eaa4a6ebc7b090ce7df26748211b3fb593661a28\",\n \"v\": \"0x1c\",\n \"r\": \"0x97d59966082ae17d60487366ccebb1be1c750a5f543fc88bbbcdd4f74a540651\",\n \"s\": \"0x2492222689b804fa96ad94c9925bb45ed790ed45bf1ae3e82deac36c98a3e9f4\",\n \"signature\": \"0x97d59966082ae17d60487366ccebb1be1c750a5f543fc88bbbcdd4f74a5406512492222689b804fa96ad94c9925bb45ed790ed45bf1ae3e82deac36c98a3e9f41c\"\n }\n}",
"config": "{\"signature\":{\"message\":\"harrellbm\",\"messageHash\":\"0xc21e0ff12bbf9bb7af1e4790eaa4a6ebc7b090ce7df26748211b3fb593661a28\",\"v\":\"0x1c\",\"r\":\"0x97d59966082ae17d60487366ccebb1be1c750a5f543fc88bbbcdd4f74a540651\",\"s\":\"0x2492222689b804fa96ad94c9925bb45ed790ed45bf1ae3e82deac36c98a3e9f4\",\"signature\":\"0x97d59966082ae17d60487366ccebb1be1c750a5f543fc88bbbcdd4f74a5406512492222689b804fa96ad94c9925bb45ed790ed45bf1ae3e82deac36c98a3e9f41c\"},\"codeName\":\"harrellbm\"}",
"project": "Governance",
"tokenPowerSwitch": {
"type": "Token Power Switch",
"name": "New Token Power Switch",
"config": "{}",
"project": "Governance",
"tokenPowerSwitch": [],
"id": "1a1ddb9c-3717-4bf6-abe7-b545fa6010d6",
"tokenPowerSwitch": [
{
"type": "Token Power Switch",
"name": "Features and Controbutions",
"config": "{}",
"project": "Governance",
"tokenPowerSwitch": [],
"claimsProgram": {
"type": "Claims Program",
"name": "New Claims Program",
"config": "{}",
"project": "Governance",
"assetClaimsFolders": [
{
"type": "Asset Claims Folder",
"name": "Launch-Scripts Asset Class",
"config": "{}",
"project": "Governance",
"assetClaimsFolders": [
{
"type": "Asset Claims Folder",
"name": "Superalgos Asset Class",
"config": "{}",
"project": "Governance",
"assetClaimsFolders": [
{
"type": "Asset Claims Folder",
"name": "Launch-Scripts Asset Class",
"config": "{}",
"project": "Governance",
"assetClaimsFolders": [],
"assetContributionClaims": [
{
"type": "Asset Contribution Claim",
"name": "Superalgos Launch-Scripts create-shortcut.js",
"config": "{\n \"description\": \"\"\n}",
"project": "Governance",
"id": "ea9a39f8-1149-4bda-aec7-58e5ac07e0c5",
"savedPayload": {
"position": {
"x": 14535.725312229182,
"y": 22181.902722406394
},
"targetPosition": {
"x": 14778.430410541667,
"y": 22358.238298094137
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset",
"name": "create-shortcut.js",
"id": "7998312a-e903-491a-b2cb-943f38e782ae"
}
}
},
{
"type": "Asset Contribution Claim",
"name": "Superalgos Launch-Scripts launch-linux-mac.sh",
"config": "{\n \"description\": \"\"\n}",
"project": "Governance",
"id": "819052d7-d3ef-432f-a27d-66507b83f591",
"savedPayload": {
"position": {
"x": 14685.725312229182,
"y": 22072.92134320559
},
"targetPosition": {
"x": 14778.430410541667,
"y": 22358.238298094137
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset",
"name": "launch-linux-mac.sh",
"id": "e96a3ea1-8580-4cd1-8032-5ff8c19f2312"
}
}
},
{
"type": "Asset Contribution Claim",
"name": "Superalgos Launch-Scripts launch-windows.bat",
"config": "{\n \"description\": \"\"\n}",
"project": "Governance",
"id": "0e11d32b-7023-4bec-b351-76d2f8e3587c",
"savedPayload": {
"position": {
"x": 14871.135508854151,
"y": 22072.92134320559
},
"targetPosition": {
"x": 14778.430410541667,
"y": 22358.238298094137
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset",
"name": "launch-windows.bat",
"id": "58c7a50e-ae5e-4430-89bc-23d2631a5642"
}
}
},
{
"type": "Asset Contribution Claim",
"name": "Superalgos Launch-Scripts superalgos.ico",
"config": "{\n \"description\": \"\"\n}",
"project": "Governance",
"id": "7f3a30a5-3f31-4d1e-bfe4-83cdb7b22efe",
"savedPayload": {
"position": {
"x": 15021.135508854151,
"y": 22181.902722406394
},
"targetPosition": {
"x": 14778.430410541667,
"y": 22358.238298094137
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset",
"name": "superalgos.ico",
"id": "24df883e-ebf1-41ed-b2a5-69a3707e65cc"
}
}
}
],
"id": "b431ca85-d9e6-4f2e-8fd2-cacd7a6e63da",
"savedPayload": {
"position": {
"x": 14778.430410541667,
"y": 22358.238298094137
},
"targetPosition": {
"x": 14778.430410541667,
"y": 22658.238298094137
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset Class",
"name": "Launch-Scripts",
"id": "37811a42-dc4f-4140-9f24-9d4c793441cb"
}
}
}
],
"assetContributionClaims": [],
"id": "95db1d06-3c18-426c-aba7-2a23b5b15c31",
"savedPayload": {
"position": {
"x": 14778.430410541667,
"y": 22658.238298094137
},
"targetPosition": {
"x": 14778.430410541667,
"y": 22958.238298094137
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset Class",
"name": "Superalgos",
"id": "8bbcd3f2-5e68-475d-9b5f-53ceb890e189"
}
}
}
],
"assetContributionClaims": [],
"id": "e178f2a9-0929-46b9-8e5f-61c976bce347",
"savedPayload": {
"position": {
"x": 14778.430410541667,
"y": 22958.238298094137
},
"targetPosition": {
"x": 14778.430410541667,
"y": 23258.238298094137
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset Class",
"name": "Launch-Scripts",
"id": "fcf025b5-12cc-4de9-8f6c-ef972746d94c"
}
}
},
{
"type": "Asset Claims Folder",
"name": "Root Asset Class",
"config": "{}",
"project": "Governance",
"assetClaimsFolders": [
{
"type": "Asset Claims Folder",
"name": "Superalgos Asset Class",
"config": "{}",
"project": "Governance",
"assetClaimsFolders": [
{
"type": "Asset Claims Folder",
"name": "Root Asset Class",
"config": "{}",
"project": "Governance",
"assetClaimsFolders": [],
"assetContributionClaims": [
{
"type": "Asset Contribution Claim",
"name": "Superalgos Root README.md",
"config": "{\n \"description\": \"\"\n}",
"project": "Governance",
"id": "49c7731e-d725-4331-971a-2c501b701424",
"savedPayload": {
"position": {
"x": 15367.896174097488,
"y": 22325.535692847705
},
"targetPosition": {
"x": 15414.826513609558,
"y": 22621.842195026245
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset",
"name": "README.md",
"id": "a5ee087a-9889-41fc-b0c5-13a0e40cb7e8"
}
}
},
{
"type": "Asset Contribution Claim",
"name": "Superalgos Root run.js",
"config": "{\n \"description\": \"\"\n}",
"project": "Governance",
"id": "5429cb15-568b-4555-8b2f-bcd7eb56b9c5",
"savedPayload": {
"position": {
"x": 15551.023663531421,
"y": 22354.540237769736
},
"targetPosition": {
"x": 15414.826513609558,
"y": 22621.842195026245
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset",
"name": "run.js",
"id": "2ec5a110-3ecc-45ad-b410-9333ebc1840e"
}
}
},
{
"type": "Asset Contribution Claim",
"name": "Superalgos Root setup.js",
"config": "{\n \"description\": \"\"\n}",
"project": "Governance",
"id": "2d42fb71-dbe7-4c68-8468-2ffa0eb1917c",
"savedPayload": {
"position": {
"x": 15682.128470866068,
"y": 22485.645045104382
},
"targetPosition": {
"x": 15414.826513609558,
"y": 22621.842195026245
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset",
"name": "setup.js",
"id": "9c99e3f4-4e00-403b-9ead-8bdee7aa6566"
}
}
},
{
"type": "Asset Contribution Claim",
"name": "Superalgos Root uninstall.js",
"config": "{\n \"description\": \"\"\n}",
"project": "Governance",
"id": "1b1b7f42-c4d0-4a83-a72b-884928d58869",
"savedPayload": {
"position": {
"x": 15711.133015788098,
"y": 22668.772534538315
},
"targetPosition": {
"x": 15414.826513609558,
"y": 22621.842195026245
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset",
"name": "uninstall.js",
"id": "bce89a4d-9098-4b36-aafc-33b7ff58e030"
}
}
}
],
"id": "7b51e89d-d513-4519-9d2b-5052dea1a177",
"savedPayload": {
"position": {
"x": 15414.826513609558,
"y": 22621.842195026245
},
"targetPosition": {
"x": 15202.694479253594,
"y": 22833.97422938221
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset Class",
"name": "Root",
"id": "1e82e5c7-9420-4205-a2c4-aab3f0f96565"
}
}
}
],
"assetContributionClaims": [],
"id": "49919de2-3a7e-44a9-aeca-c206d3409c0b",
"savedPayload": {
"position": {
"x": 15202.694479253594,
"y": 22833.97422938221
},
"targetPosition": {
"x": 14990.56244489763,
"y": 23046.106263738173
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset Class",
"name": "Superalgos",
"id": "2201a417-cf22-47f4-b8df-8a16c63deb25"
}
}
}
],
"assetContributionClaims": [],
"id": "894d3393-3ffd-4815-8eb2-316329686936",
"savedPayload": {
"position": {
"x": 14990.56244489763,
"y": 23046.106263738173
},
"targetPosition": {
"x": 14778.430410541667,
"y": 23258.238298094137
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "Asset Class",
"name": "Root",
"id": "b1ec362d-bfb5-4210-8edd-6ceb9ba52014"
}
}
}
],
"featureClaimsFolders": [],
"positionClaimsFolders": [],
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "e4f73892-845d-4cbd-bb01-41c64f9eb45c",
"savedPayload": {
"position": {
"x": 15078.430410541667,
"y": 23258.238298094137
},
"targetPosition": {
"x": 14778.430410541667,
"y": 23258.238298094137
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "c2ad753c-49b6-4675-9fdd-02b6967aaab2",
"savedPayload": {
"position": {
"x": 14844.076124072424,
"y": 23593.280114692785
},
"targetPosition": {
"x": 14554.298376185703,
"y": 23515.634401162028
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"votingProgram": {
"type": "Voting Program",
"name": "New Voting Program",
"config": "{}",
"project": "Governance",
"votesSwitch": [
{
"type": "Votes Switch",
"name": "New Votes Switch",
"config": "{}",
"project": "Governance",
"votesSwitch": [],
"claimVotesSwitch": [],
"weightVotesSwitch": [],
"userProfileVotesSwitch": [],
"id": "578d894c-20a7-4a79-b90e-ba383740d29d",
"savedPayload": {
"position": {
"x": 14844.076124072422,
"y": 24017.544183404712
},
"targetPosition": {
"x": 14631.944089716459,
"y": 23805.41214904875
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"tokensBonus": {
"type": "Tokens Bonus",
"name": "New Tokens Bonus",
"project": "Governance",
"id": "0cfaa435-6615-4df8-9d31-1fe5f21e0e61",
"savedPayload": {
"position": {
"x": 14554.298376185703,
"y": 24095.18989693547
},
"targetPosition": {
"x": 14631.944089716459,
"y": 23805.41214904875
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "4ac11744-6d87-413d-813e-f0963b156d8c",
"savedPayload": {
"position": {
"x": 14631.944089716459,
"y": 23805.41214904875
},
"targetPosition": {
"x": 14554.298376185703,
"y": 23515.634401162028
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "fcceb17d-2c2a-4e24-ab5d-e2a8a2798f90",
"savedPayload": {
"position": {
"x": 14554.298376185703,
"y": 23515.634401162028
},
"targetPosition": {
"x": 14342.16634182974,
"y": 23303.502366806064
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Token Power Switch",
"name": "User Relationships",
"config": "{\n \"percentage\": 25\n}",
"project": "Governance",
"tokenPowerSwitch": [],
"mentorshipProgram": {
"type": "Mentorship Program",
"name": "New Mentorship Program",
"config": "{}",
"project": "Governance",
"userMentors": [
{
"type": "User Mentor",
"name": "Julian-Molina",
"config": "{\n \"percentage\": 60\n}",
"project": "Governance",
"id": "ef3f92a6-083d-4255-87d7-2a39fac1c6c0",
"savedPayload": {
"position": {
"x": 15130.501917517482,
"y": 23439.79726849358
},
"targetPosition": {
"x": 14954.16634182974,
"y": 23682.502366806064
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "User Profile",
"name": "Julian-Molina",
"id": "1fd95e41-4b22-48d5-be3a-904c37afcb11"
}
}
},
{
"type": "User Mentor",
"name": "Luis-Fernando-Molina",
"config": "{}",
"project": "Governance",
"id": "58896ed7-e5b8-405c-99e7-45b509f6fe7e",
"savedPayload": {
"position": {
"x": 15239.483296718285,
"y": 23589.79726849358
},
"targetPosition": {
"x": 14954.16634182974,
"y": 23682.502366806064
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "User Profile",
"name": "Luis-Fernando-Molina",
"id": "148911b3-b2f3-44fb-8cb4-017991789132"
}
}
}
],
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "b711f3c8-3749-49f4-a7d6-accb88999cb8",
"savedPayload": {
"position": {
"x": 15239.483296718285,
"y": 23775.207465118547
},
"targetPosition": {
"x": 14954.16634182974,
"y": 23682.502366806064
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"tokensBonus": {
"type": "Tokens Bonus",
"name": "New Tokens Bonus",
"project": "Governance",
"id": "9123a5e4-dd71-4b82-95af-a8a04ac38303",
"savedPayload": {
"position": {
"x": 15130.501917517482,
"y": 23925.207465118547
},
"targetPosition": {
"x": 14954.16634182974,
"y": 23682.502366806064
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "055d1919-2b4b-40f2-8793-9cc5eb765a88",
"savedPayload": {
"position": {
"x": 14342.16634182974,
"y": 23903.502366806064
},
"targetPosition": {
"x": 14342.16634182974,
"y": 23603.502366806064
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "450eb600-3080-4d37-b8a2-12f71120573c",
"savedPayload": {
"position": {
"x": 14342.16634182974,
"y": 23603.502366806064
},
"targetPosition": {
"x": 14342.16634182974,
"y": 23303.502366806064
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Token Power Switch",
"name": "Staking",
"config": "{\n \"percentage\": 10\n}",
"project": "Governance",
"tokenPowerSwitch": [],
"stakingProgram": {
"type": "Staking Program",
"name": "New Staking Program",
"config": "{}",
"project": "Governance",
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "2a38bc32-bfa7-4f07-acdc-10eee69385d9",
"savedPayload": {
"position": {
"x": 14990.56244489763,
"y": 24318.898469873955
},
"targetPosition": {
"x": 14778.430410541667,
"y": 24106.76643551799
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "02e75b99-0944-44dd-a434-9e307bdc7935",
"savedPayload": {
"position": {
"x": 13917.902273117812,
"y": 23727.76643551799
},
"targetPosition": {
"x": 14130.034307473776,
"y": 23515.634401162028
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "8f44d9ab-8ce6-4336-8b0e-0323d7440e75",
"savedPayload": {
"position": {
"x": 14130.034307473776,
"y": 23515.634401162028
},
"targetPosition": {
"x": 14342.16634182974,
"y": 23303.502366806064
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"id": "d5ad1e6a-c6ea-465e-ae14-99fb54534baa",
"savedPayload": {
"position": {
"x": 13648,
"y": 11067.5
"x": 14342.16634182974,
"y": 23303.502366806064
},
"targetPosition": {
"x": 13348,
"y": 11067.5
"x": 14342.16634182974,
"y": 23003.502366806064
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"tokensMined": {
"type": "Tokens Mined",
"name": "New Tokens Mined",
"project": "Governance",
"id": "9f832420-03f7-4e4b-8973-c3520bd6f263",
"savedPayload": {
"position": {
"x": 14042.16634182974,
"y": 23003.502366806064
},
"targetPosition": {
"x": 14342.16634182974,
"y": 23003.502366806064
},
"floatingObject": {
"isPinned": false,
@@ -32,15 +980,15 @@
}
}
},
"id": "5a60b508-60d4-454d-ba14-a6f1f5622684",
"id": "107d3e44-1685-4540-8316-3bc6591298e9",
"savedPayload": {
"position": {
"x": 13348,
"y": 11067.5
"x": 14342.16634182974,
"y": 23003.502366806064
},
"targetPosition": {
"x": 13348,
"y": 11067.5
"x": 14342.16634182974,
"y": 23003.502366806064
},
"floatingObject": {
"isPinned": false,
@@ -30,13 +30,15 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"spaceSettings": {
"type": "Space Settings",
"name": "New Space Settings",
"config": "{\n \"node\": {\n \"distancePercentage\": 60,\n \"radiusPercentage\": 85,\n \"massPercentage\": 100,\n \"animationSteps\": 2,\n \"menuItem\": {\n \"widthPercentage\": 100,\n \"heightPercentage\": 60,\n \"radiusPercentage\": 90\n }\n },\n \"physics\": false\n}",
"config": "{\n \"node\": {\n \"distancePercentage\": 60,\n \"radiusPercentage\": 85,\n \"massPercentage\": 100,\n \"animationSteps\": 2,\n \"menuItem\": {\n \"widthPercentage\": 100,\n \"heightPercentage\": 60,\n \"radiusPercentage\": 90\n }\n },\n \"physics\": false,\n \"shortcuts\": {\n \"toggleMapMode\": \"M\",\n \"toggleDrawRelationshipLines\": \"R\",\n \"toggleDrawParentLines\": \"C\",\n \"saveWorkspace\": \"S\",\n \"adjustAspectRatio\": \"A\"\n }\n}",
"project": "Foundations",
"id": "05c9d6d5-24c4-4eec-9aca-9668d6486fdd",
"savedPayload": {
@@ -56,7 +58,9 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"id": "f8485ce5-67f3-4476-b9e2-80994e49c318",
@@ -142,13 +146,15 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"spaceSettings": {
"type": "Space Settings",
"name": "New Space Settings",
"config": "{\n \"indexContent\": false\n}",
"config": "{\n \"indexContent\": true\n}",
"project": "Foundations",
"id": "4124c674-c5fe-41d9-94b9-d669753188b7",
"savedPayload": {
@@ -168,7 +174,9 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"id": "016e464a-2b86-4c73-b79b-35c95751c339",
@@ -221,7 +229,9 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"spaces": {
@@ -246,7 +256,9 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"mines": {
@@ -271,7 +283,9 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"trading": {
@@ -296,7 +310,9 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"learning": {
@@ -321,7 +337,9 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"otherHierarchies": {
@@ -346,7 +364,9 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"id": "cf9f8b3b-77c6-43c6-b01f-95cf366a91f6",
@@ -754,7 +774,7 @@
{
"type": "Plugin File",
"name": "Luis-Fernando-Molina",
"config": "{\n \"project\": \"Governance\",\n \"fileName\": \"Luis-Fernando-Molina\",\n \"folderName\": \"User-Profiles\",\n \"nodeType\": \"User Profile\"\n}",
"config": "{\n \"project\": \"Governance\",\n \"fileName\": \"Luis-Fernando-Molina\",\n \"folderName\": \"User-Profiles\",\n \"nodeType\": \"User Profile\",\n \"saveWithWorkspace\": true\n}",
"project": "Foundations",
"id": "cccfce2d-3497-419b-8c32-4cd62fb1b33f",
"savedPayload": {
@@ -769,7 +789,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -848,7 +868,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -905,7 +925,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -1364,17 +1384,17 @@
"githubAPI": {
"type": "Github API",
"name": "New Github API",
"config": "{\n \"username\": \"\",\n \"token\": \"\"\n}",
"config": "{\n \"username\": \"Luis-Fernando-Molina\",\n \"token\": \"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\"\n}",
"project": "Foundations",
"id": "90d121ab-9f19-4437-a051-1222287085fc",
"savedPayload": {
"position": {
"x": 30530.125,
"y": 10634.899380804953
"x": 30499.125000000004,
"y": 10694.399380804953
},
"targetPosition": {
"x": 30230.125,
"y": 10634.899380804953
"x": 30199.125000000004,
"y": 10694.399380804953
},
"floatingObject": {
"isPinned": false,
@@ -1384,18 +1404,20 @@
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {}
"uiObject": {
"isRunning": false
}
}
},
"id": "23021bb7-9997-4fe6-8199-71ebf70aef76",
"savedPayload": {
"position": {
"x": 30230.125,
"y": 10634.899380804953
"x": 30199.125000000004,
"y": 10694.399380804953
},
"targetPosition": {
"x": 30230.125,
"y": 10634.899380804953
"x": 30199.125000000004,
"y": 10694.399380804953
},
"floatingObject": {
"isPinned": true,
@@ -39,7 +39,7 @@
},
"addLeftIcons": true,
"level": 1,
"propertyNameAtParent": "stackingProgram",
"propertyNameAtParent": "stakingProgram",
"childrenNodesProperties": [
{
"name": "tokensAwarded",
@@ -53,7 +53,7 @@
},
{
"action": "Add UI Object",
"actionProject": "Voting Program",
"actionProject": "Foundations",
"actionFunction": "payload.executeAction",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "votingProgram",
@@ -65,7 +65,7 @@
"actionProject": "Foundations",
"actionFunction": "payload.executeAction",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "stackingProgram",
"propertyToCheckFor": "stakingProgram",
"label": "Add Staking Program",
"relatedUiObject": "Staking Program"
},
@@ -139,7 +139,7 @@
"autoAdd": false
},
{
"name": "stackingProgram",
"name": "stakingProgram",
"type": "node",
"childType": "Staking Program",
"autoAdd": false
@@ -0,0 +1,21 @@
{
"type": "Tokens Mined",
"menuItems": [
{
"action": "Delete UI Object",
"actionProject": "Foundations",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->"
},
"propertyNameAtParent": "tokensMined"
}
@@ -17,6 +17,15 @@
"label": "Add Token Power Switch",
"relatedUiObject": "Token Power Switch"
},
{
"action": "Add UI Object",
"actionProject": "Foundations",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "tokensMined",
"actionFunction": "payload.executeAction",
"label": "Add Tokens Mined",
"relatedUiObject": "Tokens Mined"
},
{
"action": "Delete UI Object",
"actionProject": "Foundations",
@@ -44,6 +53,12 @@
"type": "node",
"childType": "Token Power Switch",
"autoAdd": true
},
{
"name": "tokensMined",
"type": "node",
"childType": "Tokens Mined",
"autoAdd": true
}
]
}
@@ -0,0 +1,85 @@
{
"topic": "Gov Commands Errors",
"pageNumber": "1",
"type": "Gov Error - Pull Requests Not Processed",
"definition": {
"text": "There was a problem trying to process the pull requests at the Superalgos repository",
"updated": 1611129378492
},
"paragraphs": [
{
"style": "Text",
"text": "Check the following section for details on what may have happened. After you fix the issue that prevented the Gov PRs Command to run, you may try again.",
"updated": 1611152997869
},
{
"style": "Title",
"text": "Error Info",
"updated": 1611154606702
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Note",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611153032408
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the Client:"
},
{
"style": "Placeholder",
"text": "errorMessage"
},
{
"style": "Subtitle",
"text": "Error Stack"
},
{
"style": "Text",
"text": "The following is the Error Stack of the Exception that occured at the Client:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the Client:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details",
"updated": 1611154543778
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the Client:",
"updated": 1611154675224
},
{
"style": "Placeholder",
"text": "errorDetails",
"updated": 1611154555419
},
{
"style": "Text",
"text": ""
}
]
}
@@ -0,0 +1,82 @@
{
"topic": "Gov Commands Errors",
"pageNumber": "2",
"type": "Gov Error - Github Credentials Missing",
"definition": {
"text": "To manage pull requests from within the app, you must first provide your Github.com credentials so that the Client can get you authenticated when while accessing Github.com.",
"updated": 1611129104270
},
"paragraphs": [
{
"style": "Anchor",
"text": "Anchor Github Credentials Missing",
"updated": 1609855373585
},
{
"style": "Error",
"text": "Github Credentials are Missing. Please solve this issue and try again.",
"updated": 1620591786589
},
{
"style": "Text",
"text": "To solve this issue follow the following instructions on how to set up your GitHub.com credentials so that the system can automate the tasks needed to submit your contributions to the main repository of the Superalgos project.",
"updated": 1609945787577
},
{
"style": "Anchor",
"text": "Anchor Hierarchy APIs Not Found"
},
{
"style": "Error",
"text": "Github Credentials are Missing. The Hierarchy APIs was not found at your workspace. Please create it following the guide below and try again.",
"updated": 1620591795457
},
{
"style": "Anchor",
"text": "Anchor Github API Node Not Found",
"updated": 1610559802944
},
{
"style": "Error",
"text": "Github Credentials are Missing. The Hierarchy APIs does not have a child of type Github API. Please create it following the guide below and try again.",
"updated": 1620591802895
},
{
"style": "Anchor",
"text": "Anchor Config Property Username Not Found",
"updated": 1610559852624
},
{
"style": "Error",
"text": "Github Credentials are Missing. The property username is missing or empty. Please create it following the guide below and try again.",
"updated": 1620591810613
},
{
"style": "Anchor",
"text": "Anchor Config Property Token Not Found",
"updated": 1610559914327
},
{
"style": "Error",
"text": "Github Crendentials are Missing. The property token is missing or empty. Please create it following the guide below and try again.",
"updated": 1610559900470
},
{
"style": "Text",
"text": ""
},
{
"style": "Title",
"text": "Applies to"
},
{
"style": "List",
"text": "Gov PRs Command"
},
{
"style": "Include",
"text": "Foundations->Topic->App Contribute Command->Block Authentication",
"updated": 1609945833844
}
]
}
@@ -0,0 +1,85 @@
{
"topic": "Gov Commands Errors",
"pageNumber": "3",
"type": "Gov Error - Pay Failed",
"definition": {
"text": "There was a problem trying to pay to contributors from the Treasury Account. Check the console for errors.",
"updated": 1611129344277
},
"paragraphs": [
{
"style": "Success",
"text": "Check for the following section for details on what may have happened. After you fix the issue, you may try again.",
"updated": 1611152967185
},
{
"style": "Title",
"text": "Error Info",
"updated": 1611154641024
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Note",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611151375974
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the Client:",
"updated": 1611151299633
},
{
"style": "Placeholder",
"text": "errorMessage"
},
{
"style": "Subtitle",
"text": "Error Stack"
},
{
"style": "Text",
"text": "The following is the Error Stack of the Exception that occured at the Client:",
"updated": 1611151427220
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the Client:",
"updated": 1611151443562
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the Client:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Text",
"text": ""
}
]
}
@@ -0,0 +1,20 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "1",
"type": "Gov Message - Pull Requests Processed",
"definition": {
"text": "The pull requests at the main Superalgos repositoryhave been succesfully processed.",
"updated": 1611002547907,
"translations": [
]
},
"paragraphs": [
{
"style": "Success",
"text": "No further action from you is required. The PRs Processing Rules have been applied and all PRs that could be merged were merged.",
"updated": 1611002626154,
"translations": [
]
}
]
}
@@ -0,0 +1,27 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "2",
"type": "Gov Message - Processing Pull Requests",
"definition": {
"text": "Hold on while this process checks all the open PRs at the Superalgos repository at GitHub.com and merges all the ones that can be merged accorfing to the PRs Processing Rules. You will get a new message when the operation is complete.",
"updated": 1611002766659,
"translations": [
]
},
"paragraphs": [
{
"style": "Title",
"text": "What's next?",
"updated": 1609940971059,
"translations": [
]
},
{
"style": "Text",
"text": "No further action from you is required. In a few seconds / minutes you should be able to see the result of this process.",
"updated": 1611128895749,
"translations": [
]
}
]
}
@@ -0,0 +1,17 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "3",
"type": "Gov Message - Paying Contributors",
"definition": {
"text": "The process to pay contributors has been started. Hold on!",
"translations": []
},
"paragraphs": [
{
"style": "Success",
"text": "You will soon get a notice informing you whether the process succeed to pay all contributors or not.",
"translations": [],
"updated": 1627203557237
}
]
}
@@ -0,0 +1,20 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "4",
"type": "Gov Message - All Payments Were Sent",
"definition": {
"text": "The pay process finished successfully. Payments to all contributors were sent.",
"updated": 1611003042937,
"translations": [
]
},
"paragraphs": [
{
"style": "Success",
"text": "The process to pay contributors was fully successfull and all payments have been sent.",
"updated": 1616081292001,
"translations": [
]
}
]
}
@@ -0,0 +1,20 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "5",
"type": "Gov Message - Not All Payments Were Sent",
"definition": {
"text": "The update pay run but no all the payments were sent. You need to check the process output to fix it and proably run it again.",
"updated": 1615458687718,
"translations": [
]
},
"paragraphs": [
{
"style": "Success",
"text": "You are up-to-date. No need to reboot the Client or refresh the UI page.",
"updated": 1610454271911,
"translations": [
]
}
]
}
@@ -0,0 +1,16 @@
{
"topic": "App Commands",
"pageNumber": "1",
"type": "App PRs Command",
"definition": {
"text": "This command allows you to check all existing PRs and automatically close the ones that do not comply with PRs Rules or merge the ones they do. It also leaves untouched the PRs that are out of the scope of the PRs Rules.",
"updated": 1610909304702
},
"paragraphs": [
{
"style": "Text",
"text": "Add more text here.",
"updated": 1622028842412
}
]
}
@@ -0,0 +1,29 @@
{
"topic": "App Commands",
"pageNumber": "2",
"type": "App Pay Command",
"definition": {
"text": "Use this command to pay to contributors using the Trasury Blockchain Account to do so. If you are not in charge of the Treasury Account you can still run this command to generate the output file of the Pay process.",
"updated": 1610449365984
},
"paragraphs": [
{
"style": "Title",
"text": "Syntax",
"updated": 1610449451990
},
{
"style": "Json",
"text": "gov.pay",
"updated": 1615612258411
},
{
"style": "Title",
"text": "Examples"
},
{
"style": "Json",
"text": "gov.pay"
}
]
}
@@ -440,7 +440,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
function drawClaims(node) {
let status =
parseFloat(node.payload.claimsProgram.awarded.tokens.toFixed(2)).toLocaleString('en') +
parseFloat(node.payload.claimsProgram.awarded.tokens.toFixed(0)).toLocaleString('en') +
' ' + 'SA Tokens Awarded' + ' - ' +
'From Reward: ' + node.payload.claimsProgram.awarded.percentage.toFixed(2) + '%' + ' - ' +
'Shared Between: ' + node.payload.claimsProgram.share.count + ' claims' + ' - ' +
@@ -452,7 +452,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
function drawProgram(node) {
if (node.payload !== undefined) {
const ownPowerText = parseFloat(node.payload.claimsProgram.ownPower.toFixed(2)).toLocaleString('en')
const ownPowerText = parseFloat(node.payload.claimsProgram.ownPower.toFixed(0)).toLocaleString('en')
node.payload.uiObject.statusAngleOffset = 0
node.payload.uiObject.statusAtAngle = false
@@ -464,7 +464,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
function drawTokensAwarded(node) {
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
const tokensAwardedText = parseFloat(node.payload.claimsProgram.awarded.tokens.toFixed(2)).toLocaleString('en')
const tokensAwardedText = parseFloat(node.payload.claimsProgram.awarded.tokens.toFixed(0)).toLocaleString('en')
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
node.tokensAwarded.payload.uiObject.valueAtAngle = true
@@ -2,6 +2,7 @@ function newGovernanceFunctionLibraryDelegationProgram() {
let thisObject = {
calculate: calculate
}
const MAX_GENERATIONS = 10
return thisObject
@@ -9,15 +10,6 @@ function newGovernanceFunctionLibraryDelegationProgram() {
pools,
userProfiles
) {
/* Bonus Calculation is here */
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"delegationProgram",
"Delegation-Bonus",
"Delegation Program"
)
/*
We will first reset all the delegate power, and then distribute it.
*/
@@ -44,43 +36,67 @@ function newGovernanceFunctionLibraryDelegationProgram() {
distributeProgram(program)
}
/* Bonus Calculation is here */
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"delegationProgram",
"Delegation-Bonus",
"Delegation Program"
)
function resetProgram(node) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
node.payload.delegationProgram = {
programPower: 0,
ownPower: 0
}
resetNode(node, 0)
if (node.type === 'User Profile') {
return
}
if (node.payload.referenceParent !== undefined) {
resetProgram(node.payload.referenceParent)
return
}
let schemaDocument = getSchemaDocument(node)
if (schemaDocument === undefined) { return }
function resetNode(node, generation) {
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (generation >= MAX_GENERATIONS) {
return
}
if (node === undefined) { return }
if (node.payload === undefined) { return }
if (node.payload.delegationProgram === undefined) {
node.payload.delegationProgram = {
programPower: 0,
ownPower: 0,
usedPower: 0
}
} else {
node.payload.delegationProgram.programPower = 0
node.payload.delegationProgram.ownPower = 0
node.payload.delegationProgram.usedPower = 0
}
switch (property.type) {
case 'node': {
let childNode = node[property.name]
resetProgram(childNode)
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
resetProgram(childNode)
if (node.type === 'User Profile') {
return
}
if (node.payload.referenceParent !== undefined) {
resetNode(node.payload.referenceParent, generation + 1)
return
}
let schemaDocument = getSchemaDocument(node)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
let childNode = node[property.name]
resetNode(childNode, generation)
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
resetNode(childNode, generation)
}
}
break
}
break
}
}
}
@@ -99,127 +115,155 @@ function newGovernanceFunctionLibraryDelegationProgram() {
The Own Power is the power generated by the same User Profile tokens, not inherited from others.
*/
programNode.payload.delegationProgram.ownPower = programPower
distributeProgramPower(programNode, programPower)
}
distributeProgramPower(programNode, programNode, programPower, undefined, 0)
function distributeProgramPower(node, programPower, percentage) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
if (node.payload.delegationProgram === undefined) { return }
node.payload.delegationProgram.programPower = node.payload.delegationProgram.programPower + programPower
drawPower(node, node.payload.delegationProgram.programPower, percentage)
/*
When we reach certain node types, we will halt the distribution, because these are targets for
delegate power.
*/
if (
node.type === 'User Profile'
function distributeProgramPower(
currentProgramNode,
node,
programPower,
percentage,
generation
) {
return
}
/*
If there is a reference parent defined, this means that the delegate power is
transfered to it and not distributed among children.
*/
if (
node.payload.referenceParent !== undefined &&
node.type === 'User Delegate'
) {
distributeProgramPower(node.payload.referenceParent, programPower / 10)
return
}
/*
If there is no reference parent we will redistribute delegate power among children.
*/
let schemaDocument = getSchemaDocument(node)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
/*
Before distributing the delegate power, we will calculate how the power
is going to be switched between all nodes. The first pass is about
scanning all sibling nodes to see which ones have a percentage defined
at their config, and check that all percentages don't add more than 100.
*/
let totalPercentage = 0
let totalNodesWithoutPercentage = 0
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
}
break
}
}
}
if (totalPercentage > 100) {
node.payload.uiObject.setErrorMessage('Delegate Power Switching Error. Total Percentage of children nodes is grater that 100.')
if (generation >= MAX_GENERATIONS) {
return
}
let defaultPercentage = 0
if (totalNodesWithoutPercentage > 0) {
defaultPercentage = (100 - totalPercentage) / totalNodesWithoutPercentage
if (node === undefined) { return }
if (node.payload === undefined) { return }
if (node.payload.delegationProgram === undefined) { return }
node.payload.delegationProgram.programPower = node.payload.delegationProgram.programPower + programPower
drawPower(node, node.payload.delegationProgram.programPower, percentage)
/*
When we reach certain node types, we will halt the distribution, because these are targets for
delegate power.
*/
if (
node.type === 'User Profile'
) {
return
}
/*
Here we do the actual distribution.
If there is a reference parent defined, this means that the delegate power is
transfered to it and not distributed among children.
*/
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (
node.payload.referenceParent !== undefined &&
node.type === 'User Delegate'
) {
currentProgramNode.payload.delegationProgram.usedPower = currentProgramNode.payload.delegationProgram.usedPower + programPower
distributeProgramPower(
currentProgramNode,
node.payload.referenceParent,
programPower / 10,
undefined,
generation + 1
)
return
}
/*
If there is no reference parent we will redistribute delegate power among children.
*/
let schemaDocument = getSchemaDocument(node)
if (schemaDocument === undefined) { return }
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(childNode, programPower * percentage / 100, percentage)
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(childNode, programPower * percentage / 100, percentage)
if (schemaDocument.childrenNodesProperties !== undefined) {
/*
Before distributing the delegate power, we will calculate how the power
is going to be switched between all nodes. The first pass is about
scanning all sibling nodes to see which ones have a percentage defined
at their config, and check that all percentages don't add more than 100.
*/
let totalPercentage = 0
let totalNodesWithoutPercentage = 0
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
break
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
}
break
}
}
}
if (totalPercentage > 100) {
node.payload.uiObject.setErrorMessage('Delegate Power Switching Error. Total Percentage of children nodes is grater that 100.')
return
}
let defaultPercentage = 0
if (totalNodesWithoutPercentage > 0) {
defaultPercentage = (100 - totalPercentage) / totalNodesWithoutPercentage
}
/*
Here we do the actual distribution.
*/
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(
currentProgramNode,
childNode,
programPower * percentage / 100,
percentage,
generation
)
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(
currentProgramNode,
childNode,
programPower * percentage / 100,
percentage,
generation
)
}
}
break
}
}
}
}
@@ -249,7 +293,7 @@ function newGovernanceFunctionLibraryDelegationProgram() {
node.payload.uiObject.percentageAtAngle = true
let powerType = 'Delegate Power'
const programPowerText = parseFloat(programPower.toFixed(2)).toLocaleString('en') + ' ' + powerType
const programPowerText = parseFloat(programPower.toFixed(0)).toLocaleString('en') + ' ' + powerType
node.payload.uiObject.setValue(programPowerText)
if (percentage !== undefined) {
@@ -261,7 +305,7 @@ function newGovernanceFunctionLibraryDelegationProgram() {
function drawUserNode(node, programPower, percentage) {
if (node.payload !== undefined) {
const outgoingPowerText = parseFloat(programPower.toFixed(2)).toLocaleString('en')
const outgoingPowerText = parseFloat(programPower.toFixed(0)).toLocaleString('en')
node.payload.uiObject.valueAngleOffset = 180
node.payload.uiObject.valueAtAngle = true
@@ -285,7 +329,7 @@ function newGovernanceFunctionLibraryDelegationProgram() {
function drawProgram(node) {
if (node.payload !== undefined) {
const ownPowerText = parseFloat(node.payload.delegationProgram.ownPower.toFixed(2)).toLocaleString('en')
const ownPowerText = parseFloat(node.payload.delegationProgram.ownPower.toFixed(0)).toLocaleString('en')
node.payload.uiObject.statusAngleOffset = 0
node.payload.uiObject.statusAtAngle = false
@@ -22,7 +22,7 @@ function newGovernanceFunctionLibraryDistributionProcess() {
)
/*
Here we will run the Delegation Program, so that all the tokens
that are going to be delegated, are transfered to the Delegate User Profile.
that are going to be delegated, are transfered to the Delegate's User Profile.
*/
UI.projects.governance.functionLibraries.delegationProgram.calculate(
pools,
@@ -35,6 +35,9 @@ function newGovernanceFunctionLibraryDistributionProcess() {
UI.projects.governance.functionLibraries.tokenPower.calculateDelegatedPower(
userProfiles
)
/*
Run the Voting Program
*/
UI.projects.governance.functionLibraries.votingProgram.calculate(
pools,
features,
@@ -42,43 +45,64 @@ function newGovernanceFunctionLibraryDistributionProcess() {
positions,
userProfiles
)
/*
Now that we have all votes applied, we will calculate all weights
*/
UI.projects.governance.functionLibraries.weights.calculate(
pools,
features,
assets,
positions
)
/*
Let's see how the tokens to be distributed flows into pools, assets, features and positions.
*/
UI.projects.governance.functionLibraries.tokens.calculate(
pools
)
/*
Run the Referral Program
*/
UI.projects.governance.functionLibraries.referralProgram.calculate(
pools,
userProfiles
)
/*
Run the Support Program
*/
UI.projects.governance.functionLibraries.supportProgram.calculate(
pools,
userProfiles
)
/*
Run the Mentorship Program
*/
UI.projects.governance.functionLibraries.mentorshipProgram.calculate(
pools,
userProfiles
)
UI.projects.governance.functionLibraries.stackingProgram.calculate(
/*
Run the Staking Program
*/
UI.projects.governance.functionLibraries.stakingProgram.calculate(
pools,
userProfiles
)
/*
Run the Claims Program
*/
UI.projects.governance.functionLibraries.claimsProgram.calculate(
features,
assets,
positions,
userProfiles
)
/*
After all the programs were ran, we can calculate the tokens mining
calculation each profile.
*/
UI.projects.governance.functionLibraries.tokenMining.calculate(
userProfiles
)
}
}
@@ -9,15 +9,7 @@ function newGovernanceFunctionLibraryMentorshipProgram() {
pools,
userProfiles
) {
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"mentorshipProgram",
"Mentorship-Bonus",
"Mentorship Program"
)
UI.projects.governance.utilities.decendentProgram.run(
pools,
userProfiles,
@@ -28,5 +20,13 @@ function newGovernanceFunctionLibraryMentorshipProgram() {
"userMentors",
"User Mentor"
)
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"mentorshipProgram",
"Mentorship-Bonus",
"Mentorship Program"
)
}
}
@@ -9,15 +9,6 @@ function newGovernanceFunctionLibraryReferralProgram() {
pools,
userProfiles
) {
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"referralProgram",
"Referrals-Bonus",
"Referral Program"
)
UI.projects.governance.utilities.decendentProgram.run(
pools,
userProfiles,
@@ -28,5 +19,13 @@ function newGovernanceFunctionLibraryReferralProgram() {
"userReferrers",
"User Referrer"
)
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"referralProgram",
"Referrals-Bonus",
"Referral Program"
)
}
}
@@ -1,4 +1,4 @@
function newGovernanceFunctionLibraryStackingProgram() {
function newGovernanceFunctionLibraryStakingProgram() {
let thisObject = {
calculate: calculate
}
@@ -12,7 +12,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
let programPoolTokenReward
/*
In order to be able to calculate the share of the Program Pool for each User Profile,
we need to accumulate all the Stacking Power that each User Profile at their Program
we need to accumulate all the Staking Power that each User Profile at their Program
node has, because with that Power is that each Program node gets a share of the pool.
*/
let accumulatedProgramPower = 0
@@ -51,7 +51,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Staking Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
if (program.payload.stackingProgram.isActive === false) { continue }
if (program.payload.stakingProgram.isActive === false) { continue }
distributeProgram(program)
}
@@ -62,7 +62,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Staking Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
if (program.payload.stackingProgram.isActive === false) { continue }
if (program.payload.stakingProgram.isActive === false) { continue }
calculateProgram(program)
}
@@ -70,13 +70,25 @@ function newGovernanceFunctionLibraryStackingProgram() {
function resetProgram(node) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
node.payload.stackingProgram = {
count: 0,
percentage: 0,
outgoingPower: 0,
ownPower: 0,
incomingPower: 0,
awarded: {
if (node.payload.stakingProgram === undefined) {
node.payload.stakingProgram = {
count: 0,
percentage: 0,
outgoingPower: 0,
ownPower: 0,
incomingPower: 0,
awarded: {
tokens: 0,
percentage: 0
}
}
} else {
node.payload.stakingProgram.count = 0
node.payload.stakingProgram.percentage = 0
node.payload.stakingProgram.outgoingPower = 0
node.payload.stakingProgram.ownPower = 0
node.payload.stakingProgram.incomingPower = 0
node.payload.stakingProgram.awarded = {
tokens: 0,
percentage: 0
}
@@ -92,21 +104,21 @@ function newGovernanceFunctionLibraryStackingProgram() {
if (
userProfile.payload.blockchainTokens === undefined
) {
node.payload.stackingProgram.isActive = false
node.payload.stakingProgram.isActive = false
userProfile.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.")
return
}
node.payload.stackingProgram.isActive = true
node.payload.stakingProgram.isActive = true
}
function distributeProgram(programNode) {
if (programNode === undefined || programNode.payload === undefined) { return }
/*
Here we will convert Token Power into Stacking Power.
As per system rules Stacking Powar = tokensPower
Here we will convert Token Power into Staking Power.
As per system rules Staking Powar = tokensPower
*/
let programPower = programNode.payload.tokenPower
programNode.payload.stackingProgram.ownPower = programPower
programNode.payload.stakingProgram.ownPower = programPower
accumulatedProgramPower = accumulatedProgramPower + programPower
}
@@ -132,7 +144,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
programNode.payload.uiObject.setErrorMessage("Tokens Awarded Node is needed in order for this Program to get Tokens from the Program Pool.")
return
}
programNode.payload.stackingProgram.awarded.tokens = programNode.payload.stackingProgram.ownPower * totalPowerRewardRatio
programNode.payload.stakingProgram.awarded.tokens = programNode.payload.stakingProgram.ownPower * totalPowerRewardRatio
drawProgram(programNode)
}
@@ -140,7 +152,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
function drawProgram(node) {
if (node.payload !== undefined) {
const ownPowerText = parseFloat(node.payload.stackingProgram.ownPower.toFixed(2)).toLocaleString('en')
const ownPowerText = parseFloat(node.payload.stakingProgram.ownPower.toFixed(0)).toLocaleString('en')
node.payload.uiObject.statusAngleOffset = 0
node.payload.uiObject.statusAtAngle = false
@@ -149,7 +161,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
}
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
const tokensAwardedText = parseFloat(node.payload.stackingProgram.awarded.tokens.toFixed(2)).toLocaleString('en')
const tokensAwardedText = parseFloat(node.payload.stakingProgram.awarded.tokens.toFixed(0)).toLocaleString('en')
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
node.tokensAwarded.payload.uiObject.valueAtAngle = false
@@ -9,15 +9,6 @@ function newGovernanceFunctionLibrarySupportProgram() {
pools,
userProfiles
) {
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"supportProgram",
"Support-Bonus",
"Support Program"
)
UI.projects.governance.utilities.decendentProgram.run(
pools,
userProfiles,
@@ -28,5 +19,13 @@ function newGovernanceFunctionLibrarySupportProgram() {
"userSupporters",
"User Supporter"
)
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"supportProgram",
"Support-Bonus",
"Support Program"
)
}
}
@@ -0,0 +1,150 @@
function newGovernanceFunctionLibraryTokenMining() {
let thisObject = {
calculate: calculate
}
return thisObject
function calculate(
userProfiles
) {
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
resetTokensMined(userProfile)
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Referral Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
calculateProgram(userProfile, program, "referralProgram")
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Support Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
calculateProgram(userProfile, program, "supportProgram")
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Mentorship Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
calculateProgram(userProfile, program, "mentorshipProgram")
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Claims Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
calculateProgram(userProfile, program, "claimsProgram")
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Voting Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
calculateProgram(userProfile, program, "votingProgram")
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Staking Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
calculateProgram(userProfile, program, "stakingProgram")
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Delegation Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
calculateProgram(userProfile, program, "delegationProgram")
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
drawTokensMined(userProfile)
}
function resetTokensMined(userProfile) {
if (userProfile === undefined) { return }
if (userProfile.payload === undefined) { return }
if (userProfile.tokensMined === undefined) { return }
if (userProfile.tokensMined.payload.tokensMined === undefined) {
userProfile.tokensMined.payload.tokensMined = {
awarded: 0,
bonus: 0,
total: 0
}
} else {
userProfile.tokensMined.payload.tokensMined.awarded = 0
userProfile.tokensMined.payload.tokensMined.bonus = 0
userProfile.tokensMined.payload.tokensMined.total = 0
}
}
function calculateProgram(userProfile, programNode, programPropertyName) {
/*
Here we will look into the program node and add their token awarded and token bonus
to the subtotals at the Tokens Mined node.
*/
if (userProfile === undefined) { return }
if (userProfile.payload === undefined) { return }
if (userProfile.tokensMined === undefined) { return }
if (programNode.payload === undefined) { return }
if (programNode.payload[programPropertyName] === undefined) { return }
if (programNode.tokensAwarded !== undefined && programNode.payload[programPropertyName].awarded !== undefined) {
let awarded = programNode.payload[programPropertyName].awarded.tokens | 0
userProfile.tokensMined.payload.tokensMined.awarded = userProfile.tokensMined.payload.tokensMined.awarded + awarded
}
if (programNode.tokensBonus !== undefined && programNode.payload[programPropertyName].bonus !== undefined) {
let bonus = programNode.payload[programPropertyName].bonus.tokens | 0
userProfile.tokensMined.payload.tokensMined.bonus = userProfile.tokensMined.payload.tokensMined.bonus + bonus
}
userProfile.tokensMined.payload.tokensMined.total = userProfile.tokensMined.payload.tokensMined.awarded + userProfile.tokensMined.payload.tokensMined.bonus
}
function drawTokensMined(userProfile) {
if (userProfile === undefined) { return }
if (userProfile.payload === undefined) { return }
if (userProfile.tokensMined === undefined) { return }
const awarded = parseFloat(userProfile.tokensMined.payload.tokensMined.awarded.toFixed(0)).toLocaleString('en')
const bonus = parseFloat(userProfile.tokensMined.payload.tokensMined.bonus.toFixed(0)).toLocaleString('en')
const total = parseFloat(userProfile.tokensMined.payload.tokensMined.total.toFixed(0)).toLocaleString('en')
userProfile.tokensMined.payload.uiObject.valueAngleOffset = 0
userProfile.tokensMined.payload.uiObject.valueAtAngle = true
userProfile.tokensMined.payload.uiObject.setStatus(awarded + ' Awarded + ' + bonus + ' Bonus')
userProfile.tokensMined.payload.uiObject.setValue(total + ' SA Tokens')
}
}
}
@@ -174,6 +174,7 @@ function newGovernanceFunctionLibraryTokenPower() {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === "Delegation Program" && excludeDelegationProgram === true) { continue }
if (childNode.type === "Tokens Mined") { continue }
let percentage = getPercentage(childNode)
@@ -191,6 +192,7 @@ function newGovernanceFunctionLibraryTokenPower() {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === "Delegation Program" && excludeDelegationProgram === true) { continue }
if (childNode.type === "Tokens Mined") { continue }
let percentage = getPercentage(childNode)
if (percentage !== undefined && isNaN(percentage) !== true) {
@@ -223,6 +225,7 @@ function newGovernanceFunctionLibraryTokenPower() {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === "Delegation Program" && excludeDelegationProgram === true) { continue }
if (childNode.type === "Tokens Mined") { continue }
let percentage = getPercentage(childNode)
if (percentage === undefined || isNaN(percentage) === true) {
@@ -243,6 +246,7 @@ function newGovernanceFunctionLibraryTokenPower() {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === "Delegation Program" && excludeDelegationProgram === true) { continue }
if (childNode.type === "Tokens Mined") { continue }
let percentage = getPercentage(childNode)
if (percentage === undefined || isNaN(percentage) === true) {
@@ -272,8 +276,8 @@ function newGovernanceFunctionLibraryTokenPower() {
if (node.type === 'User Profile') {
let incomingPower = node.payload.tokenPower - node.payload.blockchainTokens
const ownPowerText = parseFloat(node.payload.blockchainTokens.toFixed(2)).toLocaleString('en') + ' ' + 'Blockchain Power'
const incomingPowerText = parseFloat(incomingPower.toFixed(2)).toLocaleString('en') + ' ' + 'Incoming Delegated Power'
const ownPowerText = parseFloat(node.payload.blockchainTokens.toFixed(0)).toLocaleString('en') + ' ' + 'Blockchain Power'
const incomingPowerText = parseFloat(incomingPower.toFixed(0)).toLocaleString('en') + ' ' + 'Incoming Delegated Power'
node.payload.uiObject.valueAngleOffset = 0
node.payload.uiObject.valueAtAngle = false
@@ -282,7 +286,7 @@ function newGovernanceFunctionLibraryTokenPower() {
return
}
const tokenPowerText = parseFloat(tokenPower.toFixed(2)).toLocaleString('en') + ' ' + 'Token Power'
const tokenPowerText = parseFloat(tokenPower.toFixed(0)).toLocaleString('en') + ' ' + 'Token Power'
node.payload.uiObject.valueAngleOffset = 180
node.payload.uiObject.valueAtAngle = true
@@ -167,10 +167,10 @@ function newGovernanceFunctionLibraryTokens() {
if (tokens.toFixed === undefined) { return }
let status
if (weight !== undefined && weight !== 0) {
status = parseFloat(tokens.toFixed(2)).toLocaleString('en')
status = parseFloat(tokens.toFixed(0)).toLocaleString('en')
+ ' ' + 'SA Tokens Reward' + ' - ' + 'Weight: ' + (weight * 100).toFixed(2) + " %"
} else {
status = parseFloat(tokens.toFixed(2)).toLocaleString('en')
status = parseFloat(tokens.toFixed(0)).toLocaleString('en')
+ ' ' + 'SA Tokens Reward'
}
@@ -3,6 +3,7 @@ function newGovernanceFunctionLibraryVotingProgram() {
calculate: calculate,
installMissingVotes: installMissingVotes
}
const MAX_GENERATIONS = 10
return thisObject
@@ -14,15 +15,6 @@ function newGovernanceFunctionLibraryVotingProgram() {
userProfiles
) {
/* Bonus Calculation is here */
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"votingProgram",
"Voting-Bonus",
"Voting Program"
)
/* Reset Votes at Pools */
for (let i = 0; i < pools.length; i++) {
let poolsNode = pools[i]
@@ -70,91 +62,119 @@ function newGovernanceFunctionLibraryVotingProgram() {
distributeProgram(program)
}
/* Bonus Calculation is here */
UI.projects.governance.utilities.bonusProgram.run(
pools,
userProfiles,
"votingProgram",
"Voting-Bonus",
"Voting Program"
)
function resetVotes(node) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
node.payload.votingProgram = {
votes: 0,
ownPower: 0,
incomingPower: 0
}
/*
When we reach certain node types, we will halt the distribution, because these are targets for
voting power.
*/
if (
node.type === 'Position' ||
node.type === 'Asset' ||
node.type === 'Feature' ||
node.type === 'Pool' ||
node.type === 'Position Contribution Claim' ||
node.type === 'Asset Contribution Claim' ||
node.type === 'Feature Contribution Claim'
) { return }
/*
For Votes to Profiles there is a special treamtment that needs to be done
so that votes can flow from Profiles to the Program without being affected
by Percentages.
*/
switch (node.type) {
case 'User Profile Vote': {
if (node.payload.referenceParent !== undefined) {
resetVotes(node.payload.referenceParent)
}
break
}
case 'User Profile': {
let program = UI.projects.governance.utilities.validations.onlyOneProgram(node, 'Voting Program')
if (program === undefined) { return }
if (program.payload === undefined) { return }
resetVotes(program)
resetNode(node, 0)
function resetNode(node, generation) {
if (generation >= MAX_GENERATIONS) {
return
}
}
/*
If there is a reference parent defined, this means that the voting power is
transfered to it and not distributed among children.
*/
if (
node.payload.referenceParent !== undefined &&
node.type !== 'Votes Switch' &&
node.type !== 'Claim Votes Switch' &&
node.type !== 'Weight Votes Switch'
) {
resetVotes(node.payload.referenceParent)
return
}
/*
Here we are inside the Voting Program, so we will crawl all it's children.
*/
let schemaDocument = getSchemaDocument(node)
if (schemaDocument === undefined) { return }
if (node === undefined) { return }
if (node.payload === undefined) { return }
if (node.payload.votingProgram === undefined) {
node.payload.votingProgram = {
votes: 0,
ownPower: 0,
incomingPower: 0,
usedPower: 0
}
} else {
node.payload.votingProgram.votes = 0
node.payload.votingProgram.ownPower = 0
node.payload.votingProgram.incomingPower = 0
node.payload.votingProgram.usedPower = 0
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (node.type === 'User Profile' && property.name !== "votingProgram") { continue }
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
resetVotes(childNode)
}
/*
When we reach certain node types, we will halt the distribution, because these are targets for
voting power.
*/
if (
node.type === 'Position' ||
node.type === 'Asset' ||
node.type === 'Feature' ||
node.type === 'Pool' ||
node.type === 'Position Contribution Claim' ||
node.type === 'Asset Contribution Claim' ||
node.type === 'Feature Contribution Claim'
) { return }
/*
For Votes to Profiles there is a special treamtment that needs to be done
so that votes can flow from Profiles to the Program without being affected
by Percentages.
*/
switch (node.type) {
case 'User Profile Vote': {
if (node.payload.referenceParent !== undefined) {
resetNode(node.payload.referenceParent, generation + 1)
return
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode.type === 'Tokens Bonus') { continue }
resetVotes(childNode)
break
}
case 'User Profile': {
let program = UI.projects.governance.utilities.validations.onlyOneProgram(node, 'Voting Program')
if (program === undefined) { return }
if (program.payload === undefined) { return }
resetNode(program, generation)
return
}
}
/*
If there is a reference parent defined, this means that the voting power is
transfered to it and not distributed among children.
*/
if (
node.payload.referenceParent !== undefined &&
node.type !== 'Votes Switch' &&
node.type !== 'Claim Votes Switch' &&
node.type !== 'Weight Votes Switch'
) {
resetNode(node.payload.referenceParent, generation)
return
}
/*
Here we are inside the Voting Program, so we will crawl all it's children.
*/
let schemaDocument = getSchemaDocument(node)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (node.type === 'User Profile' && property.name !== "votingProgram") { continue }
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
resetNode(childNode, generation)
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode.type === 'Tokens Bonus') { continue }
resetNode(childNode, generation)
}
}
break
}
break
}
}
}
@@ -169,159 +189,200 @@ function newGovernanceFunctionLibraryVotingProgram() {
let votes = programNode.payload.tokenPower
/*
Set this initial votes as own power
*/
*/
programNode.payload.votingProgram.ownPower = votes
distributeProgramPower(programNode, votes)
}
distributeProgramPower(programNode, programNode, votes, undefined, 0)
function distributeProgramPower(node, votes, percentage) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
if (node.payload.votingProgram === undefined) { return }
node.payload.votingProgram.votes = node.payload.votingProgram.votes + votes
if (node.type === 'Voting Program') {
node.payload.votingProgram.incomingPower = node.payload.votingProgram.votes - node.payload.votingProgram.ownPower
}
drawVotes(node, node.payload.votingProgram.votes, percentage)
/*
When we reach certain node types, we will halt the distribution, because these are targets for
voting power.
*/
if (
node.type === 'Position' ||
node.type === 'Asset' ||
node.type === 'Feature' ||
node.type === 'Pool' ||
node.type === 'Position Contribution Claim' ||
node.type === 'Asset Contribution Claim' ||
node.type === 'Feature Contribution Claim'
) { return }
/*
For Votes to Profiles there is a special treamtment that needs to be done
so that votes can flow from Profiles to the Program without being affected
by Percentages.
*/
switch (node.type) {
case 'User Profile Vote': {
if (node.payload.referenceParent !== undefined) {
distributeProgramPower(node.payload.referenceParent, votes / 10)
}
return
}
case 'User Profile': {
let program = UI.projects.governance.utilities.validations.onlyOneProgram(node, 'Voting Program')
if (program === undefined) { return }
if (program.payload === undefined) { return }
distributeProgramPower(program, votes)
return
}
}
/*
If there is a reference parent defined, this means that the voting power is
transfered to it and not distributed among children.
*/
if (
node.payload.referenceParent !== undefined &&
node.type !== 'Votes Switch' &&
node.type !== 'Claim Votes Switch' &&
node.type !== 'Weight Votes Switch'
function distributeProgramPower(
currentProgramNode,
node,
votes,
percentage,
generation
) {
distributeProgramPower(node.payload.referenceParent, votes)
return
}
/*
Here we are inside the Voting Program, so we will crawl all it's children.
*/
let schemaDocument = getSchemaDocument(node)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
/*
Before distributing the voting power, we will calculate how the power
is going to be switched between all nodes. The first pass is about
scanning all sibling nodes to see which ones have a percentage defined
at their config, and check that all percentages don't add more than 100.
*/
let totalPercentage = 0
let totalNodesWithoutPercentage = 0
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
}
break
}
}
}
if (totalPercentage > 100) {
node.payload.uiObject.setErrorMessage('Voting Power Switching Error. Total Percentage of children nodes is grater that 100.')
if (generation >= MAX_GENERATIONS) {
return
}
let defaultPercentage = 0
if (totalNodesWithoutPercentage > 0) {
defaultPercentage = (100 - totalPercentage) / totalNodesWithoutPercentage
if (node === undefined) { return }
if (node.payload === undefined) { return }
if (node.payload.votingProgram === undefined) { return }
node.payload.votingProgram.votes = node.payload.votingProgram.votes + votes
if (node.type === 'Voting Program') {
node.payload.votingProgram.incomingPower = node.payload.votingProgram.votes - node.payload.votingProgram.ownPower
}
drawVotes(node, node.payload.votingProgram.votes, percentage)
/*
When we reach certain node types, we will halt the distribution, because these are targets for
voting power.
*/
if (
node.type === 'Position' ||
node.type === 'Asset' ||
node.type === 'Feature' ||
node.type === 'Pool' ||
node.type === 'Position Contribution Claim' ||
node.type === 'Asset Contribution Claim' ||
node.type === 'Feature Contribution Claim'
) { return }
/*
For Votes to Profiles there is a special treamtment that needs to be done
so that votes can flow from Profiles to the Program without being affected
by Percentages.
*/
switch (node.type) {
case 'User Profile Vote': {
if (node.payload.referenceParent !== undefined) {
currentProgramNode.payload.votingProgram.usedPower = currentProgramNode.payload.votingProgram.usedPower + votes
distributeProgramPower(
currentProgramNode,
node.payload.referenceParent,
votes / 10,
undefined,
generation + 1
)
}
return
}
case 'User Profile': {
let program = UI.projects.governance.utilities.validations.onlyOneProgram(node, 'Voting Program')
if (program === undefined) { return }
if (program.payload === undefined) { return }
distributeProgramPower(
currentProgramNode,
program,
votes,
undefined,
generation
)
return
}
}
/*
Here we do the actual distribution.
If there is a reference parent defined, this means that the voting power is
transfered to it and not distributed among children.
*/
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (
node.payload.referenceParent !== undefined &&
node.type !== 'Votes Switch' &&
node.type !== 'Claim Votes Switch' &&
node.type !== 'Weight Votes Switch'
) {
currentProgramNode.payload.votingProgram.usedPower = currentProgramNode.payload.votingProgram.usedPower + votes
distributeProgramPower(
currentProgramNode,
node.payload.referenceParent,
votes,
undefined,
generation
)
return
}
/*
Here we are inside the Voting Program, so we will crawl all it's children.
*/
let schemaDocument = getSchemaDocument(node)
if (schemaDocument === undefined) { return }
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(childNode, votes * percentage / 100, percentage)
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(childNode, votes * percentage / 100, percentage)
if (schemaDocument.childrenNodesProperties !== undefined) {
/*
Before distributing the voting power, we will calculate how the power
is going to be switched between all nodes. The first pass is about
scanning all sibling nodes to see which ones have a percentage defined
at their config, and check that all percentages don't add more than 100.
*/
let totalPercentage = 0
let totalNodesWithoutPercentage = 0
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
break
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
}
break
}
}
}
if (totalPercentage > 100) {
node.payload.uiObject.setErrorMessage('Voting Power Switching Error. Total Percentage of children nodes is grater that 100.')
return
}
let defaultPercentage = 0
if (totalNodesWithoutPercentage > 0) {
defaultPercentage = (100 - totalPercentage) / totalNodesWithoutPercentage
}
/*
Here we do the actual distribution.
*/
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
let childNode = node[property.name]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(
currentProgramNode,
childNode,
votes * percentage / 100,
percentage,
generation
)
}
break
case 'array': {
let propertyArray = node[property.name]
if (propertyArray !== undefined) {
for (let m = 0; m < propertyArray.length; m++) {
let childNode = propertyArray[m]
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(
currentProgramNode,
childNode,
votes * percentage / 100,
percentage,
generation
)
}
}
break
}
}
}
}
@@ -385,7 +446,7 @@ function newGovernanceFunctionLibraryVotingProgram() {
voteType = 'Claim Support Power'
}
const votesText = parseFloat(votes.toFixed(2)).toLocaleString('en') + ' ' + voteType
const votesText = parseFloat(votes.toFixed(0)).toLocaleString('en') + ' ' + voteType
node.payload.uiObject.setValue(votesText)
if (percentage !== undefined) {
@@ -396,7 +457,7 @@ function newGovernanceFunctionLibraryVotingProgram() {
function drawUserNode(node, votes, percentage) {
if (node.payload !== undefined) {
const outgoingPowerText = parseFloat(votes.toFixed(2)).toLocaleString('en')
const outgoingPowerText = parseFloat(votes.toFixed(0)).toLocaleString('en')
node.payload.uiObject.valueAngleOffset = 180
node.payload.uiObject.valueAtAngle = true
@@ -423,8 +484,8 @@ function newGovernanceFunctionLibraryVotingProgram() {
if (node.payload.votingProgram.ownPower === undefined) { return }
if (node.payload.votingProgram.incomingPower === undefined) { return }
const ownPowerText = parseFloat(node.payload.votingProgram.ownPower.toFixed(2)).toLocaleString('en')
const incomingPowerText = parseFloat(node.payload.votingProgram.incomingPower.toFixed(2)).toLocaleString('en')
const ownPowerText = parseFloat(node.payload.votingProgram.ownPower.toFixed(0)).toLocaleString('en')
const incomingPowerText = parseFloat(node.payload.votingProgram.incomingPower.toFixed(0)).toLocaleString('en')
node.payload.uiObject.statusAngleOffset = 0
node.payload.uiObject.statusAtAngle = false
@@ -0,0 +1,6 @@
function newGovernanceGlobalsReports() {
let thisObject = {
REPORTS_SPACE_WIDTH: 1150
}
return thisObject
}
@@ -1,47 +0,0 @@
function newGobernanceAssetsSpace() {
const MODULE_NAME = 'Assets Space'
let thisObject = {
container: undefined,
physics: physics,
draw: draw,
getContainer: getContainer,
finalize: finalize,
initialize: initialize
}
thisObject.container = newContainer()
thisObject.container.initialize(MODULE_NAME)
thisObject.container.isDraggeable = false
return thisObject
function finalize() {
thisObject.container.finalize()
thisObject.container = undefined
}
function initialize() {
}
function physics() {
if (UI.projects.foundations.spaces.designSpace.workspace === undefined) { return }
}
function getContainer(point) {
return undefined // since this space does not draw anything we return here
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
thisObject.container.space = MODULE_NAME
return thisObject.container
} else {
return undefined
}
}
function draw() {
}
}
@@ -1,47 +0,0 @@
function newGovernanceFeaturesSpace() {
const MODULE_NAME = 'Features Space'
let thisObject = {
container: undefined,
physics: physics,
draw: draw,
getContainer: getContainer,
finalize: finalize,
initialize: initialize
}
thisObject.container = newContainer()
thisObject.container.initialize(MODULE_NAME)
thisObject.container.isDraggeable = false
return thisObject
function finalize() {
thisObject.container.finalize()
thisObject.container = undefined
}
function initialize() {
}
function physics() {
if (UI.projects.foundations.spaces.designSpace.workspace === undefined) { return }
}
function getContainer(point) {
return undefined // since this space does not draw anything we return here
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
thisObject.container.space = MODULE_NAME
return thisObject.container
} else {
return undefined
}
}
function draw() {
}
}
@@ -1,49 +0,0 @@
function newGovernancePoolsSpace() {
const MODULE_NAME = 'Pool Space'
let thisObject = {
container: undefined,
physics: physics,
draw: draw,
getContainer: getContainer,
finalize: finalize,
initialize: initialize
}
thisObject.container = newContainer()
thisObject.container.initialize(MODULE_NAME)
thisObject.container.isDraggeable = false
return thisObject
function initialize() {
}
function finalize() {
thisObject.container.finalize()
thisObject.container = undefined
}
function getContainer(point) {
return undefined // since this space does not draw anything we return here
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
thisObject.container.space = MODULE_NAME
return thisObject.container
} else {
return undefined
}
}
function physics() {
if (UI.projects.foundations.spaces.designSpace.workspace === undefined) { return }
UI.projects.governance.functionLibraries.distributionProcess.calculate()
}
function draw() {
}
}
@@ -1,47 +0,0 @@
function newGovernancePositionsSpace() {
const MODULE_NAME = 'Positions Space'
let thisObject = {
container: undefined,
physics: physics,
draw: draw,
getContainer: getContainer,
finalize: finalize,
initialize: initialize
}
thisObject.container = newContainer()
thisObject.container.initialize(MODULE_NAME)
thisObject.container.isDraggeable = false
return thisObject
function finalize() {
thisObject.container.finalize()
thisObject.container = undefined
}
function initialize() {
}
function physics() {
if (UI.projects.foundations.spaces.designSpace.workspace === undefined) { return }
}
function getContainer(point) {
return undefined // since this space does not draw anything we return here
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
thisObject.container.space = MODULE_NAME
return thisObject.container
} else {
return undefined
}
}
function draw() {
}
}
@@ -0,0 +1,27 @@
function newGovernanceReportsAssets() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
return UI.projects.governance.utilities.commonTables.addHTML(
'assets',
'Asset',
'Assets',
tabIndex,
filters
)
}
}
@@ -0,0 +1,112 @@
function newGovernanceReportsClaims() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
/*
Parameters
*/
let table = 'claims'
let programName = 'Claims Program'
let programPropertyName = 'claimsProgram'
/*
Setup Filters
*/
let filtersObject
if (filters !== undefined) {
try {
filtersObject = JSON.parse(filters)
} catch (err) { }
}
/*
Other Variables
*/
let tableRecords = []
let tableRecordDefinition = {
"properties": [
{
"name": "name",
"label": "User Profile",
"type": "string",
"order": "ascending",
"textAlign": "left"
},
{
"name": "ownPower",
"label": "Claims Power",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "tokensAwarded",
"label": "Awarded",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
}
]
}
/*
Here we get from the workspace all User Profiles.
*/
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
/*
Transform the result array into table records.
*/
for (let j = 0; j < userProfiles.length; j++) {
let userProfile = userProfiles[j]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, programName)
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
let tableRecord = {
"name": userProfile.name,
"ownPower": program.payload[programPropertyName].ownPower | 0,
"tokensAwarded": program.payload[programPropertyName].awarded.tokens | 0
}
if (UI.projects.governance.utilities.filters.applyFilters(filters, filtersObject, tableRecord) === true) {
tableRecords.push(tableRecord)
}
}
/*
Get the sorting order for this table.
*/
let sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
/*
Set the default sorting order for this table.
*/
if (sortingOrder === undefined) {
UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table] = {
property: 'tokensAwarded',
order: 'descending'
}
sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
}
return UI.projects.governance.utilities.tables.addHTML(
table,
tableRecords,
tableRecordDefinition,
sortingOrder,
tabIndex
)
}
}
@@ -0,0 +1,132 @@
function newGovernanceReportsCommmandInterface() {
let thisObject = {
command: undefined,
detectCommands: detectCommands,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function detectCommands() {
if (detectGovCommands() === true) { return }
/* If we can not detect any gov or docs commands, then we assume the users is typing a filter */
}
function detectGovCommands() {
if (checkPRsCommand() === undefined) { return true }
if (checkPayCommand() === undefined) { return true }
function checkPRsCommand() {
if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() === 'gov.help gov.prs') {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov PRs Command')
return
}
if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf('Gov.PRs') !== 0 && UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf('gov.prs') !== 0) { return 'Not PRs Commands' }
/* Set up the commit message */
let message = UI.projects.governance.spaces.reportsSpace.commandInterface.command.trim().substring(UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf(' ') + 1, UI.projects.governance.spaces.reportsSpace.commandInterface.command.length)
if (message.toLowerCase() === 'gov.prs') {
message = 'Automated PR merging process.'
}
/* Find the Username and Password */
let apisNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadByNodeType('APIs')
if (apisNode === undefined) {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing')
return
}
if (apisNode.githubAPI === undefined) {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing')
return
}
let config = JSON.parse(apisNode.githubAPI.config)
if (config.username === undefined || config.username === "") {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing')
return
}
if (config.token === undefined || config.token === "") {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing')
return
}
message = message.replaceAll('#', '_HASHTAG_')
message = message.replaceAll('/', '_SLASH_')
httpRequest(
undefined,
'Gov/PRs/' +
message + '/' +
config.username + '/' +
config.token + '/' +
UI.projects.education.spaces.docsSpace.currentBranch + '/' +
UI.projects.education.spaces.docsSpace.contributionsBranch
, onResponse)
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Processing Pull Requests')
return
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
data = JSON.parse(data)
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Pull Requests Processed')
} else {
UI.projects.education.spaces.docsSpace.navigateTo(
data.docs.project,
data.docs.category,
data.docs.type,
data.docs.anchor,
undefined,
data.docs.placeholder
)
}
}
}
function checkPayCommand() {
if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() === 'gov.help gov.pay') {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Pay Command')
return
}
if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf('Gov.Pay') !== 0 && UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf('gov.pay') !== 0) { return 'Not Pay Commands' }
httpRequest(undefined, 'Gov/Pay/' + UI.projects.education.spaces.docsSpace.currentBranch, onResponse)
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Paying to Contributors')
return
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
data = JSON.parse(data)
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.CUSTOM_OK_RESPONSE.result) {
if (data.message.summary.changes + data.message.summary.deletions + data.message.summary.insertions > 0) {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Pay Done')
} else {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Pay Failed')
}
} else {
UI.projects.education.spaces.docsSpace.navigateTo(
data.docs.project,
data.docs.category,
data.docs.type,
data.docs.anchor,
undefined,
data.docs.placeholder
)
}
}
}
}
}
@@ -0,0 +1,112 @@
function newGovernanceReportsDelegation() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
/*
Parameters
*/
let table = 'delegation'
let programName = 'Delegation Program'
let programPropertyName = 'delegationProgram'
/*
Setup Filters
*/
let filtersObject
if (filters !== undefined) {
try {
filtersObject = JSON.parse(filters)
} catch (err) { }
}
/*
Other Variables
*/
let tableRecords = []
let tableRecordDefinition = {
"properties": [
{
"name": "name",
"label": "User Profile",
"type": "string",
"order": "ascending",
"textAlign": "left"
},
{
"name": "ownPower",
"label": "Delegate Power",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "tokensBonus",
"label": "Bonus",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
}
]
}
/*
Here we get from the workspace all User Profiles.
*/
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
/*
Transform the result array into table records.
*/
for (let j = 0; j < userProfiles.length; j++) {
let userProfile = userProfiles[j]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, programName)
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
let tableRecord = {
"name": userProfile.name,
"ownPower": program.payload[programPropertyName].ownPower | 0,
"tokensBonus": program.payload[programPropertyName].bonus.tokens | 0
}
if (UI.projects.governance.utilities.filters.applyFilters(filters, filtersObject, tableRecord) === true) {
tableRecords.push(tableRecord)
}
}
/*
Get the sorting order for this table.
*/
let sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
/*
Set the default sorting order for this table.
*/
if (sortingOrder === undefined) {
UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table] = {
property: 'tokensBonus',
order: 'descending'
}
sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
}
return UI.projects.governance.utilities.tables.addHTML(
table,
tableRecords,
tableRecordDefinition,
sortingOrder,
tabIndex
)
}
}
@@ -0,0 +1,27 @@
function newGovernanceReportsFeatures() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
return UI.projects.governance.utilities.commonTables.addHTML(
'features',
'Feature',
'Features',
tabIndex,
filters
)
}
}
@@ -0,0 +1,71 @@
function newGovernanceReportsFiltersHeader() {
let thisObject = {
addFilterHeader: addFilterHeader,
detectEnterOnFiltersBox: detectEnterOnFiltersBox,
setFocusOnFiltersBox: setFocusOnFiltersBox,
render: render,
initialize: initialize,
finalize: finalize
}
let lastFilters = ''
return thisObject
function initialize() {
}
function finalize() {
}
function render() {
let HTML = ''
HTML = HTML + '<div id="governance-search-page-div">'
HTML = HTML + '<center><img src="Images/superalgos-logo.png" class="governance-image-logo-search" width=400></center>'
HTML = HTML + '<center><div class="governance-font-normal governance-search-box"><input class="governance-filter-input" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></input></div></center>'
HTML = HTML + '</div>'
let docsContentDiv = document.getElementById('governance-content-div')
docsContentDiv.innerHTML = HTML + UI.projects.education.spaces.docsSpace.footer.addFooter()
UI.projects.governance.spaces.reportsSpace.filtersHeader.detectEnterOnFiltersBox()
UI.projects.governance.spaces.reportsSpace.filtersHeader.setFocusOnFiltersBox()
}
function addFilterHeader() {
let HTML = ''
// Logo & Search Box
HTML = HTML + '<div class="governance-report-page-header">'
HTML = HTML + '<div class="governance-image-logo-report-page"><img src="Images/superalgos-logo.png" width=200></div>'
HTML = HTML + '<div class="governance-report-page-box">'
HTML = HTML + '<input class="governance-filter-input" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></input>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
return HTML
}
function detectEnterOnFiltersBox() {
const element = document.getElementsByClassName("governance-filter-input")[0]
if (UI.projects.education.spaces.docsSpace.commandInterface.command !== undefined) {
element.value = UI.projects.education.spaces.docsSpace.commandInterface.command
}
element.addEventListener("keyup", function (event) {
if (event.key === "Enter" || event.keyCode === 13) {
lastFilters = element.value.trim()
UI.projects.governance.spaces.reportsSpace.reportsPage.render(undefined, lastFilters)
/*
UI.projects.education.spaces.docsSpace.commandInterface.command = element.value.trim()
UI.projects.education.spaces.docsSpace.commandInterface.detectCommands()
*/
}
});
}
function setFocusOnFiltersBox() {
const element = document.getElementsByClassName("governance-filter-input")[0]
element.value = lastFilters
element.focus()
}
}
@@ -0,0 +1,158 @@
function newGovernanceReportsFooter() {
let thisObject = {
addFooter: addFooter,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addFooter() {
let HTML = ''
HTML = HTML + '<div id="governance-footer" class="governance-node-html-footer-container">' // Container Starts
// Buttons Section
HTML = HTML + '<div class="governance-node-html-footer-table">'
HTML = HTML + '<div class="governance-footer-row">'
HTML = HTML + '<div class="governance-footer-cell style="white-space: nowrap; overflow-x: auto;" >' // white-space: nowrap; overflow-x: auto; prevents line breaks when combined with display: inline-block;" in the child elements
if (UI.projects.education.spaces.docsSpace.currentDocumentBeingRendered !== undefined) {
HTML = HTML + '<span style="float: right; display: inline-block;" onClick="UI.projects.education.spaces.docsSpace.sharePage()"><button>SHARE</button></span>'
}
HTML = HTML + '<span style="float: right; display: inline-block;" onClick="UI.projects.education.spaces.docsSpace.scrollToElement(\'governance-space-div\')"><button>TO TOP</button></span>'
if (UI.projects.education.spaces.docsSpace.previousDocumentBeingRendered !== undefined) {
HTML = HTML + '<span style="float: right; display: inline-block;" onClick="UI.projects.education.spaces.docsSpace.navigateTo(\'' + UI.projects.education.spaces.docsSpace.previousDocumentBeingRendered.project + '\', \'' + UI.projects.education.spaces.docsSpace.previousDocumentBeingRendered.category + '\', \'' + UI.projects.education.spaces.docsSpace.previousDocumentBeingRendered.type + '\')"><button>BACK</button></span>'
}
if (UI.projects.education.spaces.docsSpace.currentBookBeingRendered !== undefined) {
HTML = HTML + '<span style="float: right; display: inline-block;" onClick="UI.projects.education.spaces.docsSpace.navigateTo(\'' + UI.projects.education.spaces.docsSpace.currentBookBeingRendered.project + '\', \'' + UI.projects.education.spaces.docsSpace.currentBookBeingRendered.category + '\', \'' + UI.projects.education.spaces.docsSpace.currentBookBeingRendered.type + '\')"><button>TO BOOK</button></span>'
}
HTML = HTML + '<span style="float: right; display: inline-block;" onClick="UI.projects.education.spaces.docsSpace.navigateTo(\'' + 'Foundations' + '\', \'' + 'Book' + '\', \'' + 'Reviews' + '\')"><button>REVIEWS</button></span>'
HTML = HTML + '<span style="float: right; display: inline-block;" onClick="UI.projects.education.spaces.docsSpace.navigateTo(\'' + 'Foundations' + '\', \'' + 'Book' + '\', \'' + 'Community Data Mines' + '\')"><button>DATA MINES</button></span>'
HTML = HTML + '<span style="float: right; display: inline-block;" onClick="UI.projects.education.spaces.docsSpace.navigateTo(\'' + 'Foundations' + '\', \'' + 'Book' + '\', \'' + 'First Steps Tutorials' + '\')"><button>TUTORIALS</button></span>'
HTML = HTML + '<span style="float: right; display: inline-block;" onClick="UI.projects.education.spaces.docsSpace.navigateTo(\'' + 'Foundations' + '\', \'' + 'Book' + '\', \'' + 'User Manual' + '\')"><button>USER MANUAL</button></span>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
// GitHub Section
HTML = HTML + '<div class="governance-node-html-footer-table">'
HTML = HTML + '<div class="governance-footer-row">'
HTML = HTML + '<div class="governance-footer-cell" style="white-space: nowrap; overflow-x: auto; ">'
HTML = HTML + '<h3 style="display: inline-block;">Manage Your Superalgos Setup and Contributions!</h3>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
HTML = HTML + '<div class="governance-node-html-footer-table">'
HTML = HTML + '<div class="governance-footer-row">'
HTML = HTML + '<div class="governance-footer-cell">'
HTML = HTML + '<h4>About Your Deployment</h4>'
HTML = HTML + 'Superalgos may run from different branches in the repository. The <code class="governance-footer-code">Master</code> branch features the stable version, and the <code class="governance-footer-code">Develop</code> branch the version in development. Use the <code class="governance-footer-code">Plugins-Docs</code> branch to contribute plugins and to the Docs.'
HTML = HTML + '</div>'
HTML = HTML + '<div class="governance-footer-cell">'
HTML = HTML + '<h4>Choose the Current Branch</h4>'
HTML = HTML + 'You are currently running on the <code class="governance-footer-code">' + UI.projects.foundations.utilities.gitBranches.getBranchLabel(UI.projects.education.spaces.docsSpace.currentBranch) + '</code> branch. Switch to:'
HTML = HTML + '<ul>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.education.spaces.docsSpace.changeCurrentBranch(\'master\')">Master</a></li>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.education.spaces.docsSpace.changeCurrentBranch(\'develop\')">Develop</a></li>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.education.spaces.docsSpace.changeCurrentBranch(\'plugins-docs\')">Plugins-Docs</a></li>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.education.spaces.docsSpace.changeCurrentBranch(\'next-version\')">Next-Version</a></li>'
HTML = HTML + '</ul>'
HTML = HTML + '</div>'
HTML = HTML + '<div class="governance-footer-cell">'
HTML = HTML + '<h4>Contributions Branch</h4>'
HTML = HTML + 'You are currently contributing to the <code class="governance-footer-code">' + UI.projects.foundations.utilities.gitBranches.getBranchLabel(UI.projects.education.spaces.docsSpace.contributionsBranch) + '</code> branch. Switch to:'
HTML = HTML + '<ul>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.education.spaces.docsSpace.changeContributionsBranch(\'master\')">Master</code></li>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.education.spaces.docsSpace.changeContributionsBranch(\'develop\')">Develop</a></li>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.education.spaces.docsSpace.changeContributionsBranch(\'plugins-docs\')">Plugins-Docs</a></li>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.education.spaces.docsSpace.changeContributionsBranch(\'next-version\')">Next-Version</a></li>'
HTML = HTML + '</ul>'
HTML = HTML + '</ul>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
// Community Section
HTML = HTML + '<div class="governance-node-html-footer-table">'
HTML = HTML + '<div class="governance-footer-row">'
HTML = HTML + '<div class="governance-footer-cell" style="white-space: nowrap; overflow-x: auto; ">'
HTML = HTML + '<h3 style="display: inline-block;">Meet the Community and the Team!</h3>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
HTML = HTML + '<div class="governance-node-html-footer-table">'
HTML = HTML + '<div class="governance-footer-row">'
HTML = HTML + '<div class="governance-footer-cell">'
HTML = HTML + '<h4>Join the Conversation</h4>'
HTML = HTML + '<p>We have a new <a href="https://discord.gg/CGeKC6WQQb" target="_blank">Discord Server</a> with multiple channels, or you may join the original individual Telegram groups listed to the right.</p>'
HTML = HTML + '</div>'
HTML = HTML + '<div class="governance-footer-cell">'
HTML = HTML + '<h4>In Telegram</h4>'
HTML = HTML + '<ul>'
HTML = HTML + '<li><a href="https://t.me/superalgoscommunity" target="_blank">Community Group</a></li>'
HTML = HTML + '<li><a href="https://t.me/superalgossupport" target="_blank">Technical Support Group</a></li>'
HTML = HTML + '<li><a href="https://t.me/superalgosdevelop" target="_blank">Developers Group</a></li>'
HTML = HTML + '<li><a href="https://t.me/superalgosmachinelearning" target="_blank">Machine Learning Group</a></li>'
HTML = HTML + '<li><a href="https://t.me/superalgosdocs" target="_blank">Docs Group</a></li>'
HTML = HTML + '<li><a href="https://t.me/superalgosuxui" target="_blank">UX/UI Design Group</a></li>'
HTML = HTML + '<li><a href="https://t.me/superalgoscollaborations" target="_blank">Collaborations Group</a></li>'
HTML = HTML + '<li><a href="https://t.me/superalgoscodebase" target="_blank">Codebase Learning Group</a></li>'
HTML = HTML + '<li><a href="https://t.me/superalgos_es" target="_blank">Hablemos en Español!</a></li>'
HTML = HTML + '<li><a href="https://t.me/superalgos_ru" target="_blank">Говорим по русски!</a></li>'
HTML = HTML + '</ul>'
HTML = HTML + '</div>'
HTML = HTML + '<div class="governance-footer-cell">'
HTML = HTML + '<h4>Other Resources</h4>'
HTML = HTML + '<ul>'
HTML = HTML + '<li><a href="https://t.me/superalgos" target="_blank">Official Announcements</a></li>'
HTML = HTML + '<li><a href="https://superalgos.org" target="_blank">Features and Functionality</a></li>'
HTML = HTML + '<li><a href="https://github.com/Superalgos/Superalgos" target="_blank">Main Github Repository</a></li>'
HTML = HTML + '<li><a href="https://www.youtube.com/c/superalgos" target="_blank">Subscribe in YouTube</a></li>'
HTML = HTML + '<li><a href="https://twitter.com/superalgos" target="_blank">Follow us on Twitter</a></li>'
HTML = HTML + '<li><a href="https://www.facebook.com/superalgos" target="_blank">Connect on Facebook</a></li>'
HTML = HTML + '<li><a href="https://medium.com/Superalgos/" target="_blank">Read the Blog</a></li>'
HTML = HTML + '</ul>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
HTML = HTML + '<div class="governance-footer-row">'
HTML = HTML + '<div class="governance-footer-cell">'
HTML = HTML + '<img src="Images/superalgos-logo-white.png" width="200 px">'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
HTML = HTML + '</div>'
HTML = HTML + '</div>' // Container Ends
return HTML
}
}
@@ -0,0 +1,27 @@
function newGovernanceReportsMentors() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
return UI.projects.governance.utilities.decendentTables.addHTML(
'mentors',
'Mentorship Program',
'mentorshipProgram',
tabIndex,
filters
)
}
}
@@ -0,0 +1,125 @@
function newGovernanceReportsMining() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
/*
Setup Filters
*/
let filtersObject
if (filters !== undefined) {
try {
filtersObject = JSON.parse(filters)
} catch (err) { }
}
/*
Other Variables
*/
let tableRecords = []
let table = 'mining'
let tableRecordDefinition = {
"properties": [
{
"name": "name",
"label": "User Profile",
"type": "string",
"order": "ascending",
"textAlign": "left"
},
{
"name": "blockchainAccount",
"label": "Blockchain Account",
"type": "string",
"order": "ascending",
"textAlign": "left"
},
{
"name": "tokensAwarded",
"label": "Tokens Awarded",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "tokensBonus",
"label": "Tokens Bonus",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "tokensMined",
"label": "Tokens Mined",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
}
]
}
/*
Here we get from the workspace all User Profiles.
*/
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
/*
Transform the result array into table records.
*/
for (let j = 0; j < userProfiles.length; j++) {
let userProfile = userProfiles[j]
if (userProfile.payload === undefined) { continue }
if (userProfile.tokensMined === undefined) { continue }
if (userProfile.tokensMined.payload === undefined) { continue }
if (userProfile.tokensMined.payload.tokensMined === undefined) { continue }
let tableRecord = {
"name": userProfile.name,
"blockchainAccount": userProfile.payload.blockchainAccount,
"tokensAwarded": userProfile.tokensMined.payload.tokensMined.awarded | 0,
"tokensBonus": userProfile.tokensMined.payload.tokensMined.bonus | 0,
"tokensMined": userProfile.tokensMined.payload.tokensMined.total | 0
}
if (UI.projects.governance.utilities.filters.applyFilters(filters, filtersObject, tableRecord) === true) {
tableRecords.push(tableRecord)
}
}
/*
Get the sorting order for this table.
*/
let sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
/*
Set the default sorting order for this table.
*/
if (sortingOrder === undefined) {
UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table] = {
property: 'tokensMined',
order: 'descending'
}
sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
}
return UI.projects.governance.utilities.tables.addHTML(
table,
tableRecords,
tableRecordDefinition,
sortingOrder,
tabIndex
)
}
}
@@ -0,0 +1,27 @@
function newGovernanceReportsPools() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
return UI.projects.governance.utilities.commonTables.addHTML(
'pools',
'Pool',
'Pools',
tabIndex,
filters
)
}
}
@@ -0,0 +1,27 @@
function newGovernanceReportsPositions() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
return UI.projects.governance.utilities.commonTables.addHTML(
'positions',
'Position',
'Positions',
tabIndex,
filters
)
}
}
@@ -0,0 +1,27 @@
function newGovernanceReportsReferrals() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
return UI.projects.governance.utilities.decendentTables.addHTML(
'referrals',
'Referral Program',
'referralProgram',
tabIndex,
filters
)
}
}
@@ -0,0 +1,174 @@
function newGovernanceReportsReportsPage() {
let thisObject = {
render: render,
initialize: initialize,
finalize: finalize
}
let lastTabIndex
return thisObject
function initialize() {
}
function finalize() {
}
function render(tabIndex, filters) {
/* Setup tabIndex */
if (tabIndex === undefined) {
tabIndex = lastTabIndex
} else {
lastTabIndex = tabIndex
}
let resultsArary = []
let initialTime = new Date()
buildHTML()
function buildHTML() {
const tabs = ['Profiles', 'Referrals', 'Supporters', 'Mentors', 'Claims', 'Votes', 'Staking', 'Delegation', 'Pools', 'Assets', 'Features', 'Positions', 'Mining']
let HTML = ''
HTML = HTML + '<section id="governance-report-page-div" class="governance-search-page-container">'
HTML = HTML + UI.projects.governance.spaces.reportsSpace.filtersHeader.addFilterHeader()
// Tabs
HTML = HTML + '<div class="governance-report-page-header-tabs-container">'
let checked = ' checked=""'
for (let i = 0; i < tabs.length; i++) {
let tab = tabs[i]
HTML = HTML + '<input id="governance-tab' + (i + 1) + '" type="radio" name="tabs"' + checked + '><label for="governance-tab' + (i + 1) + '">' + tab + '</label>'
checked = ''
}
// Results
HTML = HTML + '<div class="governance-search-result-content">'
let totalResults = new Map()
for (let i = 0; i < tabs.length; i++) {
let tab = tabs[i]
HTML = HTML + '<div id="content' + (i + 1) + '">'
HTML = HTML + '<p> ' + tab.toUpperCase() + '_TOTAL_RESULTS results (' + tab.toUpperCase() + '_TOTAL_SECONDS seconds)</p>'
let resultCounter = 0
switch (tab) {
case 'Profiles': {
let response = UI.projects.governance.spaces.reportsSpace.userProfiles.addHTML(1, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Referrals': {
let response = UI.projects.governance.spaces.reportsSpace.referrals.addHTML(2, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Supporters': {
let response = UI.projects.governance.spaces.reportsSpace.supports.addHTML(3, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Mentors': {
let response = UI.projects.governance.spaces.reportsSpace.mentors.addHTML(4, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Claims': {
let response = UI.projects.governance.spaces.reportsSpace.claims.addHTML(5, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Votes': {
let response = UI.projects.governance.spaces.reportsSpace.votes.addHTML(6, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Staking': {
let response = UI.projects.governance.spaces.reportsSpace.staking.addHTML(7, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Delegation': {
let response = UI.projects.governance.spaces.reportsSpace.delegation.addHTML(8, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Pools': {
let response = UI.projects.governance.spaces.reportsSpace.pools.addHTML(9, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Assets': {
let response = UI.projects.governance.spaces.reportsSpace.assets.addHTML(10, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Features': {
let response = UI.projects.governance.spaces.reportsSpace.features.addHTML(11, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Positions': {
let response = UI.projects.governance.spaces.reportsSpace.positions.addHTML(12, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
case 'Mining': {
let response = UI.projects.governance.spaces.reportsSpace.mining.addHTML(13, filters)
HTML = HTML + response.HTML
resultCounter = response.resultCounter
break
}
}
HTML = HTML + '</div>'
totalResults.set(tab, resultCounter)
}
// End Content
HTML = HTML + '</div>'
HTML = HTML + '</div>'
// End Section
HTML = HTML + '</section>'
// Total Seconds Calculation
let finalTime = new Date()
let totalSeconds = ((finalTime.valueOf() - initialTime.valueOf()) / 1000).toFixed(3)
for (let i = 0; i < tabs.length; i++) {
let tab = tabs[i]
HTML = HTML.replace(tab.toUpperCase() + '_TOTAL_SECONDS', totalSeconds)
let resultCounter = totalResults.get(tab)
HTML = HTML.replace(tab.toUpperCase() + '_TOTAL_RESULTS', resultCounter)
}
let docsContentDiv = document.getElementById('governance-content-div')
docsContentDiv.innerHTML = HTML + UI.projects.governance.spaces.reportsSpace.footer.addFooter()
UI.projects.governance.spaces.reportsSpace.filtersHeader.detectEnterOnFiltersBox()
UI.projects.governance.spaces.reportsSpace.filtersHeader.setFocusOnFiltersBox()
// If there is a tabIndex we will switch to that tab here.
if (tabIndex !== undefined) {
let tab = document.getElementById('governance-tab' + tabIndex)
tab.checked = true
}
}
}
}
@@ -0,0 +1,310 @@
function newGobernanceReportsSpace() {
const MODULE_NAME = 'Reports Space'
let thisObject = {
container: undefined,
sidePanelTab: undefined,
reportsPage: undefined,
footer: undefined,
filtersHeader: undefined,
userProfiles: undefined,
referrals: undefined,
supports: undefined,
mentors: undefined,
claims: undefined,
votes: undefined,
staking: undefined,
delegations: undefined,
pools: undefined,
assets: undefined,
features: undefined,
positions: undefined,
mining: undefined,
tablesSortingOrders: undefined,
changeTableSortingOrder,
physics: physics,
draw: draw,
getContainer: getContainer,
finalize: finalize,
initialize: initialize,
reset: reset
}
let browserResizedEventSubscriptionId
let openingEventSubscriptionId
let closingEventSubscriptionId
let isInitialized = false
return thisObject
function finalize() {
if (isInitialized === false) { return }
thisObject.container.finalize()
thisObject.container = undefined
canvas.eventHandler.stopListening(browserResizedEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(openingEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(closingEventSubscriptionId)
thisObject.sidePanelTab = undefined
UI.projects.foundations.spaces.sideSpace.deleteSidePanelTab('Governance', 'governance-tab', 'Gov', 'right')
thisObject.reportsPage.finalize()
thisObject.reportsPage = undefined
thisObject.footer.finalize()
thisObject.footer = undefined
thisObject.filtersHeader.finalize()
thisObject.filtersHeader = undefined
thisObject.userProfiles.finalize()
thisObject.userProfiles = undefined
thisObject.referrals.finalize()
thisObject.referrals = undefined
thisObject.supports.finalize()
thisObject.supports = undefined
thisObject.mentors.finalize()
thisObject.mentors = undefined
thisObject.claims.finalize()
thisObject.claims = undefined
thisObject.votes.finalize()
thisObject.votes = undefined
thisObject.staking.finalize()
thisObject.staking = undefined
thisObject.delegation.finalize()
thisObject.delegation = undefined
thisObject.pools.finalize()
thisObject.pools = undefined
thisObject.assets.finalize()
thisObject.assets = undefined
thisObject.features.finalize()
thisObject.features = undefined
thisObject.positions.finalize()
thisObject.positions = undefined
thisObject.mining.finalize()
thisObject.mining = undefined
isInitialized = false
}
function initialize() {
let resultsArary = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
if (resultsArary.length === 0) { return }
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize()
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.detectMouseOver = true
thisObject.container.status = 'hidden'
resize()
thisObject.reportsPage = newGovernanceReportsReportsPage()
thisObject.footer = newGovernanceReportsFooter()
thisObject.filtersHeader = newGovernanceReportsFiltersHeader()
thisObject.userProfiles = newGovernanceReportsUserProfiles()
thisObject.referrals = newGovernanceReportsReferrals()
thisObject.supports = newGovernanceReportsSupports()
thisObject.mentors = newGovernanceReportsMentors()
thisObject.claims = newGovernanceReportsClaims()
thisObject.votes = newGovernanceReportsVotes()
thisObject.staking = newGovernanceReportsStaking()
thisObject.delegation = newGovernanceReportsDelegation()
thisObject.pools = newGovernanceReportsPools()
thisObject.assets = newGovernanceReportsAssets()
thisObject.features = newGovernanceReportsFeatures()
thisObject.positions = newGovernanceReportsPositions()
thisObject.mining = newGovernanceReportsMining()
thisObject.reportsPage.initialize()
thisObject.footer.initialize()
thisObject.filtersHeader.initialize()
thisObject.userProfiles.initialize()
thisObject.referrals.initialize()
thisObject.mentors.initialize()
thisObject.claims.initialize()
thisObject.votes.initialize()
thisObject.staking.initialize()
thisObject.delegation.initialize()
thisObject.pools.initialize()
thisObject.assets.initialize()
thisObject.features.initialize()
thisObject.positions.initialize()
thisObject.mining.initialize()
setupSidePanelTab()
thisObject.tablesSortingOrders = {}
isInitialized = true
function setupSidePanelTab() {
thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Governance', 'governance-tab', 'Gov', 'right')
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', onOpening)
closingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closing', onClosing)
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
}
}
function reset() {
finalize()
initialize()
}
function resize() {
thisObject.container.frame.width = UI.projects.governance.globals.reports.REPORTS_SPACE_WIDTH
thisObject.container.frame.height = browserCanvas.height // - TOP_SPACE_HEIGHT
thisObject.container.frame.position.x = browserCanvas.width
thisObject.container.frame.position.y = 0 // TOP_SPACE_HEIGHT
if (thisObject.sidePanelTab !== undefined) {
thisObject.sidePanelTab.resize()
}
}
function physics() {
if (isInitialized === false) { return }
docsAppDivPhysics()
function docsAppDivPhysics() {
let docsSpaceDiv = document.getElementById('governance-reports-space-div')
docsAppDivPosition = {
x: 0,
y: 0
}
docsAppDivPosition = thisObject.container.frame.frameThisPoint(docsAppDivPosition)
docsSpaceDiv.style = ' ' +
'overflow-y: scroll;' +
'overflow-x: hidden;' +
'position:fixed; top:' + docsAppDivPosition.y + 'px; ' +
'left:' + docsAppDivPosition.x + 'px; z-index:1; ' +
'width: ' + thisObject.container.frame.width + 'px;' +
'height: ' + thisObject.container.frame.height + 'px'
}
}
function getContainer(point, purpose) {
if (isInitialized === false) { return }
if (thisObject.sidePanelTab === undefined) { return }
let container
container = thisObject.sidePanelTab.getContainer(point, purpose)
if (container !== undefined) { return container }
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container
} else {
return undefined
}
}
function changeTableSortingOrder(table, property, order, tabIndex) {
thisObject.tablesSortingOrders[table].property = property
thisObject.tablesSortingOrders[table].order = order
thisObject.reportsPage.render(tabIndex)
}
function onOpening() {
thisObject.reportsPage.render()
}
function onClosing() {
}
function draw() {
if (CAN_SPACES_DRAW === false) { return }
if (isInitialized === false) { return }
borders()
}
function borders() {
let point1
let point2
let point3
let point4
point1 = {
x: 0,
y: 0
}
point2 = {
x: thisObject.container.frame.width,
y: 0
}
point3 = {
x: thisObject.container.frame.width,
y: thisObject.container.frame.height
}
point4 = {
x: 0,
y: thisObject.container.frame.height
}
point1 = thisObject.container.frame.frameThisPoint(point1)
point2 = thisObject.container.frame.frameThisPoint(point2)
point3 = thisObject.container.frame.frameThisPoint(point3)
point4 = thisObject.container.frame.frameThisPoint(point4)
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(point1.x, point1.y)
browserCanvasContext.lineTo(point2.x, point2.y)
browserCanvasContext.lineTo(point3.x, point3.y)
browserCanvasContext.lineTo(point4.x, point4.y)
browserCanvasContext.lineTo(point1.x, point1.y)
browserCanvasContext.closePath()
let opacity = 1
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + opacity + ''
browserCanvasContext.fill()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GREY + ', ' + opacity + ''
browserCanvasContext.lineWidth = 0.3
browserCanvasContext.stroke()
/* Shadow */
if (thisObject.container.status !== 'hidden') {
for (let i = 0; i <= 30; i++) {
opacity = 1 - (i / 300) - 0.95
browserCanvasContext.setLineDash([]) // Resets Line Dash
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(point2.x + i, point2.y)
browserCanvasContext.lineTo(point3.x + i, point3.y)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.BLACK + ', ' + opacity + ''
browserCanvasContext.lineWidth = 1
browserCanvasContext.stroke()
}
}
}
}
@@ -0,0 +1,121 @@
function newGovernanceReportsStaking() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
/*
Parameters
*/
let table = 'staking'
let programName = 'Staking Program'
let programPropertyName = 'stakingProgram'
/*
Setup Filters
*/
let filtersObject
if (filters !== undefined) {
try {
filtersObject = JSON.parse(filters)
} catch (err) { }
}
/*
Other Variables
*/
let tableRecords = []
let tableRecordDefinition = {
"properties": [
{
"name": "name",
"label": "User Profile",
"type": "string",
"order": "ascending",
"textAlign": "left"
},
{
"name": "ownPower",
"label": "Own Power",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "incoming",
"label": "Incoming",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "tokensAwarded",
"label": "Awarded",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
}
]
}
/*
Here we get from the workspace all User Profiles.
*/
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
/*
Transform the result array into table records.
*/
for (let j = 0; j < userProfiles.length; j++) {
let userProfile = userProfiles[j]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, programName)
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
let tableRecord = {
"name": userProfile.name,
"ownPower": program.payload[programPropertyName].ownPower | 0,
"incoming": program.payload[programPropertyName].incomingPower | 0,
"tokensAwarded": program.payload[programPropertyName].awarded.tokens | 0
}
if (UI.projects.governance.utilities.filters.applyFilters(filters, filtersObject, tableRecord) === true) {
tableRecords.push(tableRecord)
}
}
/*
Get the sorting order for this table.
*/
let sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
/*
Set the default sorting order for this table.
*/
if (sortingOrder === undefined) {
UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table] = {
property: 'tokensAwarded',
order: 'descending'
}
sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
}
return UI.projects.governance.utilities.tables.addHTML(
table,
tableRecords,
tableRecordDefinition,
sortingOrder,
tabIndex
)
}
}
@@ -0,0 +1,27 @@
function newGovernanceReportsSupports() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
return UI.projects.governance.utilities.decendentTables.addHTML(
'supports',
'Support Program',
'supportProgram',
tabIndex,
filters
)
}
}
@@ -0,0 +1,112 @@
function newGovernanceReportsUserProfiles() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
/*
Setup Filters
*/
let filtersObject
if (filters !== undefined) {
try {
filtersObject = JSON.parse(filters)
} catch (err) { }
}
/*
Other Variables
*/
let tableRecords = []
let table = 'userProfiles'
let tableRecordDefinition = {
"properties": [
{
"name": "name",
"label": "User Profile",
"type": "string",
"order": "ascending",
"textAlign": "left"
},
{
"name": "blockchainPower",
"label": "Blockchain Power",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "delegatedPower",
"label": "Delegated Power",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "tokenPower",
"label": "Token Power",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
}
]
}
/*
Here we get from the workspace all User Profiles.
*/
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
/*
Transform the result array into table records.
*/
for (let j = 0; j < userProfiles.length; j++) {
let userProfile = userProfiles[j]
let tableRecord = {
"name": userProfile.name,
"blockchainPower": userProfile.payload.blockchainTokens | 0,
"delegatedPower": userProfile.payload.tokenPower - userProfile.payload.blockchainTokens | 0,
"tokenPower": userProfile.payload.tokenPower | 0
}
if (UI.projects.governance.utilities.filters.applyFilters(filters, filtersObject, tableRecord) === true) {
tableRecords.push(tableRecord)
}
}
/*
Get the sorting order for this table.
*/
let sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
/*
Set the default sorting order for this table.
*/
if (sortingOrder === undefined) {
UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table] = {
property: 'blockchainPower',
order: 'descending'
}
sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
}
return UI.projects.governance.utilities.tables.addHTML(
table,
tableRecords,
tableRecordDefinition,
sortingOrder,
tabIndex
)
}
}
@@ -0,0 +1,121 @@
function newGovernanceReportsVotes() {
let thisObject = {
addHTML: addHTML,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function addHTML(tabIndex, filters) {
/*
Parameters
*/
let table = 'votes'
let programName = 'Voting Program'
let programPropertyName = 'votingProgram'
/*
Setup Filters
*/
let filtersObject
if (filters !== undefined) {
try {
filtersObject = JSON.parse(filters)
} catch (err) { }
}
/*
Other Variables
*/
let tableRecords = []
let tableRecordDefinition = {
"properties": [
{
"name": "name",
"label": "User Profile",
"type": "string",
"order": "ascending",
"textAlign": "left"
},
{
"name": "ownPower",
"label": "Own Power",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "incoming",
"label": "Incoming",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "tokensBonus",
"label": "Bonus",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
}
]
}
/*
Here we get from the workspace all User Profiles.
*/
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
/*
Transform the result array into table records.
*/
for (let j = 0; j < userProfiles.length; j++) {
let userProfile = userProfiles[j]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, programName)
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
let tableRecord = {
"name": userProfile.name,
"ownPower": program.payload[programPropertyName].ownPower | 0,
"incoming": program.payload[programPropertyName].incomingPower | 0,
"tokensBonus": program.payload[programPropertyName].bonus.tokens | 0
}
if (UI.projects.governance.utilities.filters.applyFilters(filters, filtersObject, tableRecord) === true) {
tableRecords.push(tableRecord)
}
}
/*
Get the sorting order for this table.
*/
let sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
/*
Set the default sorting order for this table.
*/
if (sortingOrder === undefined) {
UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table] = {
property: 'tokensBonus',
order: 'descending'
}
sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
}
return UI.projects.governance.utilities.tables.addHTML(
table,
tableRecords,
tableRecordDefinition,
sortingOrder,
tabIndex
)
}
}
@@ -42,6 +42,13 @@ function newGovernanceUserProfileSpace() {
function physics() {
if (UI.projects.foundations.spaces.designSpace.workspace === undefined) { return }
/*
Here we will run the distribution process, that in turn will run all the programs.
*/
UI.projects.governance.functionLibraries.distributionProcess.calculate()
/*
Load the user profiles with Token Power.
*/
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
if (waitingForResponses !== 0) { return }
/*
@@ -57,6 +64,7 @@ function newGovernanceUserProfileSpace() {
}
}
function getBlockchainAccount(userProfile) {
let signature = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(userProfile.payload, 'signature')
if (signature === undefined || signature === "") { return }
@@ -88,6 +96,7 @@ function newGovernanceUserProfileSpace() {
}
let blockchainAccount = response.address
userProfile.payload.blockchainAccount = blockchainAccount
if (
blockchainAccount !== undefined &&
blockchainAccount !== "" &&
@@ -1,4 +1,4 @@
function newFoundationsUtilitiesBonusProgram() {
function newGovernanceUtilitiesBonusProgram() {
let thisObject = {
run: run
}
@@ -15,7 +15,7 @@ function newFoundationsUtilitiesBonusProgram() {
let programPoolTokenReward
/*
In order to be able to calculate the share of the Program Pool for each User Profile,
we need to accumulate all the Participation Power that each User Profile at their Program
we need to accumulate all the Bonus Power that each User Profile at their Program
node has, because with that Power is that each Program node gets a share of the pool.
*/
let accumulatedProgramPower = 0
@@ -73,9 +73,17 @@ function newFoundationsUtilitiesBonusProgram() {
function resetProgram(node) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
node.payload[programPropertyName] = {
bonusPower: 0,
bonus: {
if (node.payload[programPropertyName] === undefined) {
node.payload[programPropertyName] = {
bonusPower: 0,
bonus: {
tokens: 0,
percentage: 0
}
}
} else {
node.payload[programPropertyName].bonusPower = 0
node.payload[programPropertyName].bonus = {
tokens: 0,
percentage: 0
}
@@ -100,13 +108,12 @@ function newFoundationsUtilitiesBonusProgram() {
function distributeProgram(programNode) {
if (programNode === undefined || programNode.payload === undefined) { return }
/*
Here we will convert Token Power into Participation Power.
As per system rules Participation Powar = tokensPower
To get into the Bonus Sub-Program we will use the usedPower previously calculated by the Program.
That means that only token power effectively used at the program (not just directed to it) will
be used to compute Bonuses.
*/
let programPower = programNode.payload.tokenPower
programNode.payload[programPropertyName].bonusPower = programPower
accumulatedProgramPower = accumulatedProgramPower + programPower
programNode.payload[programPropertyName].bonusPower = programNode.payload[programPropertyName].usedPower | 0
accumulatedProgramPower = accumulatedProgramPower + programNode.payload[programPropertyName].bonusPower
}
function calculateProgram(programNode) {
@@ -127,7 +134,7 @@ function newFoundationsUtilitiesBonusProgram() {
if (totalPowerRewardRatio < 1) { totalPowerRewardRatio = 1 }
if (programNode.tokensBonus === undefined || programNode.tokensBonus.payload === undefined) {
programNode.payload.uiObject.setErrorMessage("Tokens Bonus Node is needed in order for this Program to get Tokens from the Program Pool.")
programNode.payload.uiObject.setErrorMessage("Tokens Bonus Node is needed in order for this Program to get Tokens from the Bonus Program Pool.")
return
}
programNode.payload[programPropertyName].bonus.tokens = programNode.payload[programPropertyName].bonusPower * totalPowerRewardRatio
@@ -138,7 +145,7 @@ function newFoundationsUtilitiesBonusProgram() {
function drawProgram(node) {
if (node.tokensBonus !== undefined && node.tokensBonus.payload !== undefined) {
const tokensBonusText = parseFloat(node.payload[programPropertyName].bonus.tokens.toFixed(2)).toLocaleString('en')
const tokensBonusText = parseFloat(node.payload[programPropertyName].bonus.tokens.toFixed(0)).toLocaleString('en')
node.tokensBonus.payload.uiObject.valueAngleOffset = 0
node.tokensBonus.payload.uiObject.valueAtAngle = true
@@ -0,0 +1,103 @@
function newGovernanceUtilitiesCommonTables() {
let thisObject = {
addHTML: addHTML
}
return thisObject
function addHTML(
table,
nodeType,
hierarchyHeadsType,
tabIndex,
filters
) {
/*
Setup Filters
*/
let filtersObject
if (filters !== undefined) {
try {
filtersObject = JSON.parse(filters)
} catch (err) { }
}
let tableRecords = []
let tableRecordDefinition = {
"properties": [
{
"name": "name",
"label": "Name",
"type": "string",
"order": "ascending",
"textAlign": "left"
},
{
"name": "tokensReward",
"label": "Tokens Reward",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "weight",
"label": "Weight",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "percentage"
},
{
"name": "weightPower",
"label": "Weight Power",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
}
]
}
/*
Here we get from the workspace all User Profiles.
*/
let nodes = UI.projects.foundations.spaces.designSpace.workspace.getNodesByTypeAndHierarchyHeadsType(nodeType, hierarchyHeadsType)
/*
Transform the result array into table records.
*/
for (let j = 0; j < nodes.length; j++) {
let node = nodes[j]
let tableRecord = {
"name": node.payload.parentNode.name + ' - ' + node.name,
"tokensReward": node.payload.tokens | 0,
"weight": node.payload.weight,
"weightPower": node.payload.votingProgram.votes
}
if (UI.projects.governance.utilities.filters.applyFilters(filters, filtersObject, tableRecord) === true) {
tableRecords.push(tableRecord)
}
}
/*
Get the sorting order for this table.
*/
let sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
/*
Set the default sorting order for this table.
*/
if (sortingOrder === undefined) {
UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table] = {
property: 'tokensReward',
order: 'descending'
}
sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
}
return UI.projects.governance.utilities.tables.addHTML(
table,
tableRecords,
tableRecordDefinition,
sortingOrder,
tabIndex
)
}
}
@@ -1,7 +1,13 @@
function newFoundationsUtilitiesDecendentProgram() {
function newGovernanceUtilitiesDecendentProgram() {
/*
This Utility Module is intended to be used by all programs that have the
concept of Decendents, and when the program requires to compute recursively
all decendents.
*/
let thisObject = {
run: run
}
const MAX_GENERATIONS = 10
return thisObject
@@ -82,51 +88,75 @@ function newFoundationsUtilitiesDecendentProgram() {
}
function resetProgram(node) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
node.payload[programPropertyName] = {
count: 0,
percentage: 0,
outgoingPower: 0,
ownPower: 0,
incomingPower: 0,
awarded: {
tokens: 0,
percentage: 0
resetNode(node, 0)
function resetNode(node, generation) {
if (generation >= MAX_GENERATIONS) {
return
}
}
if (
node.type === 'User Profile' &&
node.tokenPowerSwitch !== undefined
) {
resetProgram(node.tokenPowerSwitch)
return
}
if (
node.type === 'Token Power Switch' &&
node[programPropertyName] !== undefined
) {
resetProgram(node[programPropertyName])
return
}
if (
node.type === programNodeType &&
node[usersArrayPropertyName] !== undefined
) {
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
resetProgram(node[usersArrayPropertyName][i])
if (node === undefined) { return }
if (node.payload === undefined) { return }
if (node.payload[programPropertyName] === undefined) {
node.payload[programPropertyName] = {
count: 0,
percentage: 0,
outgoingPower: 0,
ownPower: 0,
incomingPower: 0,
usedPower: 0,
awarded: {
tokens: 0,
percentage: 0
}
}
} else {
node.payload[programPropertyName].count = 0
node.payload[programPropertyName].percentage = 0
node.payload[programPropertyName].outgoingPower = 0
node.payload[programPropertyName].ownPower = 0
node.payload[programPropertyName].incomingPower = 0
node.payload[programPropertyName].usedPower = 0
node.payload[programPropertyName].awarded = {
tokens: 0,
percentage: 0
}
}
if (
node.type === 'User Profile' &&
node.tokenPowerSwitch !== undefined
) {
resetNode(node.tokenPowerSwitch, generation)
return
}
if (
node.type === 'Token Power Switch' &&
node[programPropertyName] !== undefined
) {
resetNode(node[programPropertyName], generation)
return
}
if (
node.type === programNodeType &&
node[usersArrayPropertyName] !== undefined
) {
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
resetNode(node[usersArrayPropertyName][i], generation)
}
return
}
if (
node.type === userNodeType &&
node.payload.referenceParent !== undefined
) {
resetNode(node.payload.referenceParent, generation + 1)
return
}
return
}
if (
node.type === userNodeType &&
node.payload.referenceParent !== undefined
) {
resetProgram(node.payload.referenceParent)
return
}
}
function validateProgram(node, userProfile) {
/*
This program is not going to run unless the Profile has Tokens, and for
@@ -166,6 +196,7 @@ function newFoundationsUtilitiesDecendentProgram() {
}
function distributeProgram(programNode) {
if (programNode === undefined || programNode.payload === undefined) { return }
/*
Here we will convert Token Power into programPower.
@@ -181,109 +212,142 @@ function newFoundationsUtilitiesDecendentProgram() {
*/
programNode.payload[programPropertyName].ownPower = programPower
distributeProgramPower(programNode, programPower, count)
}
distributeProgramPower(programNode, programNode, programPower, count, undefined, 0)
function distributeProgramPower(
node,
programPower,
count,
percentage
) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
if (node.payload[programPropertyName] === undefined) { return }
switch (node.type) {
case programNodeType: {
/*
This is the point where we increase to our local count of descendents whatever it comes
at the count parameters. If we are processing the User Profile of this Program
then we will add zero, otherwise, 1.
*/
node.payload[programPropertyName].count = node.payload[programPropertyName].count + count
/*
The outgoingPower of this node will be accumulating all the programPower flowing
through it, no matter from where it comes.
*/
node.payload[programPropertyName].outgoingPower = node.payload[programPropertyName].outgoingPower + programPower
/*
We need to adjust the balance that holds the accumulationt of all incomingPower of all Program
nodes. To do this we will substratct the current incomingPower, bacause it is going to be recalculated
inmediatelly after this, and then we will add it again after the recalcualtion.
*/
accumulatedIncomingProgramPower = accumulatedIncomingProgramPower - node.payload[programPropertyName].incomingPower
/*
At any point in time, the incomingPower will be equal to the total of the outgoingPower minus
the ownPower. This is like this because the outgoingPower is the accumulation of all the
power flow that is leaving this node, which includes the ownPower. That means that if we
substract the ownPower, we will have the accumulation of all the incomingPower, which
means all the power coming from other User Profiles referencing this one.
*/
node.payload[programPropertyName].incomingPower = node.payload[programPropertyName].outgoingPower - node.payload[programPropertyName].ownPower
/*
Now that we have the incomingPower calculated again, we can add it again to the balance of all the incomingPower
of all Program nodes.
*/
accumulatedIncomingProgramPower = accumulatedIncomingProgramPower + node.payload[programPropertyName].incomingPower
if (node[usersArrayPropertyName] !== undefined) {
/*
Before distributing the program power, we will calculate how the power
is going to be switched between all nodes. The first pass is about
scanning all sibling nodes to see which ones have a percentage defined
at their config, and check that all percentages don't add more than 100.
*/
let totalPercentage = 0
let totalNodesWithoutPercentage = 0
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
let childNode = node[usersArrayPropertyName][i]
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
if (totalPercentage > 100) {
node.payload.uiObject.setErrorMessage('Program Power Switching Error. Total Percentage of children nodes is grater that 100.')
return
}
let defaultPercentage = 0
if (totalNodesWithoutPercentage > 0) {
defaultPercentage = (100 - totalPercentage) / totalNodesWithoutPercentage
}
/*
Here we do the actual distribution.
*/
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
let childNode = node[usersArrayPropertyName][i]
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(childNode, programPower * percentage / 100, 0, percentage)
}
}
function distributeProgramPower(
currentProgramNode,
node,
programPower,
count,
percentage,
generation
) {
if (generation >= MAX_GENERATIONS) {
return
}
case userNodeType: {
node.payload[programPropertyName].outgoingPower = node.payload.parentNode.payload[programPropertyName].outgoingPower * percentage / 100
if (node === undefined) { return }
if (node.payload === undefined) { return }
if (node.payload[programPropertyName] === undefined) { return }
drawUserNode(node, percentage)
if (node.payload.referenceParent !== undefined) {
distributeProgramPower(node.payload.referenceParent, programPower / 10, 0)
switch (node.type) {
case programNodeType: {
/*
This is the point where we increase to our local count of descendents whatever it comes
at the count parameters. If we are processing the User Profile of this Program
then we will add zero, otherwise, 1.
*/
node.payload[programPropertyName].count = node.payload[programPropertyName].count + count
/*
The outgoingPower of this node will be accumulating all the programPower flowing
through it, no matter from where it comes.
*/
node.payload[programPropertyName].outgoingPower = node.payload[programPropertyName].outgoingPower + programPower
/*
We need to adjust the balance that holds the accumulationt of all incomingPower of all Program
nodes. To do this we will substratct the current incomingPower, bacause it is going to be recalculated
inmediatelly after this, and then we will add it again after the recalcualtion.
*/
accumulatedIncomingProgramPower = accumulatedIncomingProgramPower - node.payload[programPropertyName].incomingPower
/*
At any point in time, the incomingPower will be equal to the total of the outgoingPower minus
the ownPower. This is like this because the outgoingPower is the accumulation of all the
power flow that is leaving this node, which includes the ownPower. That means that if we
substract the ownPower, we will have the accumulation of all the incomingPower, which
means all the power coming from other User Profiles referencing this one.
*/
node.payload[programPropertyName].incomingPower = node.payload[programPropertyName].outgoingPower - node.payload[programPropertyName].ownPower
/*
Now that we have the incomingPower calculated again, we can add it again to the balance of all the incomingPower
of all Program nodes.
*/
accumulatedIncomingProgramPower = accumulatedIncomingProgramPower + node.payload[programPropertyName].incomingPower
if (node[usersArrayPropertyName] !== undefined) {
/*
Before distributing the program power, we will calculate how the power
is going to be switched between all nodes. The first pass is about
scanning all sibling nodes to see which ones have a percentage defined
at their config, and check that all percentages don't add more than 100.
*/
let totalPercentage = 0
let totalNodesWithoutPercentage = 0
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
let childNode = node[usersArrayPropertyName][i]
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
}
}
if (totalPercentage > 100) {
node.payload.uiObject.setErrorMessage('Program Power Switching Error. Total Percentage of children nodes is grater that 100.')
return
}
let defaultPercentage = 0
if (totalNodesWithoutPercentage > 0) {
defaultPercentage = (100 - totalPercentage) / totalNodesWithoutPercentage
}
/*
Here we do the actual distribution.
*/
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
let childNode = node[usersArrayPropertyName][i]
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
percentage = defaultPercentage
}
distributeProgramPower(
currentProgramNode,
childNode,
programPower * percentage / 100,
0,
percentage,
generation
)
}
}
return
}
return
}
case 'User Profile': {
let program = UI.projects.governance.utilities.validations.onlyOneProgram(node, programNodeType)
if (program === undefined) { return }
if (program.payload === undefined) { return }
if (program.payload[programPropertyName].isActive === false) { return }
case userNodeType: {
let previousOutgoing = node.payload[programPropertyName].outgoingPower
node.payload[programPropertyName].outgoingPower = node.payload.parentNode.payload[programPropertyName].outgoingPower * percentage / 100
distributeProgramPower(program, programPower, 0)
return
drawUserNode(node, percentage)
if (node.payload.referenceParent !== undefined) {
/*
We want to accumulate the usedPower, but to keep the right balance, everytime we add to it the outgoingPower
we need to substract the previous one, since this migth be executed at every user profile and also recurisvely.
*/
currentProgramNode.payload[programPropertyName].usedPower = currentProgramNode.payload[programPropertyName].usedPower - previousOutgoing
currentProgramNode.payload[programPropertyName].usedPower = currentProgramNode.payload[programPropertyName].usedPower + node.payload[programPropertyName].outgoingPower
distributeProgramPower(
currentProgramNode,
node.payload.referenceParent,
programPower / 10,
0,
undefined,
generation + 1
)
}
return
}
case 'User Profile': {
let program = UI.projects.governance.utilities.validations.onlyOneProgram(node, programNodeType)
if (program === undefined) { return }
if (program.payload === undefined) { return }
if (program.payload[programPropertyName].isActive === false) { return }
distributeProgramPower(
program,
program,
programPower,
0,
undefined,
generation)
return
}
}
}
}
@@ -317,7 +381,7 @@ function newFoundationsUtilitiesDecendentProgram() {
function drawUserNode(node, percentage) {
if (node.payload !== undefined) {
const outgoingPowerText = parseFloat(node.payload[programPropertyName].outgoingPower.toFixed(2)).toLocaleString('en')
const outgoingPowerText = parseFloat(node.payload[programPropertyName].outgoingPower.toFixed(0)).toLocaleString('en')
node.payload.uiObject.valueAngleOffset = 180
node.payload.uiObject.valueAtAngle = true
@@ -339,17 +403,17 @@ function newFoundationsUtilitiesDecendentProgram() {
function drawProgram(node) {
if (node.payload !== undefined) {
const ownPowerText = parseFloat(node.payload[programPropertyName].ownPower.toFixed(2)).toLocaleString('en')
const incomingPowerText = parseFloat(node.payload[programPropertyName].incomingPower.toFixed(2)).toLocaleString('en')
const ownPowerText = parseFloat(node.payload[programPropertyName].ownPower.toFixed(0)).toLocaleString('en')
const incomingPowerText = parseFloat(node.payload[programPropertyName].incomingPower.toFixed(0)).toLocaleString('en')
node.payload.uiObject.statusAngleOffset = 0
node.payload.uiObject.statusAtAngle = false
node.payload.uiObject.setStatus(ownPowerText + ' Own Power' + ' + ' + incomingPowerText + ' Incoming ' + programPowerName)
node.payload.uiObject.setStatus(ownPowerText + ' Own Power' + ' + ' + incomingPowerText + ' Incoming ' + programPowerName)
}
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
const tokensAwardedText = parseFloat(node.payload[programPropertyName].awarded.tokens.toFixed(2)).toLocaleString('en')
const tokensAwardedText = parseFloat(node.payload[programPropertyName].awarded.tokens.toFixed(0)).toLocaleString('en')
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
node.tokensAwarded.payload.uiObject.statusAtAngle = true
@@ -0,0 +1,129 @@
function newGovernanceUtilitiesDecendentTables() {
let thisObject = {
addHTML: addHTML
}
return thisObject
function addHTML(
table,
programName,
programPropertyName,
tabIndex,
filters
) {
/*
Setup Filters
*/
let filtersObject
if (filters !== undefined) {
try {
filtersObject = JSON.parse(filters)
} catch (err) { }
}
/*
Other Variables
*/
let tableRecords = []
let tableRecordDefinition = {
"properties": [
{
"name": "name",
"label": "User Profile",
"type": "string",
"order": "ascending",
"textAlign": "left"
},
{
"name": "ownPower",
"label": "Own Power",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "incoming",
"label": "Incoming",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "tokensAwarded",
"label": "Awarded",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
},
{
"name": "decendants",
"label": "Descendants",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "integer"
},
{
"name": "tokensBonus",
"label": "Bonus",
"type": "number",
"order": "descending",
"textAlign": "center",
"format": "2 decimals"
}
]
}
/*
Here we get from the workspace all User Profiles.
*/
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
/*
Transform the result array into table records.
*/
for (let j = 0; j < userProfiles.length; j++) {
let userProfile = userProfiles[j]
if (userProfile.tokenPowerSwitch === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, programName)
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
let tableRecord = {
"name": userProfile.name,
"ownPower": program.payload[programPropertyName].ownPower | 0,
"incoming": program.payload[programPropertyName].incomingPower | 0,
"tokensAwarded": program.payload[programPropertyName].awarded.tokens | 0,
"decendants": program.payload[programPropertyName].awarded.count | 0,
"tokensBonus": program.payload[programPropertyName].bonus.tokens | 0
}
if (UI.projects.governance.utilities.filters.applyFilters(filters, filtersObject, tableRecord) === true) {
tableRecords.push(tableRecord)
}
}
/*
Get the sorting order for this table.
*/
let sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
/*
Set the default sorting order for this table.
*/
if (sortingOrder === undefined) {
UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table] = {
property: 'tokensAwarded',
order: 'descending'
}
sortingOrder = UI.projects.governance.spaces.reportsSpace.tablesSortingOrders[table]
}
return UI.projects.governance.utilities.tables.addHTML(
table,
tableRecords,
tableRecordDefinition,
sortingOrder,
tabIndex
)
}
}
@@ -0,0 +1,37 @@
function newGovernanceUtilitiesFilters() {
let thisObject = {
applyFilters: applyFilters
}
return thisObject
function applyFilters(filters, filtersObject, tableRecord) {
/* Apply Filters */
let passedFilters = true
if (filtersObject !== undefined) {
for (var property in tableRecord) {
if (Object.prototype.hasOwnProperty.call(tableRecord, property)) {
let fiter = filtersObject[property]
if (fiter === undefined) { continue }
let value = tableRecord[property]
let condition = eval(fiter)
if (condition === false) {
passedFilters = false
}
}
}
} else {
/*
We will assume the filter is a string and that needs to be applied to the property name.
*/
if (
filters !== undefined &&
filters !== "" &&
tableRecord.name.indexOf(filters) < 0
) {
passedFilters = false
}
}
return passedFilters
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
function newFoundationsUtilitiesPools() {
function newGovernanceUtilitiesPools() {
let thisObject = {
findPool: findPool
}
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff. Show more