fix(striker-ui): consolidate network types

main
Tsu-ba-me 2 years ago
parent 0ce470a034
commit fb8e92ffb4
  1. 24
      striker-ui/components/NetworkInitForm.tsx
  2. 2
      striker-ui/lib/consts/NETWORK_TYPES.ts

@ -34,6 +34,7 @@ import { v4 as uuidv4 } from 'uuid';
import API_BASE_URL from '../lib/consts/API_BASE_URL'; import API_BASE_URL from '../lib/consts/API_BASE_URL';
import { BLUE, GREY } from '../lib/consts/DEFAULT_THEME'; import { BLUE, GREY } from '../lib/consts/DEFAULT_THEME';
import NETWORK_TYPES from '../lib/consts/NETWORK_TYPES';
import { REP_IPV4, REP_IPV4_CSV } from '../lib/consts/REG_EXP_PATTERNS'; import { REP_IPV4, REP_IPV4_CSV } from '../lib/consts/REG_EXP_PATTERNS';
import BriefNetworkInterface from './BriefNetworkInterface'; import BriefNetworkInterface from './BriefNetworkInterface';
@ -106,17 +107,6 @@ const CLASSES = {
}; };
const INITIAL_IFACES = [undefined, undefined]; const INITIAL_IFACES = [undefined, undefined];
const NETWORK_TYPES: Record<string, string> = {
bcn: 'Back-Channel Network',
ifn: 'Internet-Facing Network',
sn: 'Storage Network',
};
const NODE_NETWORK_TYPES: Record<string, string> = {
...NETWORK_TYPES,
mn: 'Migration Network',
};
const STRIKER_REQUIRED_NETWORKS: NetworkInput[] = [ const STRIKER_REQUIRED_NETWORKS: NetworkInput[] = [
{ {
inputUUID: '30dd2ac5-8024-4a7e-83a1-6a3df7218972', inputUUID: '30dd2ac5-8024-4a7e-83a1-6a3df7218972',
@ -349,11 +339,13 @@ const NetworkForm: FC<{
!isNode && networkInterfaceCount <= 2 ? [1] : NETWORK_INTERFACE_TEMPLATE, !isNode && networkInterfaceCount <= 2 ? [1] : NETWORK_INTERFACE_TEMPLATE,
[isNode, networkInterfaceCount], [isNode, networkInterfaceCount],
); );
const netTypeList = useMemo( const netTypeList = useMemo(() => {
() => const { bcn, ifn, mn, sn } = NETWORK_TYPES;
isNode && networkInterfaceCount >= 8 ? NODE_NETWORK_TYPES : NETWORK_TYPES,
[isNode, networkInterfaceCount], return isNode && networkInterfaceCount >= 8
); ? { bcn, ifn, mn, sn }
: { bcn, ifn, sn };
}, [isNode, networkInterfaceCount]);
useEffect(() => { useEffect(() => {
const { ipAddressInputRef: ipRef, subnetMaskInputRef: maskRef } = const { ipAddressInputRef: ipRef, subnetMaskInputRef: maskRef } =

@ -1,6 +1,8 @@
const NETWORK_TYPES: Record<string, string> = { const NETWORK_TYPES: Record<string, string> = {
bcn: 'Back-Channel Network', bcn: 'Back-Channel Network',
ifn: 'Internet-Facing Network', ifn: 'Internet-Facing Network',
mn: 'Migration Network',
sn: 'Storage Network',
}; };
export default NETWORK_TYPES; export default NETWORK_TYPES;

Loading…
Cancel
Save