Fixes to allow a new Project to have globals without UI components
This commit is contained in:
1 parent
fc716b9d95
commit
85cc9c2c3d
11 files changed
+61
-32
No files matched your search
@@ -29,7 +29,7 @@ exports.newEvents = function newEvents() {
|
||||
function execute() {
|
||||
let response = []
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let event = NT.memory.arrays.EVENTS[i]
|
||||
if (event === undefined) { break }
|
||||
@@ -37,7 +37,7 @@ exports.newEvents = function newEvents() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let event = NT.memory.arrays.EVENTS[i]
|
||||
if (event === undefined) { break }
|
||||
|
||||
@@ -39,7 +39,7 @@ exports.newPostReplies = function newPostReplies() {
|
||||
let array = Array.from(thisObject.post.replies)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let arrayItem = array[i]
|
||||
if (post === undefined) { break }
|
||||
@@ -47,7 +47,7 @@ exports.newPostReplies = function newPostReplies() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (post === undefined) { break }
|
||||
|
||||
@@ -32,7 +32,7 @@ exports.newProfileFollowers = function newProfileFollowers() {
|
||||
let array = Array.from(thisObject.profile.followers)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
@@ -40,7 +40,7 @@ exports.newProfileFollowers = function newProfileFollowers() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
|
||||
@@ -32,7 +32,7 @@ exports.newProfileFollowing = function newProfileFollowing() {
|
||||
let array = Array.from(thisObject.profile.following)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
@@ -40,7 +40,7 @@ exports.newProfileFollowing = function newProfileFollowing() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
|
||||
@@ -35,7 +35,7 @@ exports.newProfilePosts = function newProfilePosts() {
|
||||
let array = Array.from(thisObject.profile.posts)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
@@ -43,7 +43,7 @@ exports.newProfilePosts = function newProfilePosts() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
|
||||
@@ -28,18 +28,6 @@ global.NT = {
|
||||
},
|
||||
utilities: {
|
||||
queriesValidations: require('./Utilities/QueriesValidations.js').newQueriesValidations()
|
||||
},
|
||||
globals: {
|
||||
constants: {
|
||||
queries: {
|
||||
INITIAL_INDEX_FIRST: 'First',
|
||||
INITIAL_INDEX_LAST: 'Last',
|
||||
MIN_AMOUNT_REQUESTED: 1,
|
||||
MAX_AMOUNT_REQUESTED: 100,
|
||||
DIRECTION_FUTURE: 'Future',
|
||||
DIRECTION_PAST: 'Past'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -51,11 +51,11 @@ exports.newQueriesValidations = function newQueriesValidations() {
|
||||
throw ('Initial Index Undefined.')
|
||||
}
|
||||
|
||||
if (queryReceived.initialIndex === NT.globals.constants.queries.INITIAL_INDEX_LAST) {
|
||||
if (queryReceived.initialIndex === NT.globals.queryConstants.INITIAL_INDEX_LAST) {
|
||||
queryReceived.initialIndex = thisObject.profile.posts.length - 1
|
||||
}
|
||||
|
||||
if (queryReceived.initialIndex === NT.globals.constants.queries.INITIAL_INDEX_FIRST) {
|
||||
if (queryReceived.initialIndex === NT.globals.queryConstants.INITIAL_INDEX_FIRST) {
|
||||
queryReceived.initialIndex = 0
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ exports.newQueriesValidations = function newQueriesValidations() {
|
||||
throw ('Amount Requested Is Not a Number.')
|
||||
}
|
||||
|
||||
if (queryReceived.amountRequested < NT.globals.constants.queries.MIN_AMOUNT_REQUESTED) {
|
||||
if (queryReceived.amountRequested < NT.globals.queryConstants.MIN_AMOUNT_REQUESTED) {
|
||||
throw ('Amount Requested Below Min.')
|
||||
}
|
||||
|
||||
if (queryReceived.amountRequested > NT.globals.constants.queries.MAX_AMOUNT_REQUESTED) {
|
||||
if (queryReceived.amountRequested > NT.globals.queryConstants.MAX_AMOUNT_REQUESTED) {
|
||||
throw ('Amount Requested Above Max.')
|
||||
}
|
||||
/*
|
||||
@@ -89,7 +89,7 @@ exports.newQueriesValidations = function newQueriesValidations() {
|
||||
throw ('Direction Undefined.')
|
||||
}
|
||||
|
||||
if (queryReceived.direction !== NT.globals.constants.queries.DIRECTION_FUTURE && queryReceived.direction !== NT.globals.constants.queries.DIRECTION_PAST) {
|
||||
if (queryReceived.direction !== NT.globals.queryConstants.DIRECTION_FUTURE && queryReceived.direction !== NT.globals.queryConstants.DIRECTION_PAST) {
|
||||
throw ('Direction Not Supported.')
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function newWorkspace() {
|
||||
save: saveWorkspace,
|
||||
backup: backupWorkspace,
|
||||
share: shareWorkspace,
|
||||
getNodesByTypeAndHierarchyHeadsType: getNodesByTypeAndHierarchyHeadsType,
|
||||
getNodesByTypeAndHierarchyHeadsType: getNodesByTypeAndHierarchyHeadsType,
|
||||
getProjectsHeads: getProjectsHeads,
|
||||
getHierarchyHeads: getHierarchyHeads,
|
||||
getHierarchyHeadsById: getHierarchyHeadsById,
|
||||
@@ -70,8 +70,12 @@ function newWorkspace() {
|
||||
/* Set up the action switches map */
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let project = PROJECTS_SCHEMA[i].name
|
||||
let actionSwitch = eval('new' + project + 'ActionSwitch()')
|
||||
actionSwitchesByProject.set(project, actionSwitch)
|
||||
try {
|
||||
let actionSwitch = eval('new' + project + 'ActionSwitch()')
|
||||
actionSwitchesByProject.set(project, actionSwitch)
|
||||
} catch (err) {
|
||||
console.log('[WARN] Action Switch for project ' + project + ' not found.')
|
||||
}
|
||||
}
|
||||
|
||||
/* Check which was the last workspace. */
|
||||
@@ -157,9 +161,9 @@ function newWorkspace() {
|
||||
let workspace = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode
|
||||
|
||||
/* Validation if it is too early to save. */
|
||||
if (thisObject.isInitialized === false) {
|
||||
if (thisObject.isInitialized === false) {
|
||||
console.log('Workspace not saved because it has not been initialized. =')
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
/* Validation of 2 sessions opened at the same time. */
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
exports.newNetworkGlobalsQueryConstants = function () {
|
||||
|
||||
let thisObject = {
|
||||
INITIAL_INDEX_FIRST: 'First',
|
||||
INITIAL_INDEX_LAST: 'Last',
|
||||
MIN_AMOUNT_REQUESTED: 1,
|
||||
MAX_AMOUNT_REQUESTED: 100,
|
||||
DIRECTION_FUTURE: 'Future',
|
||||
DIRECTION_PAST: 'Past'
|
||||
}
|
||||
|
||||
return thisObject
|
||||
}
|
||||
@@ -1267,5 +1267,19 @@
|
||||
"Features",
|
||||
"Positions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Network",
|
||||
"propertyName": "network",
|
||||
"NT": {
|
||||
"globals": [
|
||||
{
|
||||
"name": "Query Constants",
|
||||
"propertyName": "queryConstants",
|
||||
"functionName": "newNetworkGlobalsQueryConstants",
|
||||
"fileName": "QueryConstants.js"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -121,6 +121,8 @@ function newCanvas() {
|
||||
let spaceAnimationDrawMap = new Map()
|
||||
let spaceDefinitionDrawMap = new Map()
|
||||
|
||||
if (projectDefinition.UI === undefined) { continue }
|
||||
|
||||
/* Set up Globals of this Project */
|
||||
if (projectDefinition.UI.globals !== undefined) {
|
||||
for (let j = 0; j < projectDefinition.UI.globals.length; j++) {
|
||||
@@ -742,6 +744,8 @@ function newCanvas() {
|
||||
let projectInstance = UI.projects[projectDefinition.propertyName]
|
||||
if (projectInstance === undefined) { continue }
|
||||
|
||||
if (projectDefinition.UI === undefined) { continue }
|
||||
if (projectDefinition.UI.spaces === undefined) { continue }
|
||||
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
|
||||
let spaceInstance = projectInstance.events.onMouseDownMap.get(j)
|
||||
if (spaceInstance === undefined) { continue }
|
||||
@@ -850,6 +854,8 @@ function newCanvas() {
|
||||
let projectInstance = UI.projects[projectDefinition.propertyName]
|
||||
if (projectInstance === undefined) { continue }
|
||||
|
||||
if (projectDefinition.UI === undefined) { continue }
|
||||
if (projectDefinition.UI.spaces === undefined) { continue }
|
||||
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
|
||||
let spaceInstance = projectInstance.events.onMouseClickMap.get(j)
|
||||
if (spaceInstance === undefined) { continue }
|
||||
@@ -966,6 +972,8 @@ function newCanvas() {
|
||||
let projectInstance = UI.projects[projectDefinition.propertyName]
|
||||
if (projectInstance === undefined) { continue }
|
||||
|
||||
if (projectDefinition.UI === undefined) { continue }
|
||||
if (projectDefinition.UI.spaces === undefined) { continue }
|
||||
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
|
||||
let spaceInstance = projectInstance.events.onMouseOverMap.get(j)
|
||||
if (spaceInstance === undefined) { continue }
|
||||
@@ -1028,6 +1036,8 @@ function newCanvas() {
|
||||
let projectInstance = UI.projects[projectDefinition.propertyName]
|
||||
if (projectInstance === undefined) { continue }
|
||||
|
||||
if (projectDefinition.UI === undefined) { continue }
|
||||
if (projectDefinition.UI.spaces === undefined) { continue }
|
||||
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
|
||||
let spaceInstance = projectInstance.events.onMouseWheelMap.get(j)
|
||||
if (spaceInstance === undefined) { continue }
|
||||
|
||||
Reference in new issue
Block a user