Skip to content

Commit

Permalink
Merge pull request #402 from catenax-ng/main
Browse files Browse the repository at this point in the history
Preparation of Data Provisioning
  • Loading branch information
ds-mmaul authored Dec 20, 2023
2 parents 0bee4c8 + b168b6e commit 0dc9709
Show file tree
Hide file tree
Showing 65 changed files with 1,162 additions and 7,057 deletions.
44 changes: 28 additions & 16 deletions .github/workflows/argo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ on:
- E2E-A/E2E-B
- int-a/int-b
testdata_version:
description: Which Testdata Version CX_Testdata_MessagingTest_v<X.X.X>.json e.g., 1.1.12"
description: Which Testdata Version CX_Testdata_MessagingTest_v<X.X.X>.json e.g., 0.0.12"
required: true
argo_token:
description: Argo Token
Expand All @@ -47,6 +47,13 @@ on:
options:
- Yes
- No
testdata_upload:
type: choice
description: Do you want a testdata upload?
required: true
options:
- Yes
- No

env:
ARGO_TEST_REGISTRY: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-dt-registry-test"
Expand Down Expand Up @@ -358,22 +365,27 @@ jobs:
run: |
python -m pip install requests
curl -o transform-and-upload.py https://raw.githubusercontent.com/catenax-ng/tx-item-relationship-service/main/local/testing/testdata/transform-and-upload.py
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-test.dev.demo.catena-x.net/api/submodel -edc https://trace-x-test-edc.dev.demo.catena-x.net -a https://trace-x-registry-test.dev.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-test-edc-dataplane.dev.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability.dev.demo.catena-x.net/api/submodel -edc https://trace-x-edc.dev.demo.catena-x.net -a https://trace-x-registry.dev.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-dataplane.dev.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-e2e-a.dev.demo.catena-x.net/api/submodel -edc https://trace-x-edc-e2e-a.dev.demo.catena-x.net -a https://trace-x-registry-e2e-a.dev.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-e2e-a-dataplane.dev.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-e2e-b.dev.demo.catena-x.net/api/submodel -edc https://trace-x-edc-e2e-b.dev.demo.catena-x.net -a https://trace-x-registry-e2e-b.dev.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-e2e-b-dataplane.dev.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-int-a.int.demo.catena-x.net/api/submodel -edc https://trace-x-edc-int-a.int.demo.catena-x.net -a https://trace-x-registry-int-a.int.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-int-a-dataplane.int.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_INT_A }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC BPNL00000003AZQP BPNL00000003CSGV
sleep 10
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-int-b.int.demo.catena-x.net/api/submodel -edc https://trace-x-edc-int-b.int.demo.catena-x.net -a https://trace-x-registry-int-b.int.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-int-b-dataplane.int.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_INT_B }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC BPNL00000003AZQP BPNL00000003CSGV
sleep 10
if [ "${{ github.event.inputs.testdata_upload }}" == "true" ]; then
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-test.dev.demo.catena-x.net/api/submodel -edc https://trace-x-test-edc.dev.demo.catena-x.net -a https://trace-x-registry-test.dev.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-test-edc-dataplane.dev.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability.dev.demo.catena-x.net/api/submodel -edc https://trace-x-edc.dev.demo.catena-x.net -a https://trace-x-registry.dev.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-dataplane.dev.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-e2e-a.dev.demo.catena-x.net/api/submodel -edc https://trace-x-edc-e2e-a.dev.demo.catena-x.net -a https://trace-x-registry-e2e-a.dev.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-e2e-a-dataplane.dev.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-e2e-b.dev.demo.catena-x.net/api/submodel -edc https://trace-x-edc-e2e-b.dev.demo.catena-x.net -a https://trace-x-registry-e2e-b.dev.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-e2e-b-dataplane.dev.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-int-a.int.demo.catena-x.net/api/submodel -edc https://trace-x-edc-int-a.int.demo.catena-x.net -a https://trace-x-registry-int-a.int.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-int-a-dataplane.int.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_INT_A }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC BPNL00000003AZQP BPNL00000003CSGV
sleep 10
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-int-b.int.demo.catena-x.net/api/submodel -edc https://trace-x-edc-int-b.int.demo.catena-x.net -a https://trace-x-registry-int-b.int.demo.catena-x.net/semantics/registry/api/v3.0 -d https://trace-x-edc-int-b-dataplane.int.demo.catena-x.net -p id-3.0-trace -k ${{ secrets.TRACE_X_API_KEY_INT_B }} --aas3 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC BPNL00000003AZQP BPNL00000003CSGV
sleep 10
fi
elif [ "${{ github.event.inputs.testdata_upload }}" == "false" ]; then
echo "Testdata upload skipped"
fi
registry_reload:
needs:
- upload_testdata
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [UNRELEASED - DD.MM.YYYY]
### Added
- Added an option for testdata upload in Argo Workflow
### Changed
- Restricted datefield on investigation creation to be only clickable and not editable
- Removed duplication of request notification component and combined it into a reusable component
Expand All @@ -20,8 +21,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- redesigned notification status confirmation modal
- bump irs version from 6.9.1 to 6.12.0

