Browse Source
Merge pull request #11288 from maxunbearable/fix/3968-resource-title-edit
Fixed Editing Resource title for JS module Resource
pull/11294/head
Igor Kulikov
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
2 additions and
3 deletions
-
ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.html
-
ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.ts
|
|
|
@ -68,7 +68,7 @@ |
|
|
|
</mat-form-field> |
|
|
|
<tb-file-input *ngIf="isAdd || (isEdit && entityForm.get('resourceType').value === resourceType.JS_MODULE)" |
|
|
|
formControlName="data" |
|
|
|
required |
|
|
|
[required]="isAdd" |
|
|
|
label="{{ (entityForm.get('resourceType').value === resourceType.LWM2M_MODEL ? 'resource.resource-files' : 'resource.resource-file') | translate }}" |
|
|
|
[readAsBinary]="true" |
|
|
|
[maxSizeByte]="maxResourceSize" |
|
|
|
|
|
|
|
@ -83,7 +83,7 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme |
|
|
|
title: [entity ? entity.title : '', [Validators.required, Validators.maxLength(255)]], |
|
|
|
resourceType: [entity?.resourceType ? entity.resourceType : ResourceType.JS_MODULE, Validators.required], |
|
|
|
fileName: [entity ? entity.fileName : null, Validators.required], |
|
|
|
data: [entity ? entity.data : null, Validators.required] |
|
|
|
data: [entity ? entity.data : null, this.isAdd ? [Validators.required] : []] |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@ -92,7 +92,6 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme |
|
|
|
this.entityForm.get('resourceType').disable({emitEvent: false}); |
|
|
|
if (entity.resourceType !== ResourceType.JS_MODULE) { |
|
|
|
this.entityForm.get('fileName').disable({emitEvent: false}); |
|
|
|
this.entityForm.get('data').disable({emitEvent: false}); |
|
|
|
} |
|
|
|
} |
|
|
|
this.entityForm.patchValue({ |
|
|
|
|