From 3ae47f9bbc90a47e978c2f7764142d4c99f6c3b4 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 27 Aug 2018 14:45:40 +0100 Subject: [PATCH] add loading page for slow devices tidy up menu --- afterremove.sh | 1 + electronflow.json | 2 +- electronflow_cred.json | 2 +- load.html | 19 +++++++++++++++++++ main.js | 22 +++++++++++++--------- package.json | 8 ++++---- 6 files changed, 39 insertions(+), 15 deletions(-) create mode 100755 afterremove.sh create mode 100644 load.html diff --git a/afterremove.sh b/afterremove.sh new file mode 100755 index 0000000..6c896ef --- /dev/null +++ b/afterremove.sh @@ -0,0 +1 @@ +rm -f /usr/bin/Node-RED diff --git a/electronflow.json b/electronflow.json index 0ea59db..b2d4721 100644 --- a/electronflow.json +++ b/electronflow.json @@ -1 +1 @@ -[{"id":"41f61d2.fbe09e4","type":"tab","label":"Flow 1"},{"id":"52a903f3.ad56fc","type":"ui_tab","z":"41f61d2.fbe09e4","name":"Home","icon":"dashboard"},{"id":"30e652f.d9de3ae","type":"ui_group","z":"41f61d2.fbe09e4","name":"Panel 2","tab":"52a903f3.ad56fc","order":3,"disp":true,"width":"6"},{"id":"a8ecb9.c60f4348","type":"ui_group","z":"41f61d2.fbe09e4","name":"Introduction","tab":"52a903f3.ad56fc","order":1,"disp":false,"width":"3"},{"id":"bbdf3e02.e8fee","type":"ui_group","z":"41f61d2.fbe09e4","name":"Panel 1","tab":"52a903f3.ad56fc","order":2,"disp":true,"width":"6"},{"id":"d9ba26fa.6d2b18","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#8e0d17","baseFont":"Copperplate,Copperplate Gothic Light,fantasy","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"Helvetica Neue","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"Helvetica Neue"},"themeState":{"base-color":{"default":"#0094CE","value":"#d80005","edited":true},"page-titlebar-backgroundColor":{"value":"#8e0d17","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#d41322","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#8e0d17","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"Copperplate,Copperplate Gothic Light,fantasy"}}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"87356b62.92e3d8","type":"ui_group","z":"","name":"Text to Speech","tab":"52a903f3.ad56fc","order":5,"disp":true,"width":"6"},{"id":"c75ad4f0.0cede8","type":"ui_group","z":"","name":"Map","tab":"52a903f3.ad56fc","order":4,"disp":true,"width":"6"},{"id":"189cf871.681118","type":"ui_template","z":"41f61d2.fbe09e4","group":"a8ecb9.c60f4348","name":"Welcome","order":1,"width":"3","height":"9","format":"

Welcome to the Node-RED Dashboard

\n

On the right you will see a graph and a chart logging data from the sliders underneath.

","storeOutMessages":false,"fwdInMessages":false,"x":93,"y":45,"wires":[[]]},{"id":"9f19ee5c.beaef","type":"ui_chart","z":"41f61d2.fbe09e4","name":"","group":"bbdf3e02.e8fee","order":1,"width":"0","height":"0","label":"","chartType":"line","xformat":"HH:mm:ss","interpolate":"basis","nodata":"No Data","dot":false,"ymin":"0","ymax":"100","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"60","cutout":"","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"x":270,"y":200,"wires":[[],[]]},{"id":"799d9318.fd385c","type":"ui_gauge","z":"41f61d2.fbe09e4","name":"","group":"30e652f.d9de3ae","order":2,"width":"","height":"","gtype":"gage","title":"Title","label":"gauge","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"x":270,"y":140,"wires":[]},{"id":"6f18b200.666a4","type":"ui_button","z":"41f61d2.fbe09e4","name":"","group":"87356b62.92e3d8","order":2,"width":0,"height":0,"label":"press to talk","color":"","bgcolor":"","icon":"fa-volume-up","payload":"Hello to Jason Isaacs","payloadType":"str","topic":"","x":110,"y":300,"wires":[["f897d7c2.467a58"]]},{"id":"f897d7c2.467a58","type":"ui_audio","z":"41f61d2.fbe09e4","name":"","group":"30e652f.d9de3ae","voice":"0","x":300,"y":300,"wires":[]},{"id":"da0f7e67.0d38a","type":"ui_slider","z":"41f61d2.fbe09e4","name":"","label":"slider","group":"30e652f.d9de3ae","order":4,"width":0,"height":0,"passthru":true,"topic":"","min":0,"max":"100","step":1,"x":90,"y":140,"wires":[["799d9318.fd385c","219da65f.e0b0da"]]},{"id":"eabf2bd7.f4e0c8","type":"ui_slider","z":"41f61d2.fbe09e4","name":"","label":"slider","group":"bbdf3e02.e8fee","order":4,"width":0,"height":0,"passthru":true,"topic":"","min":0,"max":"100","step":1,"x":90,"y":200,"wires":[["9f19ee5c.beaef","ccee40e3.c1618"]]},{"id":"7d549f6e.58ab6","type":"worldmap","z":"41f61d2.fbe09e4","name":"","lat":"","lon":"","zoom":"","layer":"OSM","cluster":"","maxage":"","usermenu":"hide","panit":"true","x":445,"y":411,"wires":[]},{"id":"45508d88.744a54","type":"function","z":"41f61d2.fbe09e4","name":"","func":"// create random position\nvar lat = 51 + Math.random() * 0.2;\nvar lon = -1.45 + Math.random() * 0.2;\nmsg.payload={lat:lat, lon:lon, name:\"Jason\", icon:\"male\", url:\"IBM link\"};\nreturn msg;","outputs":1,"noerr":0,"x":265,"y":411,"wires":[["7d549f6e.58ab6"]]},{"id":"6ca8cfc2.e0bce","type":"ui_button","z":"41f61d2.fbe09e4","name":"","group":"c75ad4f0.0cede8","order":1,"width":0,"height":0,"passthru":false,"label":"Where's Jason","color":"","bgcolor":"#910000","icon":"fa-male","payload":"","payloadType":"str","topic":"","x":113,"y":412,"wires":[["45508d88.744a54"]]},{"id":"c87aa53d.223ba8","type":"inject","z":"41f61d2.fbe09e4","name":"","topic":"","payload":"/worldmap","payloadType":"str","repeat":"","crontab":"","once":true,"x":106,"y":461,"wires":[["42a56979.e10b68"]]},{"id":"582c9a7e.d9d014","type":"ui_template","z":"41f61d2.fbe09e4","group":"c75ad4f0.0cede8","name":"","order":2,"width":"6","height":"6","format":"
","storeOutMessages":true,"fwdInMessages":true,"x":436,"y":461,"wires":[[]]},{"id":"42a56979.e10b68","type":"template","z":"41f61d2.fbe09e4","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"","x":266,"y":461,"wires":[["582c9a7e.d9d014"]]},{"id":"219da65f.e0b0da","type":"debug","z":"41f61d2.fbe09e4","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","x":300,"y":100,"wires":[]},{"id":"ccee40e3.c1618","type":"debug","z":"41f61d2.fbe09e4","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","x":300,"y":240,"wires":[]},{"id":"1c597308.3cfc0d","type":"worldmap in","z":"41f61d2.fbe09e4","name":"","x":160,"y":540,"wires":[["7d6cb82c.3f3ea8"]]},{"id":"7d6cb82c.3f3ea8","type":"debug","z":"41f61d2.fbe09e4","name":"","active":true,"tosidebar":false,"console":true,"tostatus":false,"complete":"payload","x":380,"y":540,"wires":[]}] \ No newline at end of file +[{"id":"41f61d2.fbe09e4","type":"tab","label":"Flow 1"},{"id":"52a903f3.ad56fc","type":"ui_tab","z":"41f61d2.fbe09e4","name":"Home","icon":"dashboard"},{"id":"30e652f.d9de3ae","type":"ui_group","z":"41f61d2.fbe09e4","name":"Panel 2","tab":"52a903f3.ad56fc","order":3,"disp":true,"width":"6"},{"id":"a8ecb9.c60f4348","type":"ui_group","z":"41f61d2.fbe09e4","name":"Introduction","tab":"52a903f3.ad56fc","order":1,"disp":false,"width":"4","collapse":false},{"id":"bbdf3e02.e8fee","type":"ui_group","z":"41f61d2.fbe09e4","name":"Panel 1","tab":"52a903f3.ad56fc","order":2,"disp":true,"width":"6"},{"id":"d9ba26fa.6d2b18","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#8e0d17","baseFont":"Gill Sans,Geneva,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"Helvetica Neue","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"Helvetica Neue"},"themeState":{"base-color":{"default":"#0094CE","value":"#d80005","edited":true},"page-titlebar-backgroundColor":{"value":"#8e0d17","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#d41322","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#8e0d17","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"Gill Sans,Geneva,sans-serif"}}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"87356b62.92e3d8","type":"ui_group","z":"","name":"Text to Speech","tab":"52a903f3.ad56fc","order":5,"disp":true,"width":"6"},{"id":"c75ad4f0.0cede8","type":"ui_group","z":"","name":"Map","tab":"52a903f3.ad56fc","order":4,"disp":true,"width":"6"},{"id":"189cf871.681118","type":"ui_template","z":"41f61d2.fbe09e4","group":"a8ecb9.c60f4348","name":"Welcome","order":1,"width":"4","height":"9","format":"

Welcome to the Node-RED Dashboard

\n

On the right you will see a graph and a chart logging data from the sliders underneath.

","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":93,"y":45,"wires":[[]]},{"id":"9f19ee5c.beaef","type":"ui_chart","z":"41f61d2.fbe09e4","name":"","group":"bbdf3e02.e8fee","order":1,"width":"0","height":"0","label":"","chartType":"line","xformat":"HH:mm:ss","interpolate":"basis","nodata":"No Data","dot":false,"ymin":"0","ymax":"100","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"60","cutout":"","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"x":270,"y":200,"wires":[[],[]]},{"id":"799d9318.fd385c","type":"ui_gauge","z":"41f61d2.fbe09e4","name":"","group":"30e652f.d9de3ae","order":2,"width":"","height":"","gtype":"gage","title":"Title","label":"gauge","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"x":270,"y":140,"wires":[]},{"id":"6f18b200.666a4","type":"ui_button","z":"41f61d2.fbe09e4","name":"","group":"87356b62.92e3d8","order":2,"width":0,"height":0,"label":"press to talk","color":"","bgcolor":"","icon":"fa-volume-up","payload":"Hello to Jason Isaacs","payloadType":"str","topic":"","x":110,"y":320,"wires":[["f897d7c2.467a58"]]},{"id":"f897d7c2.467a58","type":"ui_audio","z":"41f61d2.fbe09e4","name":"","group":"30e652f.d9de3ae","voice":"0","x":300,"y":320,"wires":[]},{"id":"da0f7e67.0d38a","type":"ui_slider","z":"41f61d2.fbe09e4","name":"","label":"slider","group":"30e652f.d9de3ae","order":4,"width":0,"height":0,"passthru":true,"topic":"","min":0,"max":"100","step":1,"x":90,"y":140,"wires":[["799d9318.fd385c","219da65f.e0b0da"]]},{"id":"eabf2bd7.f4e0c8","type":"ui_slider","z":"41f61d2.fbe09e4","name":"","label":"slider","group":"bbdf3e02.e8fee","order":4,"width":0,"height":0,"passthru":true,"topic":"","min":0,"max":"100","step":1,"x":130,"y":200,"wires":[["9f19ee5c.beaef","ccee40e3.c1618"]]},{"id":"7d549f6e.58ab6","type":"worldmap","z":"41f61d2.fbe09e4","name":"","lat":"","lon":"","zoom":"","layer":"OSM","cluster":"","maxage":"","usermenu":"hide","panit":"true","x":445,"y":411,"wires":[]},{"id":"45508d88.744a54","type":"function","z":"41f61d2.fbe09e4","name":"","func":"// create random position\nvar lat = 51 + Math.random() * 0.2;\nvar lon = -1.45 + Math.random() * 0.2;\nmsg.payload={lat:lat, lon:lon, name:\"Jason\", icon:\"male\", url:\"IBM link\"};\nreturn msg;","outputs":1,"noerr":0,"x":265,"y":411,"wires":[["7d549f6e.58ab6"]]},{"id":"6ca8cfc2.e0bce","type":"ui_button","z":"41f61d2.fbe09e4","name":"","group":"c75ad4f0.0cede8","order":1,"width":0,"height":0,"passthru":false,"label":"Where's Jason","color":"","bgcolor":"#910000","icon":"fa-male","payload":"","payloadType":"str","topic":"","x":113,"y":412,"wires":[["45508d88.744a54"]]},{"id":"c87aa53d.223ba8","type":"inject","z":"41f61d2.fbe09e4","name":"","topic":"","payload":"/worldmap","payloadType":"str","repeat":"","crontab":"","once":true,"x":106,"y":461,"wires":[["42a56979.e10b68"]]},{"id":"582c9a7e.d9d014","type":"ui_template","z":"41f61d2.fbe09e4","group":"c75ad4f0.0cede8","name":"","order":2,"width":"6","height":"6","format":"
","storeOutMessages":true,"fwdInMessages":true,"x":436,"y":461,"wires":[[]]},{"id":"42a56979.e10b68","type":"template","z":"41f61d2.fbe09e4","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"","x":266,"y":461,"wires":[["582c9a7e.d9d014"]]},{"id":"219da65f.e0b0da","type":"debug","z":"41f61d2.fbe09e4","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","x":300,"y":100,"wires":[]},{"id":"ccee40e3.c1618","type":"debug","z":"41f61d2.fbe09e4","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","x":300,"y":240,"wires":[]},{"id":"1c597308.3cfc0d","type":"worldmap in","z":"41f61d2.fbe09e4","name":"","x":160,"y":540,"wires":[["7d6cb82c.3f3ea8"]]},{"id":"7d6cb82c.3f3ea8","type":"debug","z":"41f61d2.fbe09e4","name":"","active":true,"tosidebar":false,"console":true,"tostatus":false,"complete":"payload","x":380,"y":540,"wires":[]},{"id":"762cecef.af00d4","type":"inject","z":"41f61d2.fbe09e4","name":"","topic":"","payload":"26","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":90,"y":260,"wires":[["eabf2bd7.f4e0c8"]]}] \ No newline at end of file diff --git a/electronflow_cred.json b/electronflow_cred.json index e166066..4d5996a 100644 --- a/electronflow_cred.json +++ b/electronflow_cred.json @@ -1 +1 @@ -{"$":"7b15c36b8209a9e08997cdea6bd0c71cpNQ="} \ No newline at end of file +{"$":"8dbcfcd6d9f25932aa00994065774d5ctxk="} \ No newline at end of file diff --git a/load.html b/load.html new file mode 100644 index 0000000..5297c28 --- /dev/null +++ b/load.html @@ -0,0 +1,19 @@ + + +
+
+
+

Loading Node-RED

+ Press Alt to see Menu bar. +
+
diff --git a/main.js b/main.js index ab2073f..2272aa7 100755 --- a/main.js +++ b/main.js @@ -117,8 +117,9 @@ red_app.use(settings.httpNodeRoot,RED.httpNode); var template = [ // {label: "Application", // submenu: [ - // { role: 'about' }, - // { type: "separator" }, + // //{ role: 'about' }, + // //{ type: "separator" }, + // { role: 'togglefullscreen' }, // { role: 'quit' } // ]}, { label: 'Node-RED', @@ -254,7 +255,8 @@ function createConsole() { title: "Node-RED Console", width: 800, height: 600, - icon: path.join(__dirname, 'nodered.png') + icon: path.join(__dirname, 'nodered.png'), + autoHideMenuBar: true }); conWindow.loadURL(url.format({ pathname: path.join(__dirname, 'console.htm'), @@ -273,17 +275,19 @@ function createConsole() { // Create the main browser window function createWindow() { mainWindow = new BrowserWindow({ - autoHideMenuBar: true, - webPreferences: { - nodeIntegration: false - }, title: "Node-RED", - fullscreenable: true, //titleBarStyle: "hidden", width: 1024, height: 768, - icon: path.join(__dirname, 'nodered.png') + icon: path.join(__dirname, 'nodered.png'), + fullscreenable: true, + autoHideMenuBar: true, + webPreferences: { + nodeIntegration: false + } }); + mainWindow.loadURL(`file://${__dirname}/load.html`); + //if (process.platform !== 'darwin') { mainWindow.setAutoHideMenuBar(true); } mainWindow.webContents.on('did-get-response-details', function(event, status, newURL, originalURL, httpResponseCode) { if ((httpResponseCode == 404) && (newURL == ("http://localhost:"+listenPort+urldash))) { diff --git a/package.json b/package.json index eb80c0d..d639924 100644 --- a/package.json +++ b/package.json @@ -10,15 +10,15 @@ "clean": "rm -rf ./build ../electron-bin && mkdir -p ./build ../electron-bin", "pack": "npm run clean && electron-packager . Node-RED --icon=nodered.icns --all --out=build --overwrite", "pack:osx": "electron-packager . Node-RED --icon=nodered.icns --platform=darwin --arch=x64 --out=build --overwrite", - "pack:linux32": "electron-packager . Node-RED --icon=nodered.icns --platform=linux --arch=ia32 --out=build --overwrite && cp afterinst.sh build/Node-RED-linux-ia32/", - "pack:linux64": "electron-packager . Node-RED --icon=nodered.icns --platform=linux --arch=x64 --out=build --overwrite && cp afterinst.sh build/Node-RED-linux-x64", + "pack:linux32": "electron-packager . Node-RED --icon=nodered.icns --platform=linux --arch=ia32 --out=build --overwrite && cp after*.sh build/Node-RED-linux-ia32/", + "pack:linux64": "electron-packager . Node-RED --icon=nodered.icns --platform=linux --arch=x64 --out=build --overwrite && cp after*.sh build/Node-RED-linux-x64", "pack:win32": "electron-packager . Node-RED --icon=nodered.icns --platform=win32 --arch=ia32 --out=build --asar --overwrite --win32metadata.CompanyName='IBM Corp.' --win32metadata.ProductName='Node-RED Electron'", "pack:win64": "electron-packager . Node-RED --icon=nodered.icns --platform=win32 --arch=x64 --out=build --asar --overwrite --win32metadata.CompanyName='IBM Corp.' --win32metadata.ProductName='Node-RED Electron'", "pack:armv7l": "electron-packager . Node-RED --icon=nodered.icns --platform=linux --arch=armv7l --out=build --overwrite && cp afterinst.sh build/Node-RED-linux-armv7l", "build": "npm run clean && npm run build:osx && npm run build:linux64 && npm run build:linux32", "build:osx": "npm run pack:osx && appdmg appdmg.json ../electron-bin/Node-RED-Electron_$npm_package_version.dmg", - "build:linux32": "npm run pack:linux32 && fpm -s dir -t deb -f -n node-red-electron -v $npm_package_version -m conway@uk.ibm.com -a i386 -p ../electron-bin -C build/Node-RED-linux-ia32 --prefix=/opt/node-red --after-install=afterinst.sh ./", - "build:linux64": "npm run pack:linux64 && fpm -s dir -t deb -f -n node-red-electron -v $npm_package_version -m conway@uk.ibm.com -a x86_64 -p ../electron-bin -C build/Node-RED-linux-x64 --prefix=/opt/node-red --after-install=afterinst.sh ./", + "build:linux32": "npm run pack:linux32 && fpm -s dir -t deb -f -n node-red-electron -v $npm_package_version -m conway@uk.ibm.com -a i386 -p ../electron-bin -C build/Node-RED-linux-ia32 --prefix=/opt/node-red --after-install=afterinst.sh --after-remove=afterremove.sh ./", + "build:linux64": "npm run pack:linux64 && fpm -s dir -t deb -f -n node-red-electron -v $npm_package_version -m conway@uk.ibm.com -a x86_64 -p ../electron-bin -C build/Node-RED-linux-x64 --prefix=/opt/node-red --after-install=afterinst.sh --after-remove=afterremove.sh ./", "build:win32": "npm run pack:win32 && node makewin32.js", "build:win64": "npm run pack:win64 && node makewin64.js", "build:armv7l": "npm run pack:armv7l && fpm -s dir -t deb -f -n node-red-electron -v $npm_package_version -m conway@uk.ibm.com -a armv7l -p ../electron-bin -C build/Node-RED-linux-armv7l --prefix=/opt/node-red --after-install=afterinst.sh ./"