From 80ac176db673670caa6d8dd13dc24f4bfea06eed Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 21 Aug 2018 14:46:02 +0100 Subject: [PATCH] Add worldmap to menu --- console.htm | 2 -- main.js | 30 ++++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/console.htm b/console.htm index 2179c81..7850de4 100644 --- a/console.htm +++ b/console.htm @@ -23,10 +23,8 @@ ipc.on('debugMsg', (event, data) => { var ts = (new Date(data.timestamp)).toISOString(); ts = ts.replace("Z"," ").replace("T"," "); - //list = list+"
"+(new Date(data.timestamp)).toISOString()+" : "+data.msg; list = ts+" : "+data.msg+"
"+list; document.getElementById("debug").innerHTML = list; - //window.scrollTo(0,document.body.scrollHeight); if (list.length > 50000) { list = list.substr(0,40000); } }); diff --git a/main.js b/main.js index 0913070..24312cf 100755 --- a/main.js +++ b/main.js @@ -10,6 +10,8 @@ const urldash = "/ui/#/0"; const urledit = "/red"; // url for the console page const urlconsole = "/console.htm"; +// url for the worldmap page +const urlmap = "/worldmap"; // tcp port to use //const listenPort = "18880"; // fix it just because const listenPort = parseInt(Math.random()*16383+49152) // or random ephemeral port @@ -18,7 +20,6 @@ const os = require('os'); const url = require('url'); const path = require('path'); const electron = require('electron'); -const {ipcMain} = require('electron'); const app = electron.app; const BrowserWindow = electron.BrowserWindow; @@ -70,7 +71,7 @@ var settings = { httpNodeRoot: "/", userDir: userdir, flowFile: flowfile, - editorTheme: { projects: { enabled: false } }, + editorTheme: { projects:{ enabled:true } }, functionGlobalContext: { }, // enables global context logging: { websock: { @@ -116,15 +117,19 @@ var template = [{ accelerator: "Shift+CmdOrCtrl+E", click() { mainWindow.loadURL("http://localhost:"+listenPort+urledit); } }, + { label: 'Worldmap', + accelerator: "Shift+CmdOrCtrl+M", + click() { mainWindow.loadURL("http://localhost:"+listenPort+urlmap); } + }, { type: 'separator' }, { label: 'Documentation', - click() { require('electron').shell.openExternal('http://nodered.org/docs') } + click() { require('electron').shell.openExternal('https://nodered.org/docs') } }, { label: 'Flows and Nodes', - click() { require('electron').shell.openExternal('http://flows.nodered.org') } + click() { require('electron').shell.openExternal('https://flows.nodered.org') } }, - { label: 'Google group', - click() { require('electron').shell.openExternal('https://groups.google.com/forum/#!forum/node-red') } + { label: 'Discourse Forum', + click() { require('electron').shell.openExternal('https://discourse.nodered.org/') } } ]}, { label: "Edit", @@ -157,7 +162,20 @@ var template = [{ ]} ]; +// function openFlow() { +// dialog.showOpenDialog(function (fileNames) { +// if (fileNames === undefined) { +// console.log("No file selected"); +// } +// else { +// console.log(fileNames[0]); +// //readFile(fileNames[0]); +// } +// }); +// } + function createConsole() { + if (conWindow) { conWindow.show(); return; } // Create the hidden console window conWindow = new BrowserWindow({ title:"Node-RED Console", width:800, height:600, frame:true, show:true