only show previous if in developer mode and there are something to show

This commit is contained in:
proddy
2025-12-23 23:28:02 +01:00
parent 35ad43b7b3
commit 537cf19e97
2 changed files with 38 additions and 26 deletions

View File

@@ -354,7 +354,9 @@ const Version = () => {
const { send: sendSetPartition } = useRequest( const { send: sendSetPartition } = useRequest(
(partition: string) => callAction({ action: 'setPartition', param: partition }), (partition: string) => callAction({ action: 'setPartition', param: partition }),
{ immediate: false } { immediate: false }
); ).onError((error) => {
toast.error(String(error.error?.message || 'An error occurred'));
});
const { const {
data, data,
@@ -401,7 +403,7 @@ const Version = () => {
await sendUploadURL(url).catch((error: Error) => { await sendUploadURL(url).catch((error: Error) => {
toast.error(error.message); toast.error(error.message);
}); });
doRestart(); await doRestart();
}, },
[sendUploadURL] [sendUploadURL]
); );
@@ -608,28 +610,37 @@ const Version = () => {
alignItems: 'baseline' alignItems: 'baseline'
}} }}
> >
<Grid size={{ xs: 4, md: 2 }}> {data.partitions.length > 0 && data.developer_mode && (
<Typography color="secondary">{LL.PREVIOUS_VERSIONS()}</Typography> <>
</Grid> <Grid size={{ xs: 4, md: 2 }}>
<Grid size={{ xs: 8, md: 10 }}> <Typography color="secondary">
{data.partitions.map((partition) => ( {LL.PREVIOUS_VERSIONS()}
<Typography key={partition.partition} mb={1}> </Typography>
v{partition.version} ({partition.partition}: {partition.size} </Grid>
{' KB'}) <Grid size={{ xs: 8, md: 10 }}>
<Button {data.partitions.map((partition) => (
sx={{ ml: 2 }} <Typography key={partition.partition} mb={1}>
variant="outlined" v{partition.version} ({partition.partition}:{' '}
size="small" {partition.size}
onClick={() => {' KB'})
showPreviousDialog(partition.version, partition.partition) <Button
} sx={{ ml: 2 }}
> variant="outlined"
{LL.INSTALL()} size="small"
</Button> onClick={() =>
</Typography> showPreviousDialog(
))} partition.version,
</Grid> partition.partition
)
}
>
{LL.INSTALL()}
</Button>
</Typography>
))}
</Grid>
</>
)}
<Grid size={{ xs: 4, md: 2 }}> <Grid size={{ xs: 4, md: 2 }}>
<Typography color="secondary">{LL.STABLE()}</Typography> <Typography color="secondary">{LL.STABLE()}</Typography>
</Grid> </Grid>

View File

@@ -117,9 +117,10 @@ let system_status = {
partition: 'factory', partition: 'factory',
version: '3.7.3-dev.39', version: '3.7.3-dev.39',
size: 4672 size: 4672
}, }
], ],
developer_mode: true, // partitions: [],
developer_mode: false,
model: '', model: '',
// model: 'BBQKees Electronics EMS Gateway E32 V2 (E32 V2.0 P3/2024011)', // model: 'BBQKees Electronics EMS Gateway E32 V2 (E32 V2.0 P3/2024011)',
// status: 0, // status: 0,