|
|
@ -88,16 +88,17 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme |
|
|
|
|
|
|
|
|
updateForm(entity: Resource): void { |
|
|
updateForm(entity: Resource): void { |
|
|
const { resourceType, fileName, title, data } = entity; |
|
|
const { resourceType, fileName, title, data } = entity; |
|
|
this.updateTableReadonlyConfig(); |
|
|
this.entityForm.patchValue({ resourceType, fileName, title, data }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (this.isEdit) { |
|
|
override updateFormState(): void { |
|
|
|
|
|
super.updateFormState(); |
|
|
|
|
|
if (this.isEdit && this.entityForm) { |
|
|
this.entityForm.get('resourceType').disable({ emitEvent: false }); |
|
|
this.entityForm.get('resourceType').disable({ emitEvent: false }); |
|
|
if (resourceType !== ResourceType.JS_MODULE) { |
|
|
if (this.entityForm.get('resourceType').value !== ResourceType.JS_MODULE) { |
|
|
this.entityForm.get('fileName').disable({ emitEvent: false }); |
|
|
this.entityForm.get('fileName').disable({ emitEvent: false }); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.entityForm.patchValue({ resourceType, fileName, title, data }); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
prepareFormValue(formValue: Resource): Resource { |
|
|
prepareFormValue(formValue: Resource): Resource { |
|
|
@ -138,11 +139,6 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme |
|
|
})); |
|
|
})); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private updateTableReadonlyConfig(): void { |
|
|
|
|
|
this.entitiesTableConfigValue.detailsReadonly = () => |
|
|
|
|
|
this.resourceType.LWM2M_MODEL === this.entityForm.get('resourceType').value; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private observeResourceTypeChange(): void { |
|
|
private observeResourceTypeChange(): void { |
|
|
this.entityForm.get('resourceType').valueChanges.pipe( |
|
|
this.entityForm.get('resourceType').valueChanges.pipe( |
|
|
startWith(ResourceType.JS_MODULE), |
|
|
startWith(ResourceType.JS_MODULE), |
|
|
|