Skip to content

Commit 39267d5

Browse files
committed
Minor style fixes
1 parent 56540fa commit 39267d5

5 files changed

Lines changed: 23 additions & 5 deletions

File tree

gitb-ui/ui/src/app/components/multi-select-filter/multi-select-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ export interface MultiSelectConfig<T extends EntityWithId> {
4040
squashItemsWithSameText?: boolean
4141
enableSelectAll?: boolean
4242
textDecorator?: (item: T) => string
43+
iconField?: string
4344

4445
}

gitb-ui/ui/src/app/components/multi-select-filter/multi-select-filter.component.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
<div class="d-flex">
3434
<input class="form-check-input" type="checkbox" tabIndex="-1" [attr.id]="'item-'+$index" [attr.name]="'item-'+$index" [(ngModel)]="selectedSelectedItems[item.id].selected" (ngModelChange)="updateCheckFlag()" (focus)="selectedItemCheckFocused($event)">
3535
<label class="form-check-label disable-select mx-2" (click)="$event.stopPropagation()" [attr.for]="'item-'+$index">
36+
@if (config.iconField && item[config.iconField]) {
37+
<i class="optionIcon" [ngClass]="item[config.iconField]"></i>
38+
}
3639
{{ item[config.textField] }}
3740
@if (config.textDecorator) {
3841
<span class="item-text-decoration">{{ config.textDecorator(item) }}</span>
@@ -54,11 +57,19 @@
5457
@for (item of visibleAvailableItems; track item.id) {
5558
<div class="itemContainer" [class]="'available-item-'+$index" [class.focused]="$index == focusedAvailableItemIndex" (click)="availableItemClicked(item)">
5659
@if (config.singleSelection) {
57-
<div>{{ item[config.textField] }}</div>
60+
<div>
61+
@if (config.iconField && item[config.iconField]) {
62+
<i class="optionIcon" [ngClass]="item[config.iconField]"></i>
63+
}
64+
{{ item[config.textField] }}
65+
</div>
5866
} @else {
5967
<div class="d-flex">
6068
<input class="form-check-input" tabIndex="-1" [attr.id]="'a_item-'+$index" [attr.name]="'a_item-'+$index" type="checkbox" [(ngModel)]="selectedAvailableItems[item.id].selected" (ngModelChange)="updateCheckFlag()" (focus)="availableItemCheckFocused($event)">
6169
<label class="form-check-label disable-select mx-2" (click)="$event.stopPropagation()" [attr.for]="'a_item-'+$index">
70+
@if (config.iconField && item[config.iconField]) {
71+
<i class="optionIcon" [ngClass]="item[config.iconField]"></i>
72+
}
6273
{{ item[config.textField] }}
6374
@if (config.textDecorator) {
6475
<span class="item-text-decoration">{{ config.textDecorator(item) }}</span>

gitb-ui/ui/src/app/components/multi-select-filter/multi-select-filter.component.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@
121121
}
122122
}
123123
}
124+
.optionIcon {
125+
font-size: 14px;
126+
margin-right: 8px;
127+
margin-left: 6px;
128+
}
124129
&.availableItems {
125130
overflow-y: auto;
126131
&.hideBorder {

gitb-ui/ui/src/app/components/test-filter/test-filter.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class TestFilterComponent implements OnInit {
164164
this.initialiseIfDefined(Constants.FILTER_TYPE.COMMUNITY, { name: Constants.FILTER_TYPE.COMMUNITY, textField: 'sname', loader: this.loadCommunitiesFn, clearItems: new EventEmitter(), replaceSelectedItems: new EventEmitter(), showAsFormControl: true })
165165
this.initialiseIfDefined(Constants.FILTER_TYPE.ORGANISATION, { name: Constants.FILTER_TYPE.ORGANISATION, textField: 'sname', loader: this.loadOrganisationsFn, clearItems: new EventEmitter(), replaceSelectedItems: new EventEmitter(), showAsFormControl: true })
166166
this.initialiseIfDefined(Constants.FILTER_TYPE.SYSTEM, { name: Constants.FILTER_TYPE.SYSTEM, textField: 'sname', loader: this.loadSystemsFn, clearItems: new EventEmitter(), replaceSelectedItems: new EventEmitter(), showAsFormControl: true })
167-
this.initialiseIfDefined(Constants.FILTER_TYPE.RESULT, { name: Constants.FILTER_TYPE.RESULT, textField: 'label', loader: this.loadTestResults.bind(this), clearItems: new EventEmitter(), replaceSelectedItems: new EventEmitter(), showAsFormControl: true } )
167+
this.initialiseIfDefined(Constants.FILTER_TYPE.RESULT, { name: Constants.FILTER_TYPE.RESULT, textField: 'label', iconField: 'icon', loader: this.loadTestResults.bind(this), clearItems: new EventEmitter(), replaceSelectedItems: new EventEmitter(), showAsFormControl: true } )
168168
if (this.commands) {
169169
this.commands.subscribe((command) => {
170170
this.handleCommand(command)
@@ -669,9 +669,9 @@ export class TestFilterComponent implements OnInit {
669669

670670
private loadTestResults(): Observable<IdLabel[]> {
671671
return of([
672-
{ id: 0, label: "Success" },
673-
{ id: 1, label: "Failure" },
674-
{ id: 2, label: "Incomplete" }
672+
{ id: 0, label: "Success", icon: this.dataService.iconForTestResult(Constants.TEST_CASE_RESULT.SUCCESS) },
673+
{ id: 1, label: "Failure", icon: this.dataService.iconForTestResult(Constants.TEST_CASE_RESULT.FAILURE) },
674+
{ id: 2, label: "Incomplete", icon: this.dataService.iconForTestResult(Constants.TEST_CASE_RESULT.UNDEFINED) }
675675
])
676676
}
677677

gitb-ui/ui/src/app/types/id-label.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ import { EntityWithId } from "./entity-with-id"
1818
export interface IdLabel extends EntityWithId {
1919

2020
label: string
21+
icon?: string
2122

2223
}

0 commit comments

Comments
 (0)