UI: rule chain search improvements

This commit is contained in:
rusikv 2024-01-09 17:28:53 +02:00
parent 8976adad2c
commit e30e2ca627
4 changed files with 31 additions and 7 deletions

View File

@ -22,13 +22,14 @@
(focusin)="onFocus()" (focusin)="onFocus()"
[matAutocomplete]="ruleChainAutocomplete"> [matAutocomplete]="ruleChainAutocomplete">
<mat-icon matSuffix>search</mat-icon> <mat-icon matSuffix>search</mat-icon>
<mat-autocomplete class="tb-autocomplete" <mat-autocomplete class="tb-autocomplete tb-rule-chain-search"
#ruleChainAutocomplete="matAutocomplete" #ruleChainAutocomplete="matAutocomplete"
(optionSelected)="selected($event)"> (optionSelected)="selected($event)">
<mat-option *ngFor="let ruleChain of filteredRuleChains | async" <mat-option *ngFor="let ruleChain of filteredRuleChains | async"
[fxHide]="ruleChainId === ruleChain.id.id" [class.tb-selected-option]="ruleChainId === ruleChain.id.id"
[value]="ruleChain"> [value]="ruleChain">
<span [innerHTML]="ruleChain.name | highlight:searchText"></span> <mat-icon *ngIf="ruleChainId === ruleChain.id.id">check</mat-icon>
<span [innerHTML]="ruleChain.name | highlight:searchText:true"></span>
</mat-option> </mat-option>
<mat-option *ngIf="!(filteredRuleChains | async)?.length" [value]="null" class="tb-not-found"> <mat-option *ngIf="!(filteredRuleChains | async)?.length" [value]="null" class="tb-not-found">
<div class="tb-not-found-content" (click)="$event.stopPropagation()"> <div class="tb-not-found-content" (click)="$event.stopPropagation()">

View File

@ -13,6 +13,28 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
@import "../../../../scss/constants";
:host { :host {
width: 100%; width: 100%;
} }
::ng-deep {
.tb-autocomplete.tb-rule-chain-search {
.mat-mdc-option.tb-selected-option {
display: flex;
flex-direction: row-reverse;
background-color: rgba(0, 0, 0, .04);
mat-icon {
margin-right: 0;
margin-left: 16px;
color: $tb-primary-color;
}
.mdc-list-item__primary-text {
color: $tb-primary-color;
}
}
}
}

View File

@ -16,12 +16,11 @@
--> -->
<mat-form-field class="tb-rule-select" subscriptSizing="dynamic" appearance="fill" <mat-form-field class="tb-rule-select" subscriptSizing="dynamic" appearance="fill"
[ngClass]="{'cursor-pointer': !disabled}" [class.cursor-pointer]="!disabled"
(click)="openRuleChainSelectPanel($event)"> (click)="openRuleChainSelectPanel($event)">
<mat-icon matPrefix>settings_ethernet</mat-icon> <mat-icon matPrefix>settings_ethernet</mat-icon>
<input matInput readonly <input matInput readonly disabled
[required]="required" [required]="required"
[disabled]="disabled"
[value]="ruleChain?.name"> [value]="ruleChain?.name">
<mat-icon [ngClass]="{'disabled': disabled || panelOpened}" matSuffix>arrow_drop_down</mat-icon> <mat-icon [class.disabled]="disabled || panelOpened" matSuffix>arrow_drop_down</mat-icon>
</mat-form-field> </mat-form-field>

View File

@ -23,6 +23,8 @@
input { input {
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
text-overflow: ellipsis;
pointer-events: none;
&:disabled { &:disabled {
cursor: unset; cursor: unset;