Skip to content

Commit

Permalink
Added version filter for products and apps (#305)
Browse files Browse the repository at this point in the history
* feat: added product version as filter

* feat: added app version as filter

* fix: tests
  • Loading branch information
HenryT-CG authored Nov 5, 2024
1 parent 255282c commit 642f56b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,16 @@ describe('AppSearchComponent', () => {
'ACTIONS.DATAVIEW.FILTER_OF': 'searchFilterOf ',
'APP.APP_ID': 'appId',
'APP.APP_TYPE': 'appType',
'APP.APP_VERSION': 'appVersion',
'APP.CLASSIFICATIONS': 'classes',
'APP.PRODUCT_NAME': 'productName'
}
spyOn(translateService, 'get').and.returnValue(of(dialogTranslations))

await component.ngOnInit()

expect(component.dataViewControlsTranslations).toEqual({
filterInputTooltip: 'searchFilterOf appId, appType, productName'
filterInputTooltip: 'searchFilterOf appId, appType, appVersion, classes, productName'
})
})

Expand Down
15 changes: 13 additions & 2 deletions src/app/product-store/app-search/app-search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class AppSearchComponent implements OnInit, OnDestroy {
public quickFilterValue: string = 'ALL'
public quickFilterItems: SelectItem[]
public filterValue: string | undefined
public filterValueDefault = 'appId,appType,productName,classifications'
public filterValueDefault = 'appId,appType,appVersion,productName,classifications'
public filterBy = this.filterValueDefault
public filter: string | undefined
public sortField = 'appId'
Expand Down Expand Up @@ -255,7 +255,14 @@ export class AppSearchComponent implements OnInit, OnDestroy {

public prepareDialogTranslations(): void {
this.translate
.get(['APP.APP_ID', 'APP.APP_TYPE', 'APP.PRODUCT_NAME', 'ACTIONS.DATAVIEW.FILTER_OF'])
.get([
'APP.APP_ID',
'APP.APP_TYPE',
'APP.APP_VERSION',
'APP.CLASSIFICATIONS',
'APP.PRODUCT_NAME',
'ACTIONS.DATAVIEW.FILTER_OF'
])
.pipe(
map((data) => {
this.dataViewControlsTranslations = {
Expand All @@ -265,6 +272,10 @@ export class AppSearchComponent implements OnInit, OnDestroy {
', ' +
data['APP.APP_TYPE'] +
', ' +
data['APP.APP_VERSION'] +
', ' +
data['APP.CLASSIFICATIONS'] +
', ' +
data['APP.PRODUCT_NAME']
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
[rows]="viewMode === 'grid' ? 16 : 20"
[layout]="viewMode"
[emptyMessage]="'ACTIONS.SEARCH.NOT_FOUND' | translate"
filterBy="name,displayName,classification"
filterBy="name,displayName,classification,version"
[sortField]="sortField"
[sortOrder]="sortOrder"
[showCurrentPageReport]="true"
Expand All @@ -87,11 +87,6 @@
[defaultSortDirection]="false"
(dataViewChange)="onLayoutChange($event)"
(filterChange)="onFilterChange($event)"
[filterColumns]="[
'PRODUCT.DISPLAY_NAME' | translate,
'PRODUCT.NAME' | translate,
'PRODUCT.CLASSIFICATIONS' | translate
]"
(sortChange)="onSortChange($event)"
(sortDirectionChange)="onSortDirChange($event)"
[translations]="dataViewControlsTranslations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class ProductSearchComponent implements OnInit {
'PRODUCT.NAME',
'PRODUCT.DISPLAY_NAME',
'PRODUCT.CLASSIFICATIONS',
'PRODUCT.VERSION',
'ACTIONS.DATAVIEW.VIEW_MODE_GRID',
'ACTIONS.DATAVIEW.VIEW_MODE_LIST',
'ACTIONS.DATAVIEW.VIEW_MODE_TABLE',
Expand All @@ -113,7 +114,9 @@ export class ProductSearchComponent implements OnInit {
', ' +
data['PRODUCT.NAME'] +
', ' +
data['PRODUCT.CLASSIFICATIONS'],
data['PRODUCT.CLASSIFICATIONS'] +
', ' +
data['PRODUCT.VERSION'],
viewModeToggleTooltips: {
grid: data['ACTIONS.DATAVIEW.VIEW_MODE_GRID'],
list: data['ACTIONS.DATAVIEW.VIEW_MODE_LIST']
Expand Down

0 comments on commit 642f56b

Please sign in to comment.