Skip to content

Commit

Permalink
Merge pull request #554 from catenax-ng/main
Browse files Browse the repository at this point in the history
Added import data service
  • Loading branch information
ds-mmaul authored Jan 12, 2024
2 parents 30e003e + 3d33c33 commit ed0e141
Show file tree
Hide file tree
Showing 85 changed files with 6,251 additions and 1,031 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/argo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ on:
options:
- Yes
- No
trigger_registry_reload:
type: choice
description: Do You want to trigger registry reload right away?
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 @@ -138,6 +145,10 @@ jobs:
run: |
echo "### inputs" >> $GITHUB_STEP_SUMMARY
echo "- environment: ${{ github.event.inputs.environment }}" >> $GITHUB_STEP_SUMMARY
echo "- test data version: ${{ github.event.inputs.testdata_version }}" >> $GITHUB_STEP_SUMMARY
echo "- do hard refresh: ${{ github.event.inputs.hard_refresh }}" >> $GITHUB_STEP_SUMMARY
echo "- upload test data: ${{ github.event.inputs.testdata_upload }}" >> $GITHUB_STEP_SUMMARY
echo "- reload registry: ${{ github.event.inputs.trigger_registry_reload }}" >> $GITHUB_STEP_SUMMARY
hard_refresh_environment:
Expand Down Expand Up @@ -385,22 +396,23 @@ jobs:
elif [ "${{ github.event.inputs.testdata_upload }}" == "false" ]; then
echo "Testdata upload skipped"
fi
registry_reload:
needs:
- upload_testdata
runs-on: ubuntu-latest
steps:
- name: reload the registry
run: |
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
curl -X GET "$ARGO_TEST_RegistryReload"
curl -X GET "$ARGO_DEV_RegistryReload"
elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then
curl -X GET "$ARGO_E2E_A_RegistryReload"
curl -X GET "$ARGO_E2E_B_RegistryReload"
elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then
curl -X GET "$ARGO_INT_A_RegistryReload"
curl -X GET "$ARGO_INT_B_RegistryReload"
if [ "${{ github.event.inputs.trigger_registry_reload }}" == "true" ]; then
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
curl -X GET "$ARGO_TEST_RegistryReload"
curl -X GET "$ARGO_DEV_RegistryReload"
elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then
curl -X GET "$ARGO_E2E_A_RegistryReload"
curl -X GET "$ARGO_E2E_B_RegistryReload"
elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then
curl -X GET "$ARGO_INT_A_RegistryReload"
curl -X GET "$ARGO_INT_B_RegistryReload"
fi
fi
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [UNRELEASED - DD.MM.YYYY]

### Added
- Import Data Service for data provisioning
- Added UI to publish own assets

### Changed
- Fixed security findings
- Fixed deadline overlap issues for Q-investigations in update menu
- Fixed sorting of asPlanned parts
### Removed

## [10.1.0 - 22.12.2023]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
= Concept for Trace-X Data Import interface (Data Provider)

Modul 1

Modul 2
[plantuml, target=modul2-sequence, format=svg]
....
include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-sequence.puml[]
....

[plantuml, target=modul2-swimlane, format=svg]
....
include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-swimlane.puml[]
....

Modul 3
[plantuml, target=modul3-sequence, format=svg]
....
include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-sequence.puml[]
....

[plantuml, target=modul3-swimlane, format=svg]
....
include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-swimlane.puml[]
....

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@startuml
participant FE
participant BE

FE -> BE: [001] request assets: GET/assetsAsxxx
BE --> FE: [002] return assets_as_built OR assets_as_planned
FE -> FE: [003] present assets
FE -> BE: [004] select assets to synchronize: GET/policies
BE --> FE: [005] return policies
FE -> FE: [006] open detailview & assign policy (via dropdown)
FE -> BE: [007] register assets for publishing: POST/assets/sync
BE --> FE: [008] update asset state to IN_SYNC
BE -> BE: [008] trigger 'publish AAS Workflow' (Job scheduler)
FE -> FE: [009] refresh of FE view
@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@startuml
|FE|
start
:request assets;
-> GET/assetsAsxxx;
|#Mistyrose|BE|
:return assets_as_built OR assets_as_planned;
-> response;
|FE|
:present assets;
:select assets to synchronize;
-> GET/policies;
|#Mistyrose|BE|
:return policies;
-> response;
|FE|
:open detailview & assign policy (via dropdown);
:register assets for publishing;
-> POST/assets/sync;
|#Mistyrose|BE|
:update asset state to IN_SYNC;
split
:trigger 'publish AAS Workflow' (Job scheduler);
stop
|FE|
split again
:refresh of FE view;
stop
@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@startuml
participant BE
participant EDC
participant Registry
participant Submodels

