WebApp Loading all modules declared at Project Schema
This commit is contained in:
1 parent
ecc7b7d7b6
commit
373f0307d8
7 files changed
+72
-23
No files matched your search
@@ -35,6 +35,41 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
let endpointOrFile = requestPath[1]
|
||||
|
||||
switch (endpointOrFile) {
|
||||
case 'ProjectsSchema':
|
||||
{
|
||||
let path = global.env.PATH_TO_PROJECTS + '/' + 'ProjectsSchema.json'
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(path, httpResponse)
|
||||
}
|
||||
break
|
||||
case 'ListFunctionLibraries':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithProjectFolderFileList(httpResponse, 'Function-Libraries', 'UI')
|
||||
}
|
||||
break
|
||||
case 'ListUtilitiesFiles':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithProjectFolderFileList(httpResponse, 'Utilities', 'UI')
|
||||
}
|
||||
break
|
||||
case 'ListGlobalFiles':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithProjectFolderFileList(httpResponse, 'Globals', 'UI')
|
||||
}
|
||||
break
|
||||
case 'Projects':
|
||||
{
|
||||
let path = ''
|
||||
for (let i = 2; i < 10; i++) {
|
||||
if (requestPath[i] !== undefined) {
|
||||
let parameter = unescape(requestPath[i])
|
||||
path = path + '/' + parameter
|
||||
}
|
||||
|
||||
}
|
||||
let filePath = global.env.PATH_TO_PROJECTS + path
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(filePath, httpResponse)
|
||||
}
|
||||
break
|
||||
case 'Images': // This means the Images folder.
|
||||
{
|
||||
let path = global.env.PATH_TO_DESKTOP + '/WebServer/Images/' + requestPath[2]
|
||||
|
||||
+4
-21
@@ -10,12 +10,12 @@ function newAppLoader() {
|
||||
|
||||
async function loadModules() {
|
||||
try {
|
||||
let modulesArray = []
|
||||
|
||||
modulesArray = modulesArray.concat([
|
||||
let modulesArray = [
|
||||
'WebDebugLog.js',
|
||||
'AppPostLoader.js',
|
||||
'Globals.js',
|
||||
'WebApp.js'
|
||||
])
|
||||
]
|
||||
|
||||
functionLibraries()
|
||||
|
||||
@@ -74,23 +74,6 @@ function newAppLoader() {
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Globals' + '/' + fileName)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
spaces()
|
||||
}
|
||||
}
|
||||
|
||||
function spaces() {
|
||||
let url = 'ListSpaceFiles'
|
||||
httpRequest(undefined, url, onResponse)
|
||||
|
||||
function onResponse(err, fileList) {
|
||||
let urlArray = []
|
||||
let fileArray = JSON.parse(fileList)
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
let path = fileArray[i]
|
||||
urlArray.push('Projects' + '/' + path)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
downloadIncludedFiles()
|
||||
}
|
||||
|
||||
@@ -9,8 +9,18 @@ function newAppPostLoader() {
|
||||
|
||||
function start() {
|
||||
try {
|
||||
|
||||
setupProjectsSchema()
|
||||
|
||||
function setupProjectsSchema() {
|
||||
httpRequest(undefined, 'ProjectsSchema', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
PROJECTS_SCHEMA = JSON.parse(file)
|
||||
webApp = newWebApp()
|
||||
webApp.initialize()
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[ERROR] err.stack = ' + err.stack)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ function httpRequest(pContentToSend, pPath, callBackFunction) {
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
try {
|
||||
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, xmlHttpRequest.responseText)
|
||||
callBackFunction(undefined, xmlHttpRequest.responseText)
|
||||
} catch(err) {
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> err.stack = '+ err.stack)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> pContentToSend = '+ pContentToSend)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
function newWebDebugLog() {
|
||||
try {
|
||||
let thisObject = {
|
||||
write: write,
|
||||
fileName: 'undefined'
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function write(pText) {
|
||||
console.log(spacePad(thisObject.fileName, 50) + ' : ' + pText)
|
||||
|
||||
function spacePad(str, max) {
|
||||
str = str.toString()
|
||||
return str.length < max ? spacePad(' ' + str, max) : str
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(spacePad(MODULE_NAME, 50) + ' : ' + '[ERROR] WebDebugLog --> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -6,7 +6,7 @@
|
||||
<meta name="description" content="Free and Open Source Crypto Social Trading">
|
||||
<link rel="stylesheet" href="main.css" type="text/css" charset="utf-8" />
|
||||
<link rel="shortcut icon" type="image/png/ico" href="Images/favicon.ico" />
|
||||
<script type="text/javascript" src="WebServer/require.js"></script>
|
||||
<script type="text/javascript" src="require.js"></script>
|
||||
<script type="text/javascript" src="AppPreLoader.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
Reference in new issue
Block a user