Skip to content

Commit

Permalink
Merge pull request #366 from catenax-ng/main
Browse files Browse the repository at this point in the history
Added filtering capabilities and dashboard enhancements
  • Loading branch information
ds-mwesener authored Nov 28, 2023
2 parents c1aacf6 + 293b8b2 commit 37c86ff
Show file tree
Hide file tree
Showing 84 changed files with 7,088 additions and 6,119 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/argo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ on:
argo_token:
description: Argo Token
required: true
api-token:
description: Api Token
required: true

env:
ARGO_TEST_REGISTRY: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-dt-registry-test"
Expand Down Expand Up @@ -247,6 +250,7 @@ jobs:
ARGO_TOKEN=$(jq -r '.inputs.argo_token' $GITHUB_EVENT_PATH)
echo ::add-mask::$ARGO_TOKEN
echo ARGO_TOKEN=$ARGO_TOKEN >> $GITHUB_ENV
- name: test apps state
run: |
source ./.github/argo/argo_config.sh
Expand Down Expand Up @@ -297,25 +301,31 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.11'


- name: mask token
run: |
API_TOKEN=$(jq -r '.inputs.api-token' $GITHUB_EVENT_PATH)
echo ::add-mask::$API_TOKEN
echo API_TOKEN=$API_TOKEN >> $GITHUB_ENV
- name: Upload testdata
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 }}
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 ${{ env.API_TOKEN }}
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 }}
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 ${{ env.API_TOKEN }}
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 }}
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 ${{ env.API_TOKEN }}
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 }}
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 ${{ env.API_TOKEN }}
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 }}
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 ${{ env.API_TOKEN }}
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 }}
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 ${{ env.API_TOKEN }}
sleep 10
fi
registry_reload:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,42 @@ jobs:
run: echo HELM_VERSION=$(cat charts/traceability-foss/CHANGELOG.md | sed -n 's/.*\[\([0-9]\+\.[0-9]\+\.[0-9]\+\)\].*/\1/p' | head -n 1) >> $GITHUB_ENV

- name: Update Chart.yaml appVersion
uses: mikefarah/yq@v4.35.2
uses: mikefarah/yq@v4.40.2
with:
cmd: yq -i eval '.appVersion = "${{ github.ref_name }}"' charts/traceability-foss/Chart.yaml

- name: Update Chart.yaml version
uses: mikefarah/yq@v4.35.2
uses: mikefarah/yq@v4.40.2
with:
cmd: yq -i eval '.version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/Chart.yaml

- name: Update frontend dependency version in Chart.yaml
uses: mikefarah/yq@v4.35.2
uses: mikefarah/yq@v4.40.2
with:
cmd: yq -i eval '.dependencies[0].version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/Chart.yaml

- name: Update backend dependency version in Chart.yaml
uses: mikefarah/yq@v4.35.2
uses: mikefarah/yq@v4.40.2
with:
cmd: yq -i eval '.dependencies[1].version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/Chart.yaml

- name: Update frontend version in frontend/Chart.yaml
uses: mikefarah/yq@v4.35.2
uses: mikefarah/yq@v4.40.2
with:
cmd: yq -i eval '.version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/charts/frontend/Chart.yaml

- name: Update frontend appVersion in frontend/Chart.yaml
uses: mikefarah/yq@v4.35.2
uses: mikefarah/yq@v4.40.2
with:
cmd: yq -i eval '.appVersion = "${{ github.ref_name }}"' charts/traceability-foss/charts/frontend/Chart.yaml

- name: Update backend version in backend/Chart.yaml
uses: mikefarah/yq@v4.35.2
uses: mikefarah/yq@v4.40.2
with:
cmd: yq -i eval '.version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/charts/backend/Chart.yaml

- name: Update backend appVersion in frontend/Chart.yaml
uses: mikefarah/yq@v4.35.2
uses: mikefarah/yq@v4.40.2
with:
cmd: yq -i eval '.appVersion = "${{ github.ref_name }}"' charts/traceability-foss/charts/backend/Chart.yaml