BE ->> BE: [001] scheduler job
BE ->> BE: [002] receive list of IN_SYNC_assets
BE ->> EDC: [003] create asset in EDC: POST/create/asset
EDC -->> BE: [004] response
BE ->> EDC: [005] create policy in EDC: POST/create/policy
EDC -->> BE: [006] response
BE ->> EDC: [007] create contract in EDC: POST/create/contract
EDC -->> BE: [008] response
BE ->> Submodels: [009] create submodel: POST/submodel
Submodels -->> BE: [010]
BE ->> Registry: [011] register shell in registry: POST/semantics/registry
Registry -->> BE: [012]
BE ->> BE: [013] update asset state PUBLISHED_TO_CX
BE ->> BE: [014] trigger IRS sync
@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@startuml
|BE|
start
:receive list of IN_SYNC_assets;
:create asset in EDC;
-> POST/create/asset;
|#AntiqueWhite|EDC|
:create EDC asset;
|BE|
:create policy in EDC;
-> POST/create/policy;
|#AntiqueWhite|EDC|
:create policy;
|BE|
:create contract in EDC;
-> POST/create/contract;
|#AntiqueWhite|EDC|
:create contract;
|BE|
:create submodel;
-> POST/submodel;
|#Lavender|Submodel|
:create submodel;
|BE|
:register shell in registry;
|#Mistyrose|Registry|
:register shell;
-> POST/semantic/registry;
|BE|
:update asset state PUBLISHED_TO_CX;
:trigger IRS sync;
stop
@enduml
59 changes: 30 additions & 29 deletions frontend/src/app/modules/page/admin/core/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,44 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { Injectable } from '@angular/core';
import { ApiService } from '@core/api/api.service';
import { environment } from '@env';
import { AdminAssembler } from '@page/admin/core/admin.assembler';
import { BpnConfig, BpnConfigResponse} from '@page/admin/core/admin.model';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import {Injectable} from '@angular/core';
import {ApiService} from '@core/api/api.service';
import {environment} from '@env';
import {AdminAssembler} from '@page/admin/core/admin.assembler';
import {BpnConfig, BpnConfigResponse} from '@page/admin/core/admin.model';
import {Observable} from 'rxjs';
import {map} from 'rxjs/operators';

