Skip to content

Commit

Permalink
Merge pull request #10 from catenax-ng/main
Browse files Browse the repository at this point in the history
Create New Version with fixes
  • Loading branch information
SebastianBezold authored Mar 6, 2023
2 parents ae79385 + 17043cc commit 1211db0
Show file tree
Hide file tree
Showing 40 changed files with 438 additions and 377 deletions.
44 changes: 20 additions & 24 deletions .env
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
REACT_URL_ENV=http://localhost:8080
REACT_APP_AUTH_URL=http://localhost:8080/auth
REACT_APP_PORTAL_URL=http://localhost:8080/auth
REACT_APP_PORTAL_BACKEND_URL=http://localhost:8080/auth
REACT_APP_DASHBOARD_URL=${REACT_URL_ENV}/api/dashboard/getTableInfo?
REACT_APP_DASHBOARD_URL_RATINGSTABLE=${REACT_URL_ENV}/api/dashboard/ratingsByYear?
REACT_APP_DATEFORM_URL=${REACT_URL_ENV}/api/dashboard/allYears
REACT_APP_DASHBOARD_WOLRD_MAP_URL=${REACT_URL_ENV}/api/dashboard/getWorldMap?
REACT_APP_DASHBOARD_FILE_TEMPLATE_DOWNLOAD=${REACT_URL_ENV}/api/dashboard/getTemplate?
REACT_APP_GET_RANGES=${REACT_URL_ENV}/api/dashboard/getUserRanges?
REACT_APP_SAVE_RANGES=${REACT_URL_ENV}/api/dashboard/saveUserRanges?
REACT_APP_UPLOAD_FILE=${REACT_URL_ENV}/api/dashboard/uploadCsv?
REACT_APP_GET_COUNTRYS=${REACT_URL_ENV}/api/dashboard/getCountryFilterByISO2?
REACT_APP_GET_BPN_COUNTRYS=${REACT_URL_ENV}/api/dashboard/getBpnCountrys?
REACT_APP_GET_BPNS=${REACT_URL_ENV}/api/dashboard/getCompanyBpns?
REACT_APP_GET_REPORTS_BY_USER=${REACT_URL_ENV}/api/dashboard/getReportsByCompanyUser?
REACT_APP_GET_REPORT_VALUES_BY_REPORT=${REACT_URL_ENV}/api/dashboard/getReportsValueByReport?
REACT_APP_SAVE_REPORTS=${REACT_URL_ENV}/api/dashboard/saveReports?
REACT_APP_SHARE_REPORTS=${REACT_URL_ENV}/api/dashboard/shareReport?
REACT_APP_UPDATE_REPORTS=${REACT_URL_ENV}/api/dashboard/updateReports?
REACT_APP_DELETE_REPORTS=${REACT_URL_ENV}/api/dashboard/deleteReport
REACT_APP_GET_USER_BPDM_GATES=${REACT_URL_ENV}/api/dashboard/getAllUserBPDMGates?
REACT_APP_DELETE_RATINGS=${REACT_URL_ENV}/api/dashboard/deleteRating
REACT_APP_GET_COMPANY_USERS=${REACT_URL_ENV}/api/dashboard/getUserFromCompany?
REACT_APP_DASHBOARD_URL=/api/dashboard/getTableInfo?
REACT_APP_DASHBOARD_URL_RATINGSTABLE=/api/dashboard/ratingsByYear?
REACT_APP_DATEFORM_URL=/api/dashboard/allYears
REACT_APP_DASHBOARD_WOLRD_MAP_URL=/api/dashboard/getWorldMap?
REACT_APP_DASHBOARD_FILE_TEMPLATE_DOWNLOAD=/api/dashboard/getTemplate?
REACT_APP_GET_RANGES=/api/dashboard/getUserRanges?
REACT_APP_SAVE_RANGES=/api/dashboard/saveUserRanges?
REACT_APP_UPLOAD_FILE=/api/dashboard/uploadCsv?
REACT_APP_GET_COUNTRYS=/api/dashboard/getCountryFilterByISO2?
REACT_APP_GET_BPN_COUNTRYS=/api/dashboard/getBpnCountrys?
REACT_APP_GET_BPNS=/api/dashboard/getCompanyBpns?
REACT_APP_GET_REPORTS_BY_USER=/api/dashboard/getReportsByCompanyUser?
REACT_APP_GET_REPORT_VALUES_BY_REPORT=/api/dashboard/getReportsValueByReport?
REACT_APP_SAVE_REPORTS=/api/dashboard/saveReports?
REACT_APP_SHARE_REPORTS=/api/dashboard/shareReport?
REACT_APP_UPDATE_REPORTS=/api/dashboard/updateReports?
REACT_APP_DELETE_REPORTS=/api/dashboard/deleteReport
REACT_APP_GET_USER_BPDM_GATES=/api/dashboard/getAllUserBPDMGates?
REACT_APP_DELETE_RATINGS=/api/dashboard/deleteRating
REACT_APP_GET_COMPANY_USERS=/api/dashboard/getUserFromCompany?
20 changes: 0 additions & 20 deletions .env.development

