remove logging

This commit is contained in:
James B. Pollack 2016-03-11 16:57:50 -08:00
parent 23fd2e93b5
commit 42e3d0bdad

View file

@ -57,7 +57,10 @@ function getBuildInfo() {
} }
} }
const DEFAULT_BUILD_INFO = { releaseType: "", buildIdentifier: "dev" }; const DEFAULT_BUILD_INFO = {
releaseType: "",
buildIdentifier: "dev"
};
var buildInfo = DEFAULT_BUILD_INFO; var buildInfo = DEFAULT_BUILD_INFO;
if (buildInfoPath) { if (buildInfoPath) {
@ -104,6 +107,7 @@ const ipcMain = electron.ipcMain;
var isShuttingDown = false; var isShuttingDown = false;
function shutdown() { function shutdown() {
if (!isShuttingDown) { if (!isShuttingDown) {
// if the home server is running, show a prompt before quit to ask if the user is sure // if the home server is running, show a prompt before quit to ask if the user is sure
@ -283,8 +287,7 @@ function openFileBrowser(path) {
// NOTE: this looks like it does nothing, but it's very important. // NOTE: this looks like it does nothing, but it's very important.
// Without it the default behaviour is to quit the app once all windows closed // Without it the default behaviour is to quit the app once all windows closed
// which is absolutely not what we want for a taskbar application. // which is absolutely not what we want for a taskbar application.
app.on('window-all-closed', function() { app.on('window-all-closed', function() {});
});
function startInterface(url) { function startInterface(url) {
var argArray = []; var argArray = [];
@ -320,7 +323,11 @@ LogWindow.prototype = {
return; return;
} }
// Create the browser window. // Create the browser window.
this.window = new BrowserWindow({ width: 700, height: 500, icon: appIcon }); this.window = new BrowserWindow({
width: 700,
height: 500,
icon: appIcon
});
this.window.loadURL('file://' + __dirname + '/log.html'); this.window.loadURL('file://' + __dirname + '/log.html');
if (!debug) { if (!debug) {
@ -481,74 +488,72 @@ function buildMenuArray(serverState) {
var menuArray = null; var menuArray = null;
if (isShuttingDown) { if (isShuttingDown) {
menuArray = [ menuArray = [{
{
label: "Shutting down...", label: "Shutting down...",
enabled: false enabled: false
} }];
];
} else { } else {
menuArray = [ menuArray = [{
{
label: 'Server - Stopped', label: 'Server - Stopped',
enabled: false enabled: false
}, }, {
{ label: 'Version - ' + buildInfo.buildIdentifier,
label: 'Version - '+buildInfo.buildIdentifier,
enabled: false enabled: false
}, }, {
{
type: 'separator' type: 'separator'
}, }, {
{
label: 'Go Home', label: 'Go Home',
click: goHomeClicked, click: goHomeClicked,
enabled: false enabled: false
}, }, {
{
type: 'separator' type: 'separator'
}, }, {
{
label: 'Start Server', label: 'Start Server',
click: function() { homeServer.restart(); } click: function() {
}, homeServer.restart();
{ }
}, {
label: 'Stop Server', label: 'Stop Server',
visible: false, visible: false,
click: function() { homeServer.stop(); } click: function() {
}, homeServer.stop();
{ }
}, {
label: 'Settings', label: 'Settings',
click: function() { shell.openExternal('http://localhost:40100/settings'); }, click: function() {
shell.openExternal('http://localhost:40100/settings');
},
enabled: false enabled: false
}, }, {
{
label: 'View Logs', label: 'View Logs',
click: function() { logWindow.open(); } click: function() {
}, logWindow.open();
{ }
}, {
type: 'separator' type: 'separator'
}, }, {
{
label: 'Share', label: 'Share',
click: function() { shell.openExternal('http://localhost:40100/settings/?action=share') } click: function() {
}, shell.openExternal('http://localhost:40100/settings/?action=share')
{ }
}, {
type: 'separator' type: 'separator'
}, }, {
{
label: 'Quit', label: 'Quit',
accelerator: 'Command+Q', accelerator: 'Command+Q',
click: function() { shutdown(); } click: function() {
shutdown();
} }
]; }];
var foundStackManagerContent = isStackManagerContentPresent(); var foundStackManagerContent = isStackManagerContentPresent();
if (foundStackManagerContent) { if (foundStackManagerContent) {
// add a separator and the stack manager content migration option // add a separator and the stack manager content migration option
menuArray.splice(menuArray.length - 1, 0, { menuArray.splice(menuArray.length - 1, 0, {
label: 'Migrate Stack Manager Content', label: 'Migrate Stack Manager Content',
click: function() { promptToMigrateContent(); } click: function() {
promptToMigrateContent();
}
}, { }, {
type: 'separator' type: 'separator'
}); });
@ -647,9 +652,13 @@ function maybeInstallDefaultContentSet(onComplete) {
electron.ipcMain.on('ready', function() { electron.ipcMain.on('ready', function() {
console.log("got ready"); console.log("got ready");
function sendStateUpdate(state, args) { function sendStateUpdate(state, args) {
// console.log(state, window, args); // console.log(state, window, args);
window.webContents.send('update', { state: state, args: args }); window.webContents.send('update', {
state: state,
args: args
});
} }
var aborted = false; var aborted = false;
@ -673,7 +682,9 @@ function maybeInstallDefaultContentSet(onComplete) {
} else { } else {
sendStateUpdate('installing'); sendStateUpdate('installing');
} }
}), { throttle: 250 }).on('progress', function(state) { }), {
throttle: 250
}).on('progress', function(state) {
if (!aborted) { if (!aborted) {
// Update progress popup // Update progress popup
sendStateUpdate('downloading', state); sendStateUpdate('downloading', state);
@ -687,7 +698,7 @@ function maybeInstallDefaultContentSet(onComplete) {
console.log("Done", arguments); console.log("Done", arguments);
sendStateUpdate('complete'); sendStateUpdate('complete');
}); });
unzipper.on('error', function (err) { unzipper.on('error', function(err) {
console.log("aborting"); console.log("aborting");
aborted = true; aborted = true;
req.abort(); req.abort();
@ -777,10 +788,7 @@ app.on('ready', function() {
var currentVersion = null; var currentVersion = null;
try { try {
currentVersion = parseInt(buildInfo.buildIdentifier); currentVersion = parseInt(buildInfo.buildIdentifier);
console.log('CURRENT VERSION:: ',currentVersion) } catch (e) {}
} catch (e) {
}
if (currentVersion !== null) { if (currentVersion !== null) {
const CHECK_FOR_UPDATES_INTERVAL_SECONDS = 60 * 30; const CHECK_FOR_UPDATES_INTERVAL_SECONDS = 60 * 30;
@ -811,7 +819,8 @@ app.on('ready', function() {
domainServer = new Process('domain-server', dsPath, ["--get-temp-name"], logPath); domainServer = new Process('domain-server', dsPath, ["--get-temp-name"], logPath);
acMonitor = new ACMonitorProcess('ac-monitor', acPath, ['-n6', acMonitor = new ACMonitorProcess('ac-monitor', acPath, ['-n6',
'--log-directory', logPath, '--log-directory', logPath,
'--http-status-port', httpStatusPort], httpStatusPort, logPath); '--http-status-port', httpStatusPort
], httpStatusPort, logPath);
homeServer = new ProcessGroup('home', [domainServer, acMonitor]); homeServer = new ProcessGroup('home', [domainServer, acMonitor]);
logWindow = new LogWindow(acMonitor, domainServer); logWindow = new LogWindow(acMonitor, domainServer);
@ -820,7 +829,9 @@ app.on('ready', function() {
}; };
// handle process updates // handle process updates
homeServer.on('state-update', function(processGroup) { updateTrayMenu(processGroup.state); }); homeServer.on('state-update', function(processGroup) {
updateTrayMenu(processGroup.state);
});
// start the home server // start the home server
homeServer.start(); homeServer.start();