Expand Down
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,35 @@ 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
- new filtering capabilities ( receivedQualityAlertIdsInStatusActive, sentQualityAlertIdsInStatusActive, receivedQualityInvestigationIdsInStatusActive, sentQualityInvestigationIdsInStatusActive )
- Validation check if table-settings correct and reset on invalid state
- Added Api-Input in Argo Workflow to fix bugs
### Changed
- Filter configuration for tables to be resuable and easy to adapt
- Realigned some mappings e.g. (manufacturer / manufacturerName) to be more clear
- Updated mikefarah/yq from 4.35.2 to 4.40.2
- Upgraded maven-checkstyle-plugin from 3.3.0 to 3.3.1
- Upgraded nimbus-jose-jwt from 9.31 to 9.37.1
- Upgraded maven-install-plugin from 3.0.1 to 3.1.1
- Upgraded json-unit-assertj from 2.38.0 to 3.2.2
- Upgraded asciidoctorj-diagram from 2.2.9 to 2.2.13

### Removed
- removed asset filters ( qualityInvestigationIdsInStatusActive, qualityInvestigationIdsInStatusActive )

## [9.0.0-rc4 - xx.xx.2023]
### Added
- Added new dashboard layout and additional widgets
- Refactored dashboard response

## [9.0.0-rc3 - 27.11.2023]
### Added
- DEPENDENCIES_FRONTEND, SECURITY.md, NOTICE.md, LICENSE file to frontend docker image
- Added a step-by-step guide to register a server in pgAdmin in the database dump README
- Documentation about technical users
- Added new dashboard layout and additional widgets

### Changed
- Fixed helm repository path for backend & frontend (wrong prefix)
- Refactored dashboard response
- Updated user manual
- Autocomplete endpoints changed owner String type param to Owner for input validation and sql injection prevention
- Autocomplete endpoints repository uses now criteria api rather than native query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,80 +19,84 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import type { NotificationResponse } from '@shared/model/notification.model';
import { NotificationStatus, NotificationType } from '@shared/model/notification.model';
import { Severity } from '@shared/model/severity.model';
import { getRandomAsset } from '../parts-mock/partsAsPlanned/partsAsPlanned.model';
import { MOCK_part_1 } from '../parts-mock/partsAsPlanned/partsAsPlanned.test.model';
import { getRandomIntFromInterval, getRandomText } from '../text-generator.helper';
import type {NotificationResponse} from '@shared/model/notification.model';
import {NotificationStatus, NotificationType} from '@shared/model/notification.model';
import {Severity} from '@shared/model/severity.model';
import {getRandomAsset} from '../parts-mock/partsAsPlanned/partsAsPlanned.model';
import {MOCK_part_1} from '../parts-mock/partsAsPlanned/partsAsPlanned.test.model';
import {getRandomIntFromInterval, getRandomText} from '../text-generator.helper';

export const InvestigationIdPrefix = 'id-';

// TODO: rethink this approach
const severities = [Severity.MINOR, Severity.MAJOR, Severity.CRITICAL, Severity.LIFE_THREATENING];

