Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support more aspectmodels, filtering parts #305

Merged
merged 65 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
96fe41b
chore: TRACEFOSS-2512 created search field including logic to trigger…
ds-mwesener Oct 4, 2023
9725ca6
Merge branch 'feature/TRACEFOSS-1424-filtering-parts' into feature/TR…
ds-mwesener Oct 4, 2023
28c3d35
chore: TRACEFOSS-2711 update irs from 6.6.1 to 6.7.1
ds-ext-sceronik Oct 4, 2023
6576193
chore: TRACEFOSS-2711 added changelog
ds-ext-sceronik Oct 4, 2023
2af5c5a
Merge branch 'main' into feature/TRACEFOSS-2512-global-search
ds-mwesener Oct 4, 2023
2b1bfb0
chore: TRACEFOSS-2512 Refactored SearchCriteria logic to reflect new …
ds-mwesener Oct 4, 2023
a04c1c7
fixed: Response Code Missing (v3)
Oct 4, 2023
dc88297
Revert "fixed: Response Code Missing (v3)"
Oct 4, 2023
5284694
fixed: Response Code Missing (v3)
Oct 4, 2023
19f913c
chore: TRACEFOSS-2512 Refactored SearchCriteria logic to reflect new …
ds-mwesener Oct 4, 2023
9063185
fixed: Response Code Missing (v3)
Oct 4, 2023
69456a1
fixed: Response Code Missing (v3)
Oct 4, 2023
f1d161b
Merge pull request #641 from abi231002/main
ds-lcapellino Oct 4, 2023
29d957f
chore: TRACEFOSS-2512 Refactored SearchCriteria logic to reflect new …
ds-mwesener Oct 4, 2023
f2d7447
chore: TRACEFOSS-2512 Refactored SearchCriteria logic to reflect new …
ds-mwesener Oct 4, 2023
5dbf77e
chore: TRACEFOSS-2512 Refactored SearchCriteria logic to reflect new …
ds-mwesener Oct 4, 2023
4f70f50
chore: TRACEFOSS-2513 Added global search field functionality
ds-mwesener Oct 4, 2023
6063f36
fixed: Response Code Missing (v3)
Oct 4, 2023
5a03814
chore: TRACEFOSS-2513 Added global search field functionality
ds-mwesener Oct 4, 2023
763c835
chore: TRACEFOSS-2513 Added global search field functionality
ds-mwesener Oct 4, 2023
bdb1f1f
chore: TRACEFOSS-2513 added some testing fixxes
ds-mwesener Oct 5, 2023
5730452
Merge pull request #642 from abi231002/main
ds-lcapellino Oct 5, 2023
0997354
chore: TRACEFOSS-XXXX update authors
ds-ext-sceronik Oct 5, 2023
05646c9
Merge pull request #644 from catenax-ng/chore/TRACEFOSS-XXX-update-au…
ds-ext-sceronik Oct 5, 2023
a3e4824
Update Dependencies Backend Action
ds-ext-sceronik Oct 5, 2023
9a3970d
chore: TRACEFOSS-2513 added some testing
ds-mwesener Oct 5, 2023
43f6e94
chore: TRACEFOSS-2513 added some testing
ds-mwesener Oct 5, 2023
86ee8b7
chore: TRACEFOSS-2513 added some testing
ds-mwesener Oct 5, 2023
59dafc4
chore: TRACEFOSS-2513 added some testing
ds-mwesener Oct 5, 2023
0ffa7c7
Merge pull request #643 from catenax-ng/action/dependencies
ds-mwesener Oct 5, 2023
4bbe098
chore: TRACEFOSS-2513 added some testing
ds-mwesener Oct 5, 2023
ef3d97b
chore: TRACEFOSS-2513 added some testing
ds-mwesener Oct 5, 2023
a47ad03
chore: TRACEFOSS-2513 fixxed smaller things
ds-mwesener Oct 5, 2023
4b7d5b3
Merge pull request #636 from catenax-ng/feature/TRACEFOSS-2512-global…
ds-mwesener Oct 5, 2023
25faf7f
feature(JIS):[TRACEFOSS-2337] Added JustInSequence Semantic Model
ds-mmaul Oct 5, 2023
0ea0490
chore: TRACEFOSS-2337 added flag css and implemented it with todo com…
ds-mwesener Oct 5, 2023
d87a111
Merge remote-tracking branch 'origin/feature/TRACEFOSS-2337-FE-just-i…
ds-mwesener Oct 5, 2023
b610c60
chore: TRACEFOSS-2337 fixed other part service
ds-mwesener Oct 5, 2023
6b7a017
feature(JIS):[TRACEFOSS-2337] added iso alpha-3 country flags
ds-mmaul Oct 5, 2023
37ad138
feature(JIS):[TRACEFOSS-2337] added iso alpha-3 country flags
ds-mmaul Oct 5, 2023
d0fb2b2
chore: TRACEFOSS-2513 changed logic of filter in backend.
ds-mwesener Oct 5, 2023
3a43126
chore: TRACEFOSS-2513 changed logic of filter in backend.
ds-mwesener Oct 6, 2023
113ca21
feature(JIS):[TRACEFOSS-2337] added iso alpha-3 country flags
ds-mmaul Oct 6, 2023
c811902
chore: TRACEFOSS-2513 changed logic of filter in backend.
ds-mwesener Oct 6, 2023
32db87d
chore: TRACEFOSS-2711
ds-ext-sceronik Oct 6, 2023
e50e11f
feature(jis):[TRACEFOSS-2337] fix tests
ds-mmaul Oct 6, 2023
e65336f
feature(jis):[TRACEFOSS-2337] removed unnecessary code and assets
ds-mmaul Oct 6, 2023
1dc13f1
feature(jis):[TRACEFOSS-2337] removed unnecessary code and assets
ds-mmaul Oct 6, 2023
fe7c545
chore: TRACEFOSS-2711 adjust creating policies logic
ds-ext-sceronik Oct 6, 2023
d4a5404
feature(jis):[TRACEFOSS-2337] changelog and user manual update
ds-mmaul Oct 6, 2023
3f30843
feature(jis):[TRACEFOSS-2337] changelog and user manual update
ds-mmaul Oct 6, 2023
3f80715
chore: TRACEFOSS-2711 merge main
ds-ext-sceronik Oct 6, 2023
8653971
chore: TRACEFOSS-2711 remove unneded code
ds-ext-sceronik Oct 6, 2023
3637ba7
chore: TRACEFOSS-2711 unusedImports
ds-ext-sceronik Oct 6, 2023
4d0eb59
Merge pull request #638 from catenax-ng/chore/TRACEFOSS-2711-main-upd…
ds-ext-sceronik Oct 6, 2023
a3ef1e6
Merge branch 'main' into feature/TRACEFOSS-2513-extend-simple-search
ds-mwesener Oct 6, 2023
da51179
Update Dependencies Backend Action
ds-ext-sceronik Oct 6, 2023
89734c3
Merge branch 'main' into feature/TRACEFOSS-2337-FE-just-in-sequence-part
ds-mmaul Oct 6, 2023
be0ec74
chore: TRACEFOSS-2513 changed logic of filter in backend.
ds-mwesener Oct 6, 2023
59415a1
Merge pull request #646 from catenax-ng/feature/TRACEFOSS-2513-extend…
ds-mwesener Oct 6, 2023
c36b4c6
Merge pull request #649 from catenax-ng/action/dependencies
ds-ext-sceronik Oct 6, 2023
674ed1d
Update Dependencies Backend Action
ds-mwesener Oct 6, 2023
e0d5659
Merge branch 'main' into feature/TRACEFOSS-2337-FE-just-in-sequence-part
ds-mwesener Oct 6, 2023
bf25bfd
Merge pull request #648 from catenax-ng/feature/TRACEFOSS-2337-FE-jus…
ds-mwesener Oct 6, 2023
f52a33c
Merge pull request #650 from catenax-ng/action/dependencies
ds-mwesener Oct 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ The following people have contributed to this repository:
- Martin Maul, doubleSlash Net-Business GmbH, https://github.com/ds-mmaul
- Lucas Capellino, doubleSlash Net-Business GmbH, https://github.com/ds-lcapellino
- Abilash Shanmugavel, doubleSlash Net-Business GmbH, https://github.com/abi231002
- Sebastian Ceronik, doubleSlash Net-Business GmbH, https://github.com/ds-ext-sceronik
23 changes: 16 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]
### Added

