-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Minor enhancements GitHub Issue #10 and simple implementation of #42. * Beta version with additional error handling, part 1 Some of GitHub issue #74. This check-in is for better printer error handling when running as an app. * Attempt at better error trapping/logging Work in progress... * Change error handling a bit GitHub Issue #74 * Write to log upon successful print * Remove try/catch in printing Electron printing doesn't catch "invalid deviceNmae" error. The try/catch/finally block did, but it caused a problem for printing when there were no printer issues. Remove try/catch/finally. Comment out some superfluous "WriteLog" statements. * More for issue #74 * Implement global configuration option Addresses GitHub issue #44 and parts of issue #76. * Trap errors writing to log file * Remove beta version number for 2.2 general release
- Loading branch information
Showing
11 changed files
with
707 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Alma Print Daemon 2.2.0</title> | ||
</head> | ||
<style> | ||
#notification { | ||
position: fixed; | ||
bottom: 20px; | ||
left: 20px; | ||
width: 200px; | ||
padding: 20px; | ||
border-radius: 5px; | ||
background-color: white; | ||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); | ||
} | ||
.hidden { | ||
display: none; | ||
} | ||
#updateCheck { | ||
position: fixed; | ||
bottom: 20px; | ||
left: 20px; | ||
width: 200px; | ||
padding: 20px; | ||
border-radius: 5px; | ||
background-color: white; | ||
} | ||
.hidden { | ||
display: none; | ||
} | ||
</style> | ||
<body> | ||
<form> | ||
<h4> | ||
Printing is paused; time is outside active Alma Print Daemon hours.<br> | ||
<br> | ||
<br> | ||
<button type="button" id="displayConfig" onclick="javascript:displayConfigPage()"> Update Configuration</button> | ||
</h4> | ||
<div id="updateCheck"> | ||
<button type="button" id="checkForUpdate" onclick="javascript:checkForSoftwareUpdate()"> Check for Update</button> | ||
</div> | ||
<div id="notification" class="hidden"> | ||
<p id="message"></p> | ||
<button id="close-button" onClick="closeNotification()" class="hidden"> | ||
Close | ||
</button> | ||
<button id="restart-button" onClick="restartApp()" class="hidden"> | ||
Restart | ||
</button> | ||
</div> | ||
<script> | ||
const electron = require('electron'); | ||
const {ipcRenderer} = electron; | ||
const form = document.querySelector('form'); | ||
|
||
form.addEventListener('submit', submitForm); | ||
|
||
function submitForm(e){ | ||
e.preventDefault(); | ||
ipcRenderer.send('print-continue'); | ||
} | ||
|
||
function displayConfigPage() { | ||
ipcRenderer.send('display-config'); | ||
} | ||
|
||
function checkForSoftwareUpdate() { | ||
ipcRenderer.send('check-for-update'); | ||
} | ||
|
||
const notification = document.getElementById('notification'); | ||
const message = document.getElementById('message'); | ||
const restartButton = document.getElementById('restart-button'); | ||
ipcRenderer.on('update_available', () => { | ||
ipcRenderer.removeAllListeners('update_available'); | ||
message.innerText = 'A new update is available. Downloading now...'; | ||
notification.classList.remove('hidden'); | ||
}); | ||
ipcRenderer.on('update_not_available', () => { | ||
ipcRenderer.removeAllListeners('update_not_available'); | ||
console.log ('Sofware is up-to-date'); | ||
message.innerText = 'Your software is up to date.'; | ||
notification.classList.remove('hidden'); | ||
}); | ||
ipcRenderer.on('update_downloaded', () => { | ||
ipcRenderer.removeAllListeners('update_downloaded'); | ||
message.innerText = 'Update Downloaded. It will be installed on restart. Restart now?'; | ||
restartButton.classList.remove('hidden'); | ||
notification.classList.remove('hidden'); | ||
}); | ||
|
||
function closeNotification() { | ||
notification.classList.add('hidden'); | ||
} | ||
function restartApp() { | ||
ipcRenderer.send('restart_app'); | ||
} | ||
</script> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.