fix(striker-ui): get host-specific NICs in NetworkInitForm

main
Tsu-ba-me 2 years ago
parent 32c32350bd
commit e02ffcd95a
  1. 14
      striker-ui/components/NetworkInitForm.tsx

@ -580,8 +580,11 @@ NetworkForm.defaultProps = {
const NetworkInitForm = forwardRef< const NetworkInitForm = forwardRef<
NetworkInitFormForwardedRefContent, NetworkInitFormForwardedRefContent,
{ toggleSubmitDisabled?: (testResult: boolean) => void } {
>(({ toggleSubmitDisabled }, ref) => { targetHostUUID?: string;
toggleSubmitDisabled?: (testResult: boolean) => void;
}
>(({ targetHostUUID = 'local', toggleSubmitDisabled }, ref) => {
const [dragMousePosition, setDragMousePosition] = useState<{ const [dragMousePosition, setDragMousePosition] = useState<{
x: number; x: number;
y: number; y: number;
@ -601,7 +604,7 @@ const NetworkInitForm = forwardRef<
const { data: networkInterfaces = MOCK_NICS, isLoading } = periodicFetch< const { data: networkInterfaces = MOCK_NICS, isLoading } = periodicFetch<
NetworkInterfaceOverviewMetadata[] NetworkInterfaceOverviewMetadata[]
>(`${API_BASE_URL}/network-interface`, { >(`${API_BASE_URL}/network-interface/${targetHostUUID}`, {
refreshInterval: 2000, refreshInterval: 2000,
onSuccess: (data) => { onSuccess: (data) => {
const map = data.reduce<NetworkInterfaceInputMap>((result, metadata) => { const map = data.reduce<NetworkInterfaceInputMap>((result, metadata) => {
@ -1381,7 +1384,10 @@ const NetworkInitForm = forwardRef<
); );
}); });
NetworkInitForm.defaultProps = { toggleSubmitDisabled: undefined }; NetworkInitForm.defaultProps = {
targetHostUUID: 'local',
toggleSubmitDisabled: undefined,
};
NetworkInitForm.displayName = 'NetworkInitForm'; NetworkInitForm.displayName = 'NetworkInitForm';
export type { export type {

Loading…
Cancel
Save