- added multisorting in FE for notifications
- added possiblity to add operator to searchquery of assets
- added global search field and combined with the OR operator to be able to search for multiple elements in the database
- Filter for each assetAsBuilt table attribute
- Filter for each assetAsPlanned table attribute
- Extended testdata to reflect better overview of assets
- Extended testdata to reflect better overview of assets
- Support for TractionBatteryCode
- Support for JustInSequence Semantice data model in FE
- Added country flags icons to manufacturing Country
- new submodelserver related API endpoints for data provisioning /api/submodel/data/{id}

### Changed
- updated IRS helm chart from 6.6.1 to 6.7.2
- Updated policy related logic to reflect IRS changes

### Removed
- Updated user manual to reflect current state of the part views

### Removed
- Owner filter and replaced it with the new filter query param

## [7.1.0 - 29.09.2023]
Expand All @@ -23,11 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- archunit tests as preparation for good quality architecture checks
- safety and security doc including roles matrix
- handling for duplicate shellDescriptor ids when refreshing registry
- Filter for each assetAsBuilt table attribute
- Filter for each assetAsPlanned table attribute
- Extended testdata to reflect better overview of assets
- Extended testdata to reflect better overview of assets
- Support for TractionBatteryCode


### Changed
- added sorting for /api/investigations received and created endpoints
Expand Down
2 changes: 1 addition & 1 deletion DEPENDENCIES_BACKEND
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ maven/mavencentral/org.eclipse.edc/transfer-spi/0.1.3, Apache-2.0, approved, tec
maven/mavencentral/org.eclipse.edc/transform-spi/0.1.3, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/validator-spi/0.1.3, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/web-spi/0.1.3, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.tractusx.irs/irs-registry-client/1.2.1-20230929.134937-6, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-registry-client/1.2.1-20231005.130041-12, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.traceability/tx-backend/0.0.1-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.traceability/tx-models/0.0.1-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.flywaydb/flyway-core/9.16.3, Apache-2.0, approved, #7935
Expand Down
4 changes: 2 additions & 2 deletions DEPENDENCIES_FRONTEND
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ npm/npmjs/-/has-proto/1.0.1, MIT, approved, #6175
npm/npmjs/-/has-symbols/1.0.3, MIT, approved, clearlydefined
npm/npmjs/-/has-tostringtag/1.0.0, MIT, approved, clearlydefined
npm/npmjs/-/has-unicode/2.0.1, ISC, approved, clearlydefined
npm/npmjs/-/has/1.0.3, MIT, approved, clearlydefined
npm/npmjs/-/has/1.0.3, MIT, approved, #10930
npm/npmjs/-/hdr-histogram-js/2.0.3, BSD-2-Clause AND BSD-3-Clause AND CC0-1.0 AND 0BSD, approved, #3301
npm/npmjs/-/hdr-histogram-percentiles-obj/3.0.0, MIT, approved, clearlydefined
npm/npmjs/-/headers-polyfill/3.1.2, MIT, approved, clearlydefined
Expand Down Expand Up @@ -848,7 +848,7 @@ npm/npmjs/-/readable-stream/3.6.2, MIT, approved, CQ22627
npm/npmjs/-/readdirp/3.6.0, MIT, approved, #2977
npm/npmjs/-/redent/3.0.0, MIT, approved, clearlydefined
npm/npmjs/-/reflect-metadata/0.1.13, Apache-2.0, approved, clearlydefined
npm/npmjs/-/regenerate-unicode-properties/10.1.0, MIT, approved, clearlydefined
npm/npmjs/-/regenerate-unicode-properties/10.1.0, MIT, approved, #10903
npm/npmjs/-/regenerate/1.4.2, MIT, approved, clearlydefined
npm/npmjs/-/regenerator-runtime/0.13.11, MIT, approved, #4978
npm/npmjs/-/regenerator-transform/0.15.1, MIT, approved, #5001
Expand Down
2 changes: 1 addition & 1 deletion charts/traceability-foss/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies:
condition: pgadmin4.enabled
- name: irs-helm
repository: https://eclipse-tractusx.github.io/item-relationship-service
version: 6.6.1
version: 6.7.2
condition: irs-helm.enabled
- name: tractusx-connector
repository: https://eclipse-tractusx.github.io/tractusx-edc
Expand Down
21 changes: 20 additions & 1 deletion docs/src/docs/user/user-manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,22 @@ By default, both tables are displayed. You can adjust the View of tables by acti

