|
|
@ -39,8 +39,8 @@ import { BaseData, HasId } from '@shared/models/base-data'; |
|
|
import { EntityType } from '@shared/models/entity-type.models'; |
|
|
import { EntityType } from '@shared/models/entity-type.models'; |
|
|
import { DeviceProfileService } from '@core/http/device-profile.service'; |
|
|
import { DeviceProfileService } from '@core/http/device-profile.service'; |
|
|
import { EntityId } from '@shared/models/id/entity-id'; |
|
|
import { EntityId } from '@shared/models/id/entity-id'; |
|
|
import { Observable, of, Subscription } from 'rxjs'; |
|
|
import { Observable, of, Subscription, throwError } from 'rxjs'; |
|
|
import { map, mergeMap, tap } from 'rxjs/operators'; |
|
|
import { catchError, map, mergeMap, tap } from 'rxjs/operators'; |
|
|
import { DeviceService } from '@core/http/device.service'; |
|
|
import { DeviceService } from '@core/http/device.service'; |
|
|
import { ErrorStateMatcher } from '@angular/material/core'; |
|
|
import { ErrorStateMatcher } from '@angular/material/core'; |
|
|
import { StepperSelectionEvent } from '@angular/cdk/stepper'; |
|
|
import { StepperSelectionEvent } from '@angular/cdk/stepper'; |
|
|
@ -335,7 +335,15 @@ export class DeviceWizardDialogComponent extends |
|
|
mergeMap( |
|
|
mergeMap( |
|
|
(deviceCredentials) => { |
|
|
(deviceCredentials) => { |
|
|
const deviceCredentialsValue = {...deviceCredentials, ...this.credentialsFormGroup.value.credential}; |
|
|
const deviceCredentialsValue = {...deviceCredentials, ...this.credentialsFormGroup.value.credential}; |
|
|
return this.deviceService.saveDeviceCredentials(deviceCredentialsValue); |
|
|
return this.deviceService.saveDeviceCredentials(deviceCredentialsValue).pipe( |
|
|
|
|
|
catchError(e => { |
|
|
|
|
|
return this.deviceService.deleteDevice(device.id.id).pipe( |
|
|
|
|
|
mergeMap(() => { |
|
|
|
|
|
return throwError(e); |
|
|
|
|
|
} |
|
|
|
|
|
)); |
|
|
|
|
|
}) |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
), |
|
|
), |
|
|
map(() => true)); |
|
|
map(() => true)); |
|
|
|