Merge pull request #1108 from Luis-Fernando-Molina/next-version
Contribution: Bug fixed with attaching
This commit is contained in:
37 files changed
+115
-72
No files matched your search
+85
-49
@@ -948,6 +948,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
}
|
||||
|
||||
path = unescape(path)
|
||||
|
||||
respondWithImage(path, httpResponse)
|
||||
}
|
||||
break
|
||||
@@ -1068,7 +1069,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
|
||||
const folder = global.env.PATH_TO_PROJECTS + '/' + project + '/Icons/'
|
||||
|
||||
fs.readdir(folder, (err, files) => {
|
||||
getAllFilesInDirectoryAndSubdirectories(folder, onFilesReady)
|
||||
|
||||
function onFilesReady(files) {
|
||||
for (let j = 0; j < files.length; j++) {
|
||||
let file = files[j]
|
||||
icons.push([project, file])
|
||||
@@ -1078,7 +1081,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
if (projectCounter === totalProjects) {
|
||||
respondWithContent(JSON.stringify(icons), httpResponse)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
@@ -1496,57 +1499,57 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
|
||||
function sendSchema(filePath, schemaType) {
|
||||
let fs = require('fs')
|
||||
try {
|
||||
let folder = ''
|
||||
switch (schemaType) {
|
||||
case 'AppSchema': {
|
||||
folder = 'App-Schema'
|
||||
break
|
||||
}
|
||||
case 'DocsNodeSchema': {
|
||||
folder = 'Docs-Nodes'
|
||||
break
|
||||
}
|
||||
case 'DocsConceptSchema': {
|
||||
folder = 'Docs-Concepts'
|
||||
break
|
||||
}
|
||||
case 'DocsTopicSchema': {
|
||||
folder = 'Docs-Topics'
|
||||
break
|
||||
}
|
||||
case 'DocsTutorialSchema': {
|
||||
folder = 'Docs-Tutorials'
|
||||
break
|
||||
}
|
||||
case 'DocsReviewSchema': {
|
||||
folder = 'Docs-Reviews'
|
||||
break
|
||||
}
|
||||
case 'DocsBookSchema': {
|
||||
folder = 'Docs-Books'
|
||||
break
|
||||
}
|
||||
try {
|
||||
let folder = ''
|
||||
switch (schemaType) {
|
||||
case 'AppSchema': {
|
||||
folder = 'App-Schema'
|
||||
break
|
||||
}
|
||||
|
||||
let schemaArray = []
|
||||
let fileList = fs.readdirSync(filePath + '/' + folder)
|
||||
for (let k = 0; k < fileList.length; k++) {
|
||||
let name = fileList[k]
|
||||
let fileContent = fs.readFileSync(filePath + '/' + folder + '/' + name)
|
||||
let schemaDocument = JSON.parse(fileContent)
|
||||
schemaArray.push(schemaDocument)
|
||||
case 'DocsNodeSchema': {
|
||||
folder = 'Docs-Nodes'
|
||||
break
|
||||
}
|
||||
let schema = JSON.stringify(schemaArray)
|
||||
respondWithContent(schema, httpResponse)
|
||||
} catch (err) {
|
||||
if (err.message.indexOf('no such file or directory') < 0) {
|
||||
console.log('Could not send Schema:', filePath, schemaType)
|
||||
console.log(err.stack)
|
||||
case 'DocsConceptSchema': {
|
||||
folder = 'Docs-Concepts'
|
||||
break
|
||||
}
|
||||
case 'DocsTopicSchema': {
|
||||
folder = 'Docs-Topics'
|
||||
break
|
||||
}
|
||||
case 'DocsTutorialSchema': {
|
||||
folder = 'Docs-Tutorials'
|
||||
break
|
||||
}
|
||||
case 'DocsReviewSchema': {
|
||||
folder = 'Docs-Reviews'
|
||||
break
|
||||
}
|
||||
case 'DocsBookSchema': {
|
||||
folder = 'Docs-Books'
|
||||
break
|
||||
}
|
||||
respondWithContent("[]", httpResponse)
|
||||
}
|
||||
|
||||
|
||||
let schemaArray = []
|
||||
let fileList = fs.readdirSync(filePath + '/' + folder)
|
||||
for (let k = 0; k < fileList.length; k++) {
|
||||
let name = fileList[k]
|
||||
let fileContent = fs.readFileSync(filePath + '/' + folder + '/' + name)
|
||||
let schemaDocument = JSON.parse(fileContent)
|
||||
schemaArray.push(schemaDocument)
|
||||
}
|
||||
let schema = JSON.stringify(schemaArray)
|
||||
respondWithContent(schema, httpResponse)
|
||||
} catch (err) {
|
||||
if (err.message.indexOf('no such file or directory') < 0) {
|
||||
console.log('Could not send Schema:', filePath, schemaType)
|
||||
console.log(err.stack)
|
||||
}
|
||||
respondWithContent("[]", httpResponse)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sendStyleSheet(fileName) {
|
||||
@@ -1727,4 +1730,37 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
function getAllFilesInDirectoryAndSubdirectories(dir, callback) {
|
||||
const { promisify } = require('util');
|
||||
const { resolve } = require('path');
|
||||
const fs = require('fs');
|
||||
const readdir = promisify(fs.readdir);
|
||||
const stat = promisify(fs.stat);
|
||||
|
||||
getFiles(dir)
|
||||
.then(files => {
|
||||
let splittedDir = dir.split('/')
|
||||
let lastFolder = splittedDir[splittedDir.length - 2]
|
||||
let pathAndNames = []
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
let file = files[i]
|
||||
let filesSplitted = file.split(lastFolder)
|
||||
let pathName = filesSplitted[1]
|
||||
pathName = pathName.substring(1, pathName.length)
|
||||
pathAndNames.push(pathName)
|
||||
}
|
||||
callback(pathAndNames)
|
||||
})
|
||||
.catch(e => console.error(e));
|
||||
|
||||
async function getFiles(dir) {
|
||||
const subdirs = await readdir(dir);
|
||||
const files = await Promise.all(subdirs.map(async (subdir) => {
|
||||
const res = resolve(dir, subdir);
|
||||
return (await stat(res)).isDirectory() ? getFiles(res) : res;
|
||||
}));
|
||||
return files.reduce((a, f) => a.concat(f), []);
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
|
Before Width: | Height: | Size: 9.5 KiB |
File renamed without changes.
@@ -19,8 +19,9 @@
|
||||
}
|
||||
],
|
||||
"title": [
|
||||
"Use Reference Parent",
|
||||
"Use Reference Parent Parent"
|
||||
"Use Reference Parent Parent Parent",
|
||||
"Use Reference Parent Parent",
|
||||
"Use Reference Parent"
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
|
||||
@@ -54,5 +54,6 @@
|
||||
"project": "Superalgos",
|
||||
"autoAdd": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"icon": "Governance Project"
|
||||
}
|
||||
@@ -27,10 +27,10 @@
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "referrer",
|
||||
"propertyToCheckFor": "userReferrer",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Referrer",
|
||||
"relatedUiObject": "Referrer"
|
||||
"label": "Add User Referrer",
|
||||
"relatedUiObject": "User Referrer"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
@@ -66,9 +66,9 @@
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "referrer",
|
||||
"name": "userReferrer",
|
||||
"type": "node",
|
||||
"childType": "Referrer",
|
||||
"childType": "User Referrer",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "Referrer",
|
||||
"type": "User Referrer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
@@ -35,5 +35,5 @@
|
||||
"referencingRules": {
|
||||
"compatibleTypes": "->User Profile->"
|
||||
},
|
||||
"propertyNameAtParent": "referrer"
|
||||
"propertyNameAtParent": "userReferrer"
|
||||
}
|
||||
@@ -17,10 +17,10 @@
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "referrer",
|
||||
"propertyToCheckFor": "userReferrer",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Referrer",
|
||||
"relatedUiObject": "Referrer"
|
||||
"label": "Add User Referrer",
|
||||
"relatedUiObject": "User Referrer"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"type": "Referrer",
|
||||
"type": "User Referrer",
|
||||
"definition": {
|
||||
"text": "This node is used by users to reference other users defining in this way who was the user who brought them into the project. The referrer could have acted by word of mouth, or producing some marketing material with it's referral id. These references are later used at the token distribution process to reward referrers and also users declaring who these referrers are.",
|
||||
"text": "This node is used by users to reference other users defining in this way who was the user who brought them into the project. The userReferrer could have acted by word of mouth, or producing some marketing material with it's referral id. These references are later used at the token distribution process to reward referrers and also users declaring who these referrers are.",
|
||||
"updated": 1622990015308
|
||||
},
|
||||
"paragraphs": [
|
||||
|
||||
@@ -167,7 +167,7 @@ function newGovernanceFunctionLibraryClaims() {
|
||||
let votesRatio = node.payload.referenceParent.payload.votes / node.payload.referenceParent.payload.claimsVotes
|
||||
if (votesRatio > 1) { votesRatio = 1 }
|
||||
/*
|
||||
Share Count means the amount to claims pointing to the same potential tokens reward.
|
||||
Share Count means the amount to claims pointing to the same potential tokens reward.
|
||||
*/
|
||||
let shareCount = node.payload.referenceParent.payload.claimsCount
|
||||
let sharePercentage = node.payload.votes * 100 / node.payload.referenceParent.payload.claimsVotes
|
||||
|
||||
@@ -38,7 +38,7 @@ function newSuperalgosDesignSpace() {
|
||||
/* Take types-icons relationships defined at the schema */
|
||||
for (let i = 0; i < PROJECTS_ARRAY.length; i++) {
|
||||
let project = PROJECTS_ARRAY[i]
|
||||
|
||||
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.appSchema)
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema)
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema)
|
||||
@@ -78,21 +78,24 @@ function newSuperalgosDesignSpace() {
|
||||
|
||||
for (let i = 0; i < iconsArray.length; i++) {
|
||||
let project = iconsArray[i][0]
|
||||
let name = iconsArray[i][1]
|
||||
loadImage(project, name)
|
||||
let path = iconsArray[i][1]
|
||||
loadImage(project, path)
|
||||
}
|
||||
|
||||
function loadImage(project, name) {
|
||||
function loadImage(project, path) {
|
||||
imageLoadedCounter++
|
||||
const PATH = 'Icons/' + project + '/'
|
||||
let image = new Image()
|
||||
image.onload = onImageLoad
|
||||
image.fileName = name
|
||||
image.fileName = path
|
||||
|
||||
function onImageLoad() {
|
||||
image.canDrawIcon = true
|
||||
}
|
||||
image.src = PATH + name
|
||||
image.src = PATH + path
|
||||
let splittedPath = path.split('\\')
|
||||
let name = splittedPath[splittedPath.length - 1]
|
||||
|
||||
let key = project + '-' + name.substring(0, name.length - 4)
|
||||
thisObject.iconsByProjectAndName.set(key, image)
|
||||
|
||||
|
||||
@@ -469,6 +469,7 @@ function newUiObject() {
|
||||
let nearby = nearbyFloatingObjects[i]
|
||||
let distance = nearby[0]
|
||||
let floatingObject = nearby[1]
|
||||
if (floatingObject.payload === undefined) { continue }
|
||||
let nearbyNode = floatingObject.payload.node
|
||||
if (compatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0) {
|
||||
/* Discard App Schema defined objects with busy coonection ports */
|
||||
@@ -614,6 +615,7 @@ function newUiObject() {
|
||||
let nearby = nearbyFloatingObjects[i]
|
||||
let distance = nearby[0]
|
||||
let floatingObject = nearby[1]
|
||||
if (floatingObject.payload === undefined) { continue }
|
||||
let nearbyNode = floatingObject.payload.node
|
||||
if (compatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0 || compatibleTypes === "->*Any Node*->") {
|
||||
if (schemaDocument.referencingRules.incompatibleTypes !== undefined) {
|
||||
@@ -1891,7 +1893,7 @@ function newUiObject() {
|
||||
y: position.y
|
||||
}
|
||||
labelPoint.x = labelPoint.x + radius * 7 / 3 * Math.cos(toRadians(thisObject.payload.angle + thisObject.valueAngleOffset))
|
||||
labelPoint.y = labelPoint.y + radius * 7 / 3 * Math.sin(toRadians(thisObject.payload.angle + thisObject.valueAngleOffset)) + lineSeparator * 1
|
||||
labelPoint.y = labelPoint.y + radius * 7 / 3 * Math.sin(toRadians(thisObject.payload.angle + thisObject.valueAngleOffset)) + lineSeparator * 1
|
||||
} else {
|
||||
if (thisObject.isOnFocus === true) {
|
||||
labelPoint = {
|
||||
|
||||
Reference in new issue
Block a user