Execution in the Browser of Bots Removed

This commit is contained in:
Luis Fernando Molina committed 2019-03-26 14:19:52 +01:00
1 parent 53b081cc0d
commit a87482734d
10 files changed
-785

No files matched your search

-148
View File
@@ -1,148 +0,0 @@
function newPlayStopButton () {
var thisObject = {
container: undefined,
setDatetime: setDatetime,
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
thisObject.container.frame.width = 50
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
resize()
container.isDraggeable = false
container.isClickeable = true
let play
let stop
let canDraw = false
let showing = 'Play'
let image
let datetime
let timePeriod
return thisObject
function initialize () {
play = new Image()
play.onload = onImageLoad
function onImageLoad () {
image = play
canDraw = true
}
play.src = window.canvasApp.urlPrefix + 'Images/Icons/play.png'
stop = new Image()
stop.src = window.canvasApp.urlPrefix + 'Images/Icons/pause.png'
thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick)
viewPort.eventHandler.listenToEvent('Zoom Changed', onZoomChanged)
timePeriod = INITIAL_TIME_PERIOD
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
}
function resize () {
container.frame.position.x = viewPort.visibleArea.topLeft.x + 150 * 5
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
}
function onClick () {
let sessionToken = window.localStorage.getItem('sessionToken')
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return
}
switch (showing) {
case 'Play': {
image = stop
showing = 'Stop'
let UI_COMMANDS = {
beginDatetime: datetime,
endDatetime: undefined,
timePeriod: timePeriod,
startMode: window.CURRENT_START_MODE,
eventHandler: thisObject.container.eventHandler
}
cloudVM.onBotPlayPressed(UI_COMMANDS)
break
}
case 'Stop': {
image = play
showing = 'Play'
cloudVM.onBotStopPressed()
break
}
}
}
function onZoomChanged (event) {
timePeriod = recalculatePeriod(event.newLevel)
}
function setDatetime (pDatetime) {
datetime = new Date(pDatetime)
}
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 {
/* This point does not belong to this space. */
return undefined
}
}
function draw () {
let sessionToken = window.localStorage.getItem('sessionToken')
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return
}
thisObject.container.frame.draw(false, false)
let breakpointsHeight = 14
if (canDraw === false) { return }
let imageHeight = 20
let imageWidth = 20
let imagePoint = {
x: thisObject.container.frame.width / 2 - imageWidth / 2,
y: thisObject.container.frame.height / 2 - imageHeight / 2 + breakpointsHeight
}
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint)
browserCanvasContext.drawImage(image, imagePoint.x, imagePoint.y, imageWidth, imageHeight)
}
}
-1
View File
@@ -2,7 +2,6 @@
let canvas
let markets
let ecosystem = newEcosystem()
let cloudVM = newCloudVM()
let INITIAL_ZOOM_LEVEL = -26 // This is the zoom level at the view port in which the APP starts.
let INITIAL_TIME_PERIOD = recalculatePeriod(INITIAL_ZOOM_LEVEL) // This value will be overwritten at the viewPort.initialize if the user had a prevous session with this same browser.
let viewPort = newViewPort()
-6
View File
@@ -47,11 +47,6 @@ function newTimeControlPanel () {
thisObject.datetimeDisplay = datetimeDisplay
/* Here we will listen to the event when time was changed due to a Bot Execution. */
canvas.bottomSpace.playStopButton.container.eventHandler.listenToEvent('Bot Execution Changed Datetime', onBotChangedTime)
canvas.bottomSpace.playStopButton.setDatetime(datetime)
viewPort.eventHandler.listenToEvent('Zoom Changed', onZoomChanged)
timePeriod = INITIAL_TIME_PERIOD
}
@@ -87,7 +82,6 @@ function newTimeControlPanel () {
function setDatetime (pDatetime) {
thisObject.datetimeDisplay.currentDatetime = new Date(pDatetime)
canvas.bottomSpace.playStopButton.setDatetime(pDatetime)
}
function addTime (seconds) {
-8
View File
@@ -3,7 +3,6 @@ function newBottomSpace () {
var thisObject = {
deleteTradingHistory: undefined,
chartAspectRatio: undefined,
playStopButton: undefined,
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
@@ -27,9 +26,6 @@ function newBottomSpace () {
thisObject.chartAspectRatio = newChartAspectRatio()
thisObject.chartAspectRatio.initialize()
thisObject.playStopButton = newPlayStopButton()
thisObject.playStopButton.initialize()
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
}
@@ -48,9 +44,6 @@ function newBottomSpace () {
if (container !== undefined) { return container }
container = thisObject.chartAspectRatio.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.playStopButton.getContainer(point)
if (container !== undefined) { return container }
/* The point does not belong to any inner container, so we return the current container. */
@@ -64,7 +57,6 @@ function newBottomSpace () {
drawBackground()
thisObject.deleteTradingHistory.draw()
thisObject.chartAspectRatio.draw()
thisObject.playStopButton.draw()
}
function drawBackground () {
-43
View File
@@ -4,12 +4,7 @@ function newTopSpace () {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
companyLogo: undefined,
endUser: undefined,
devTeam: undefined,
currentBot: undefined,
currentProcess: undefined,
currentStartMode: undefined,
currentEvent: undefined,
login: undefined,
initialize: initialize
@@ -38,25 +33,7 @@ function newTopSpace () {
thisObject.login = newLogin()
await thisObject.login.initialize(sharedStatus)
/*
thisObject.companyLogo = newCompanyLogo()
thisObject.endUser = newEndUser()
thisObject.currentBot = newCurrentBot()
thisObject.currentProcess = newCurrentProcess()
thisObject.currentStartMode = newCurrentStartMode()
thisObject.currentEvent = newCurrentEvent()
thisObject.devTeam = newDevTeam()
*/
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
/*
thisObject.companyLogo.initialize()
thisObject.endUser.initialize()
thisObject.currentBot.initialize(sharedStatus)
thisObject.currentProcess.initialize(sharedStatus)
thisObject.currentStartMode.initialize(sharedStatus)
thisObject.currentEvent.initialize(sharedStatus)
thisObject.devTeam.initialize(sharedStatus)
*/
}
function resize () {
@@ -71,24 +48,9 @@ function newTopSpace () {
let container
return
container = thisObject.companyLogo.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.endUser.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.devTeam.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.currentBot.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.currentProcess.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.currentStartMode.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.currentEvent.getContainer(point)
if (container !== undefined) { return container }
@@ -106,12 +68,7 @@ function newTopSpace () {
drawBackground()
return
thisObject.companyLogo.draw()
thisObject.endUser.draw()
thisObject.devTeam.draw()
thisObject.currentBot.draw()
thisObject.currentProcess.draw()
thisObject.currentStartMode.draw()
thisObject.currentEvent.draw()
thisObject.login.draw()
}
-75
View File
@@ -1,75 +0,0 @@

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 container = newContainer()
container.initialize()
thisObject.container = container
thisObject.container.frame.width = 150
thisObject.container.frame.height = TOP_SPACE_HEIGHT
container.frame.position.x = 0
container.frame.position.y = 0
container.isDraggeable = 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/Superalgos-logo-horz-sm.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 {
/* This point does not belong to this space. */
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
}
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint)
browserCanvasContext.drawImage(logo, imagePoint.x, imagePoint.y, imageWidth, imageHeight)
}
}
-139
View File
@@ -1,139 +0,0 @@
function newCurrentBot () {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
}
let container = newContainer()
container.initialize()
thisObject.container = container
thisObject.container.frame.width = 150
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
resize()
container.isDraggeable = false
container.isClickeable = true
const NOT_FOUND = ''
let sharedStatus
return thisObject
function initialize (pSharedStatus) {
sharedStatus = pSharedStatus
if (window.USER_PROFILE === undefined) { return }
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)
}
function resize () {
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 1
container.frame.position.y = viewPort.visibleArea.bottomLeft.y + BREAKPOINT_HEIGHT
}
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 onClick () {
let sessionToken = window.localStorage.getItem('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
}
}
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 {
/* This point does not belong to this space. */
return undefined
}
}
function draw () {
let sessionToken = window.localStorage.getItem('sessionToken')
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return
}
thisObject.container.frame.draw(false, false)
let breakpointsHeight = 0
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)
}
}
-130
View File
@@ -1,130 +0,0 @@
function newCurrentProcess () {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
}
let container = newContainer()
container.initialize()
thisObject.container = container
thisObject.container.frame.width = 150
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
resize()
container.isDraggeable = false
container.isClickeable = true
const NOT_FOUND = ''
let sharedStatus
return thisObject
function initialize (pSharedStatus) {
sharedStatus = pSharedStatus
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 {
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 () {
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 3
container.frame.position.y = viewPort.visibleArea.bottomLeft.y + BREAKPOINT_HEIGHT
}
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
}
}
window.CURRENT_PROCESS = NOT_FOUND
}
function onClick () {
let sessionToken = window.localStorage.getItem('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
}
}
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 {
/* This point does not belong to this space. */
return undefined
}
}
function draw () {
let sessionToken = window.localStorage.getItem('sessionToken')
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return
}
thisObject.container.frame.draw(false, false)
let breakpointsHeight = 0
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)
}
}
-110
View File
@@ -1,110 +0,0 @@
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 container = newContainer()
container.initialize()
thisObject.container = container
thisObject.container.frame.width = 150
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
resize()
container.isDraggeable = false
container.isClickeable = true
return thisObject
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)
}
function resize () {
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 4
container.frame.position.y = viewPort.visibleArea.bottomLeft.y + BREAKPOINT_HEIGHT
}
function onClick () {
let sessionToken = window.localStorage.getItem('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
}
}
}
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 {
/* This point does not belong to this space. */
return undefined
}
}
function draw () {
let sessionToken = window.localStorage.getItem('sessionToken')
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return
}
if (window.CURRENT_BOT_DISPLAY_NAME === '') { return }
thisObject.container.frame.draw(false, false)
let breakpointsHeight = 0
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)
}
}
-125
View File
@@ -1,125 +0,0 @@
function newDevTeam () {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
}
let container = newContainer()
container.initialize()
thisObject.container = container
thisObject.container.frame.width = 150
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
resize()
container.isDraggeable = false
container.isClickeable = true
const NOT_FOUND = 'Team NOT FOUND'
let sharedStatus
let label = ''
return thisObject
function initialize (pSharedStatus) {
let sessionToken = window.localStorage.getItem('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)
}
function resize () {
container.frame.position.x = viewPort.visibleArea.topLeft.x + thisObject.container.frame.width * 0
container.frame.position.y = viewPort.visibleArea.bottomLeft.y + BREAKPOINT_HEIGHT
}
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
}
}
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 {
/* This point does not belong to this space. */
return undefined
}
}
function draw () {
let sessionToken = window.localStorage.getItem('sessionToken')
if (sessionToken === null || sessionToken === '') {
/* not logged in */
return
}
thisObject.container.frame.draw(false, false)
let breakpointsHeight = 0
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)
}
}