export const buildMockInvestigations = (
statuses: NotificationStatus[],
channel: 'SENDER' | 'RECEIVER',
statuses: NotificationStatus[],
channel: 'SENDER' | 'RECEIVER',
): NotificationResponse[] =>
new Array(101).fill(null).map((_, index) => {
const status = statuses[index % statuses.length];
const severity = severities[index % severities.length];
// every 10th alert should have an error
const errorInvestigation = (index+1) % 10 === 0 ? "The Services returned an Error while processing this Investigation" : undefined;
new Array(101).fill(null).map((_, index) => {
const status = statuses[index % statuses.length];
const severity = severities[index % severities.length];
// every 10th alert should have an error
const errorInvestigation = (index + 1) % 10 === 0 ? "The Services returned an Error while processing this Investigation" : undefined;

const close = status === NotificationStatus.CLOSED ? getRandomText(getRandomIntFromInterval(15, 500)) : '';
const isDeclined = Math.random() >= 0.5;
const close = status === NotificationStatus.CLOSED ? getRandomText(getRandomIntFromInterval(15, 500)) : '';
const isDeclined = Math.random() >= 0.5;

const decline =
status === NotificationStatus.DECLINED || (!!close && isDeclined)
? getRandomText(getRandomIntFromInterval(15, 500))
: '';
const decline =
status === NotificationStatus.DECLINED || (!!close && isDeclined)
? getRandomText(getRandomIntFromInterval(15, 500))
: '';

const accept =
status === NotificationStatus.ACCEPTED || (!!close && !isDeclined)
? getRandomText(getRandomIntFromInterval(15, 500))
: '';
const accept =
status === NotificationStatus.ACCEPTED || (!!close && !isDeclined)
? getRandomText(getRandomIntFromInterval(15, 500))
: '';

const numberToString = (i: number) => i.toString().padStart(2, '0');
const month = getRandomIntFromInterval(1, 12);
const day = getRandomIntFromInterval(1, 27);
const numberToString = (i: number) => i.toString().padStart(2, '0');
const month = getRandomIntFromInterval(1, 12);
const day = getRandomIntFromInterval(1, 27);

return {
id: `${InvestigationIdPrefix}${index + 1}`,
description: `Investigation No ${index + 1} ${getRandomText(getRandomIntFromInterval(15, 500))}`,
status,
severity,
channel,
createdBy: 'BPN10000000OEM0A',
createdByName: 'OEM xxxxxxxxxxxxxxx A',
sendTo: 'BPN20000000OEM0B',
sendToName: 'OEM xxxxxxxxxxxxxxx B',
reason: { close, decline, accept },
createdDate: `2022-${numberToString(month)}-${numberToString(day)}T12:34:12`,
targetDate: `2022-${numberToString(month)}-${numberToString(day + 1)}T11:34:12Z`,
assetIds: [MOCK_part_1.id, getRandomAsset().id, getRandomAsset().id, getRandomAsset().id],
errorMessage: errorInvestigation,
notificationType: NotificationType.INVESTIGATION,
};
});
return {
id: `${InvestigationIdPrefix}${index + 1}`,
description: `Investigation No ${index + 1} ${getRandomText(getRandomIntFromInterval(15, 500))}`,
status,
severity,
channel,
createdBy: 'BPN10000000OEM0A',
createdByName: 'OEM xxxxxxxxxxxxxxx A',
sendTo: 'BPN20000000OEM0B',
sendToName: 'OEM xxxxxxxxxxxxxxx B',
reason: {close, decline, accept},
createdDate: `2022-${numberToString(month)}-${numberToString(day)}T12:34:12`,
targetDate: `2022-${numberToString(month)}-${numberToString(day + 1)}T11:34:12Z`,
assetIds: [MOCK_part_1.id, getRandomAsset().id, getRandomAsset().id, getRandomAsset().id],
errorMessage: errorInvestigation,
notificationType: NotificationType.INVESTIGATION,
};
});

const MockEmptyInvestigation: NotificationResponse = {
id: `${InvestigationIdPrefix}000`,
description: `Investigation No 000`,
status: NotificationStatus.CREATED,
severity: Severity.MINOR,
createdBy: 'BPN10000000OEM0A',
createdByName: 'OEM xxxxxxxxxxxxxxx A',
sendTo: 'BPN20000000OEM0B',
sendToName: 'OEM xxxxxxxxxxxxxxx B',
reason: { close: '', decline: '', accept: '' },
createdDate: `2022-05-01T12:34:12`,
targetDate: `2022-02-01T12:34:12`,
assetIds: [getRandomAsset().id],
channel: 'SENDER',
id: `${InvestigationIdPrefix}000`,
description: `Investigation No 000`,
status: NotificationStatus.CREATED,
severity: Severity.MINOR,
createdBy: 'BPN10000000OEM0A',
createdByName: 'OEM xxxxxxxxxxxxxxx A',
sendTo: 'BPN20000000OEM0B',
sendToName: 'OEM xxxxxxxxxxxxxxx B',
reason: {close: '', decline: '', accept: ''},
createdDate: `2022-05-01T12:34:12`,
targetDate: `2022-02-01T12:34:12`,
assetIds: [getRandomAsset().id],
channel: 'SENDER',
};

export interface NotificationFilter {
notificationIds: string[]
}

export const getInvestigationById = (id: string) => {
return [].find(investigation => investigation.id === id) || { ...MockEmptyInvestigation, id };
return [].find(investigation => investigation.id === id) || {...MockEmptyInvestigation, id};
};
Loading

0 comments on commit 37c86ff

Please sign in to comment.