mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-26 08:39:09 +03:00
text changes
This commit is contained in:
@@ -60,6 +60,13 @@ const DEV_RELNOTES_URL =
|
|||||||
'https://github.com/emsesp/EMS-ESP32/blob/dev/CHANGELOG_LATEST.md';
|
'https://github.com/emsesp/EMS-ESP32/blob/dev/CHANGELOG_LATEST.md';
|
||||||
|
|
||||||
// Types for better type safety
|
// Types for better type safety
|
||||||
|
interface PartitionData {
|
||||||
|
partition: string;
|
||||||
|
version: string;
|
||||||
|
install_date?: string;
|
||||||
|
size: number;
|
||||||
|
}
|
||||||
|
|
||||||
interface VersionData {
|
interface VersionData {
|
||||||
emsesp_version: string;
|
emsesp_version: string;
|
||||||
arduino_version: string;
|
arduino_version: string;
|
||||||
@@ -67,6 +74,9 @@ interface VersionData {
|
|||||||
flash_chip_size: number;
|
flash_chip_size: number;
|
||||||
psram: boolean;
|
psram: boolean;
|
||||||
build_flags?: string;
|
build_flags?: string;
|
||||||
|
partition: string;
|
||||||
|
partitions: PartitionData[];
|
||||||
|
developer_mode: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UpgradeCheckData {
|
interface UpgradeCheckData {
|
||||||
@@ -294,7 +304,7 @@ const InstallDialog = memo(
|
|||||||
return (
|
return (
|
||||||
<Dialog sx={dialogStyle} open={openInstallDialog} onClose={onClose}>
|
<Dialog sx={dialogStyle} open={openInstallDialog} onClose={onClose}>
|
||||||
<DialogTitle>
|
<DialogTitle>
|
||||||
{`${LL.UPDATE()} ${fetchDevVersion ? LL.DEVELOPMENT() : LL.STABLE()} Firmware`}
|
{`${LL.INSTALL()} ${fetchDevVersion ? LL.DEVELOPMENT() : LL.STABLE()} Firmware`}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Typography mb={2}>
|
<Typography mb={2}>
|
||||||
@@ -357,7 +367,9 @@ const InstallPartitionDialog = memo(
|
|||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Dialog sx={dialogStyle} open={openInstallPartitionDialog} onClose={onClose}>
|
<Dialog sx={dialogStyle} open={openInstallPartitionDialog} onClose={onClose}>
|
||||||
<DialogTitle>Rollback Firmware</DialogTitle>
|
<DialogTitle>
|
||||||
|
{LL.INSTALL()} {LL.STORED_VERSIONS()}
|
||||||
|
</DialogTitle>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Typography mb={2}>{LL.INSTALL_VERSION(LL.INSTALL(), version)}</Typography>
|
<Typography mb={2}>{LL.INSTALL_VERSION(LL.INSTALL(), version)}</Typography>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
@@ -457,9 +469,11 @@ const Version = () => {
|
|||||||
|
|
||||||
// Memoized values
|
// Memoized values
|
||||||
const platform = useMemo(() => (data ? getPlatform(data) : ''), [data]);
|
const platform = useMemo(() => (data ? getPlatform(data) : ''), [data]);
|
||||||
const isDev = useMemo(
|
|
||||||
() => data?.emsesp_version.includes('dev') ?? false,
|
// Memoize filtered partitions to avoid recomputing on every render
|
||||||
[data?.emsesp_version]
|
const otherPartitions = useMemo(
|
||||||
|
() => data?.partitions.filter((p) => p.partition !== data.partition) ?? [],
|
||||||
|
[data]
|
||||||
);
|
);
|
||||||
|
|
||||||
const setPartitionVersionInfo = useCallback(
|
const setPartitionVersionInfo = useCallback(
|
||||||
@@ -496,7 +510,7 @@ const Version = () => {
|
|||||||
});
|
});
|
||||||
await doRestart();
|
await doRestart();
|
||||||
},
|
},
|
||||||
[sendUploadURL]
|
[sendUploadURL, doRestart]
|
||||||
);
|
);
|
||||||
|
|
||||||
const installPartitionFirmware = useCallback(
|
const installPartitionFirmware = useCallback(
|
||||||
@@ -702,7 +716,7 @@ const Version = () => {
|
|||||||
alignItems: 'baseline'
|
alignItems: 'baseline'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{data.partitions.length > 0 && data.developer_mode && (
|
{otherPartitions.length > 0 && data.developer_mode && (
|
||||||
<>
|
<>
|
||||||
<Grid size={{ xs: 4, md: 2 }}>
|
<Grid size={{ xs: 4, md: 2 }}>
|
||||||
<Typography color="secondary">
|
<Typography color="secondary">
|
||||||
@@ -710,40 +724,36 @@ const Version = () => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid size={{ xs: 8, md: 10 }}>
|
<Grid size={{ xs: 8, md: 10 }}>
|
||||||
{data.partitions
|
{otherPartitions.map((partition) => (
|
||||||
.filter(
|
<Typography key={partition.partition} mb={1}>
|
||||||
(partition) => partition.partition !== data.partition
|
{partition.version}
|
||||||
)
|
<IconButton
|
||||||
.map((partition) => (
|
onClick={() =>
|
||||||
<Typography key={partition.partition} mb={1}>
|
setPartitionVersionInfo(partition.partition)
|
||||||
{partition.version}
|
}
|
||||||
<IconButton
|
aria-label={LL.FIRMWARE_VERSION_INFO()}
|
||||||
onClick={() =>
|
>
|
||||||
setPartitionVersionInfo(partition.partition)
|
<InfoOutlinedIcon
|
||||||
}
|
color="primary"
|
||||||
aria-label={LL.FIRMWARE_VERSION_INFO()}
|
sx={{ fontSize: 18 }}
|
||||||
>
|
/>
|
||||||
<InfoOutlinedIcon
|
</IconButton>
|
||||||
color="primary"
|
<Button
|
||||||
sx={{ fontSize: 18 }}
|
sx={{ ml: 0 }}
|
||||||
/>
|
variant="outlined"
|
||||||
</IconButton>
|
size="small"
|
||||||
<Button
|
onClick={() =>
|
||||||
sx={{ ml: 0 }}
|
showPartitionDialog(
|
||||||
variant="outlined"
|
partition.version,
|
||||||
size="small"
|
partition.partition,
|
||||||
onClick={() =>
|
partition.install_date ?? ''
|
||||||
showPartitionDialog(
|
)
|
||||||
partition.version,
|
}
|
||||||
partition.partition,
|
>
|
||||||
partition.install_date ?? ''
|
{LL.INSTALL()}
|
||||||
)
|
</Button>
|
||||||
}
|
</Typography>
|
||||||
>
|
))}
|
||||||
{LL.INSTALL()}
|
|
||||||
</Button>
|
|
||||||
</Typography>
|
|
||||||
))}
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -834,7 +844,6 @@ const Version = () => {
|
|||||||
loadData,
|
loadData,
|
||||||
LL,
|
LL,
|
||||||
platform,
|
platform,
|
||||||
isDev,
|
|
||||||
internetLive,
|
internetLive,
|
||||||
latestVersion,
|
latestVersion,
|
||||||
latestDevVersion,
|
latestDevVersion,
|
||||||
@@ -848,7 +857,15 @@ const Version = () => {
|
|||||||
handleVersionInfoClose,
|
handleVersionInfoClose,
|
||||||
closeInstallDialog,
|
closeInstallDialog,
|
||||||
installFirmwareURL,
|
installFirmwareURL,
|
||||||
doRestart
|
doRestart,
|
||||||
|
otherPartitions,
|
||||||
|
setPartitionVersionInfo,
|
||||||
|
showPartitionDialog,
|
||||||
|
partitionVersion,
|
||||||
|
partition,
|
||||||
|
firmwareSize,
|
||||||
|
closeInstallPartitionDialog,
|
||||||
|
installPartitionFirmware
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return <SectionContent>{restarting ? <SystemMonitor /> : content}</SectionContent>;
|
return <SectionContent>{restarting ? <SystemMonitor /> : content}</SectionContent>;
|
||||||
|
|||||||
Reference in New Issue
Block a user