diff --git a/modules/ui/src/app/store/effects.spec.ts b/modules/ui/src/app/store/effects.spec.ts index 2ac8b65d2..da263c4ae 100644 --- a/modules/ui/src/app/store/effects.spec.ts +++ b/modules/ui/src/app/store/effects.spec.ts @@ -268,6 +268,35 @@ describe('Effects', () => { done(); }); }); + + it('should call updateValidInterfaces and set all true if interface are empty and config is not set', done => { + actions$ = of( + actions.fetchInterfacesSuccess({ + interfaces: {}, + }), + actions.fetchSystemConfigSuccess({ + systemConfig: { + network: { + device_intf: '', + internet_intf: '', + }, + }, + }) + ); + + effects.checkInterfacesInConfig$.subscribe(action => { + expect(action).toEqual( + actions.updateValidInterfaces({ + validInterfaces: { + hasSetInterfaces: true, + deviceValid: true, + internetValid: true, + }, + }) + ); + done(); + }); + }); }); it('onFetchSystemStatus$ should call onFetchSystemStatusSuccess on success', done => { diff --git a/modules/ui/src/app/store/effects.ts b/modules/ui/src/app/store/effects.ts index 10b2e4afb..53cf77232 100644 --- a/modules/ui/src/app/store/effects.ts +++ b/modules/ui/src/app/store/effects.ts @@ -63,9 +63,11 @@ export class AppEffects { validInterfaces: { hasSetInterfaces: network != null, deviceValid: - !!network && - !!network.device_intf && - !!interfaces[network.device_intf], + (!!network && + !!network.device_intf && + !!interfaces[network.device_intf]) || + (network?.device_intf == '' && + Object.keys(interfaces).length === 0), internetValid: !!network && (network?.internet_intf == '' ||