Browse Source

UI: Refactoring no text option for extension

pull/12206/head
Artem Dzhereleiko 2 years ago
parent
commit
845f209996
  1. 25
      ui-ngx/src/app/shared/components/resource/resource-autocomplete.component.html
  2. 2
      ui-ngx/src/app/shared/components/resource/resource-autocomplete.component.ts

25
ui-ngx/src/app/shared/components/resource/resource-autocomplete.component.html

@ -41,17 +41,24 @@
<mat-option *ngFor="let resource of filteredResources$ | async" [value]="resource">
<span [innerHTML]="resource.title | highlight:searchText"></span>
</mat-option>
<mat-option *ngIf="!(filteredResources$ | async)?.length" [value]="null">
<div (click)="$event.stopPropagation()">
<div *ngIf="!textIsNotEmpty(searchText); else searchNotEmpty">
<span>{{ 'js-func.no-js-module-text' | translate }}</span>
</div>
<ng-template #searchNotEmpty>
<ng-container *ngIf="subType !== ResourceSubType.EXTENSION; else extensionNoText">
<mat-option *ngIf="!(filteredResources$ | async)?.length" [value]="null">
<div (click)="$event.stopPropagation()">
<div *ngIf="!textIsNotEmpty(searchText); else searchNotEmpty">
<span>{{ 'js-func.no-js-module-text' | translate }}</span>
</div>
<ng-template #searchNotEmpty>
<span>
{{ translate.get('js-func.no-js-module-matching', {module: searchText}) | async }}
</span>
</ng-template>
</div>
</mat-option>
</ng-template>
</div>
</mat-option>
</ng-container>
<ng-template #extensionNoText>
<mat-option *ngIf="!(filteredResources$ | async)?.length" [value]="searchText">
{{ searchText }}
</mat-option>
</ng-template>
</mat-autocomplete>
</mat-form-field>

2
ui-ngx/src/app/shared/components/resource/resource-autocomplete.component.ts

@ -79,6 +79,8 @@ export class ResourceAutocompleteComponent implements ControlValueAccessor, OnIn
@Input()
subType = ResourceSubType.EXTENSION;
ResourceSubType = ResourceSubType;
resourceFormGroup = this.fb.group({
resource: this.fb.control<string|ResourceInfo>(null)
});

Loading…
Cancel
Save