UI: Fixed Genaral resources
This commit is contained in:
		
							parent
							
								
									0a94c03a4b
								
							
						
					
					
						commit
						a549340010
					
				@ -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,16 +48,14 @@
 | 
			
		||||
<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>
 | 
			
		||||
            <mat-option *ngFor="let resourceType of resourceTypes" [value]="resourceType">
 | 
			
		||||
              {{ resourceTypesTranslationMap.get(resourceType) | translate }}
 | 
			
		||||
            </mat-option>
 | 
			
		||||
          </mat-select>
 | 
			
		||||
        </mat-form-field>
 | 
			
		||||
      }
 | 
			
		||||
      <mat-form-field class="mat-block">
 | 
			
		||||
        <mat-label translate>resource.resource-type</mat-label>
 | 
			
		||||
        <mat-select formControlName="resourceType" required>
 | 
			
		||||
          <mat-option *ngFor="let resourceType of resourceTypes" [value]="resourceType">
 | 
			
		||||
            {{ resourceTypesTranslationMap.get(resourceType) | translate }}
 | 
			
		||||
          </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>
 | 
			
		||||
 | 
			
		||||
@ -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 });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user