Merge pull request #14120 from ArtemDzhereleiko/AD/bug-fix/resources-general
General resources show resources type on add dialog
This commit is contained in:
		
						commit
						395f262573
					
				@ -30,7 +30,7 @@
 | 
				
			|||||||
  </button>
 | 
					  </button>
 | 
				
			||||||
  <button mat-raised-button color="primary"
 | 
					  <button mat-raised-button color="primary"
 | 
				
			||||||
          [disabled]="(isLoading$ | async)"
 | 
					          [disabled]="(isLoading$ | async)"
 | 
				
			||||||
          (click)="onEntityAction($event, 'delete')"
 | 
					          (click)="onEntityAction($event, 'deleteResource')"
 | 
				
			||||||
          [class.!hidden]="hideDelete() || isEdit">
 | 
					          [class.!hidden]="hideDelete() || isEdit">
 | 
				
			||||||
    {{ 'resource.delete' | translate }}
 | 
					    {{ 'resource.delete' | translate }}
 | 
				
			||||||
  </button>
 | 
					  </button>
 | 
				
			||||||
@ -48,7 +48,6 @@
 | 
				
			|||||||
<div class="mat-padding flex flex-col">
 | 
					<div class="mat-padding flex flex-col">
 | 
				
			||||||
  <form [formGroup]="entityForm">
 | 
					  <form [formGroup]="entityForm">
 | 
				
			||||||
    <fieldset [disabled]="(isLoading$ | async) || !isEdit">
 | 
					    <fieldset [disabled]="(isLoading$ | async) || !isEdit">
 | 
				
			||||||
      @if (resourceTypes.length > 1) {
 | 
					 | 
				
			||||||
      <mat-form-field class="mat-block">
 | 
					      <mat-form-field class="mat-block">
 | 
				
			||||||
        <mat-label translate>resource.resource-type</mat-label>
 | 
					        <mat-label translate>resource.resource-type</mat-label>
 | 
				
			||||||
        <mat-select formControlName="resourceType" required>
 | 
					        <mat-select formControlName="resourceType" required>
 | 
				
			||||||
@ -57,7 +56,6 @@
 | 
				
			|||||||
          </mat-option>
 | 
					          </mat-option>
 | 
				
			||||||
        </mat-select>
 | 
					        </mat-select>
 | 
				
			||||||
      </mat-form-field>
 | 
					      </mat-form-field>
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      <mat-form-field class="mat-block" *ngIf="entityForm.get('resourceType').value !== resourceType.LWM2M_MODEL || !isAdd">
 | 
					      <mat-form-field class="mat-block" *ngIf="entityForm.get('resourceType').value !== resourceType.LWM2M_MODEL || !isAdd">
 | 
				
			||||||
        <mat-label translate>resource.title</mat-label>
 | 
					        <mat-label translate>resource.title</mat-label>
 | 
				
			||||||
        <input matInput formControlName="title" required>
 | 
					        <input matInput formControlName="title" required>
 | 
				
			||||||
 | 
				
			|||||||
@ -112,6 +112,10 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme
 | 
				
			|||||||
    if (this.isEdit && this.entityForm && !this.isAdd) {
 | 
					    if (this.isEdit && this.entityForm && !this.isAdd) {
 | 
				
			||||||
      this.entityForm.get('resourceType').disable({ emitEvent: false });
 | 
					      this.entityForm.get('resourceType').disable({ emitEvent: false });
 | 
				
			||||||
      this.entityForm.get('fileName').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':
 | 
					      case 'downloadResource':
 | 
				
			||||||
        this.downloadResource(action.event, action.entity);
 | 
					        this.downloadResource(action.event, action.entity);
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
      case 'deleteLibrary':
 | 
					      case 'deleteResource':
 | 
				
			||||||
        this.deleteResource(action.event, action.entity);
 | 
					        this.deleteResource(action.event, action.entity);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user