Skip to content

Commit

Permalink
Merge pull request #215 from xeptagondev/unified
Browse files Browse the repository at this point in the history
Sprint 43 changes
  • Loading branch information
mbelinsky authored Nov 13, 2023
2 parents ca32744 + 7ff1649 commit 647eb07
Show file tree
Hide file tree
Showing 22 changed files with 246 additions and 42 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/frontend-deployment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,33 @@ jobs:
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
- name: Build, tag, and push the image to Amazon ECR
id: build-test-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: carbon-web
IMAGE_TAG: unified-test
run: |
# Build a docker container and push it to ECR
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f web/Dockerfile . --build-arg PORT=3030 --build-arg REACT_APP_BACKEND=http://localhost:3000 --build-arg REACT_APP_STAT_URL=http://localhost:3100 --build-arg COUNTRY_NAME="CountryX" --build-arg COUNTRY_FLAG_URL="https://carbon-common-dev.s3.amazonaws.com/flag.png" --build-arg COUNTRY_CODE="NG" --build-arg REACT_APP_MAP_TYPE="Mapbox" --build-arg REACT_APP_MAPBOXGL_ACCESS_TOKEN=${{ secrets.MAPBOXGL_ACCESS_TOKEN }}
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
- name: Deploy docker image to Amazon EC2
if: github.ref == 'refs/heads/unified'
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: carbon-web
IMAGE_TAG: unified
PRIVATE_KEY: ${{ secrets.AWS_SSH_KEY_PRIVATE_UNIFIED }}
HOSTNAME: ${{ secrets.HOST_IP_UNIFIED }}
USER_NAME: ec2-user
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} '
cd repos/carbon-registry &&
sudo $(aws ecr get-login --no-include-email --region us-east-1) &&
sudo docker stop carbon-registry-web-1 || true &&
sudo docker rm carbon-registry-web-1 &&
sudo docker pull 302213478610.dkr.ecr.us-east-1.amazonaws.com/carbon-web:unified &&
docker-compose -f docker-compose-image.yml up -d web '
18 changes: 18 additions & 0 deletions .github/workflows/server-deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,21 @@ jobs:
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
- name: Deploy docker image to Amazon EC2
if: github.ref == 'refs/heads/unified'
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: carbon-services
IMAGE_TAG: unified
PRIVATE_KEY: ${{ secrets.AWS_SSH_KEY_PRIVATE_UNIFIED }}
HOSTNAME: ${{secrets.HOST_IP_UNIFIED }}
USER_NAME: ec2-user
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} '
cd repos/carbon-registry &&
sudo $(aws ecr get-login --no-include-email --region us-east-1) &&
sudo docker stop carbon-registry-national-1 carbon-registry-replicator-1 carbon-registry-stats-1 || true &&
sudo docker rm carbon-registry-national-1 carbon-registry-replicator-1 carbon-registry-stats-1 &&
sudo docker pull 302213478610.dkr.ecr.us-east-1.amazonaws.com/carbon-services:unified &&
docker-compose -f docker-compose-image.yml up -d national stats replicator '
2 changes: 1 addition & 1 deletion .github/workflows/service-lib-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Update Version
working-directory: ./backend/services
run: yarn upgrade carbon-services-lib --latest
run: yarn upgrade @undp/carbon-services-lib --latest
- name: Commit Changes
working-directory: ./backend/services
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ backend/services/.env.local
./data/*
!./data/README.md
web/src/Assets/.DS_Store
.yalc
yalc.lock
3 changes: 2 additions & 1 deletion backend/services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@
"@nestjs/swagger": "^6.1.3",
"@nestjs/typeorm": "^9.0.1",
"@undp/carbon-credit-calculator": "^1.0.0",
"@undp/carbon-services-lib": "^0.0.238",
"@undp/carbon-services-lib": "0.0.243",
"@undp/serial-number-gen": "^1.0.0",
"amazon-qldb-driver-nodejs": "^3.0.1",
"aws-kinesis-agg": "^4.2.6",
"aws-lambda": "^1.0.7",
"aws-serverless-express": "^3.4.0",
"axios": "^1.2.4",
"carbon-services-lib": "0.0.231-CARBON-323.2",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"dotenv-flow": "^3.2.0",
Expand Down
1 change: 1 addition & 0 deletions backend/services/src/setup/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export const handler: Handler = async (event) => {
company.name = event["name"];
company.logo = event["logoBase64"];
company.companyRole = CompanyRole.GOVERNMENT;
company.taxId = `00000${event["systemCountryCode"]}`

const user = new UserDto();
user.email = event["rootEmail"];
Expand Down
56 changes: 52 additions & 4 deletions backend/services/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4933,10 +4933,10 @@
"@types/node" "^18.11.9"
convert-units "^2.3.4"

"@undp/carbon-services-lib@^0.0.238":
version "0.0.238"
resolved "https://registry.yarnpkg.com/@undp/carbon-services-lib/-/carbon-services-lib-0.0.238.tgz#85944d7c8eae5d507781dd101ba3376b24b1080d"
integrity sha512-nzMyKh9uGDu7QS32LXRoyepIhN8M0YS/K1tRXG/gs9pOsMy/OQ1S3caPhJ5QP70aeR+vfbdQi5F75O48UeLLxw==
"@undp/[email protected].243":
version "0.0.243"
resolved "https://registry.yarnpkg.com/@undp/carbon-services-lib/-/carbon-services-lib-0.0.243.tgz#384b9d9e952f195b46e6b19e6322da7af75ba471"
integrity sha512-BioneoFADRehckXQVxtAJQOxHGc4g9bypJW+6XjMtYQlVCqokWpew1/2aFfqSjZQpDYMx0OUfHBXwRSbKFJnfw==
dependencies:
"@aws-sdk/client-qldb" "^3.408.0"
"@aws-sdk/client-qldb-session" "^3.408.0"
Expand Down Expand Up @@ -6273,6 +6273,54 @@ caniuse-lite@^1.0.30001449:
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001474.tgz#13b6fe301a831fe666cce8ca4ef89352334133d5"
integrity sha512-iaIZ8gVrWfemh5DG3T9/YqarVZoYf0r188IjaGwx68j4Pf0SGY6CQkmJUIE+NZHkkecQGohzXmBGEwWDr9aM3Q==

[email protected]:
version "0.0.231-CARBON-323.2"
resolved "https://registry.yarnpkg.com/carbon-services-lib/-/carbon-services-lib-0.0.231-CARBON-323.2.tgz#b4a33fc0955ef8839e5e4bf857c5215872df2f43"
integrity sha512-IR0d1s7T4jUneQ6eH1muqdXJNwHaIGVhDL66X7I1dJSIvQqQ1ajG1ZZMWyMvwk/SsQB+EWeQEFCwPVYTYBEjXQ==
dependencies:
"@aws-sdk/client-qldb" "^3.408.0"
"@aws-sdk/client-qldb-session" "^3.408.0"
"@aws-sdk/client-s3" "^3.408.0"
"@aws-sdk/client-sqs" "^3.408.0"
"@casl/ability" "^6.3.2"
"@drdgvhbh/postgres-error-codes" "^0.0.6"
"@nestjs/common" "^9.0.0"
"@nestjs/config" "^2.2.0"
"@nestjs/core" "^9.0.0"
"@nestjs/jwt" "^10.0.0"
"@nestjs/passport" "^9.0.0"
"@nestjs/platform-express" "^9.0.0"
"@nestjs/swagger" "^6.1.3"
"@nestjs/typeorm" "^9.0.1"
"@undp/carbon-credit-calculator" "^1.0.0"
"@undp/serial-number-gen" "^1.0.0"
amazon-qldb-driver-nodejs "^3.0.1"
aws-kinesis-agg "^4.2.6"
aws-lambda "^1.0.7"
aws-serverless-express "^3.4.0"
axios "^1.2.4"
cheerio "^1.0.0-rc.12"
class-transformer "^0.5.1"
class-validator "^0.14.0"
dotenv-flow "^3.2.0"
fs "^0.0.1-security"
ion-js "^4.3.0"
jsbi "^4.3.0"
nanoid "3.3.4"
nest-winston "^1.8.0"
nestjs-i18n "^10.2.6"
nodemailer "^6.8.0"
passport "^0.6.0"
passport-headerapikey "^1.2.2"
passport-jwt "^4.0.0"
passport-local "^1.0.0"
pg "^8.8.0"
reflect-metadata "^0.1.13"
rimraf "^3.0.2"
rxjs "^7.2.0"
typeorm "^0.3.10"
winston "^3.8.2"

[email protected], chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@types/react-dom": "^18.0.8",
"@types/styled-components": "^5.1.26",
"@types/validator": "^13.7.13",
"@undp/carbon-library": "^1.0.134",
"@undp/carbon-library": "1.0.168",
"antd": "^4.24.1",
"apexcharts": "^3.36.3",
"axios": "^1.1.3",
Expand Down
3 changes: 2 additions & 1 deletion web/public/Assets/i18n/company/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"all": "All",
"searchMail": "Search by email",
"searchName": "Search by name",
"min": "Ministry"
"min": "Ministry",
"nationalSopValue": "National Share of Proceeds"
}
3 changes: 2 additions & 1 deletion web/public/Assets/i18n/companyProfile/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
"adminDetailsHeading": "Organisation Admin Details",
"adminName": "Name",
"adminEmail": "Email",
"adminPhone": "Phone"
"adminPhone": "Phone",
"nationalSopValue": "National Share of Proceeds"
}
3 changes: 2 additions & 1 deletion web/public/Assets/i18n/programme/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@
"ministryLevel": "Ministry Level",
"description": "Description",
"emissionReductionAchievedandCreditIssued": "Emission Reduction Achieved/ Credit Issued",
"environmentalImpactAssessment": "Environmental Impact Assessment"
"environmentalImpactAssessment": "Environmental Impact Assessment",
"docUploadProgrammeRejected": "This document cannot be uploaded for rejected programmes"
}
4 changes: 3 additions & 1 deletion web/public/Assets/i18n/view/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,7 @@
"addInvestment": "ADD INVESTMENT",
"addAction": "ADD ACTION",
"ministryLevel": "Ministry Level",
"environmentalAssessmentRegistrationNo": "Environmental Assessment Registration Number"
"environmentalAssessmentRegistrationNo": "Environmental Assessment Registration Number",
"verificationEl": "Verification",
"monitoringEl": "Monitoring"
}
2 changes: 1 addition & 1 deletion web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const App = () => {
element={<CustomLayout selectedKey="programmeManagement/viewAll" />}
>
<Route path="viewAll" element={<ProgrammeManagement />} />
<Route path="view" element={<ProgrammeView />} />
<Route path="view/:id" element={<ProgrammeView />} />
<Route path="addProgramme" element={<AddProgramme />} />
<Route path="addNdcAction" element={<AddNDCAction />} />
</Route>
Expand Down
4 changes: 2 additions & 2 deletions web/src/Pages/InvestmentManagement/investmentCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const AddInvestmentComponent = () => {
const navigate = useNavigate();
const { t } = useTranslation(['common', 'programme']);

const onNavigateToProgrammeView = () => {
navigate('/programmeManagement/view');
const onNavigateToProgrammeView = (id: string) => {
navigate('/programmeManagement/view/' + id);
};

const onNavigateToProgrammeManagementView = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const InvestmentManagement = () => {
const { t, i18n } = useTranslation(['common', 'programme', 'creditTransfer', 'view']);

const onNavigateToProgrammeView = (programmeId: any) => {
navigate('/programmeManagement/view', { state: { id: programmeId } });
navigate('/programmeManagement/view/' + programmeId);
};

return (
Expand Down
4 changes: 3 additions & 1 deletion web/src/Pages/NdcActionManagement/addNDCAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const AddNDCAction = () => {
};

const onNavigateToProgrammeView = (programmeDetails: any) => {
navigate('/programmeManagement/view', { state: { record: programmeDetails } });
navigate(`/programmeManagement/view/${programmeDetails.programmeId}`, {
state: { record: programmeDetails },
});
};

return (
Expand Down
2 changes: 1 addition & 1 deletion web/src/Pages/NdcActionManagement/ndcActionManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const NdcActionManagement = () => {
};

const onNavigateToProgrammeManagementView = (programmeId: any) => {
navigate('/programmeManagement/view', { state: { id: programmeId } });
navigate('/programmeManagement/view/' + programmeId);
};

return (
Expand Down
2 changes: 1 addition & 1 deletion web/src/Pages/ProgrammeManagement/programmeManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ProgrammeManagement = () => {
];

const onNavigateToProgrammeView = (record: any) => {
navigate('/programmeManagement/view', { state: { record } });
navigate(`/programmeManagement/view/${record.programmeId}`, { state: { record } });
};

const onClickAddProgramme = () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/Pages/ProgrammeView/programmeView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@

.upcom-issue-step{
color: #000000;
background-color: rgba(#1e1f1f, 0.5);
background-color: rgba(#3A3541, 0.5);
}

.reject-step {
Expand Down
Loading

0 comments on commit 647eb07

Please sign in to comment.