frontend bug fix
This commit is contained in:
parent
0657a5fb82
commit
4bb35c6951
|
|
@ -42,6 +42,7 @@ import {
|
||||||
remapTree,
|
remapTree,
|
||||||
computeFlatValues,
|
computeFlatValues,
|
||||||
wouldLoseData,
|
wouldLoseData,
|
||||||
|
SODIOHOME_DEVICE_TYPES,
|
||||||
} from './installationSetupUtils';
|
} from './installationSetupUtils';
|
||||||
|
|
||||||
interface InformationSodistorehomeProps {
|
interface InformationSodistorehomeProps {
|
||||||
|
|
@ -93,10 +94,7 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
|
||||||
return [value.trim()];
|
return [value.trim()];
|
||||||
};
|
};
|
||||||
|
|
||||||
const DeviceTypes = [
|
const DeviceTypes = SODIOHOME_DEVICE_TYPES;
|
||||||
{ id: 3, name: 'Growatt' },
|
|
||||||
{ id: 4, name: 'inesco 12K - WR Hybrid' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// Preset state — initializes from persisted installationModel, empty for legacy
|
// Preset state — initializes from persisted installationModel, empty for legacy
|
||||||
const [selectedPreset, setSelectedPreset] = useState<string>(
|
const [selectedPreset, setSelectedPreset] = useState<string>(
|
||||||
|
|
@ -741,7 +739,7 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
|
||||||
shrink
|
shrink
|
||||||
sx={{ fontSize: 14, backgroundColor: 'white', px: 0.5 }}
|
sx={{ fontSize: 14, backgroundColor: 'white', px: 0.5 }}
|
||||||
>
|
>
|
||||||
Installation Model
|
<FormattedMessage id="installationModel" defaultMessage="Installation Model" />
|
||||||
</InputLabel>
|
</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
value={selectedPreset}
|
value={selectedPreset}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
|
export const SODIOHOME_DEVICE_TYPES = [
|
||||||
|
{ id: 3, name: 'Growatt' },
|
||||||
|
{ id: 4, name: 'inesco 12K - WR Hybrid' }
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export const getDeviceTypeName = (deviceId: number): string =>
|
||||||
|
SODIOHOME_DEVICE_TYPES.find(d => d.id === deviceId)?.name ?? '';
|
||||||
|
|
||||||
// [inverter][cluster] = batteryCount
|
// [inverter][cluster] = batteryCount
|
||||||
export type PresetConfig = number[][];
|
export type PresetConfig = number[][];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
import routes from '../../../Resources/routes.json';
|
import routes from '../../../Resources/routes.json';
|
||||||
import CancelIcon from '@mui/icons-material/Cancel';
|
import CancelIcon from '@mui/icons-material/Cancel';
|
||||||
import BuildIcon from '@mui/icons-material/Build';
|
import BuildIcon from '@mui/icons-material/Build';
|
||||||
|
import { getDeviceTypeName } from '../Information/installationSetupUtils';
|
||||||
|
|
||||||
interface FlatInstallationViewProps {
|
interface FlatInstallationViewProps {
|
||||||
installations: I_Installation[];
|
installations: I_Installation[];
|
||||||
|
|
@ -168,7 +169,7 @@ const FlatInstallationView = (props: FlatInstallationViewProps) => {
|
||||||
noWrap
|
noWrap
|
||||||
sx={{ marginTop: '10px', fontSize: 'small' }}
|
sx={{ marginTop: '10px', fontSize: 'small' }}
|
||||||
>
|
>
|
||||||
{installation.device === 3 ? 'Growatt' : installation.device === 4 ? 'inesco 12K - WR Hybrid' : ''}
|
{getDeviceTypeName(installation.device)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import { Close as CloseIcon } from '@mui/icons-material';
|
||||||
import { I_Installation } from 'src/interfaces/InstallationTypes';
|
import { I_Installation } from 'src/interfaces/InstallationTypes';
|
||||||
import { InstallationsContext } from 'src/contexts/InstallationsContextProvider';
|
import { InstallationsContext } from 'src/contexts/InstallationsContextProvider';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { INSTALLATION_PRESETS } from '../Information/installationSetupUtils';
|
import { INSTALLATION_PRESETS, SODIOHOME_DEVICE_TYPES } from '../Information/installationSetupUtils';
|
||||||
|
|
||||||
interface SodistorehomeInstallationFormPros {
|
interface SodistorehomeInstallationFormPros {
|
||||||
cancel: () => void;
|
cancel: () => void;
|
||||||
|
|
@ -36,10 +36,7 @@ function SodistorehomeInstallationForm(props: SodistorehomeInstallationFormPros)
|
||||||
});
|
});
|
||||||
const requiredFields = ['name', 'vpnIp', 'installationModel'];
|
const requiredFields = ['name', 'vpnIp', 'installationModel'];
|
||||||
|
|
||||||
const DeviceTypes = [
|
const DeviceTypes = SODIOHOME_DEVICE_TYPES;
|
||||||
{ id: 3, name: 'Growatt' },
|
|
||||||
{ id: 4, name: 'inesco 12K - WR Hybrid' }
|
|
||||||
];
|
|
||||||
const installationContext = useContext(InstallationsContext);
|
const installationContext = useContext(InstallationsContext);
|
||||||
const { createInstallation, loading, setLoading, error, setError } =
|
const { createInstallation, loading, setLoading, error, setError } =
|
||||||
installationContext;
|
installationContext;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue