Modules loaded at UI
This commit is contained in:
1 parent
303c8a9920
commit
73134a4f45
9 files changed
+55
-19
No files matched your search
@@ -15,7 +15,7 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
/*
|
||||
This is the Web Sockets client that interacts with the Superalgos Network.
|
||||
*/
|
||||
DK.running.socialGraph = DK.projects.socialTrading.modules.socialTrading.newSocialTradingModulesSocialGraph()
|
||||
DK.running.socialGraph = DK.projects.socialTrading.modules.socialGraph.newSocialTradingModulesSocialGraph()
|
||||
await DK.running.socialGraph.initialize()
|
||||
|
||||
/*
|
||||
@@ -23,17 +23,18 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
*/
|
||||
DK.running.webSocketsClient = SA.projects.network.modules.webSocketsClient.newNetworkModulesWebSocketsClient()
|
||||
await DK.running.webSocketsClient.initialize()
|
||||
console.log('Desktop App Client Connected to Network Node via Web Sockets ................... Connected to port ' + global.env.NETWORK_WEB_SOCKETS_INTERFACE_PORT)
|
||||
|
||||
/* These are the Network Interfaces by which the UI interacts with the Desktop App.*/
|
||||
|
||||
DK.running.webSocketsInterface = DK.projects.socialTrading.modules.webSocketsInterface.newDesktopModulesWebSocketsInterface()
|
||||
DK.running.webSocketsInterface.initialize()
|
||||
console.log('Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT)
|
||||
console.log('Desktop App Client Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT)
|
||||
|
||||
|
||||
DK.running.httpInterface = DK.projects.socialTrading.modules.httpInterface.newDesktopModulesHttpInterface()
|
||||
DK.running.httpInterface.initialize()
|
||||
console.log('Http Interface .............................................. Listening at port ' + global.env.DESKTOP_HTTP_INTERFACE_PORT)
|
||||
console.log('Desktop App Client Http Interface .............................................. Listening at port ' + global.env.DESKTOP_HTTP_INTERFACE_PORT)
|
||||
|
||||
return
|
||||
|
||||
|
||||
+11
-2
@@ -34,7 +34,7 @@ function newWebApp() {
|
||||
projectInstance.utilities = {}
|
||||
projectInstance.globals = {}
|
||||
projectInstance.functionLibraries = {}
|
||||
|
||||
projectInstance.modules = {}
|
||||
|
||||
if (projectDefinition.UI === undefined) { continue }
|
||||
|
||||
@@ -64,6 +64,15 @@ function newWebApp() {
|
||||
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up Modules of this Project */
|
||||
if (projectDefinition.UI.modules !== undefined) {
|
||||
for (let j = 0; j < projectDefinition.UI.modules.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition.UI.modules[j]
|
||||
|
||||
projectInstance.modules[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +110,7 @@ function newWebApp() {
|
||||
console.log(profile)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Error Handling
|
||||
*/
|
||||
|
||||
@@ -74,6 +74,26 @@ function newWebAppLoader() {
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Globals' + '/' + fileName)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
modules()
|
||||
}
|
||||
}
|
||||
|
||||
function modules() {
|
||||
let url = 'ListModulesFiles'
|
||||
httpRequest(undefined, url, onResponse)
|
||||
|
||||
function onResponse(err, fileList) {
|
||||
let urlArray = []
|
||||
let fileArray = JSON.parse(fileList)
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
let item = fileArray[i]
|
||||
|
||||
project = item[0]
|
||||
fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Modules' + '/' + fileName)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
downloadIncludedFiles()
|
||||
}
|
||||
|
||||
@@ -185,7 +185,6 @@ exports.newNetworkModulesWebSocketsClient = function newNetworkModulesWebSockets
|
||||
reject()
|
||||
return
|
||||
}
|
||||
console.log('[INFO] Web Sockets Client -> stepTwoResponse -> response.message = ' + response.message)
|
||||
/*
|
||||
This was the end of the Handshake producere. We are connected to the
|
||||
Network Node and from now on, all response messages will be received
|
||||
|
||||
@@ -8,7 +8,6 @@ exports.newSocialTradingModulesSocialGraph = function newSocialTradingModulesSoc
|
||||
as in the Network Node.
|
||||
*/
|
||||
let thisObject = {
|
||||
messageReceived: messageReceived,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
@@ -33,15 +33,15 @@ exports.newDesktopModulesWebSocketsInterface = function newDesktopModulesWebSock
|
||||
socketServer.on('connection', onConnectionOpened)
|
||||
|
||||
function onConnectionOpened(socket)
|
||||
|
||||
if (webApp !== undefined) {
|
||||
console.log('[ERROR] Only one websockets client allowed.')
|
||||
return
|
||||
}
|
||||
/*
|
||||
This function is executed every time a new Websockets connection
|
||||
is stablished.
|
||||
*/ {
|
||||
if (webApp !== undefined) {
|
||||
console.log('[ERROR] Only one websockets client allowed.')
|
||||
return
|
||||
}
|
||||
|
||||
webApp = {
|
||||
socket: socket
|
||||
}
|
||||
@@ -79,9 +79,9 @@ exports.newDesktopModulesWebSocketsInterface = function newDesktopModulesWebSock
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Web Sockets Interface -> setUpWebSocketServer -> err.stack = ' + err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
function sendToWebApp(message) {
|
||||
webApp.socket.send(JSON.stringify(message))
|
||||
}
|
||||
function sendToWebApp(message) {
|
||||
webApp.socket.send(JSON.stringify(message))
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,11 @@ exports.newDesktopModulesHttpInterface = function newDesktopModulesHttpInterface
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithProjectFolderFileList(httpResponse, 'Globals', 'UI')
|
||||
}
|
||||
break
|
||||
case 'ListModulesFiles':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithProjectFolderFileList(httpResponse, 'Modules', 'UI')
|
||||
}
|
||||
break
|
||||
case 'Projects':
|
||||
{
|
||||
let path = ''
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newSocialTradingModulesWebSocketsClient = function newSocialTradingModulesWebSocketsClient() {
|
||||
function newSocialTradingModulesWebSocketsClient() {
|
||||
|
||||
let thisObject = {
|
||||
sendMessage: sendMessage,
|
||||
|
||||
+6
-3
@@ -60,7 +60,10 @@ DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID = "baa2f02c-2920-4edb-a103-d452fc61d82f"
|
||||
DK.TEST_NETWORK_CLIENT_USER_PROFILE_HANDLE = "Test-Network-Client-Profile"
|
||||
DK.TEST_NETWORK_CLIENT_USER_PROFILE_PRIVATE_KEY = "0x5fed4817a87431c8a328d0936561e63f45b6db289adac6125b9306ded644dfe9"
|
||||
|
||||
DK.app = require('./Desktop/DesktopApp.js').newDesktopApp()
|
||||
DK.app.run()
|
||||
run()
|
||||
|
||||
console.log('Superalgos Desktop is Running.')
|
||||
async function run() {
|
||||
DK.app = require('./Desktop/DesktopApp.js').newDesktopApp()
|
||||
await DK.app.run()
|
||||
console.log('Superalgos Desktop App is Running.')
|
||||
}
|
||||
Reference in new issue
Block a user