Cleaning
This commit is contained in:
1 parent
6cb40a395c
commit
d1c7199b25
4 files changed
+2
-179
No files matched your search
-149
@@ -1,149 +0,0 @@
|
||||
|
||||
function newEcosystem() {
|
||||
|
||||
let thisObject = {
|
||||
getHost: getHost,
|
||||
getCompetition: getCompetition,
|
||||
getDataMine: getDataMine,
|
||||
getDataMines: getDataMines,
|
||||
getBot: getBot,
|
||||
getProduct: getProduct,
|
||||
getDataSet: getDataSet,
|
||||
getExchange: getExchange,
|
||||
getPlotter: getPlotter,
|
||||
getPlotterModule: getPlotterModule,
|
||||
getStoragePermissions: getStoragePermissions,
|
||||
setEvent: setEvent,
|
||||
initialize: initialize
|
||||
}
|
||||
|
||||
let ECOSYSTEM = JSON.parse(window.localStorage.getItem('ecosystem'));
|
||||
if (ECOSYSTEM === null || ECOSYSTEM === undefined) {
|
||||
ECOSYSTEM = getUserEcosystem()
|
||||
}
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize() {
|
||||
|
||||
}
|
||||
|
||||
function setEvent(input) {
|
||||
ECOSYSTEM.hosts = input;
|
||||
}
|
||||
|
||||
function getStoragePermissions() {
|
||||
|
||||
return ECOSYSTEM.STORAGE_PERMISSIONS;
|
||||
|
||||
}
|
||||
|
||||
function getHost(pHostCodeName) {
|
||||
|
||||
for (let i = 0; i < ECOSYSTEM.hosts.length; i++) {
|
||||
|
||||
if (ECOSYSTEM.hosts[i].codeName === pHostCodeName) {
|
||||
|
||||
return ECOSYSTEM.hosts[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCompetition(pHost, pCompetitionCodeName) {
|
||||
|
||||
for (let i = 0; i < pHost.competitions.length; i++) {
|
||||
|
||||
if (pHost.competitions[i].codeName === pCompetitionCodeName) {
|
||||
|
||||
return pHost.competitions[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getDataMines() {
|
||||
|
||||
return ECOSYSTEM.dataMines;
|
||||
|
||||
}
|
||||
|
||||
function getDataMine(pDataMineCodeName) {
|
||||
|
||||
for (let i = 0; i < ECOSYSTEM.dataMines.length; i++) {
|
||||
|
||||
if (ECOSYSTEM.dataMines[i].codeName === pDataMineCodeName) {
|
||||
|
||||
return ECOSYSTEM.dataMines[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getBot(pDataMine, pBotCodeName) {
|
||||
|
||||
for (let i = 0; i < pDataMine.bots.length; i++) {
|
||||
|
||||
if (pDataMine.bots[i].codeName === pBotCodeName) {
|
||||
|
||||
return pDataMine.bots[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getPlotter(pDataMine, pPlotterCodeName) {
|
||||
|
||||
for (let i = 0; i < pDataMine.plotters.length; i++) {
|
||||
|
||||
if (pDataMine.plotters[i].codeName === pPlotterCodeName) {
|
||||
|
||||
return pDataMine.plotters[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getPlotterModule(pPlotter, pModuleCodeName) {
|
||||
|
||||
for (let i = 0; i < pPlotter.modules.length; i++) {
|
||||
|
||||
if (pPlotter.modules[i].codeName === pModuleCodeName) {
|
||||
|
||||
return pPlotter.modules[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getProduct(pBot, pProductCodeName) {
|
||||
|
||||
for (let i = 0; i < pBot.products.length; i++) {
|
||||
|
||||
if (pBot.products[i].codeName === pProductCodeName) {
|
||||
|
||||
return pBot.products[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getDataSet(pProduct, pSetCodeName) {
|
||||
|
||||
for (let i = 0; i < pProduct.dataSets.length; i++) {
|
||||
|
||||
if (pProduct.dataSets[i].codeName === pSetCodeName) {
|
||||
|
||||
return pProduct.dataSets[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getExchange(pProduct, pName) {
|
||||
|
||||
for (let i = 0; i < pProduct.exchangeList.length; i++) {
|
||||
|
||||
if (pProduct.exchangeList[i].name === pName) {
|
||||
|
||||
return pProduct.exchangeList[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -31,7 +31,6 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Ecosystem.js" />
|
||||
<Compile Include="LegacyPlotter.js" />
|
||||
<Compile Include="PlotterPanel.js" />
|
||||
<Compile Include="Scripts\AppLoader.js">
|
||||
@@ -44,7 +43,6 @@
|
||||
<Compile Include="server.js" />
|
||||
<Compile Include="Server\FileCloud.js" />
|
||||
<Content Include=".env" />
|
||||
<Content Include="ecosystem.json" />
|
||||
<Content Include="index.html" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -17,20 +17,16 @@ function newAppLoader() {
|
||||
try {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> Entering function.') }
|
||||
|
||||
window.localStorage.removeItem('ecosystem')
|
||||
|
||||
let plotters
|
||||
let modulesArray = []
|
||||
|
||||
plotters = defaultPlotters()
|
||||
modulesArray = ['UserEcosystem.js']
|
||||
|
||||
modulesArray = modulesArray.concat([
|
||||
'ChartingSpace/Viewport.js',
|
||||
|
||||
|
||||
'Globals.js',
|
||||
'Ecosystem.js',
|
||||
'UserEcosystem.js',
|
||||
|
||||
'AppSchema.js',
|
||||
'MQService',
|
||||
|
||||
|
||||
@@ -340,28 +340,6 @@ function onBrowserRequest (request, response) {
|
||||
}
|
||||
break
|
||||
|
||||
case 'UserEcosystem.js':
|
||||
{
|
||||
let fs = require('fs')
|
||||
|
||||
try {
|
||||
let filePath = process.env.INTER_PROCESS_FILES_PATH + '/ecosystem.json'
|
||||
fs.readFile(filePath, onFileRead)
|
||||
} catch (e) {
|
||||
console.log('[ERROR] Error reading the user ecosystem.', e)
|
||||
}
|
||||
|
||||
function onFileRead (err, userEcosystem) {
|
||||
if (err) {
|
||||
respondWithContent(undefined, response)
|
||||
} else {
|
||||
let responseContent = 'function getUserEcosystem(){ return ' + userEcosystem + '}'
|
||||
respondWithContent(responseContent, response)
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
|
||||
case 'AppSchema.js':
|
||||
{
|
||||
let fs = require('fs')
|
||||
|
||||
Reference in new issue
Block a user