Skip to content

Commit

Permalink
Merge pull request #1 from catenax-ng/sonar
Browse files Browse the repository at this point in the history
chr: use SONAR_PROJECT_KEY and SONAR_ORGANIZATION env vars in build
  • Loading branch information
dblankevia authored Feb 2, 2023
2 parents d694f18 + 6e69f3c commit 66ea1d2
Show file tree
Hide file tree
Showing 27 changed files with 230 additions and 85 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/kics.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "KICS"

on:
workflow_dispatch:
push:
branches: [main, master]
# pull_request:
Expand Down Expand Up @@ -29,6 +30,10 @@ jobs:
with:
# Scanning directory .
path: "."
# Excluded paths:
# - docker-compose.yml - used only on local env
# - in cypress dir docker related files used only on local env
exclude_paths: "docker-compose.yml,cypress/docker-compose.yml,cypress/Dockerfile"
# Fail on HIGH severity results
fail_on: high
# Disable secrets detection - we use GitGuardian
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,19 @@ jobs:
cmd: install # will run `yarn install` command
- name: Run npm test:ci
run: CHROMIUM_BIN=$(which chrome) npm run test:ci # will run `test:ci` command
- uses: SonarSource/sonarcloud-github-action@master
- name: Run SonarCloud with organzation and project key from environment
uses: SonarSource/sonarcloud-github-action@master
if: ${{ vars.SONAR_ORGANIZATION != '' && vars.SONAR_PROJECT_KEY != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=${{ vars.SONAR_ORGANIZATION }}
-Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }}
- name: Run SonarCloud with hardcoded organization and project key
uses: SonarSource/sonarcloud-github-action@master # Fallback for the catenax-ng/product-traceability-foss-frontend
if: ${{ vars.SONAR_ORGANIZATION == '' || vars.SONAR_PROJECT_KEY == '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
20 changes: 20 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#Authors

The following people have contributed to this repository:

- Blazej Kepa,doubleSlash Net-Business GmbH,https://github.com/ds-ext-bkepa
- Dirk Blank,evia consulting GmbH,https://github.com/dblankevia
- Fabian Bedarf,evia consulting GmbH,https://github.com/evia-fbedarf
- Jedrzej Serwa,doubleSlash Net-Business GmbH,https://github.com/ds-ext-jserwa
- Martin Kanal,doubleSlash Net-Business GmbH,https://github.com/mkanal
- Anton Kononenko,doubleSlash Net-Business GmbH,https://github.com/ds-ext-akononenko
- Sebastian Scherer,Mercedes-Benz Group AG,https://github.com/the-tatanka
- Ivan Emelianov,T-Systems International GmbH,https://github.com/Anacin
- Sebastian Bezold,Mercedes-Benz Group AG,https://github.com/SebastianBezold
- Gregor Stelzer,msg DAVID GmbH,https://github.com/gregors101
- Darek Skrzypczak,doubleSlash Net-Business GmbH,https://github.com/ds-ext-dskrzypczak
- Nobert Geczi,msg Systems Romania SRL,https://github.com/norbertgeczi
- Markus Kreuz,FEV Consulting GmbH,https://github.com/CXkreuz
- Thomas Braun,ZF Friedrichshafen AG,https://github.com/tbraun-zf


28 changes: 28 additions & 0 deletions charts/product-traceability-foss-frontend/values-dev-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

image:
tag: $ARGOCD_APP_REVISION
CATENAX_PORTAL_API_URL: 'https://traceability-test.dev.demo.catena-x.net/api'
CATENAX_PORTAL_KEYCLOAK_URL: 'https://centralidp.dev.demo.catena-x.net/auth'
CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part'
CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central'

nameOverride: "product-traceability-foss-test-frontend"
fullnameOverride: "product-traceability-foss-test-frontend"

autoscaling:
enabled: false

ingress:
enabled: true
className: "nginx"
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hosts:
- host: "traceability-portal-test.dev.demo.catena-x.net"
paths:
- path: /
pathType: ImplementationSpecific
tls:
- hosts:
- "traceability-portal-test.dev.demo.catena-x.net"
secretName: "traceability-portal-test.dev.demo.catena-x.net-tls"
2 changes: 1 addition & 1 deletion charts/product-traceability-foss-frontend/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ingress:
- host: "traceability-portal.dev.demo.catena-x.net"
paths:
- path: /
pathType: Prefix
pathType: ImplementationSpecific
tls:
- hosts:
- "traceability-portal.dev.demo.catena-x.net"
Expand Down
27 changes: 27 additions & 0 deletions charts/product-traceability-foss-frontend/values-int-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
image:
tag: $ARGOCD_APP_REVISION
CATENAX_PORTAL_API_URL: 'https://traceability-test.int.demo.catena-x.net/api'
CATENAX_PORTAL_KEYCLOAK_URL: 'https://centralidp.int.demo.catena-x.net/auth'
CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part'
CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central'

nameOverride: "product-traceability-foss-test-frontend"
fullnameOverride: "product-traceability-foss-test-frontend"

autoscaling:
enabled: false

ingress:
enabled: true
className: "nginx"
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hosts:
- host: "traceability-portal-test.int.demo.catena-x.net"
paths:
- path: /
pathType: ImplementationSpecific
tls:
- hosts:
- "traceability-portal-test.int.demo.catena-x.net"
secretName: "traceability-portal-test.int.demo.catena-x.net-tls"
2 changes: 1 addition & 1 deletion charts/product-traceability-foss-frontend/values-int.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ingress:
- host: "traceability-portal.int.demo.catena-x.net"
paths:
- path: /
pathType: Prefix
pathType: ImplementationSpecific
tls:
- hosts:
- "traceability-portal.int.demo.catena-x.net"
Expand Down
6 changes: 5 additions & 1 deletion cypress/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# DISCLAIMER!
# purpose of this file is to run cypress E2E tests locally, we don't use it in other env
# because of statement above, we don't need to change settings to comply with some KICS requirements


# if you need to change image please make sure use the same version in all places
# (here and in .github/workflows/e2e-tests.yml)
Expand All @@ -8,6 +12,7 @@
# but cypress/included:12.3.0 version base on cypress/browsers:node16.16.0-chrome107-ff107-edge
FROM cypress/included:12.3.0

USER root
RUN mkdir /ng-app
WORKDIR /ng-app

Expand All @@ -18,4 +23,3 @@ COPY yarn.lock /ng-app/yarn.lock
RUN yarn install
# https://docs.cypress.io/guides/guides/launching-browsers#Linux-Dependencies
RUN npx playwright install --with-deps webkit

23 changes: 19 additions & 4 deletions cypress/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
# DISCLAIMER!
# purpose of this file is to run cypress E2E tests locally, we don't use it in other env
# because of statement above, we don't need to change settings to comply with some KICS requirements

version: "3.9"
services:
cypress:
build:
context: ../
dockerfile: cypress/Dockerfile

volumes:
- ../:/ng-app/
- /ng-app/node_modules/ # we don't want to override it by host machine
security_opt:
- label:user:testuser
- no-new-privileges:true
network_mode: host # important to be able to connect to localhost url on host machine


networks:
TRACE_X_FE:
# to comply with KICS requirement:
# [MEDIUM] Memory Not Limited
# Memory limits should be defined for each container. This prevents potential resource exhaustion by ensuring that containers consume not more than the designated amount of memory
deploy:
resources:
limits:
cpus: "4"
memory: "1024M"
reservations:
cpus: "2"
memory: "512M"
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# DISCLAIMER!
# purpose of this file is to run services locally, we don't use it in other env
# because of statement above, we don't need to change settings to comply with some KICS requirements

version: "3.9"
services:
keycloak:
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,21 @@
"@testing-library/angular": "11.0.4",
"@testing-library/jasmine-dom": "1.2.0",
"@types/d3": "7.4.0",
"@types/jasmine": "4.3.0",
"@types/jasmine": "4.3.1",
"@types/luxon": "2.3.2",
"@types/node": "18.11.4",
"@types/testing-library__jasmine-dom": "^1.0.3",
"@typescript-eslint/eslint-plugin": "5.48.0",
"@typescript-eslint/parser": "5.17.0",
"cypress": "^12.3.0",
"@typescript-eslint/parser": "5.49.0",
"cypress": "^12.4.0",
"eslint": "8.28.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsdoc": "39.6.4",
"eslint-plugin-prefer-arrow": "1.2.3",
"husky": "8.0.2",
"jasmine-core": "4.3.0",
"karma": "6.4.0",
"karma": "6.4.1",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.2.0",
"karma-jasmine": "5.1.0",
Expand All @@ -107,7 +107,7 @@
"msw": "0.48.0",
"playwright-webkit": "^1.29.2",
"postcss-import": "15.1.0",
"postcss-loader": "7.0.1",
"postcss-loader": "7.0.2",
"postcss-scss": "4.0.4",
"prettier": "2.7.1",
"stylelint": "14.8.2",
Expand Down
1 change: 0 additions & 1 deletion src/app/modules/core/layout/layout.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const routes: Routes = [
loadChildren: () => import('../../page/investigations/investigations.module').then(m => m.InvestigationsModule),
data: {
breadcrumb: 'investigations',
roles: ['wip'],
},
canActivate: [RoleGuard],
},
Expand Down
12 changes: 5 additions & 7 deletions src/app/modules/core/layout/sidebar/sidebar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
<div class="sidebar-content">
<div [class.openAnimation]="this.expanded" [class.closeAnimation]="!this.expanded" class="scrollable">
<ul class="sidebar-menu-container">
<ng-container *ngTemplateOutlet="listItem; context: { name: 'dashboard' }"> </ng-container>
<ng-container *ngTemplateOutlet="listItem; context: { name: 'parts', icon: 'build' }"> </ng-container>
<ng-container *ngTemplateOutlet="listItem; context: { name: 'otherParts', icon: 'commute' }"> </ng-container>
<ng-container
*ngTemplateOutlet="listItem; context: { name: 'investigations', icon: 'inbox', role: 'wip' }"
></ng-container>
<ng-container *ngTemplateOutlet="listItem; context: { name: 'dashboard' }"></ng-container>
<ng-container *ngTemplateOutlet="listItem; context: { name: 'parts', icon: 'build' }"></ng-container>
<ng-container *ngTemplateOutlet="listItem; context: { name: 'otherParts', icon: 'commute' }"></ng-container>
<ng-container *ngTemplateOutlet="listItem; context: { name: 'investigations', icon: 'inbox' }"></ng-container>
</ul>
</div>
<div class="flex-auto"></div>
Expand All @@ -37,7 +35,7 @@
<ng-container
*ngTemplateOutlet="listItem; context: { name: 'admin', icon: 'apps', role: 'admin' }"
></ng-container>
<ng-container *ngTemplateOutlet="listItem; context: { name: 'about', icon: 'info' }"> </ng-container>
<ng-container *ngTemplateOutlet="listItem; context: { name: 'about', icon: 'info' }"></ng-container>
</ul>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
********************************************************************************/

import { Injectable } from '@angular/core';
import { RoleService } from '@core/user/role.service';
import { CountryLocationMap, PartsCoordinates } from '@page/dashboard/presentation/map/map.model';
import { Notifications } from '@shared/model/notification.model';
import { View } from '@shared/model/view.model';
Expand All @@ -43,7 +42,6 @@ export class DashboardFacade {
private readonly dashboardState: DashboardState,
private readonly partsService: PartsService,
private readonly investigationsService: InvestigationsService,
private readonly roleService: RoleService,
) {}

public get numberOfMyParts$(): Observable<View<number>> {
Expand All @@ -69,9 +67,7 @@ export class DashboardFacade {
public setDashboardData(): void {
this.setAssetNumbers();
this.setAssetsPerCountry();
if (this.roleService.hasAccess('wip')) {
this.setInvestigations();
}
this.setInvestigations();
}

private setAssetNumbers(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</ng-container>
</section>

<section *appHasRole="['wip']" class="parts-section">
<section class="parts-section">
<ng-container
*viewContainer="
this.numberOfInvestigations$ | async;
Expand All @@ -60,7 +60,7 @@
</ng-container>
</section>

<section *appHasRole="['wip']" class="dashboard--investigation">
<section class="dashboard--investigation">
<div class="flex justify-between items-center">
<h3 class="mb-4 flex items-center">
<mat-icon>find_in_page</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ describe('Dashboard', () => {

describe('investigations', () => {
it('should render investigation component', async () => {
await renderDashboard({ roles: ['wip'] });
await renderDashboard();

expect(await screen.findByText('Quality Investigations')).toBeInTheDocument();
});

it('should render count for investigations', async () => {
await renderDashboard({ roles: ['wip'] });
await renderDashboard();

expect(await screen.findByText('20')).toBeInTheDocument();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@ export class InvestigationHelperService {
}

public showApproveButton({ status, isFromSender } = {} as Notification): boolean {
return isFromSender && status === NotificationStatus.CREATED && this.roleService.isAtLeastSupervisor();
return /*isFromSender &&*/ status === NotificationStatus.CREATED && this.roleService.isAtLeastSupervisor();
}

public showCancelButton({ status, isFromSender } = {} as Notification): boolean {
return isFromSender && status === NotificationStatus.CREATED && this.roleService.isAtLeastSupervisor();
return /*isFromSender &&*/ status === NotificationStatus.CREATED && this.roleService.isAtLeastSupervisor();
}

public showCloseButton({ status, isFromSender } = {} as Notification): boolean {
const disallowedStatus = [NotificationStatus.CREATED, NotificationStatus.CLOSED, NotificationStatus.CANCELED];
return isFromSender && !disallowedStatus.includes(status) && this.roleService.isAtLeastSupervisor();
return /*isFromSender &&*/ !disallowedStatus.includes(status) && this.roleService.isAtLeastSupervisor();
}
public showAcknowledgeButton({ status, isFromSender } = {} as Notification): boolean {
return !isFromSender && status === NotificationStatus.RECEIVED && this.roleService.isAtLeastSupervisor();
return /*!isFromSender &&*/ status === NotificationStatus.RECEIVED && this.roleService.isAtLeastSupervisor();
}
public showAcceptButton({ status, isFromSender } = {} as Notification): boolean {
return !isFromSender && status === NotificationStatus.ACKNOWLEDGED && this.roleService.isAtLeastSupervisor();
return /*!isFromSender &&*/ status === NotificationStatus.ACKNOWLEDGED && this.roleService.isAtLeastSupervisor();
}
public showDeclineButton({ status, isFromSender } = {} as Notification): boolean {
return !isFromSender && status === NotificationStatus.ACKNOWLEDGED && this.roleService.isAtLeastSupervisor();
return /*!isFromSender &&*/ status === NotificationStatus.ACKNOWLEDGED && this.roleService.isAtLeastSupervisor();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
></ng-container>
</mat-tab>

<mat-tab>
<mat-tab *appHasRole="['wip']">
<ng-template mat-tab-label>
<span [id]="customerTabLabelId">{{ 'pageParts.tab.customer' | i18n }} </span>
</ng-template>
Expand Down
Loading

0 comments on commit 66ea1d2

Please sign in to comment.