Skip to content

Commit

Permalink
move Version back to Status page
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Mar 4, 2025
1 parent 7f60279 commit eca17f2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
4 changes: 2 additions & 2 deletions interface/src/AuthenticatedRouting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import DownloadUpload from 'app/settings/DownloadUpload';
import MqttSettings from 'app/settings/MqttSettings';
import NTPSettings from 'app/settings/NTPSettings';
import Settings from 'app/settings/Settings';
import Version from 'app/settings/Version';
import Network from 'app/settings/network/Network';
import Security from 'app/settings/security/Security';
import APStatus from 'app/status/APStatus';
Expand All @@ -26,6 +25,7 @@ import NTPStatus from 'app/status/NTPStatus';
import NetworkStatus from 'app/status/NetworkStatus';
import Status from 'app/status/Status';
import SystemLog from 'app/status/SystemLog';
import Version from 'app/status/Version';
import { Layout } from 'components';
import { AuthenticatedContext } from 'contexts/authentication';

Expand All @@ -48,11 +48,11 @@ const AuthenticatedRouting = () => {
<Route path="/status/ntp" element={<NTPStatus />} />
<Route path="/status/ap" element={<APStatus />} />
<Route path="/status/network" element={<NetworkStatus />} />
<Route path="/status/version" element={<Version />} />

{me.admin && (
<>
<Route path="/settings" element={<Settings />} />
<Route path="/settings/version" element={<Version />} />
<Route path="/settings/application" element={<ApplicationSettings />} />
<Route path="/settings/mqtt" element={<MqttSettings />} />
<Route path="/settings/ntp" element={<NTPSettings />} />
Expand Down
16 changes: 1 addition & 15 deletions interface/src/app/settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState } from 'react';

import AccessTimeIcon from '@mui/icons-material/AccessTime';
import BuildIcon from '@mui/icons-material/Build';
import CancelIcon from '@mui/icons-material/Cancel';
import DeviceHubIcon from '@mui/icons-material/DeviceHub';
import ImportExportIcon from '@mui/icons-material/ImportExport';
Expand All @@ -21,7 +20,7 @@ import {
List
} from '@mui/material';

import { API, callAction } from 'api/app';
import { API } from 'api/app';

import { dialogStyle } from 'CustomTheme';
import { useRequest } from 'alova/client';
Expand All @@ -40,11 +39,6 @@ const Settings = () => {
immediate: false
});

// call checkUpgrade with no param to fetch EMS-ESP version
const { data } = useRequest(() => callAction({ action: 'checkUpgrade' }), {
initialData: { emsesp_version: '...' }
});

const doFormat = async () => {
await sendAPI({ device: 'system', cmd: 'format', id: 0 }).then(() => {
setConfirmFactoryReset(false);
Expand Down Expand Up @@ -83,14 +77,6 @@ const Settings = () => {
const content = () => (
<>
<List sx={{ borderRadius: 3, border: '2px solid grey' }}>
<ListMenuItem
icon={BuildIcon}
bgcolor="#72caf9"
label="EMS-ESP Firmware"
text={'v' + data.emsesp_version}
to="version"
/>

<ListMenuItem
icon={TuneIcon}
bgcolor="#134ba2"
Expand Down
9 changes: 9 additions & 0 deletions interface/src/app/status/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useContext, useState } from 'react';
import { toast } from 'react-toastify';

import AccessTimeIcon from '@mui/icons-material/AccessTime';
import BuildIcon from '@mui/icons-material/Build';
import CancelIcon from '@mui/icons-material/Cancel';
import DeviceHubIcon from '@mui/icons-material/DeviceHub';
import DirectionsBusIcon from '@mui/icons-material/DirectionsBus';
Expand Down Expand Up @@ -253,6 +254,14 @@ const SystemStatus = () => {
return (
<>
<List sx={{ borderRadius: 3, border: '2px solid grey' }}>
<ListMenuItem
icon={BuildIcon}
bgcolor="#72caf9"
label="EMS-ESP Firmware"
text={'v' + data.emsesp_version}
to="version"
/>

<ListItem>
<ListItemAvatar>
<Avatar sx={{ bgcolor: '#c5572c', color: 'white' }}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useContext, useEffect, useState } from 'react';
import { toast } from 'react-toastify';

import CancelIcon from '@mui/icons-material/Cancel';
Expand Down Expand Up @@ -34,10 +34,13 @@ import {
SingleUpload,
useLayoutTitle
} from 'components';
import { AuthenticatedContext } from 'contexts/authentication';
import { useI18nContext } from 'i18n/i18n-react';

const Version = () => {
const { LL, locale } = useI18nContext();
const { me } = useContext(AuthenticatedContext);

const [restarting, setRestarting] = useState<boolean>(false);
const [openInstallDialog, setOpenInstallDialog] = useState<boolean>(false);
const [usingDevVersion, setUsingDevVersion] = useState<boolean>(false);
Expand Down Expand Up @@ -230,6 +233,10 @@ const Version = () => {
};

const showButtons = (showDev?: boolean) => {
if (!me.admin) {
return;
}

if (downloadOnly) {
return (
<Button
Expand Down Expand Up @@ -435,11 +442,15 @@ const Version = () => {
{LL.INTERNET_CONNECTION_REQUIRED()}
</Typography>
)}
{renderInstallDialog()}
<Typography sx={{ pt: 2, pb: 2 }} variant="h6" color="primary">
{LL.UPLOAD()}
</Typography>
<SingleUpload text={LL.UPLOAD_DROP_TEXT()} doRestart={doRestart} />
{!me.admin && (
<>
{renderInstallDialog()}
<Typography sx={{ pt: 2, pb: 2 }} variant="h6" color="primary">
{LL.UPLOAD()}
</Typography>
<SingleUpload text={LL.UPLOAD_DROP_TEXT()} doRestart={doRestart} />
</>
)}
</Box>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.7.2-dev.24"
#define EMSESP_APP_VERSION "3.7.2-dev.25"

0 comments on commit eca17f2

Please sign in to comment.