image::https://raw.githubusercontent.com/eclipse-tractusx/traceability-foss/main/docs/src/images/arc42/user-guide/parts-list-view.png[]

=== Parts Table

A Table View split into the different BOM Lifecycle phases (AsBuilt / AsPlanned) of a part.

Between the views, there is a slider to adjust the view to make either the left or the right table more visible.
Alternatively, you can use the view toggle to adjust the visibility of the tables.

Both tables can be sorted, filtered and searched.
The global search bar at the top returns part results from both Tables.

=== AsBuilt Lifecycle Parts
List view of own Parts with AsBuilt Lifecycle.
Gives detailed information on the assets registered in the Digital Twin Registry of Catena-X for the company. This includes data based on the aspect models of Use Case Traceability: Asbuilt, SerialPart, Batch.
Parts that are in a quality alert are highlighted yellow.

=== AsPlanned
=== AsPlanned Lifecycle Parts
List view of own Parts with AsPlanned Lifecycle.
Gives detailed information on the assets registered in the Digital Twin Registry of Catena-X for the company. This includes data based on the aspect models of Use Case Traceability: AsPlanned, SerialPart, Batch.
Parts that are in a quality alert are highlighted yellow.
Expand Down Expand Up @@ -106,6 +116,15 @@ Information about the identifiers at the customer for the respective part/batch.
List view of the supplied/delivered parts and batches (Supplier parts / Customer parts).
Gives detailed information on the assets registered in the Digital Twin Registry of Catena-X. This includes data based on the aspect models of Use Case Traceability: SerialPart, Batch.

