UI: Fixed queue autocomplete class name and code syle
This commit is contained in:
parent
4523ee9d1e
commit
9c393dccba
@ -34,7 +34,7 @@
|
|||||||
#queueAutocomplete="matAutocomplete"
|
#queueAutocomplete="matAutocomplete"
|
||||||
[displayWith]="displayQueueFn"
|
[displayWith]="displayQueueFn"
|
||||||
>
|
>
|
||||||
<mat-option *ngFor="let queue of filteredQueues | async" [value]="queue" class="template-option">
|
<mat-option *ngFor="let queue of filteredQueues | async" [value]="queue" class="queue-option">
|
||||||
<span [innerHTML]="queue.name | highlight:searchText"></span>
|
<span [innerHTML]="queue.name | highlight:searchText"></span>
|
||||||
<small class="queue-option-description">{{getDescription(queue)}}</small>
|
<small class="queue-option-description">{{getDescription(queue)}}</small>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
///
|
///
|
||||||
|
|
||||||
import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@angular/core';
|
import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@angular/core';
|
||||||
import { ControlValueAccessor, UntypedFormBuilder, UntypedFormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
|
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { catchError, debounceTime, distinctUntilChanged, map, share, switchMap, tap } from 'rxjs/operators';
|
import { catchError, debounceTime, distinctUntilChanged, map, share, switchMap, tap } from 'rxjs/operators';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
@ -45,7 +45,7 @@ import { SubscriptSizing } from '@angular/material/form-field';
|
|||||||
})
|
})
|
||||||
export class QueueAutocompleteComponent implements ControlValueAccessor, OnInit {
|
export class QueueAutocompleteComponent implements ControlValueAccessor, OnInit {
|
||||||
|
|
||||||
selectQueueFormGroup: UntypedFormGroup;
|
selectQueueFormGroup: FormGroup;
|
||||||
|
|
||||||
modelValue: string | null;
|
modelValue: string | null;
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ export class QueueAutocompleteComponent implements ControlValueAccessor, OnInit
|
|||||||
public truncate: TruncatePipe,
|
public truncate: TruncatePipe,
|
||||||
private entityService: EntityService,
|
private entityService: EntityService,
|
||||||
private queueService: QueueService,
|
private queueService: QueueService,
|
||||||
private fb: UntypedFormBuilder) {
|
private fb: FormBuilder) {
|
||||||
this.selectQueueFormGroup = this.fb.group({
|
this.selectQueueFormGroup = this.fb.group({
|
||||||
queueName: [null]
|
queueName: [null]
|
||||||
});
|
});
|
||||||
@ -127,8 +127,6 @@ export class QueueAutocompleteComponent implements ControlValueAccessor, OnInit
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {}
|
|
||||||
|
|
||||||
setDisabledState(isDisabled: boolean): void {
|
setDisabledState(isDisabled: boolean): void {
|
||||||
this.disabled = isDisabled;
|
this.disabled = isDisabled;
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
@ -145,19 +143,19 @@ export class QueueAutocompleteComponent implements ControlValueAccessor, OnInit
|
|||||||
writeValue(value: string | null): void {
|
writeValue(value: string | null): void {
|
||||||
this.searchText = '';
|
this.searchText = '';
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
this.queueService.getQueueByName(value, {ignoreLoading: true, ignoreErrors: true}).subscribe(
|
this.queueService.getQueueByName(value, {ignoreLoading: true, ignoreErrors: true}).subscribe({
|
||||||
(entity) => {
|
next: (entity) => {
|
||||||
this.modelValue = entity.name;
|
this.modelValue = entity.name;
|
||||||
this.selectQueueFormGroup.get('queueName').patchValue(entity, {emitEvent: false});
|
this.selectQueueFormGroup.get('queueName').patchValue(entity, {emitEvent: false});
|
||||||
},
|
},
|
||||||
() => {
|
error: () => {
|
||||||
this.modelValue = null;
|
this.modelValue = null;
|
||||||
this.selectQueueFormGroup.get('queueName').patchValue('', {emitEvent: false});
|
this.selectQueueFormGroup.get('queueName').patchValue('', {emitEvent: false});
|
||||||
if (value !== null) {
|
if (value !== null) {
|
||||||
this.propagateChange(this.modelValue);
|
this.propagateChange(this.modelValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
} else {
|
} else {
|
||||||
this.modelValue = null;
|
this.modelValue = null;
|
||||||
this.selectQueueFormGroup.get('queueName').patchValue('', {emitEvent: false});
|
this.selectQueueFormGroup.get('queueName').patchValue('', {emitEvent: false});
|
||||||
@ -195,9 +193,7 @@ export class QueueAutocompleteComponent implements ControlValueAccessor, OnInit
|
|||||||
});
|
});
|
||||||
return this.queueService.getTenantQueuesByServiceType(pageLink, this.queueType, {ignoreLoading: true}).pipe(
|
return this.queueService.getTenantQueuesByServiceType(pageLink, this.queueType, {ignoreLoading: true}).pipe(
|
||||||
catchError(() => of(emptyPageData<QueueInfo>())),
|
catchError(() => of(emptyPageData<QueueInfo>())),
|
||||||
map(pageData => {
|
map(pageData => pageData.data)
|
||||||
return pageData.data;
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user