### Removed
- Removed registry lookups feature

## [10.0.0 - 12.12.2024]
## [10.0.0 - 12.12.2023]
### Added
- new filtering capabilities ( receivedQualityAlertIdsInStatusActive, sentQualityAlertIdsInStatusActive, receivedQualityInvestigationIdsInStatusActive, sentQualityInvestigationIdsInStatusActive )
- Validation check if table-settings correct and reset on invalid state
Expand All @@ -37,6 +40,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Added a step for testing input and included an option for a hard refresh in Argo Workflow
- Added manufacturer_id to assets_as_planned
- Added local filtering and auto complete for notifications
- Added a drag-and-drop option for JSON files and an endpoint to receive them

### Changed
- Filter configuration for tables to be resuable and easy to adapt
Expand Down
10 changes: 2 additions & 8 deletions frontend/src/app/mocks/services/admin-mock/admin.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,11 @@

import { environment } from '@env';
import { rest } from 'msw';
import { applyPagination, extractPagination } from '../pagination.helper';
import { buildMockRegistryProcesses, getBpnConfig } from './admin.model';
import { getBpnConfig } from './admin.model';

export const adminHandler = (_ => {
const mockRegistryProcesses = buildMockRegistryProcesses();
return [
rest.get(`*${ environment.apiUrl }/metrics/registry-lookup`, (req, res, ctx) => {
const pagination = extractPagination(req);

return res(ctx.status(200), ctx.json(applyPagination(mockRegistryProcesses, pagination)));
}),
return [

rest.post(`*${ environment.apiUrl }/bpn-config`, (req, res, ctx) => {
return res(ctx.status(204));
Expand Down
26 changes: 1 addition & 25 deletions frontend/src/app/mocks/services/admin-mock/admin.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,8 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { BpnConfigResponse, RegistryLookupStatus, RegistryProcessResponse } from '@page/admin/core/admin.model';
import { getRandomIntFromInterval } from '../text-generator.helper';
import { BpnConfigResponse} from '@page/admin/core/admin.model';

export const buildMockRegistryProcesses = (): RegistryProcessResponse[] =>
new Array(101).fill(null).map((_, index) => {
const status = Object.keys(RegistryLookupStatus) as RegistryLookupStatus[];
const registryLookupStatus = status[index % 3];

const failedCount = registryLookupStatus === RegistryLookupStatus.SUCCESSFUL ? 0 : Math.floor(Math.random() * 100);
const successCount = registryLookupStatus === RegistryLookupStatus.ERROR ? 0 : Math.floor(Math.random() * 100);

const numberToString = (i: number) => i.toString().padStart(2, '0');
const month = index === 0 ? 1 : getRandomIntFromInterval(1, 11);
const day = index === 0 ? 1 : getRandomIntFromInterval(1, 28);
const year = index === 0 ? '2000' : '2022';

return {
registryLookupStatus,
startDate: `${ year }-${ numberToString(month) }-${ numberToString(day) }T12:34:12`,
endDate: `${ year }-${ numberToString(month + 1) }-${ numberToString(day) }T12:34:12`,

successShellDescriptorsFetchCount: failedCount,
failedShellDescriptorsFetchCount: successCount,
shellDescriptorsFetchDelta: failedCount + successCount,
};
});

export const getBpnConfig = (): BpnConfigResponse[] => [
{
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/app/modules/core/api/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ export class ApiService {
});
}

public postFile<T>(
url: string,
file: FormData,
): Observable<T> {
return this.httpClient.post<T>(url, file, {
headers: this.buildHeadersForFile(),
});
}

public put<T>(
url: string,
body?: Record<string, unknown> | unknown,
Expand Down Expand Up @@ -109,4 +118,11 @@ export class ApiService {
Authorization: this.authService.getBearerToken(),
});
}


private buildHeadersForFile(): HttpHeaders {
return new HttpHeaders({
Authorization: this.authService.getBearerToken(),
});
}
}
7 changes: 3 additions & 4 deletions frontend/src/app/modules/page/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@ import { NgModule } from '@angular/core';
import { getI18nPageProvider } from '@core/i18n';
import { AdminFacade } from '@page/admin/core/admin.facade';
import { AdminService } from '@page/admin/core/admin.service';
import { AdminState } from '@page/admin/core/admin.state';
import { SharedModule } from '@shared/shared.module';
import { TemplateModule } from '@shared/template.module';
import { AdminRoutingModule } from './admin.routing';
import { AdminComponent } from './presentation/admin.component';
import { ScheduledRegistryProcessesComponent } from './presentation/scheduled-registry-processes/scheduled-registry-processes.component';
import { BpnConfigurationComponent } from './presentation/bpn-configuration/bpn-configuration.component';
import { SaveBpnConfigModal } from './presentation/bpn-configuration/save-modal/save-modal.component';
import { ModalModule } from '@shared/modules/modal/modal.module';
import { ImportJsonComponent } from './presentation/import-json/import-json.component';

@NgModule({
declarations: [ AdminComponent, ScheduledRegistryProcessesComponent, BpnConfigurationComponent, SaveBpnConfigModal ],
declarations: [ AdminComponent, BpnConfigurationComponent, SaveBpnConfigModal, ImportJsonComponent ],
imports: [ CommonModule, TemplateModule, SharedModule, AdminRoutingModule, ModalModule ],
providers: [ ...getI18nPageProvider('page.admin'), AdminService, AdminFacade, AdminState ],
providers: [ ...getI18nPageProvider('page.admin'), AdminService, AdminFacade ],
})
export class AdminModule {
}
16 changes: 8 additions & 8 deletions frontend/src/app/modules/page/admin/admin.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,32 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { I18NEXT_NAMESPACE_RESOLVER } from 'angular-i18next';
import { ScheduledRegistryProcessesComponent } from '@page/admin/presentation/scheduled-registry-processes/scheduled-registry-processes.component';
import { KnownAdminRouts } from '@page/admin/core/admin.model';
import { KnownAdminRoutes } from '@page/admin/core/admin.model';
import { BpnConfigurationComponent } from '@page/admin/presentation/bpn-configuration/bpn-configuration.component';
import { ImportJsonComponent } from '@page/admin/presentation/import-json/import-json.component';
import { RoleGuard } from '@core/user/role.guard';

export /** @type {*} */
const ADMIN_ROUTING: Routes = [
{
path: '',
pathMatch: 'full',
redirectTo: KnownAdminRouts.REGISTRY,
redirectTo: KnownAdminRoutes.BPN,
},
{
path: KnownAdminRouts.REGISTRY,
path: KnownAdminRoutes.BPN,
pathMatch: 'full',
component: ScheduledRegistryProcessesComponent,
component: BpnConfigurationComponent,
data: { i18nextNamespaces: [ 'page.admin' ] },
resolve: { i18next: I18NEXT_NAMESPACE_RESOLVER },
canActivate: [ RoleGuard ],
},
{
path: KnownAdminRouts.BPN,
path: KnownAdminRoutes.IMPORT,
pathMatch: 'full',
component: BpnConfigurationComponent,
component: ImportJsonComponent,
data: { i18nextNamespaces: [ 'page.admin' ] },
resolve: { i18next: I18NEXT_NAMESPACE_RESOLVER },
canActivate: [ RoleGuard ],
},
];

Expand Down
19 changes: 4 additions & 15 deletions frontend/src/app/modules/page/admin/core/admin.assembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,13 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { CalendarDateModel } from '@core/model/calendar-date.model';
import { Pagination, PaginationResponse } from '@core/model/pagination.model';
import { PaginationAssembler } from '@core/pagination/pagination.assembler';
import { BpnConfig, BpnConfigResponse, RegistryProcess, RegistryProcessResponse } from '@page/admin/core/admin.model';
import _deepClone from 'lodash-es/cloneDeep';

import { BpnConfig, BpnConfigResponse} from '@page/admin/core/admin.model';


export class AdminAssembler {
public static AssembleRegistryProcess(registryProcess: RegistryProcessResponse): RegistryProcess {
const clonedProcess = _deepClone(registryProcess);
const { startDate, endDate } = clonedProcess;
return { ...clonedProcess, startDate: new CalendarDateModel(startDate), endDate: new CalendarDateModel(endDate) };
}

public static assemblePaginationRegistryProcess(
data: PaginationResponse<RegistryProcessResponse>,
): Pagination<RegistryProcess> {
return PaginationAssembler.assemblePagination(AdminAssembler.AssembleRegistryProcess, data);
}


public static assembleBpnConfig(data: BpnConfigResponse[]): BpnConfig[] {
return data.map(({ bpn, url }) => ({ bpn, url }));
Expand Down
35 changes: 7 additions & 28 deletions frontend/src/app/modules/page/admin/core/admin.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,13 @@
********************************************************************************/

import { Injectable } from '@angular/core';
import { Pagination } from '@core/model/pagination.model';
import { BpnConfig, RegistryProcess } from '@page/admin/core/admin.model';
import { BpnConfig } from '@page/admin/core/admin.model';
import { AdminService } from '@page/admin/core/admin.service';
import { AdminState } from '@page/admin/core/admin.state';
import { TableHeaderSort } from '@shared/components/table/table.model';
import { View } from '@shared/model/view.model';
import _deepClone from 'lodash-es/cloneDeep';
import { Observable, Subscription } from 'rxjs';
import { Observable} from 'rxjs';

@Injectable()
export class AdminFacade {
private scheduledRegistryProcessesSubscription: Subscription;

constructor(private readonly adminState: AdminState, private readonly adminService: AdminService) {
}

public get scheduledRegistryProcesses$(): Observable<View<Pagination<RegistryProcess>>> {
return this.adminState.scheduledRegistryProcesses$;
}

public set scheduledRegistryProcesses(view: View<Pagination<RegistryProcess>>) {
this.adminState.scheduledRegistryProcesses = _deepClone(view);
}

public setScheduledRegistryProcesses(page = 0, pageSize = 50, sorting: TableHeaderSort = null) {
this.scheduledRegistryProcessesSubscription?.unsubscribe();
this.scheduledRegistryProcessesSubscription = this.adminService
.getScheduledRegistryProcesses(page, pageSize, sorting)
.subscribe({
next: data => (this.adminState.scheduledRegistryProcesses = { data }),
error: error => (this.adminState.scheduledRegistryProcesses = { error }),
});
constructor( private readonly adminService: AdminService) {
}

public createBpnFallbackConfig(bpnConfig: BpnConfig[]): Observable<BpnConfig[]> {
Expand All @@ -69,4 +44,8 @@ export class AdminFacade {
public deleteBpnFallbackConfig(bpnId: string): Observable<void> {
return this.adminService.deleteBpnFallbackConfig(bpnId);
}

public postJsonImport(file: File): Observable<void>{
return this.adminService.postJsonFile(file);
}
}
Loading

0 comments on commit 0dc9709

Please sign in to comment.