Merge pull request #14120 from ArtemDzhereleiko/AD/bug-fix/resources-general

General resources show resources type on add dialog
This commit is contained in:
Vladyslav Prykhodko 2025-10-08 15:41:58 +03:00 committed by GitHub
commit 395f262573
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 12 deletions

View File

@ -30,7 +30,7 @@
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'delete')"
(click)="onEntityAction($event, 'deleteResource')"
[class.!hidden]="hideDelete() || isEdit">
{{ 'resource.delete' | translate }}
</button>
@ -48,7 +48,6 @@
<div class="mat-padding flex flex-col">
<form [formGroup]="entityForm">
<fieldset [disabled]="(isLoading$ | async) || !isEdit">
@if (resourceTypes.length > 1) {
<mat-form-field class="mat-block">
<mat-label translate>resource.resource-type</mat-label>
<mat-select formControlName="resourceType" required>
@ -57,7 +56,6 @@
</mat-option>
</mat-select>
</mat-form-field>
}
<mat-form-field class="mat-block" *ngIf="entityForm.get('resourceType').value !== resourceType.LWM2M_MODEL || !isAdd">
<mat-label translate>resource.title</mat-label>
<input matInput formControlName="title" required>

View File

@ -112,6 +112,10 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme
if (this.isEdit && this.entityForm && !this.isAdd) {
this.entityForm.get('resourceType').disable({ emitEvent: false });
this.entityForm.get('fileName').disable({ emitEvent: false });
this.entityForm.get('data').disable({ emitEvent: false });
}
if (this.isAdd && this.resourceTypes.length === 1) {
this.entityForm.get('resourceType').disable({ emitEvent: false });
}
}

View File

@ -173,7 +173,7 @@ export class ResourcesLibraryTableConfigResolver {
case 'downloadResource':
this.downloadResource(action.event, action.entity);
return true;
case 'deleteLibrary':
case 'deleteResource':
this.deleteResource(action.event, action.entity);
}
return false;