This file was deleted.

24 changes: 0 additions & 24 deletions .env.production

This file was deleted.

Empty file.
19 changes: 14 additions & 5 deletions .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.1.1] - 2023-03-02

### Changed
- Changed file scripts/inject-dynamic-env.sh adding more dynamic vars into application
- Changed value  .securityContext.runAsUser   on values.yaml to run in the container as the same privileged user created on the dockerfile
- Changed copy command on docker file to a more clean sintaxis combining cp command with chwon command

### Removed
- Remove env files not used
- Remove images on public folder not used and not needed

### Fixes
- Fixed $REACT_APP_AUTH_URL from vars  to be reused on many more files-services for api calling using only common path

## [1.1.0] - 2023-02-22

Expand All @@ -14,13 +27,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Added script for injecting vars on nginx
- Added arq42 documentation
- Added arq42 documentation
- Added UserGuide

### Fixes
- Fixed a bug in the Help Dialog regarding broken attachments that we´re missing

## [1.0.1] - 2023-02-21
## [1.0.1] - 2023-02-21

### Changed

Expand All @@ -42,6 +55,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- First Release

[unreleased]: https://github.com/eclipse-tractusx/vas-country-risk-frontend/compare
[1.0.0]: https://github.com/eclipse-tractusx/vas-country-risk-frontend/compare
[1.1.0]: https://github.com/eclipse-tractusx/vas-country-risk-frontend/compare

25 changes: 16 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ FROM node:16.15.1 AS compile-image
WORKDIR /app

COPY package.json .
COPY package-lock.json .
COPY --chown=root:node package-lock.json .
COPY public ./public
copy .env* .
COPY --chown=root:node .env* .
COPY src ./src

RUN chown -R root:node .
RUN chmod -R u+rwx,g+rwx,o+rwx .
RUN chmod -R 775 package-lock.json

USER node

Expand All @@ -24,16 +22,25 @@ RUN npm run build

FROM nginxinc/nginx-unprivileged:stable-alpine

WORKDIR /usr/share/nginx/html
COPY .conf/nginx.conf /etc/nginx/conf.d/default.conf

COPY --from=compile-image /app/build .
COPY --from=compile-image /app/build /usr/share/nginx/html

ENTRYPOINT ["nginx", "-g", "daemon off;"]
# Change to root user for renaming of index.html to index.html.reference, to be used by env variables inject script
USER root

RUN mv /usr/share/nginx/html/index.html /usr/share/nginx/html/index.html.reference

EXPOSE 8080
# Add env variables inject script and mark as executable
COPY ./scripts/inject-dynamic-env.sh /docker-entrypoint.d/00-inject-dynamic-env.sh
RUN chmod +x /docker-entrypoint.d/00-inject-dynamic-env.sh

EXPOSE 80
# Install bash for env variables inject script
RUN apk update && apk add bash

# Make nginx owner of /usr/share/nginx/html/ and change to nginx user
RUN chown -R 101:101 /usr/share/nginx/html/
USER 101



Expand Down
4 changes: 2 additions & 2 deletions charts/country-risk-frontend-charts/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.0.8
version: 2.0.9

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.1.0"
appVersion: "1.1.1"



8 changes: 8 additions & 0 deletions charts/country-risk-frontend-charts/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ ingress:
certificate:
host: "country-risk-dashboard.dev.demo.catena-x.net"

configmap:
# Specifies whether a configmap should be created or not
data:
REACT_APP_AUTH_URL: 'https://centralidp.dev.demo.catena-x.net/auth'
REACT_APP_COUNTRY_RISK_API: 'https://vas-country-risk-backend.dev.demo.catena-x.net'
REACT_APP_PORTAL_FRONTEND: 'https://portal.dev.demo.catena-x.net'
REACT_APP_PORTAL_BACKEND: 'https://portal-backend.dev.demo.catena-x.net'

8 changes: 8 additions & 0 deletions charts/country-risk-frontend-charts/values-int.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,12 @@ ingress:
certificate:
host: "country-risk-dashboard.int.demo.catena-x.net"