@Injectable()
export class AdminService {
private readonly url = environment.apiUrl;
private readonly url = environment.apiUrl;

constructor(private readonly apiService: ApiService) {
}
constructor(private readonly apiService: ApiService) {
}


public createBpnFallbackConfig(bpnConfig: BpnConfig[]): Observable<BpnConfig[]> {
return this.apiService.post<BpnConfig[]>(`${ this.url }/bpn-config`, bpnConfig);
}
public createBpnFallbackConfig(bpnConfig: BpnConfig[]): Observable<BpnConfig[]> {
return this.apiService.post<BpnConfig[]>(`${this.url}/bpn-config`, bpnConfig);
}

public readBpnFallbackConfig(): Observable<BpnConfig[]> {
return this.apiService
.get<BpnConfigResponse[]>(`${ this.url }/bpn-config`)
.pipe(map(data => AdminAssembler.assembleBpnConfig(data)));
}
public readBpnFallbackConfig(): Observable<BpnConfig[]> {
return this.apiService
.get<BpnConfigResponse[]>(`${this.url}/bpn-config`)
.pipe(map(data => AdminAssembler.assembleBpnConfig(data)));
}

public updateBpnFallbackConfig(bpnConfig: BpnConfig[]): Observable<BpnConfig[]> {
return this.apiService.put<BpnConfig[]>(`${ this.url }/bpn-config`, bpnConfig);
}
public updateBpnFallbackConfig(bpnConfig: BpnConfig[]): Observable<BpnConfig[]> {
return this.apiService.put<BpnConfig[]>(`${this.url}/bpn-config`, bpnConfig);
}

public deleteBpnFallbackConfig(bpn: string): Observable<void> {
return this.apiService.delete<void>(`${ this.url }/bpn-config/${ bpn }`);
}
public deleteBpnFallbackConfig(bpn: string): Observable<void> {
return this.apiService.delete<void>(`${this.url}/bpn-config/${bpn}`);
}

public postJsonFile(file: File): Observable<any> {
const formData = new FormData();
formData.append('file', file);
return this.apiService.postFile(`${this.url}/assets/import`, formData);
}

public postJsonFile(file: File): Observable<void>{
const formData = new FormData();
formData.append('file', file);
return this.apiService.postFile(`${ this.url }/assets/import`, formData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,95 @@
-->

<mat-card>
<mat-card-header>
<mat-card-title
><h3>{{ 'pageAdmin.importJson.title' | i18n }}</h3></mat-card-title
>
</mat-card-header>
<mat-card-content>
<div class="import-json">
<div class="file-container_drag_and_drop" *ngIf="!shouldShowFileContainer_upload_file(file)">
<mat-icon>upload</mat-icon>
<input type="file" (change)="getFile($event)" class="file" />
<h4>{{ 'pageAdmin.importJson.Drag_and_Drop' | i18n }}</h4>
<p class="or">{{ 'pageAdmin.importJson.or' | i18n }}</p>
<div class="text-box">
<p class="text-box-p">{{ 'pageAdmin.importJson.browseFiles' | i18n }}</p>
</div>
<p class="error-message" *ngIf=" showError">{{ 'pageAdmin.importJson.error' | i18n }}</p>
</div>

<div class="file-container_upload_file" *ngIf="shouldShowFileContainer_upload_file(file)">
<mat-icon class="icon_uploadFile">upload_file</mat-icon>
<p class="file-name">{{file.name}}</p>
<app-button variant="raised" class="custom-button_clear" color="warn" (click)="clearFile()">{{ 'pageAdmin.importJson.clear_file' | i18n }}</app-button>
<app-button variant="raised" class="custom-button_upload" color="primary" (click)="uploadFile(file)">{{ 'pageAdmin.importJson.upload_file' | i18n }}</app-button>
</div>
</div>
</mat-card-content>
<mat-card-header>
<mat-card-title
><h3 class="mb-2">{{ 'pageAdmin.importJson.title' | i18n }}</h3></mat-card-title
>
</mat-card-header>
<mat-card-content>
<div class="import-container">
<ng-container *ngIf="displayUploader">
<div class="import-json">
<div class="file-container_drag_and_drop" *ngIf="!shouldShowFileContainer_upload_file(file)">
<mat-icon>upload</mat-icon>
<input type="file" (change)="getFile($event)" class="file" accept=".json"/>
<h4>{{ 'pageAdmin.importJson.Drag_and_Drop' | i18n }}</h4>
<p class="or">{{ 'pageAdmin.importJson.or' | i18n }}</p>
<div class="text-box">
<p class="text-box-p">{{ 'pageAdmin.importJson.browseFiles' | i18n }}</p>
</div>
<p class="error-message" *ngIf=" showError">{{ 'pageAdmin.importJson.error' | i18n }}</p>
</div>

<div class="file-container_upload_file" *ngIf="shouldShowFileContainer_upload_file(file)">
<mat-icon class="icon_uploadFile">upload_file</mat-icon>
<p class="file-name">{{file.name}}</p>
<app-button variant="raised" class="custom-button_clear" color="warn"
(click)="clearFile()">{{ 'pageAdmin.importJson.clear_file' | i18n }}</app-button>
<app-button variant="raised" class="custom-button_upload" color="primary"
(click)="uploadFile(file)">{{ 'pageAdmin.importJson.upload_file' | i18n }}</app-button>
</div>
</div>
</ng-container>
<ng-container *ngIf="assetResponse.length">
<div class="status-container">
<app-button variant="stroked" class="custom-button_upload" color="primary"
(click)="displayUploader = true; clearFile()">{{'pageAdmin.importStatus.uploadMore' | i18n}}</app-button>
<div class="status-assets-container mt-2">
<h4 class="pb-2.5">{{ 'pageAdmin.importStatus.importStatus' | i18n }}:</h4>
<div class="status-content pb-0.5">
<section class="import-report-content-container">
<table mat-table
[dataSource]="assetResponse"
aria-describedby="importResponseTable"
>
<ng-container matColumnDef="catenaXId">
<th mat-header-cell *matHeaderCellDef> {{'pageAdmin.importStatus.catenaXId' | i18n}}</th>
<td mat-cell *matCellDef="let entry">{{entry.catenaXId}}</td>
</ng-container>
<ng-container matColumnDef="import-status">
<th mat-header-cell *matHeaderCellDef>{{'pageAdmin.importStatus.status' | i18n}}</th>
<td mat-cell
*matCellDef="let entry">{{entry.persistedOrUpdated ? ('pageAdmin.importStatus.imported' | i18n) : ('pageAdmin.importStatus.skipped' | i18n)}}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="importedAssetsDisplayedColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: importedAssetsDisplayedColumns;"></tr>
</table>
</section>
</div>
</div>
</div>
</ng-container>
<ng-container *ngIf="errorValidationErrors.length">
<div class="status-validation-container">
<h4 class="pb-2.5">{{'pageAdmin.importStatus.validationReport' | i18n}}:</h4>

<div class="status-validation-import_state_message-container">
<span class="font-semiBold pr-1 pb-1">{{'pageAdmin.importStatus.importStateMessage' | i18n}}</span>
<div>{{errorImportStateMessage.length ? errorImportStateMessage : ('pageAdmin.importStatus.noImportStateMessage' | i18n)}}</div>
</div>

<div class="status-validation-validation_errors-container">
<table mat-table
[dataSource]="errorValidationErrors"
aria-describedby="importValidationErrorsTable"
>
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef>{{'pageAdmin.importStatus.errors' | i18n}}</th>
<td mat-cell *matCellDef="let i=index">{{i+1}}</td>
</ng-container>
<ng-container matColumnDef="description">
<th mat-header-cell *matHeaderCellDef>{{'pageAdmin.importStatus.description' | i18n}}</th>
<td mat-cell
*matCellDef="let errorDescription" class="text-error">{{errorDescription}}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="validationErrorsDisplayedColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: validationErrorsDisplayedColumns;"></tr>
</table>
</div>
</div>
</ng-container>
</div>
</mat-card-content>
</mat-card>

Loading

0 comments on commit ed0e141

Please sign in to comment.