Autoformatter applied on all js files

This commit is contained in:
Luis Fernando Molina committed 2019-02-23 10:32:06 +01:00
1 parent 72c1017b20
commit c627aedcf6
59 files changed
+9087 -10892

No files matched your search

+56 -65
View File
@@ -1,84 +1,75 @@
function newCompanyLogo() {

function newCompanyLogo () {
var thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
}
var thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
};
var container = newContainer()
container.initialize()
thisObject.container = container
var container = newContainer();
container.initialize();
thisObject.container = container;
thisObject.container.frame.width = 150
thisObject.container.frame.height = TOP_SPACE_HEIGHT
thisObject.container.frame.width = 150;
thisObject.container.frame.height = TOP_SPACE_HEIGHT;
container.frame.position.x = 0
container.frame.position.y = 0
container.frame.position.x = 0;
container.frame.position.y = 0;
container.isDraggeable = false
container.isDraggeable = false;
let logo
let canDrawLogo = false
let logo;
let canDrawLogo = false;
return thisObject;
function initialize() {
if (window.canvasApp.executingAt === 'Master App') {
currentLabel = "";
return;
}
logo = new Image();
logo.onload = onImageLoad;
function onImageLoad() {
canDrawLogo = true;
}
logo.src = window.canvasApp.urlPrefix + "Images/aa-logo-dark-8.png";
return thisObject
function initialize () {
if (window.canvasApp.executingAt === 'Master App') {
currentLabel = ''
return
}
function getContainer(point) {
logo = new Image()
let container;
logo.onload = onImageLoad
function onImageLoad () {
canDrawLogo = true
}
logo.src = window.canvasApp.urlPrefix + 'Images/aa-logo-dark-8.png'
}
function getContainer (point) {
let container
/* First we check if this point is inside this object UI. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container;
} else {
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container
} else {
/* This point does not belong to this space. */
return undefined;
}
return undefined
}
}
function draw () {
thisObject.container.frame.draw(false, false)
if (canDrawLogo === false) { return }
let imageHeight = 24
let imageWidth = 120
let imagePoint = {
x: 10,
y: thisObject.container.frame.height / 2 - imageHeight / 2
}
function draw() {
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint)
thisObject.container.frame.draw(false, false);
if (canDrawLogo === false) { return;}
let imageHeight = 24;
let imageWidth = 120;
let imagePoint = {
x: 10,
y: thisObject.container.frame.height / 2 - imageHeight / 2
};
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint);
browserCanvasContext.drawImage(logo, imagePoint.x, imagePoint.y, imageWidth, imageHeight);
}
}
browserCanvasContext.drawImage(logo, imagePoint.x, imagePoint.y, imageWidth, imageHeight)
}
}
+107 -126
View File
@@ -1,156 +1,137 @@
function newCurrentBot() {

function newCurrentBot () {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
}
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
};
let container = newContainer()
container.initialize()
thisObject.container = container
let container = newContainer();
container.initialize();
thisObject.container = container;
thisObject.container.frame.width = 150
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
thisObject.container.frame.width = 150;
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT;
resize()
resize();
container.isDraggeable = false
container.isClickeable = true
container.isDraggeable = false;
container.isClickeable = true;
const NOT_FOUND = ''
const NOT_FOUND = "";
let sharedStatus
let sharedStatus;
return thisObject
return thisObject;
function initialize (pSharedStatus) {
sharedStatus = pSharedStatus
function initialize(pSharedStatus) {
sharedStatus = pSharedStatus;
if (window.USER_PROFILE.devTeams.length === 0) {
window.CURRENT_BOT_DISPLAY_NAME = NOT_FOUND;
} else {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length === 0) {
window.CURRENT_BOT_DISPLAY_NAME = NOT_FOUND;
window.CURRENT_BOT_REPO = "NO REPO";
window.CURRENT_BOT_CODE_NAME = "";
} else {
window.CURRENT_BOT_DISPLAY_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName;
window.CURRENT_BOT_REPO = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].repo;
window.CURRENT_BOT_CODE_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].codeName;
}
}
thisObject.container.eventHandler.listenToEvent("onMouseClick", onClick);
sharedStatus.eventHandler.listenToEvent("devTeam Changed", onDevTeamChanged);
window.canvasApp.eventHandler.listenToEvent("Browser Resized", resize);
if (window.USER_PROFILE.devTeams.length === 0) {
window.CURRENT_BOT_DISPLAY_NAME = NOT_FOUND
} else {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length === 0) {
window.CURRENT_BOT_DISPLAY_NAME = NOT_FOUND
window.CURRENT_BOT_REPO = 'NO REPO'
window.CURRENT_BOT_CODE_NAME = ''
} else {
window.CURRENT_BOT_DISPLAY_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName
window.CURRENT_BOT_REPO = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].repo
window.CURRENT_BOT_CODE_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].codeName
}
}
function resize() {
thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick)
sharedStatus.eventHandler.listenToEvent('devTeam Changed', onDevTeamChanged)
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 1;
container.frame.position.y = viewPort.visibleArea.bottomLeft.y;
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
}
function resize () {
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 1
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
}
function onDevTeamChanged () {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length > 0) {
sharedStatus.currentUserBotIndex = 0
window.CURRENT_BOT_DISPLAY_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName
window.CURRENT_BOT_REPO = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].repo
window.CURRENT_BOT_CODE_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].codeName
sharedStatus.eventHandler.raiseEvent('userBot Changed')
} else {
window.CURRENT_BOT_DISPLAY_NAME = NOT_FOUND
}
}
function onDevTeamChanged() {
function onClick () {
let sessionToken = window.localStorage.getItem('sessionToken')
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length > 0) {
sharedStatus.currentUserBotIndex = 0;
window.CURRENT_BOT_DISPLAY_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName;
window.CURRENT_BOT_REPO = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].repo;
window.CURRENT_BOT_CODE_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].codeName;
sharedStatus.eventHandler.raiseEvent("userBot Changed");
} else {
window.CURRENT_BOT_DISPLAY_NAME = NOT_FOUND;
}
}
function onClick() {
let sessionToken = window.localStorage.getItem('sessionToken');
if (sessionToken === null || sessionToken === "") {
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return;
}
if (sharedStatus.currentUserBotIndex + 1 === window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length) {
sharedStatus.currentUserBotIndex = 0;
window.CURRENT_BOT_DISPLAY_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName;
window.CURRENT_BOT_REPO = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].repo;
window.CURRENT_BOT_CODE_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].codeName;
sharedStatus.eventHandler.raiseEvent("userBot Changed");
return;
}
if (sharedStatus.currentUserBotIndex + 1 < window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length) {
sharedStatus.currentUserBotIndex++;
window.CURRENT_BOT_DISPLAY_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName;
window.CURRENT_BOT_REPO = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].repo;
window.CURRENT_BOT_CODE_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].codeName;
sharedStatus.eventHandler.raiseEvent("userBot Changed");
return;
}
return
}
function getContainer(point) {
if (sharedStatus.currentUserBotIndex + 1 === window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length) {
sharedStatus.currentUserBotIndex = 0
window.CURRENT_BOT_DISPLAY_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName
window.CURRENT_BOT_REPO = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].repo
window.CURRENT_BOT_CODE_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].codeName
let container;
sharedStatus.eventHandler.raiseEvent('userBot Changed')
return
}
if (sharedStatus.currentUserBotIndex + 1 < window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length) {
sharedStatus.currentUserBotIndex++
window.CURRENT_BOT_DISPLAY_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName
window.CURRENT_BOT_REPO = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].repo
window.CURRENT_BOT_CODE_NAME = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].codeName
sharedStatus.eventHandler.raiseEvent('userBot Changed')
return
}
}
function getContainer (point) {
let container
/* First we check if this point is inside this object UI. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container;
} else {
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container
} else {
/* This point does not belong to this space. */
return undefined;
}
return undefined
}
}
function draw() {
function draw () {
let sessionToken = window.localStorage.getItem('sessionToken')
let sessionToken = window.localStorage.getItem('sessionToken');
if (sessionToken === null || sessionToken === "") {
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return;
}
thisObject.container.frame.draw(false, false);
let breakpointsHeight = 14;
let fontSize = 12;
let label = window.CURRENT_BOT_DISPLAY_NAME;
if (label === undefined) { label = "" };
let point = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize / 3,
y: thisObject.container.frame.height / 2 + fontSize / 2 + breakpointsHeight
};
point = thisObject.container.frame.frameThisPoint(point);
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY;
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)';
browserCanvasContext.fillText(label, point.x, point.y);
return
}
}
thisObject.container.frame.draw(false, false)
let breakpointsHeight = 14
let fontSize = 12
let label = window.CURRENT_BOT_DISPLAY_NAME
if (label === undefined) { label = '' };
let point = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize / 3,
y: thisObject.container.frame.height / 2 + fontSize / 2 + breakpointsHeight
}
point = thisObject.container.frame.frameThisPoint(point)
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
browserCanvasContext.fillText(label, point.x, point.y)
}
}
+97 -117
View File
@@ -1,150 +1,130 @@
function newCurrentProcess() {

function newCurrentProcess () {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
}
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
};
let container = newContainer()
container.initialize()
thisObject.container = container
let container = newContainer();
container.initialize();
thisObject.container = container;
thisObject.container.frame.width = 150
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
thisObject.container.frame.width = 150;
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT;
resize()
resize()
container.isDraggeable = false
container.isClickeable = true
container.isDraggeable = false;
container.isClickeable = true;
const NOT_FOUND = ''
const NOT_FOUND = "";
let sharedStatus
let sharedStatus;
return thisObject
return thisObject;
function initialize (pSharedStatus) {
sharedStatus = pSharedStatus
function initialize(pSharedStatus) {
sharedStatus = pSharedStatus;
if (window.USER_PROFILE.devTeams.length === 0) {
window.CURRENT_PROCESS = NOT_FOUND;
if (window.USER_PROFILE.devTeams.length === 0) {
window.CURRENT_PROCESS = NOT_FOUND
} else {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length === 0) {
window.CURRENT_PROCESS = NOT_FOUND
} else {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length === 0) {
window.CURRENT_PROCESS = NOT_FOUND
} else {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length === 0) {
window.CURRENT_PROCESS = NOT_FOUND;
} else {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length === 0) {
window.CURRENT_PROCESS = NOT_FOUND;
} else {
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name;
}
}
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name
}
thisObject.container.eventHandler.listenToEvent("onMouseClick", onClick);
sharedStatus.eventHandler.listenToEvent("userBot Changed", onUserBotChanged);
window.canvasApp.eventHandler.listenToEvent("Browser Resized", resize);
}
}
function resize() {
thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick)
sharedStatus.eventHandler.listenToEvent('userBot Changed', onUserBotChanged)
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 2;
container.frame.position.y = viewPort.visibleArea.bottomLeft.y;
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
}
function resize () {
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 2
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
}
function onUserBotChanged () {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length > 0) {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length > 0) {
sharedStatus.currentProcessIndex = 0
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name
return
}
}
function onUserBotChanged() {
window.CURRENT_PROCESS = NOT_FOUND
}
if ( window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length > 0) {
function onClick () {
let sessionToken = window.localStorage.getItem('sessionToken')
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length > 0) {
sharedStatus.currentProcessIndex = 0;
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name;
return;
}
}
window.CURRENT_PROCESS = NOT_FOUND;
}
function onClick() {
let sessionToken = window.localStorage.getItem('sessionToken');
if (sessionToken === null || sessionToken === "") {
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return;
}
if (sharedStatus.currentProcessIndex + 1 === window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length) {
sharedStatus.currentProcessIndex = 0;
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name;
return;
}
if (sharedStatus.currentProcessIndex + 1 < window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length) {
sharedStatus.currentProcessIndex++;
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name;
return;
}
return
}
function getContainer(point) {
if (sharedStatus.currentProcessIndex + 1 === window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length) {
sharedStatus.currentProcessIndex = 0
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name
return
}
let container;
if (sharedStatus.currentProcessIndex + 1 < window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length) {
sharedStatus.currentProcessIndex++
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name
return
}
}
function getContainer (point) {
let container
/* First we check if this point is inside this object UI. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container;
} else {
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container
} else {
/* This point does not belong to this space. */
return undefined;
}
return undefined
}
}
function draw() {
function draw () {
let sessionToken = window.localStorage.getItem('sessionToken')
let sessionToken = window.localStorage.getItem('sessionToken');
if (sessionToken === null || sessionToken === "") {
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return;
}
thisObject.container.frame.draw(false, false);
let breakpointsHeight = 14;
let fontSize = 12;
let label = window.CURRENT_PROCESS;
if (label === undefined) { label = "" };
let point = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize / 3,
y: thisObject.container.frame.height / 2 + fontSize / 2 + breakpointsHeight
};
point = thisObject.container.frame.frameThisPoint(point);
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY;
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)';
browserCanvasContext.fillText(label, point.x, point.y);
return
}
}
thisObject.container.frame.draw(false, false)
let breakpointsHeight = 14
let fontSize = 12
let label = window.CURRENT_PROCESS
if (label === undefined) { label = '' };
let point = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize / 3,
y: thisObject.container.frame.height / 2 + fontSize / 2 + breakpointsHeight
}
point = thisObject.container.frame.frameThisPoint(point)
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
browserCanvasContext.fillText(label, point.x, point.y)
}
}
+83 -95
View File
@@ -1,122 +1,110 @@
function newCurrentStartMode() {

function newCurrentStartMode () {
var thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
}
var thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
};
var container = newContainer()
container.initialize()
thisObject.container = container
var container = newContainer();
container.initialize();
thisObject.container = container;
thisObject.container.frame.width = 150
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
thisObject.container.frame.width = 150;
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT;
resize()
resize();
container.isDraggeable = false
container.isClickeable = true
container.isDraggeable = false;
container.isClickeable = true;
return thisObject
return thisObject;
function initialize () {
window.CURRENT_START_MODE = window.localStorage.getItem('currentStartMode')
function initialize() {
window.CURRENT_START_MODE = window.localStorage.getItem("currentStartMode");
if (window.CURRENT_START_MODE === null) {
window.CURRENT_START_MODE = "Backtest";
}
thisObject.container.eventHandler.listenToEvent("onMouseClick", onClick);
window.canvasApp.eventHandler.listenToEvent("Browser Resized", resize);
if (window.CURRENT_START_MODE === null) {
window.CURRENT_START_MODE = 'Backtest'
}
function resize() {
thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick)
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 3;
container.frame.position.y = viewPort.visibleArea.bottomLeft.y;
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
}
}
function resize () {
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 3
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
}
function onClick() {
function onClick () {
let sessionToken = window.localStorage.getItem('sessionToken')
let sessionToken = window.localStorage.getItem('sessionToken');
if (sessionToken === null || sessionToken === "") {
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return;
}
if (window.CURRENT_BOT_DISPLAY_NAME === "") { return; }
switch (window.CURRENT_START_MODE) {
case "Backtest": {
window.CURRENT_START_MODE = "Live";
break;
}
case "Live": {
window.CURRENT_START_MODE = "Competition";
break;
}
case "Competition": {
window.CURRENT_START_MODE = "Backtest";
break;
}
}
return
}
function getContainer(point) {
if (window.CURRENT_BOT_DISPLAY_NAME === '') { return }
let container;
switch (window.CURRENT_START_MODE) {
case 'Backtest': {
window.CURRENT_START_MODE = 'Live'
break
}
case 'Live': {
window.CURRENT_START_MODE = 'Competition'
break
}
case 'Competition': {
window.CURRENT_START_MODE = 'Backtest'
break
}
}
}
function getContainer (point) {
let container
/* First we check if this point is inside this object UI. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container;
} else {
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container
} else {
/* This point does not belong to this space. */
return undefined;
}
return undefined
}
}
function draw() {
function draw () {
let sessionToken = window.localStorage.getItem('sessionToken')
let sessionToken = window.localStorage.getItem('sessionToken');
if (sessionToken === null || sessionToken === "") {
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return;
}
if (window.CURRENT_BOT_DISPLAY_NAME === "") { return;}
thisObject.container.frame.draw(false, false);
let breakpointsHeight = 14;
let fontSize = 12;
let label = window.CURRENT_START_MODE + " Mode";
if (label === "undefined Mode") { label = "" };
let point = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize / 3,
y: thisObject.container.frame.height / 2 + fontSize / 2 + breakpointsHeight
};
point = thisObject.container.frame.frameThisPoint(point);
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY;
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)';
browserCanvasContext.fillText(label, point.x, point.y);
return
}
}
if (window.CURRENT_BOT_DISPLAY_NAME === '') { return }
thisObject.container.frame.draw(false, false)
let breakpointsHeight = 14
let fontSize = 12
let label = window.CURRENT_START_MODE + ' Mode'
if (label === 'undefined Mode') { label = '' };
let point = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize / 3,
y: thisObject.container.frame.height / 2 + fontSize / 2 + breakpointsHeight
}
point = thisObject.container.frame.frameThisPoint(point)
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
browserCanvasContext.fillText(label, point.x, point.y)
}
}
+93 -107
View File
@@ -1,140 +1,126 @@
function newDevTeam() {

function newDevTeam () {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
}
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
};
let container = newContainer()
container.initialize()
thisObject.container = container
let container = newContainer();
container.initialize();
thisObject.container = container;
thisObject.container.frame.width = 150
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
thisObject.container.frame.width = 150;
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT;
resize()
resize();
container.isDraggeable = false
container.isClickeable = true
container.isDraggeable = false;
container.isClickeable = true;
const NOT_FOUND = 'Team NOT FOUND'
const NOT_FOUND = "Team NOT FOUND";
let sharedStatus
let label = ''
let sharedStatus;
let label = ""
return thisObject
return thisObject;
function initialize (pSharedStatus) {
let sessionToken = window.localStorage.getItem('sessionToken')
function initialize(pSharedStatus) {
let sessionToken = window.localStorage.getItem('sessionToken');
if (sessionToken === null || sessionToken === "") {
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return;
}
sharedStatus = pSharedStatus;
let storedTeams = window.localStorage.getItem('userTeams');
if (storedTeams === null || storedTeams === "[]" || storedTeams === "") {
window.TEAMS = "";
window.DEV_TEAM = "";
label = NOT_FOUND;
} else {
storedTeams = JSON.parse(storedTeams)
window.TEAMS = storedTeams;
window.DEV_TEAM = storedTeams[sharedStatus.currentDevTeamIndex].slug;
label = storedTeams[sharedStatus.currentDevTeamIndex].name;
sharedStatus.eventHandler.raiseEvent("devTeam Changed");
}
thisObject.container.eventHandler.listenToEvent("onMouseClick", onClick);
window.canvasApp.eventHandler.listenToEvent("Browser Resized", resize);
return
}
function resize() {
sharedStatus = pSharedStatus
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 0;
container.frame.position.y = viewPort.visibleArea.bottomLeft.y;
let storedTeams = window.localStorage.getItem('userTeams')
if (storedTeams === null || storedTeams === '[]' || storedTeams === '') {
window.TEAMS = ''
window.DEV_TEAM = ''
label = NOT_FOUND
} else {
storedTeams = JSON.parse(storedTeams)
window.TEAMS = storedTeams
window.DEV_TEAM = storedTeams[sharedStatus.currentDevTeamIndex].slug
label = storedTeams[sharedStatus.currentDevTeamIndex].name
sharedStatus.eventHandler.raiseEvent('devTeam Changed')
}
function onClick() {
thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick)
let sessionToken = window.localStorage.getItem('sessionToken');
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
}
if (sessionToken === null || sessionToken === "") {
function resize () {
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 0
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
}
function onClick () {
let sessionToken = window.localStorage.getItem('sessionToken')
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return;
}
if (sharedStatus.currentDevTeamIndex + 1 === window.TEAMS.length) {
sharedStatus.currentDevTeamIndex = 0;
window.DEV_TEAM = window.TEAMS[sharedStatus.currentDevTeamIndex].slug;
label = window.TEAMS[sharedStatus.currentDevTeamIndex].name;
sharedStatus.eventHandler.raiseEvent("devTeam Changed");
return;
}
if (sharedStatus.currentDevTeamIndex + 1 < window.TEAMS.length) {
sharedStatus.currentDevTeamIndex++;
window.DEV_TEAM = window.TEAMS[sharedStatus.currentDevTeamIndex].slug;
label = window.TEAMS[sharedStatus.currentDevTeamIndex].name;
sharedStatus.eventHandler.raiseEvent("devTeam Changed");
return;
}
return
}
function getContainer(point) {
if (sharedStatus.currentDevTeamIndex + 1 === window.TEAMS.length) {
sharedStatus.currentDevTeamIndex = 0
window.DEV_TEAM = window.TEAMS[sharedStatus.currentDevTeamIndex].slug
label = window.TEAMS[sharedStatus.currentDevTeamIndex].name
sharedStatus.eventHandler.raiseEvent('devTeam Changed')
return
}
let container;
if (sharedStatus.currentDevTeamIndex + 1 < window.TEAMS.length) {
sharedStatus.currentDevTeamIndex++
window.DEV_TEAM = window.TEAMS[sharedStatus.currentDevTeamIndex].slug
label = window.TEAMS[sharedStatus.currentDevTeamIndex].name
sharedStatus.eventHandler.raiseEvent('devTeam Changed')
return
}
}
function getContainer (point) {
let container
/* First we check if this point is inside this object UI. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container;
} else {
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container
} else {
/* This point does not belong to this space. */
return undefined;
}
return undefined
}
}
function draw() {
function draw () {
let sessionToken = window.localStorage.getItem('sessionToken')
let sessionToken = window.localStorage.getItem('sessionToken');
if (sessionToken === null || sessionToken === "") {
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return;
}
thisObject.container.frame.draw(false, false);
let breakpointsHeight = 14;
let fontSize = 12;
let point = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize / 3,
y: thisObject.container.frame.height / 2 + fontSize / 2 + breakpointsHeight
};
point = thisObject.container.frame.frameThisPoint(point);
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY;
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)';
browserCanvasContext.fillText(label, point.x, point.y);
return
}
thisObject.container.frame.draw(false, false)
let breakpointsHeight = 14
let fontSize = 12
let point = {
x: thisObject.container.frame.width / 2 - label.length / 2 * fontSize / 3,
y: thisObject.container.frame.height / 2 + fontSize / 2 + breakpointsHeight
}
point = thisObject.container.frame.frameThisPoint(point)
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
browserCanvasContext.fillText(label, point.x, point.y)
}
}
+57 -69
View File
@@ -1,96 +1,84 @@
function newEndUser() {

function newEndUser () {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
}
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
};
let container = newContainer()
container.initialize()
thisObject.container = container
let container = newContainer();
container.initialize();
thisObject.container = container;
thisObject.container.frame.width = 200
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
thisObject.container.frame.width = 200;
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT;
container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 5
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 5;
container.frame.position.y = viewPort.visibleArea.bottomLeft.y;
container.isDraggeable = false
container.isDraggeable = false;
return thisObject
return thisObject;
function initialize() {
let storedUser = window.localStorage.getItem('loggedInUser');
if (storedUser === null || storedUser === "") {
function initialize () {
let storedUser = window.localStorage.getItem('loggedInUser')
if (storedUser === null || storedUser === '') {
// User is currently not logged in.
window.USER_LOGGED_IN = "";
return;
}
window.USER_LOGGED_IN = ''
return
}
let loggedInUser = JSON.parse(storedUser);
let loggedInUser = JSON.parse(storedUser)
window.USER_LOGGED_IN = loggedInUser.alias;
window.USER_LOGGED_IN = loggedInUser.alias
/* Here we will rearrange the storage permissions array into a map, so that it can be easily consumed when needed. */
let permissionsMap = new Map;
let permissionsMap = new Map()
for (i = 0; i < window.USER_PROFILE.storagePermissions.length; i++) {
let permission = window.USER_PROFILE.storagePermissions[i];
permissionsMap.set(permission[0], permission[1]);
}
window.USER_PROFILE.storagePermissions = permissionsMap;
for (i = 0; i < window.USER_PROFILE.storagePermissions.length; i++) {
let permission = window.USER_PROFILE.storagePermissions[i]
permissionsMap.set(permission[0], permission[1])
}
function getContainer(point) {
window.USER_PROFILE.storagePermissions = permissionsMap
}
let container;
function getContainer (point) {
let container
/* First we check if this point is inside this object UI. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container;
} else {
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container
} else {
/* This point does not belong to this space. */
return undefined;
}
return undefined
}
}
function draw () {
return // nothing to show
thisObject.container.frame.draw(false, false)
let fontSize = 12
let label = window.USER_LOGGED_IN
if (label === undefined) { label = '' };
let point = {
x: thisObject.container.frame.width * 1 / 3,
y: (thisObject.container.frame.height / 2) + 4
}
function draw() {
point = thisObject.container.frame.frameThisPoint(point)
return; // nothing to show
thisObject.container.frame.draw(false, false);
let fontSize = 12;
let label = window.USER_LOGGED_IN;
if (label === undefined) { label = "" };
let point = {
x: thisObject.container.frame.width * 1 / 3,
y: (thisObject.container.frame.height / 2) + 4
};
point = thisObject.container.frame.frameThisPoint(point);
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY;
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)';
browserCanvasContext.fillText(label, point.x, point.y);
}
}
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
browserCanvasContext.fillText(label, point.x, point.y)
}
}
+136 -153
View File
@@ -1,62 +1,58 @@
function newLogin() {

function newLogin () {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
}
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
};
let container = newContainer()
container.initialize()
thisObject.container = container
let container = newContainer();
container.initialize();
thisObject.container = container;
thisObject.container.frame.width = 200
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
thisObject.container.frame.width = 200;
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT;
container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 1
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 1;
container.frame.position.y = viewPort.visibleArea.bottomLeft.y;
container.isDraggeable = false
container.isClickeable = true
container.isDraggeable = false;
container.isClickeable = true;
let currentLabel
let currentLabel;
let userAuthorization
let userAuthorization;
return thisObject
return thisObject;
function initialize(callBackFunction) {
const accessToken = window.localStorage.getItem("access_token");
let user = window.localStorage.getItem("user");
if (user === null) {
function initialize (callBackFunction) {
const accessToken = window.localStorage.getItem('access_token')
let user = window.localStorage.getItem('user')
if (user === null) {
// if there is no user that means that we are logged off, which means it is time to clean the local storage of things from the last log in.
window.localStorage.removeItem("loggedInUser");
window.localStorage.removeItem('sessionToken');
return;
}
window.localStorage.removeItem('loggedInUser')
window.localStorage.removeItem('sessionToken')
return
}
user = JSON.parse(user);
user = JSON.parse(user)
const authId = user.authId;
const authId = user.authId
let sessionToken;
let sessionToken
const apolloClient = new Apollo.lib.ApolloClient({
networkInterface: Apollo.lib.createNetworkInterface({
uri: window.canvasApp.graphQL.masterAppApiUrl,
transportBatching: true,
}),
connectToDevTools: true,
})
const apolloClient = new Apollo.lib.ApolloClient({
networkInterface: Apollo.lib.createNetworkInterface({
uri: window.canvasApp.graphQL.masterAppApiUrl,
transportBatching: true
}),
connectToDevTools: true
})
const QUERY = Apollo.gql`
const QUERY = Apollo.gql`
query($authId: String){
users_UserByAuthId (authId: $authId){
id
@@ -80,46 +76,46 @@ function newLogin() {
}
}
`
const getUser = () => {
return new Promise((resolve, reject) => {
apolloClient.query({
query: QUERY,
variables: {
authId: authId
}
})
const getUser = () => {
return new Promise((resolve, reject) => {
apolloClient.query({
query: QUERY,
variables: {
authId: authId
}
})
.then(response => {
sessionToken = response.data.users_UserByAuthId.sessionToken;
window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId));
resolve({ user: response.data.users_UserByAuthId})
sessionToken = response.data.users_UserByAuthId.sessionToken
window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId))
resolve({ user: response.data.users_UserByAuthId})
})
.catch(error => {
console.log("apolloClient error getting user query", error)
reject(error)
});
});
}
console.log('apolloClient error getting user query', error)
reject(error)
})
})
}
const networkInterfaceTeams = Apollo.lib.createNetworkInterface({
uri: window.canvasApp.graphQL.masterAppApiUrl
});
const networkInterfaceTeams = Apollo.lib.createNetworkInterface({
uri: window.canvasApp.graphQL.masterAppApiUrl
})
networkInterfaceTeams.use([{
applyMiddleware(req, next) {
req.options.headers = {
authorization: `Bearer ${accessToken}`
};
next();
}
}]);
networkInterfaceTeams.use([{
applyMiddleware (req, next) {
req.options.headers = {
authorization: `Bearer ${accessToken}`
}
next()
}
}])
const apolloClientTeams = new Apollo.lib.ApolloClient({
networkInterface: networkInterfaceTeams,
connectToDevTools: true,
});
const apolloClientTeams = new Apollo.lib.ApolloClient({
networkInterface: networkInterfaceTeams,
connectToDevTools: true
})
const TEAM_BY_OWNER_QUERY = Apollo.gql`
const TEAM_BY_OWNER_QUERY = Apollo.gql`
query teamsByOwnerQuery {
teams_TeamsByOwner {
id
@@ -153,113 +149,100 @@ function newLogin() {
}
`
const getTeamByOwner = () => {
return new Promise((resolve, reject) => {
apolloClientTeams.query({
query: TEAM_BY_OWNER_QUERY
})
const getTeamByOwner = () => {
return new Promise((resolve, reject) => {
apolloClientTeams.query({
query: TEAM_BY_OWNER_QUERY
})
.then(response => {
window.localStorage.setItem('userTeams', JSON.stringify(response.data.teams_TeamsByOwner));
resolve({ teams: response.data.teams_TeamsByOwner})
window.localStorage.setItem('userTeams', JSON.stringify(response.data.teams_TeamsByOwner))
resolve({ teams: response.data.teams_TeamsByOwner})
})
.catch(error => {
console.log("apolloClient error getting user teams", error)
reject (error)
});
console.log('apolloClient error getting user teams', error)
reject(error)
})
}
})
}
// To avoid race conditions, add asynchronous fetches to array
let fetchDataPromises = [];
let fetchDataPromises = []
fetchDataPromises.push(getUser(), getTeamByOwner());
fetchDataPromises.push(getUser(), getTeamByOwner())
// When all asynchronous fetches resolve, authenticate user or throw error.
Promise.all(fetchDataPromises).then(result => {
Promise.all(fetchDataPromises).then(result => {
/* this is the time to authenticate the user at AAWeb */
authenticateUser();
authenticateUser()
}, err => {
console.error('fetchData error', err)
})
}, err => {
console.error("fetchData error", err)
});
thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick)
thisObject.container.eventHandler.listenToEvent("onMouseClick", onClick);
function authenticateUser () {
if (sessionToken === undefined) { sessionToken = '' }
function authenticateUser() {
let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' + sessionToken
if (sessionToken === undefined) { sessionToken = "" }
callServer(undefined, path, onServerReponded)
let path = window.canvasApp.urlPrefix + "AABrowserAPI/authenticateUser/" + sessionToken;
function onServerReponded (pResponseFromServer) {
let responseFromServer = JSON.parse(pResponseFromServer)
callServer(undefined, path, onServerReponded);
err = responseFromServer.err
function onServerReponded(pResponseFromServer) {
let responseFromServer = JSON.parse(pResponseFromServer);
err = responseFromServer.err;
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
console.log("Please make sure you create a new team!");
return;
}
window.USER_PROFILE = responseFromServer.userProfile;
window.localStorage.setItem('sessionToken', sessionToken);
currentLabel = "Logged In"
callBackFunction();
}
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
console.log('Please make sure you create a new team!')
return
}
window.USER_PROFILE = responseFromServer.userProfile
window.localStorage.setItem('sessionToken', sessionToken)
currentLabel = 'Logged In'
callBackFunction()
}
}
}
function onClick () {
function onClick() {
}
}
function getContainer(point) {
let container;
function getContainer (point) {
let container
/* First we check if this point is inside this object UI. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container;
} else {
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return this.container
} else {
/* This point does not belong to this space. */
return undefined;
}
return undefined
}
}
function draw () {
return // nothing to show.
thisObject.container.frame.draw(false, false)
let fontSize = 12
let label = currentLabel
if (label === undefined) { label = '' };
let point = {
x: thisObject.container.frame.width * 1 / 3,
y: (thisObject.container.frame.height / 2) + 4
}
function draw() {
point = thisObject.container.frame.frameThisPoint(point)
return; // nothing to show.
thisObject.container.frame.draw(false, false);
let fontSize = 12;
let label = currentLabel;
if (label === undefined) { label = "" };
let point = {
x: thisObject.container.frame.width * 1 / 3,
y: (thisObject.container.frame.height / 2) + 4
};
point = thisObject.container.frame.frameThisPoint(point);
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY;
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)';
browserCanvasContext.fillText(label, point.x, point.y);
}
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
browserCanvasContext.fillText(label, point.x, point.y)
}
}