=== Other parts Table

A Table View split into the different BOM Lifecycle phases (AsBuilt / AsPlanned) of a part.

Between the views, there is a slider to adjust the view to make either the left or the right table more visible.
Alternatively, you can use the view toggle to adjust the visibility of the tables.

Additionally, it's possible to switch between tabs above each of the table views to display either supplier or customer parts

=== Supplier parts
List view of supplied parts and batches.
Supplier parts that are in a quality investigation are highlighted yellow.
Expand Down
Binary file modified docs/src/images/arc42/user-guide/parts-list-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
********************************************************************************/

import { DetailAspectType } from '@page/parts/model/detailAspectModel.model';
import { Owner } from '@page/parts/model/owner.enum';
import { PartResponse, PartsResponse, QualityType, SemanticDataModel } from '@page/parts/model/parts.model';
import {Owner} from '@page/parts/model/owner.enum';

export const MOCK_part_5 = {
"id": "MOCK_part_5",
Expand Down Expand Up @@ -74,7 +74,7 @@ export const MOCK_part_4 = {
"underInvestigation": false,
"qualityType": QualityType.Ok,
"van": "--",
"semanticDataModel": SemanticDataModel.JUSTINSEQUENCEPART,
'semanticDataModel': SemanticDataModel.JUSTINSEQUENCE,
"classification": "product",
"detailAspectModels": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class OtherPartsService {
let params = new HttpParams()
.set('page', page)
.set('size', pageSize)
.set('filterOperator', "AND")
.set('filter', "owner,EQUAL," + owner);

sort.forEach(sortingItem => {
Expand All @@ -65,6 +66,7 @@ export class OtherPartsService {
let params = new HttpParams()
.set('page', page)
.set('size', pageSize)
.set('filterOperator', "AND")
.set('filter', "owner,EQUAL," + owner);

sort.forEach(sortingItem => {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/modules/page/parts/core/parts.facade.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('Parts facade', () => {
partsFacade.setPartsAsBuilt(0, 10);

await waitFor(() => expect(serviceSpy).toHaveBeenCalledTimes(1));
await waitFor(() => expect(serviceSpy).toHaveBeenCalledWith(0, 10, [], undefined));
await waitFor(() => expect(serviceSpy).toHaveBeenCalledWith(0, 10, [], undefined, undefined));

const parts = await firstValueFrom(partsState.partsAsBuilt$);
await waitFor(() =>
Expand All @@ -78,7 +78,7 @@ describe('Parts facade', () => {
partsFacade.setPartsAsBuilt(0, 10, [], filter);

await waitFor(() => expect(serviceSpy).toHaveBeenCalledTimes(1));
await waitFor(() => expect(serviceSpy).toHaveBeenCalledWith(0, 10, [], filter));
await waitFor(() => expect(serviceSpy).toHaveBeenCalledWith(0, 10, [], filter, undefined));

const parts = await firstValueFrom(partsState.partsAsBuilt$);
await waitFor(() =>
Expand All @@ -98,7 +98,7 @@ describe('Parts facade', () => {
partsFacade.setPartsAsPlanned(0, 10, [], filter);

await waitFor(() => expect(serviceSpy).toHaveBeenCalledTimes(1));
await waitFor(() => expect(serviceSpy).toHaveBeenCalledWith(0, 10, [], filter));
await waitFor(() => expect(serviceSpy).toHaveBeenCalledWith(0, 10, [], filter, undefined));

const parts = await firstValueFrom(partsState.partsAsPlanned$);
await waitFor(() =>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/app/modules/page/parts/core/parts.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ export class PartsFacade {
return this.partsState.partsAsPlanned$;
}

public setPartsAsBuilt(page = 0, pageSize = 50, sorting: TableHeaderSort[] = [], assetAsBuiltFilter?: AssetAsBuiltFilter): void {
public setPartsAsBuilt(page = 0, pageSize = 50, sorting: TableHeaderSort[] = [], assetAsBuiltFilter?: AssetAsBuiltFilter, isOrSearch?: boolean): void {
this.partsAsBuiltSubscription?.unsubscribe();
this.partsAsBuiltSubscription = this.partsService.getPartsAsBuilt(page, pageSize, sorting, assetAsBuiltFilter).subscribe({
this.partsAsBuiltSubscription = this.partsService.getPartsAsBuilt(page, pageSize, sorting, assetAsBuiltFilter, isOrSearch).subscribe({
next: data => (this.partsState.partsAsBuilt = {data}),
error: error => (this.partsState.partsAsBuilt = {error}),
});
}

public setPartsAsPlanned(page = 0, pageSize = 50, sorting: TableHeaderSort[] = [], assetAsPlannedFilter?: AssetAsPlannedFilter): void {
public setPartsAsPlanned(page = 0, pageSize = 50, sorting: TableHeaderSort[] = [], assetAsPlannedFilter?: AssetAsPlannedFilter, isOrSearch?: boolean): void {
this.partsAsPlannedSubscription?.unsubscribe();
this.partsAsPlannedSubscription = this.partsService.getPartsAsPlanned(page, pageSize, sorting, assetAsPlannedFilter).subscribe({
this.partsAsPlannedSubscription = this.partsService.getPartsAsPlanned(page, pageSize, sorting, assetAsPlannedFilter, isOrSearch).subscribe({
next: data => (this.partsState.partsAsPlanned = {data}),
error: error => (this.partsState.partsAsPlanned = {error}),
});
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/app/modules/page/parts/model/parts.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import type {PaginationResponse} from '@core/model/pagination.model';
import {SemanticModel} from '@page/parts/model/aspectModels.model';
import {DetailAspectModel} from '@page/parts/model/detailAspectModel.model';
import {MainAspectType} from '@page/parts/model/mainAspectType.enum';
import {Owner} from '@page/parts/model/owner.enum';
import type { PaginationResponse } from '@core/model/pagination.model';
import { SemanticModel } from '@page/parts/model/aspectModels.model';
import { DetailAspectModel } from '@page/parts/model/detailAspectModel.model';
import { MainAspectType } from '@page/parts/model/mainAspectType.enum';
import { Owner } from '@page/parts/model/owner.enum';

export interface Part {
id: string;
Expand Down Expand Up @@ -101,15 +101,15 @@ export enum SemanticDataModel {
BATCH = 'BATCH',
SERIALPART = 'SERIALPART',
PARTASPLANNED = 'PARTASPLANNED',
JUSTINSEQUENCEPART = 'JUSTINSEQUENCEPART',
JUSTINSEQUENCE = 'JUSTINSEQUENCE',
UNKNOWN = 'UNKNOWN'
}

export enum SemanticDataModelInCamelCase {
BATCH = "Batch",
SERIALPART = 'SerialPart',
PARTASPLANNED = 'PartAsPlanned',
JUSTINSEQUENCEPART = 'JustInSequencePart',
JUSTINSEQUENCE = 'JustInSequence',
UNKNOWN = 'Unknown'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@
-->

<div class="parts-table-container">
<div class="parts-search-input-wrapper" [formGroup]="searchFormGroup">
<app-input
[label]="'parts.input.global-search.placeholder' | i18n"
[suffixIconHover]="true"
[displayClearButton]="true"
(suffixIconClick)="triggerPartSearch()"
[onEnterActive]="true"
[suffixIcon]="'search'"
class="parts-search-input"
formControlName="partSearch"
[parentFormGroup]="searchFormGroup"
[parentControlName]="'partSearch'"
suffixIconColor="primary"
></app-input>
</div>
<div class="app-bom-lifecycle-activator-container">
<app-bom-lifecycle-activator [view]=UserSettingView.PARTS
(buttonClickEvent)="handleTableActivationEvent($event)"></app-bom-lifecycle-activator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@
margin: 16px;
box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
}

.parts-search-input-wrapper{
padding:20px;
}

Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ import {SharedModule} from '@shared/shared.module';
import {screen, waitFor} from '@testing-library/angular';
import {renderComponent} from '@tests/test-render.utils';
import {PartsModule} from '../parts.module';
import {AssetAsBuiltFilter, AssetAsPlannedFilter, Part} from "@page/parts/model/parts.model";
import {AssetAsBuiltFilter, AssetAsPlannedFilter} from "@page/parts/model/parts.model";
import {TableHeaderSort} from "@shared/components/table/table.model";
import {PartDetailsFacade} from "@shared/modules/part-details/core/partDetails.facade";
import {toGlobalSearchAssetFilter} from "@shared/helper/filter-helper";

describe('Parts', () => {

Expand Down Expand Up @@ -192,10 +193,10 @@ describe('Parts', () => {
});


it('should set selectedPart in PartDetailsFacade correctly',async () => {
it('should set selectedPart in PartDetailsFacade correctly', async () => {
const {fixture} = await renderParts();
const {componentInstance} = fixture;
const sampleEvent: Record<string, unknown> = { id: 123, name: 'Sample Part' };
const sampleEvent: Record<string, unknown> = {id: 123, name: 'Sample Part'};

componentInstance.onSelectItem(sampleEvent);
const partDetailsFacade = (componentInstance as any)['partDetailsFacade'];
Expand All @@ -221,4 +222,46 @@ describe('Parts', () => {
expect(partsFacadeSpy).toHaveBeenCalledWith(page, pageSize, componentInstance['tableAsBuiltSortList']);
});

it('should clear filters and call partsFacade methods with search value', async () => {

const {fixture} = await renderParts();
const {componentInstance} = fixture;
// Arrange
const searchValue = 'searchTerm';

const partsFacade = (componentInstance as any)['partsFacade'];
const partsFacadeSpy = spyOn(partsFacade, 'setPartsAsBuilt');
const partsFacadeAsPlannedSpy = spyOn(partsFacade, 'setPartsAsPlanned');
componentInstance.searchControl.setValue(searchValue);


// Act
componentInstance.triggerPartSearch();

// Assert
expect(partsFacadeAsPlannedSpy).toHaveBeenCalledWith(0, 50, [], toGlobalSearchAssetFilter(searchValue, false), true);
expect(partsFacadeSpy).toHaveBeenCalledWith(0, 50, [], toGlobalSearchAssetFilter(searchValue, true), true);
});

it('should not filter if filter search is unset', async () => {

const {fixture} = await renderParts();
const {componentInstance} = fixture;
// Arrange
const searchValue = '';

const partsFacade = (componentInstance as any)['partsFacade'];
const partsFacadeSpy = spyOn(partsFacade, 'setPartsAsBuilt');
const partsFacadeAsPlannedSpy = spyOn(partsFacade, 'setPartsAsPlanned');
componentInstance.searchControl.setValue(searchValue);


// Act
componentInstance.triggerPartSearch();

// Assert
expect(partsFacadeAsPlannedSpy).toHaveBeenCalledWith();
expect(partsFacadeSpy).toHaveBeenCalledWith();
});

});
Loading
Loading