From 9d5042b1f0d8f6ac4df9806deed63ec2dd2d38d7 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Fri, 24 Jan 2025 15:15:07 +0300 Subject: [PATCH] fix install types and test ids --- client/src/helpers/helpers.tsx | 6 ++-- client/src/initialState.ts | 16 +++++---- client/src/install/Setup/AddressList.tsx | 4 +-- client/src/install/Setup/Auth.tsx | 3 ++ client/src/install/Setup/Controls.tsx | 29 ++++++++-------- client/src/install/Setup/Devices.tsx | 21 +++++------- client/src/install/Setup/Progress.tsx | 12 +++---- client/src/install/Setup/Settings.tsx | 43 +++++++++++++++++------- client/src/install/Setup/Submit.tsx | 22 +++++------- client/src/install/Setup/index.tsx | 25 +++++++------- client/src/install/index.tsx | 2 +- 11 files changed, 97 insertions(+), 86 deletions(-) diff --git a/client/src/helpers/helpers.tsx b/client/src/helpers/helpers.tsx index fff7d45a..04e09768 100644 --- a/client/src/helpers/helpers.tsx +++ b/client/src/helpers/helpers.tsx @@ -28,7 +28,7 @@ import { THEMES, } from './constants'; import { LOCAL_STORAGE_KEYS, LocalStorageHelper } from './localStorageHelper'; -import { DhcpInterface } from '../initialState'; +import { DhcpInterface, InstallInterface } from '../initialState'; /** * @param time {string} The time to format @@ -217,9 +217,9 @@ export const getInterfaceIp = (option: any) => { return interfaceIP; }; -export const getIpList = (interfaces: DhcpInterface[]) => +export const getIpList = (interfaces: InstallInterface[]) => Object.values(interfaces) - .reduce((acc: string[], curr: DhcpInterface) => acc.concat(curr.ip_addresses), [] as string[]) + .reduce((acc: string[], curr: InstallInterface) => acc.concat(curr.ip_addresses), [] as string[]) .sort(); /** diff --git a/client/src/initialState.ts b/client/src/initialState.ts index 7292693c..bfb22e3a 100644 --- a/client/src/initialState.ts +++ b/client/src/initialState.ts @@ -9,6 +9,14 @@ import { import { DEFAULT_BLOCKING_IPV4, DEFAULT_BLOCKING_IPV6 } from './reducers/dnsConfig'; import { Filter } from './helpers/helpers'; +export type InstallInterface = { + flags: string; + hardware_address: string; + ip_addresses: string[]; + mtu: number; + name: string; +}; + export type InstallData = { step: number; processingDefault: boolean; @@ -31,13 +39,7 @@ export type InstallData = { ip: string; error: string; }; - interfaces: { - flags: string; - hardware_address: string; - ip_addresses: string[]; - mtu: number; - name: string; - }[]; + interfaces: InstallInterface[]; dnsVersion: string; }; diff --git a/client/src/install/Setup/AddressList.tsx b/client/src/install/Setup/AddressList.tsx index b943d2a4..4d9488fa 100644 --- a/client/src/install/Setup/AddressList.tsx +++ b/client/src/install/Setup/AddressList.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { getIpList, getDnsAddress, getWebAddress } from '../../helpers/helpers'; import { ALL_INTERFACES_IP } from '../../helpers/constants'; -import { DhcpInterface } from '../../initialState'; +import { InstallInterface } from '../../initialState'; interface renderItemProps { ip: string; @@ -28,7 +28,7 @@ const renderItem = ({ ip, port, isDns }: renderItemProps) => { }; interface AddressListProps { - interfaces: DhcpInterface[]; + interfaces: InstallInterface[]; address: string; port: number; isDns?: boolean; diff --git a/client/src/install/Setup/Auth.tsx b/client/src/install/Setup/Auth.tsx index 90d1c097..a0632383 100644 --- a/client/src/install/Setup/Auth.tsx +++ b/client/src/install/Setup/Auth.tsx @@ -60,6 +60,7 @@ export const Auth = ({ onAuthSubmit }: Props) => { { { { case 3: return ( ); @@ -69,6 +62,7 @@ class Controls extends Component { case 3: return ( ); case 5: return (