Skip to content

Commit

Permalink
get the rough edges on auto-update
Browse files Browse the repository at this point in the history
  • Loading branch information
toddtarsi committed Jan 28, 2024
1 parent 9314cdc commit 6a0ba89
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/selenium-ide/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "selenium-ide",
"version": "4.0.1-alpha.88",
"version": "4.0.1-alpha.89",
"private": false,
"description": "Selenium IDE electron app",
"author": "Todd <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { contextBridge, ipcRenderer } from "electron"

function completeUpdateNotifier() {
ipcRenderer.send('do-restart')
function doRestart() {
ipcRenderer.send('do-restart ')
}

contextBridge.exposeInMainWorld('completeUpdateNotifier', completeUpdateNotifier);
contextBridge.exposeInMainWorld('doRestart', doRestart);
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import AppWrapper from 'browser/components/AppWrapper'
import renderWhenReady from 'browser/helpers/renderWhenReady'
import React from 'react'

const completeStatus =
'Update has been installed and will be applied on restart.'
const completeStatus = 'Update Downloaded'

let lastStatus = ''
// @ts-expect-error just whatever
Expand All @@ -22,36 +21,36 @@ const UpdateNotifier = () => {
setStatus(lastStatus)
}, [])
// @ts-expect-error this exists
const completeUpdateNotifier = () => window.completeUpdateNotifier()
const closeUpdateNotifier = () => window.close()
const doRestart = () => window.doRestart()
const close = () => window.close()

return (
<AppWrapper>
<Grid className="centered pt-4" container spacing={1}>
<Grid item xs={12}>
<Typography variant="subtitle1">{status}</Typography>
</Grid>
{status === completeStatus && (
<>
<Grid item xs={6}>
<Button onClick={closeUpdateNotifier} variant="outlined">
OK
</Button>
</Grid>
<Grid item xs={6}>
<Button onClick={completeUpdateNotifier} variant="contained">
Restart Now
</Button>
</Grid>
</>
)}
{status.startsWith('Error') && (
{status === completeStatus && (
<>
<Grid item xs={6}>
<Button onClick={close} variant="outlined">
OK
</Button>
</Grid>
<Grid item xs={6}>
<Button onClick={doRestart} variant="contained">
Restart
</Button>
</Grid>
</>
)}
{status.startsWith('Error') && (
<Grid item xs={12}>
<Button onClick={closeUpdateNotifier} variant="outlined">
<Button onClick={close} variant="outlined">
OK
</Button>
</Grid>
)}
)}
</Grid>
</AppWrapper>
)
Expand Down

0 comments on commit 6a0ba89

Please sign in to comment.