configmap:
# Specifies whether a configmap should be created or not
data:
REACT_APP_AUTH_URL: 'https://centralidp.int.demo.catena-x.net/auth'
REACT_APP_COUNTRY_RISK_API: 'https://vas-country-risk-backend.int.demo.catena-x.net'
REACT_APP_PORTAL_FRONTEND: 'https://portal.int.demo.catena-x.net'
REACT_APP_PORTAL_BACKEND: 'https://portal-backend.int.demo.catena-x.net'


2 changes: 1 addition & 1 deletion charts/country-risk-frontend-charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ securityContext:
# -- Specifies whether the process inside the container should run as a non-root user
runAsNonRoot: true
# -- Specifies the user ID that the process inside the container should run
runAsUser: 10001
runAsUser: 101
# -- Specifies the group ID that the process inside the container should run
runAsGroup: 3000
# -- Capabilities that the process inside the container should have
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dashboard-app",
"version": "1.1.0",
"version": "1.1.1",
"private": true,
"dependencies": {
"@emotion/react": "^11.10.5",
Expand Down
12 changes: 6 additions & 6 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script>
window.ENV = {REACT_APP_COUNTRY_RISK_API:"http://localhost:8080",
REACT_APP_AUTH_URL:"http://localhost:8080/auth",
REACT_APP_PORTAL_FRONTEND:"http://localhost:8080",
REACT_APP_PORTAL_BACKEND:"http://localhost:8080"};
</script>
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script>
const ENV = {
REACT_URL_ENV: "http://localhost:8080",
REACT_APP_AUTH_URL: "http://localhost:8080/auth",
};
</script>
</body>
</html>
Binary file removed public/left_map.PNG
Binary file not shown.
Binary file removed public/right_map.PNG
Binary file not shown.
3 changes: 0 additions & 3 deletions public/robots.txt

This file was deleted.

37 changes: 33 additions & 4 deletions scripts/inject-dynamic-env.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
#!/bin/bash
###############################################################
# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
###############################################################
custom_env_vars_REACT_APP_AUTH_URL='REACT_APP_AUTH_URL:"'$REACT_APP_AUTH_URL'"'
custom_env_vars_REACT_APP_COUNTRY_RISK_API='REACT_APP_COUNTRY_RISK_API:"'$REACT_APP_COUNTRY_RISK_API'"'
custom_env_vars_REACT_APP_PORTAL_FRONTEND='REACT_APP_PORTAL_FRONTEND:"'$REACT_APP_PORTAL_FRONTEND'"'
custom_env_vars_REACT_APP_PORTAL_BACKEND='REACT_APP_PORTAL_BACKEND:"'$REACT_APP_PORTAL_BACKEND'"'


custom_env_vars='{REACT_URL_ENV:"'$REACT_URL_ENV'",REACT_APP_AUTH_URL:"'$REACT_APP_AUTH_URL'"}'
custom_env_vars_anchor='{REACT_URL_ENV:"http://localhost:8080",REACT_APP_AUTH_URL:"http://localhost:8080/auth"}'
REACT_APP_AUTH_URL_anchor='REACT_APP_AUTH_URL:"http://localhost:8080/auth"'
REACT_APP_COUNTRY_RISK_API_anchor='REACT_APP_COUNTRY_RISK_API:"http://localhost:8080"'
REACT_APP_PORTAL_FRONTEND_anchor='REACT_APP_PORTAL_FRONTEND:"http://localhost:8080"'
REACT_APP_PORTAL_BACKEND_anchor='REACT_APP_PORTAL_BACKEND:"http://localhost:8080"'

index_html_reference=`cat /usr/share/nginx/html/index.html.reference`
index_html=${index_html_reference//$custom_env_vars_anchor/$custom_env_vars}

index_html=$(sed -r 's%'$REACT_APP_AUTH_URL_anchor'%'$custom_env_vars_REACT_APP_AUTH_URL'%g' <<< "$index_html_reference")
index_html=$(sed -r 's%'$REACT_APP_COUNTRY_RISK_API_anchor'%'$custom_env_vars_REACT_APP_COUNTRY_RISK_API'%g' <<< "$index_html")
index_html=$(sed -r 's%'$REACT_APP_PORTAL_FRONTEND_anchor'%'$custom_env_vars_REACT_APP_PORTAL_FRONTEND'%g' <<< "$index_html")
index_html=$(sed -r 's%'$REACT_APP_PORTAL_BACKEND_anchor'%'$custom_env_vars_REACT_APP_PORTAL_BACKEND'%g' <<< "$index_html")

echo "$index_html"
echo "$index_html" > /usr/share/nginx/html/index.html
Loading

0 comments on commit 1211db0

Please sign in to comment.