Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvements to version checking #2399

Merged
merged 5 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"eslint": "^9.20.0",
"eslint-config-prettier": "^10.0.1",
"formidable": "^3.5.2",
"prettier": "^3.4.2",
"prettier": "^3.5.0",
"rollup-plugin-visualizer": "^5.14.0",
"terser": "^5.38.1",
"typescript-eslint": "8.23.0",
Expand Down
9 changes: 5 additions & 4 deletions interface/public/css/roboto.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
local('Roboto'),
local('Roboto-Regular'),
url(../fonts/re.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0104-0107, U+0118-0119, U+011E-011F, U+0130-0131,
U+0141-0144, U+0152-0153, U+015A-015B, U+015E-015F, U+0179-017C, U+02BB-02BC,
U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
U+2212, U+2215, U+FEFF, U+FFFD;
unicode-range:
U+0000-00FF, U+0104-0107, U+0118-0119, U+011E-011F, U+0130-0131, U+0141-0144,
U+0152-0153, U+015A-015B, U+015E-015F, U+0179-017C, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
97 changes: 62 additions & 35 deletions interface/src/app/settings/Version.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import WarningIcon from '@mui/icons-material/Warning';
import {
Box,
Button,
Checkbox,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
FormControlLabel,
Grid2 as Grid,
Link,
Typography
Expand Down Expand Up @@ -91,7 +93,7 @@ const Version = () => {
}, [latestVersion, latestDevVersion]);

const getBinURL = () => {
if (!latestVersion || !latestDevVersion) {
if (!internetLive) {
return '';
}
const filename =
Expand Down Expand Up @@ -182,21 +184,16 @@ const Version = () => {
setUsingDevVersion(data.emsesp_version.includes('dev'));
};

const switchToDev = () => {
setUsingDevVersion(true);
setUpgradeAvailable(true);
};

const showButtons = () => {
const showButtons = (showDev?: boolean) => {
if (downloadOnly) {
return (
<Button
sx={{ ml: 2 }}
startIcon={<DownloadIcon />}
variant="outlined"
onClick={() => setOpenInstallDialog(false)}
color="warning"
size="small"
sx={{ ml: 2 }}
>
<Link underline="none" target="_blank" href={getBinURL()} color="warning">
{LL.DOWNLOAD(1)}
Expand All @@ -213,7 +210,10 @@ const Version = () => {
size="small"
onClick={() => showFirmwareDialog()}
>
{upgradeAvailable ? LL.UPGRADE() : LL.REINSTALL()}&hellip;
{upgradeAvailable || (!usingDevVersion && showDev)
? LL.UPGRADE()
: LL.REINSTALL()}
&hellip;
</Button>
);
};
Expand All @@ -223,6 +223,8 @@ const Version = () => {
return <FormLoader onRetry={loadData} errorMessage={error?.message} />;
}

const isDev = data.emsesp_version.includes('dev');

return (
<>
<Box p={2} border="1px solid grey" borderRadius={2}>
Expand Down Expand Up @@ -269,11 +271,36 @@ const Version = () => {
<Typography color="secondary">{LL.RELEASE_TYPE()}</Typography>
</Grid>
<Grid size={{ xs: 8, md: 10 }}>
<Typography>
{data.emsesp_version.includes('dev')
? LL.DEVELOPMENT()
: LL.STABLE()}
</Typography>
<FormControlLabel
disabled
control={
<Checkbox
sx={{
'&.Mui-checked': {
color: 'lightblue'
}
}}
/>
}
checked={!isDev}
label={LL.STABLE()}
sx={{ '& .MuiSvgIcon-root': { fontSize: 18 } }}
/>
<FormControlLabel
disabled
control={
<Checkbox
sx={{
'&.Mui-checked': {
color: 'lightblue'
}
}}
/>
}
checked={isDev}
label={LL.DEVELOPMENT()}
sx={{ '& .MuiSvgIcon-root': { fontSize: 18 } }}
/>
</Grid>
</Grid>

Expand Down Expand Up @@ -303,10 +330,17 @@ const Version = () => {
{latestVersion.published_at && (
<Typography component="span" variant="caption">
&nbsp;(
{Math.floor((Date.now() - new Date(latestVersion.published_at).getTime()) / (1000 * 60 * 60 * 24))} days ago)
{LL.DAYS_AGO(
Math.floor(
(Date.now() -
new Date(latestVersion.published_at).getTime()) /
(1000 * 60 * 60 * 24)
)
)}
)
</Typography>
)}
&nbsp;&nbsp;{!usingDevVersion && showButtons()}
{!usingDevVersion && showButtons(false)}
</Typography>
</Grid>

Expand All @@ -317,14 +351,21 @@ const Version = () => {
<Typography>
<Link target="_blank" href={DEV_RELNOTES_URL} color="primary">
{latestDevVersion.name}
</Link>
</Link>
{latestDevVersion.published_at && (
<Typography component="span" variant="caption">
&nbsp;(
{Math.floor((Date.now() - new Date(latestDevVersion.published_at).getTime()) / (1000 * 60 * 60 * 24))} days ago)
{LL.DAYS_AGO(
Math.floor(
(Date.now() -
new Date(latestDevVersion.published_at).getTime()) /
(1000 * 60 * 60 * 24)
)
)}
)
</Typography>
)}
&nbsp;&nbsp;{usingDevVersion && showButtons()}
{showButtons(true)}
</Typography>
</Grid>
</Grid>
Expand All @@ -346,25 +387,11 @@ const Version = () => {
{LL.LATEST_VERSION()}
</Typography>
)}

{!data.emsesp_version.includes('dev') && !usingDevVersion && (
<Typography variant="caption">
<Button
sx={{ mt: 2 }}
variant="outlined"
color="primary"
size="small"
onClick={() => switchToDev()}
>
{LL.SWITCH_DEV()}
</Button>
</Typography>
)}
</>
) : (
<Typography mb={1} color="warning">
<Typography mt={2} color="warning">
<WarningIcon color="warning" sx={{ verticalAlign: 'middle', mr: 2 }} />
no access to download site
{LL.INTERNET_CONNECTION_REQUIRED()}
</Typography>
)}
{renderInstallDialog()}
Expand Down
7 changes: 4 additions & 3 deletions interface/src/i18n/cz/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ const cz: Translation = {
SPECIAL_FUNCTIONS: 'Speciální funkce',
WAIT_FIRMWARE: 'Firmware se nahrává a instaluje',
INSTALL_VERSION: 'Tímto se instalovat verze {0}. Jste si jistí?',
SWITCH_DEV: 'přepnout na vývojovou verzi',
UPGRADE_AVAILABLE: 'Je k dispozici aktualizace firmwaru!',
LATEST_VERSION: 'Používáte nejnovější verzi firmwaru.',
LATEST_VERSION: 'Používáte nejnovější verzi firmwaru',
PLEASE_WAIT: 'Prosím čekejte',
RESTARTING_PRE: 'Inicializace',
RESTARTING_POST: 'Příprava',
Expand All @@ -350,7 +349,9 @@ const cz: Translation = {
THIS_VERSION: 'This Version', // TODO translate
PLATFORM: 'Platform', // TODO translate
RELEASE_TYPE: 'Release Type', // TODO translate
REINSTALL: 'Re-install' // TODO translate
REINSTALL: 'Re-install', // TODO translate
INTERNET_CONNECTION_REQUIRED: 'Internet connection required for automatic version checking and upgrading',
DAYS_AGO: '{0} den{{y|ní|ní|ní|ní|ní}} zpátky'
};

export default cz;
9 changes: 5 additions & 4 deletions interface/src/i18n/de/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ const de: Translation = {
SPECIAL_FUNCTIONS: 'Sonderfunktionen',
WAIT_FIRMWARE: 'Die Firmware wird hochgeladen und installiert.',
INSTALL_VERSION: 'Dadurch wird die Version {0} heruntergeladen. Sind Sie sicher?',
SWITCH_DEV: 'Wechseln Sie zur Entwicklungsversion!',
UPGRADE_AVAILABLE: 'Es ist ein Firmware-Upgrade verfügbar.',
LATEST_VERSION: 'Sie verwenden die neueste Firmware-Version.',
LATEST_VERSION: 'Sie verwenden die neueste Firmware-Version',
PLEASE_WAIT: 'Bitte warten',
RESTARTING_PRE: 'Initialisierung',
RESTARTING_POST: 'Vorbereitung',
Expand All @@ -347,10 +346,12 @@ const de: Translation = {
NO_DATA_1: 'Keine favorisierten EMS-Entitäten gefunden! Verwenden Sie das Modul',
NO_DATA_2: ', um sie zu markieren.',
NO_DATA_3: 'Um alle verfügbaren Entitäten anzuzeigen, gehen Sie zu',
THIS_VERSION: 'This Version',
THIS_VERSION: 'Diese Version',
PLATFORM: 'Plattform',
RELEASE_TYPE: 'Release Typ',
REINSTALL: 'Neu installieren'
REINSTALL: 'Neu installieren',
INTERNET_CONNECTION_REQUIRED: 'Internetverbindung erforderlich für automatische Version-Überprüfung und -Aktualisierung',
DAYS_AGO: '{0} Tag{{e}} vorher'
};

export default de;
7 changes: 4 additions & 3 deletions interface/src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ const en: Translation = {
SPECIAL_FUNCTIONS: 'Special Functions',
WAIT_FIRMWARE: 'Firmware is uploading and installing',
INSTALL_VERSION: 'This will install version {0}. Are you sure?',
SWITCH_DEV: 'switch to the development version',
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!',
LATEST_VERSION: 'You are using the latest firmware version.',
LATEST_VERSION: 'You are using the latest firmware version',
PLEASE_WAIT: 'Please wait',
RESTARTING_PRE: 'Initializing',
RESTARTING_POST: 'Preparing',
Expand All @@ -350,7 +349,9 @@ const en: Translation = {
THIS_VERSION: 'This Version',
PLATFORM: 'Platform',
RELEASE_TYPE: 'Release Type',
REINSTALL: 'Re-install'
REINSTALL: 'Re-install',
INTERNET_CONNECTION_REQUIRED: 'Internet connection required for automatic version checking and upgrading',
DAYS_AGO: '{0} day{{s}} ago'
};

export default en;
7 changes: 4 additions & 3 deletions interface/src/i18n/fr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ const fr: Translation = {
SPECIAL_FUNCTIONS: 'Special Functions',
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version', // TODO translate
PLEASE_WAIT: 'Please wait', // TODO translate
RESTARTING_PRE: 'Initializing', // TODO translate
RESTARTING_POST: 'Preparing', // TODO translate
Expand All @@ -350,7 +349,9 @@ const fr: Translation = {
THIS_VERSION: 'This Version', // TODO translate
PLATFORM: 'Platform', // TODO translate
RELEASE_TYPE: 'Release Type', // TODO translate
REINSTALL: 'Re-install' // TODO translate
REINSTALL: 'Re-install', // TODO translate
INTERNET_CONNECTION_REQUIRED: 'Internet connection required for automatic version checking and upgrading',
DAYS_AGO: '{0} jour{{s}} avant'
};

export default fr;
7 changes: 4 additions & 3 deletions interface/src/i18n/it/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ const it: Translation = {
SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version', // TODO translate
PLEASE_WAIT: 'Please wait', // TODO translate
RESTARTING_PRE: 'Initializing', // TODO translate
RESTARTING_POST: 'Preparing', // TODO translate
Expand All @@ -350,7 +349,9 @@ const it: Translation = {
THIS_VERSION: 'This Version', // TODO translate
PLATFORM: 'Platform', // TODO translate
RELEASE_TYPE: 'Release Type', // TODO translate
REINSTALL: 'Re-install' // TODO translate
REINSTALL: 'Re-install', // TODO translate
INTERNET_CONNECTION_REQUIRED: 'Internet connection required for automatic version checking and upgrading',
DAYS_AGO: '{0} giorni{{s}} fa'
};

export default it;
7 changes: 4 additions & 3 deletions interface/src/i18n/nl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ const nl: Translation = {
SPECIAL_FUNCTIONS: 'Speciale functies',
WAIT_FIRMWARE: 'Firmware wordt geüpload en geïnstalleerd',
INSTALL_VERSION: 'Hiermee wordt versie {0} geïnstalleerd. Weet je het zeker?',
SWITCH_DEV: 'Overschakelen naar de ontwikkelingsversie',
UPGRADE_AVAILABLE: 'Er is een firmware-upgrade beschikbaar!',
LATEST_VERSION: 'U gebruikt de nieuwste firmwareversie.',
LATEST_VERSION: 'U gebruikt de nieuwste firmwareversie',
PLEASE_WAIT: 'Een ogenblik geduld',
RESTARTING_PRE: 'Initialiseren',
RESTARTING_POST: 'Voorbereiding',
Expand All @@ -350,7 +349,9 @@ const nl: Translation = {
THIS_VERSION: 'Deze Versie',
PLATFORM: 'Platform',
RELEASE_TYPE: 'Release Typ',
REINSTALL: 'Opnieuw Installeren'
REINSTALL: 'Opnieuw Installeren',
INTERNET_CONNECTION_REQUIRED: 'Internetverbinding vereist voor automatische versiecontrole en -upgrade',
DAYS_AGO: '{0} dag{{en}} geleden'
};

export default nl;
7 changes: 4 additions & 3 deletions interface/src/i18n/no/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ const no: Translation = {
SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version', // TODO translate
PLEASE_WAIT: 'Please wait', // TODO translate
RESTARTING_PRE: 'Initializing', // TODO translate
RESTARTING_POST: 'Preparing', // TODO translate
Expand All @@ -350,7 +349,9 @@ const no: Translation = {
THIS_VERSION: 'This Version', // TODO translate
PLATFORM: 'Platform', // TODO translate
RELEASE_TYPE: 'Release Type', // TODO translate
REINSTALL: 'Re-install' // TODO translate
REINSTALL: 'Re-install', // TODO translate
INTERNET_CONNECTION_REQUIRED: 'Internet connection required for automatic version checking and upgrading',
DAYS_AGO: '{0} dag{{er}} siden'
};

export default no;
7 changes: 4 additions & 3 deletions interface/src/i18n/pl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ const pl: BaseTranslation = {
SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version', // TODO translate
PLEASE_WAIT: 'Please wait', // TODO translate
RESTARTING_PRE: 'Initializing', // TODO translate
RESTARTING_POST: 'Preparing', // TODO translate
Expand All @@ -350,7 +349,9 @@ const pl: BaseTranslation = {
THIS_VERSION: 'This Version', // TODO translate
PLATFORM: 'Platform', // TODO translate
RELEASE_TYPE: 'Release Type', // TODO translate
REINSTALL: 'Re-install' // TODO translate
REINSTALL: 'Re-install', // TODO translate
INTERNET_CONNECTION_REQUIRED: 'Internet connection required for automatic version checking and upgrading', // TODO translate
DAYS_AGO: '{0} dzień{{s}} temu'
};

export default pl;
Loading