feat: added shutdown function to the machine loader
feat: created shutdown route and call it from gql server (called from admin UI button) feat: added an extra message property to the ConfirmDialog refactor: simplified the MachineDetailsCard component feat: added an extra information message to the Shutdown machine action
This commit is contained in:
parent
f10b49f31c
commit
3a5bbbca1f
4 changed files with 59 additions and 43 deletions
|
|
@ -38,6 +38,7 @@ const SETTINGS_CACHE_REFRESH = 60 * 60 * 1000
|
|||
|
||||
const pids = {}
|
||||
const reboots = {}
|
||||
const shutdowns = {}
|
||||
const restartServicesMap = {}
|
||||
const canGetLastSeenMap = {}
|
||||
const canLogClockSkewMap = {}
|
||||
|
|
@ -74,6 +75,7 @@ function poll (req, res, next) {
|
|||
const cassettes = results.cassettes
|
||||
|
||||
const reboot = pid && reboots[deviceId] && reboots[deviceId] === pid
|
||||
const shutdown = pid && shutdowns[deviceId] && shutdowns[deviceId] === pid
|
||||
const restartServices = pid && restartServicesMap[deviceId] && restartServicesMap[deviceId] === pid
|
||||
const langs = localeConfig.languages
|
||||
|
||||
|
|
@ -95,6 +97,7 @@ function poll (req, res, next) {
|
|||
twoWayMode: cashOutConfig.active,
|
||||
zeroConfLimit: cashOutConfig.zeroConfLimit,
|
||||
reboot,
|
||||
shutdown,
|
||||
restartServices,
|
||||
hasLightning,
|
||||
receipt,
|
||||
|
|
@ -510,6 +513,18 @@ localApp.post('/reboot', (req, res) => {
|
|||
res.sendStatus(200)
|
||||
})
|
||||
|
||||
localApp.post('/shutdown', (req, res) => {
|
||||
const deviceId = req.query.device_id
|
||||
const pid = pids[deviceId] && pids[deviceId].pid
|
||||
|
||||
if (!deviceId || !pid) {
|
||||
return res.sendStatus(400)
|
||||
}
|
||||
|
||||
shutdowns[deviceId] = pid
|
||||
res.sendStatus(200)
|
||||
})
|
||||
|
||||
localApp.post('/restartServices', (req, res) => {
|
||||
const deviceId = req.query.device_id
|
||||
const pid = pids[deviceId] && pids[deviceId].pid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue