diff --git a/Desktop/Client/httpInterface.js b/Desktop/Client/httpInterface.js
index 22a202645..86ae51201 100644
--- a/Desktop/Client/httpInterface.js
+++ b/Desktop/Client/httpInterface.js
@@ -19,13 +19,13 @@ exports.newHttpInterface = function newHttpInterface() {
/*
We will create an HTTP Server and leave it running forever.
*/
- SA.nodeModules.http.createServer(onHttpRequest).listen(global.env.DESKTOP_HTTP_INTERFACE_PORT)
- /* Starting the browser now is optional */
- if (process.argv.includes("noBrowser")) {
- //Running Client only with no UI.
- } else {
- SA.nodeModules.open('http://localhost:' + global.env.DESKTOP_HTTP_INTERFACE_PORT)
- }
+ SA.nodeModules.http.createServer(onHttpRequest).listen(global.env.DESKTOP_HTTP_INTERFACE_PORT)
+ /* Starting the browser now is optional */
+ if (process.argv.includes("noBrowser")) {
+ //Running Client only with no UI.
+ } else {
+ SA.nodeModules.open('http://localhost:' + global.env.DESKTOP_HTTP_INTERFACE_PORT)
+ }
}
function onHttpRequest(httpRequest, httpResponse) {
@@ -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]
@@ -58,7 +93,7 @@ exports.newHttpInterface = function newHttpInterface() {
break
default:
{
- SA.projects.foundations.utilities.httpResponses.respondWithWebFile(httpResponse, endpointOrFile, global.env.PATH_TO_DESKTOP)
+ SA.projects.foundations.utilities.httpResponses.respondWithWebFile(httpResponse, endpointOrFile, global.env.PATH_TO_DESKTOP)
}
}
} catch (err) {
diff --git a/Desktop/UI/AppLoader.js b/Desktop/UI/AppLoader.js
index 1f8de0d3e..24c5ccd21 100644
--- a/Desktop/UI/AppLoader.js
+++ b/Desktop/UI/AppLoader.js
@@ -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()
}
diff --git a/Desktop/UI/AppPostLoader.js b/Desktop/UI/AppPostLoader.js
index 3e962a181..e0040e951 100644
--- a/Desktop/UI/AppPostLoader.js
+++ b/Desktop/UI/AppPostLoader.js
@@ -9,8 +9,18 @@ function newAppPostLoader() {
function start() {
try {
- webApp = newWebApp()
- webApp.initialize()
+
+ 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)
}
diff --git a/Desktop/UI/AppPreLoader.js b/Desktop/UI/AppPreLoader.js
index a21df4ccb..8897aa49d 100644
--- a/Desktop/UI/AppPreLoader.js
+++ b/Desktop/UI/AppPreLoader.js
@@ -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)
diff --git a/Desktop/UI/WebDebugLog.js b/Desktop/UI/WebDebugLog.js
new file mode 100644
index 000000000..2a6bc1af1
--- /dev/null
+++ b/Desktop/UI/WebDebugLog.js
@@ -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)
+ }
+}
diff --git a/Desktop/WebServer/require.js b/Desktop/UI/require.js
similarity index 100%
rename from Desktop/WebServer/require.js
rename to Desktop/UI/require.js
diff --git a/Desktop/WebServer/index.html b/Desktop/WebServer/index.html
index afeb95d14..793a8c5f3 100644
--- a/Desktop/WebServer/index.html
+++ b/Desktop/WebServer/index.html
@@ -6,7 +6,7 @@
-
+