Skip to content

Commit d66972e

Browse files
witolDarkAndrewKozovyiDenBlazanastasiakuznietsovaholus-bolus
authored
Spelina/update prod (#3911)
* corrected certificate input * deleted new set env, old changed * new workflow test * pre push changed * dir issue corrected * updated workflow * some adjustment * redundand file deleted from ignore * update files ignore * typo and code rabbit advice * menu on customer is fixed * adress issues * telegram-subscription-fix * add-isTelegramNotifyChecked-method * fixes * test-fix * # issues fixed and tests * added nothing was found * small issue fixed * removed the word close * fixed unit test * input does not send request if forbidden symbols were entered * code rabbit advice * fixed bug quantity and the ability to pay for the order * fixed issues and removed dependencies form front end for authorities * sonar fixes * code rabbit fixes * fix * code rabbit advice * more of code rabbit * returned the search bar * sonar issue fix (I hope) * fix-sending-2-same-imgs * fixed search field * picture issue and tests * sonar issue * code rabbit * tests fix * renewed skipped tests * initial district change back fix * changing disctict for just added address issue * issues fixed * tests * workflow update * azure pipelines updated * code rabbit advice * added a button to see all customers orders * added coderabit suggestions * unit tests * input accepts 40 characters now * fix * rewritten method and unit tests * sockets fix for stage * monobank was removed * styles for payment removed * unsued imports removed * number of completed orders added * code rabbit advice * last important correction for pipelines and deploy * code rabbit advice * replaced empty string with null * test fix * captcha removed * redundant imports * fixed incorrect address comment behavior * reliability fix * fix pipelines * one more fix * pipelines fix 1 * hotfix pipelines * fix * fix name * reading env fix * fix 6 * git workflow fix * adjusted file write * fix * localization fix * codeRabbit comment fix * removed redundant console logs, added logic to prod pipelines and readme file updated * code rabbit suggestion to README * incorrect links uk -> ua * touch deleted * redundand import and less lines html * fixed error in json * close dialog after confirmation for excel download * fixed accessibility for buttons in orders page * tests * import order * req changes * req changes * readonly di * localization, pipelines and lint bypass * lint bypass * conflict for prod to resolve commits ahead * styles back * conflicts for prod * cleared conflict * fixed empty district address creation * fixed file display bug * hidden show/hide password btn for ms edge * [chat] added translation for file status * [chat] added router link for order id, fixed position selection * [chat] added router link for order id, fixed position selection * fixed invalid order of data * req changes * test fix * name is hidden if there's nothing to show * fixed city and street error * replace history state by queryParams * test fix * test fix * add test * added correct confirm page * unit tests * coderabbit fixes * unit tests * fixed display of employee cards while zoomed, added responsibility for chat * lint * lint * lint * test * req changes * fixed no internet connection case for message bar * test fix * fix: employees table now adjusts to window resizing #8845 * add digits after points for bonuses and certificates * added floating digits for the sum, removed for the certificate * fixed deletion of certificate after pushing enter * bugfix/ fixed the order confirmation after paying for the order with points (#3858) * fixed points order payment * cicd fix * added orderId check * req changes, refactor, translation fix * tests fix * tests fix * events page fix * test fix * add tests * tests fix * fix test, remove memory leaks * remove unused imports * added view violation modal * tests * lint * fixed filename display and file download * coderabbit suggestiona * fixed sonar issue * fix button position * style fix * add fakeAsyncZone and explicit call for ngOnInit * test fix * add callThrough and language service * add tests * req changes * tests fix * req changes * req changes * Feature/continue existing payment (#3892) * added cases for existing payment * tests fix * tests fix * tests * styles fix * lint * tests * tests * Spelina/clear filters btn, styles fix (#3894) * #9143 * #9130 clear all filters * tests * updates for separated user status (#3893) * feature/3872 telegram chat edit and delete message from admin (#3887) * added edit endpoint to the server * added edit message display in the input field * added mat menu on the right click and finger press * fix linter * missing imports * fixed save changes button on the order address editing view * finalized edit status and added unit tests * fixed sonar issues * removed console log * Bugfix/styles for user orders (#3895) * tests * styles fix * style fix * remove get online user request for homepage if unlogined fixed locale bug * #9196 * fixed sending message (#3900) * #9196 fixed font styles for new order * fixed changing address comment from val to empty * lint * telegram socket temp fix * Spelina/not taken out reason, socket for mention fix (#3898) * added taken out reason for admin order details * #9098 * hidden by flag * enhanced dateLocalisation pipe for runtime change * socket fix * type * removed unused socket * fixed ubs socket service * req changes * details date fix * tests fix * tests * styles fix, refactor * take-from-endpoint-and-new-field * fix * #9184, added status column for customers table * interceptor throws error if no internet * added permissions * test fix * lint * added translation for sign in in blocked and deactivated cases * Bugfix/fixed editing existing order, fixed scroll to existing order (#3896) * fixed editing existing order, fixed scroll to existing order * removed console statements * req changes * Bugfix/minor bugfixes (#3907) * #9223 switched button labels and actions * #9240 * #9234 * #9186 changed labels for address in order form * #9178 * #9178 * lint * tests fix * test * fixed test coverage * removed console statement * Feature/admin panel settings tab (#3902) * feat: add admin settings and homepage edit components * feat: implement OnInit in ubs-admin-edit-homepage component * feat: enable dynamic multilingual content management for homepage settings * feat: extract price section into a reusable component for ubs main page * refactor: replace flex-direction and flex-wrap with flex-flow in ubs-admin-edit-homepage styles * added telegram responses edit * lint fix * fix 2 lint * tests fix * tests fix * req changes * main page setting clearance, bug fixing * icon fix * improved styles for edit homepage * returned source map * req changes, refactor * tests fix, reliability * req changes * styles fix * styles fix * css fix * button styles for setting page --------- Co-authored-by: viktor <[email protected]> Co-authored-by: witolDark <[email protected]> * updated key vault for prod (#3906) * Feature/chat id column, bugfixes (#3904) * feat: added chat id column to customers table * #9262 added label for no chats found * #9261 automatic select of first available chat on search * #9260 fixed width of chatid input * rebase fix * css lint * tests fix * env fix --------- Co-authored-by: Andrew <[email protected]> Co-authored-by: Andrew <[email protected]> Co-authored-by: Den_Blazh <[email protected]> Co-authored-by: anastasiakuznietsova <[email protected]> Co-authored-by: holus-bolus <[email protected]> Co-authored-by: vryazh <[email protected]> Co-authored-by: Denys Blazhiichuk <[email protected]> Co-authored-by: hnativlyubomyr <[email protected]> Co-authored-by: Yaroslav <[email protected]> Co-authored-by: MaxZhylka <[email protected]> Co-authored-by: Anastasia Kuznietsova <[email protected]> Co-authored-by: viktor <[email protected]> Co-authored-by: Viktor <[email protected]>
1 parent 9646e51 commit d66972e

File tree

433 files changed

+10227
-2784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

433 files changed

+10227
-2784
lines changed

.github/workflows/main.yml

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
branches: [prod-branch, dev]
1010
workflow_dispatch:
1111

12+
permissions:
13+
contents: read
14+
checks: write
15+
pull-requests: write
16+
1217
env:
1318
repository: client
1419
dockerRepoName: skyere/greencity-front
@@ -46,9 +51,9 @@ jobs:
4651
npm install
4752
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
4853
sudo apt-get install ./google-chrome-stable_current_amd64.deb -y --allow-downgrades
49-
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.0.0.4432-linux.zip
50-
unzip sonar-scanner-cli-6.0.0.4432-linux.zip
51-
sudo mv sonar-scanner-6.0.0.4432-linux /opt/sonar-scanner
54+
55+
- name: Build Test Environment
56+
run: npx ts-node ./scripts/setenv.ts
5257

5358
- name: JS Linter
5459
run: npm run lint
@@ -69,39 +74,44 @@ jobs:
6974
exit 1
7075
fi
7176
72-
- name: Sonar scan
77+
- name: SonarCloud Scan
78+
uses: SonarSource/[email protected]
7379
env:
7480
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7581
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
76-
run: |
77-
PR_KEY="${{ github.event.pull_request.number }}"
78-
PR_BRANCH="${{ github.head_ref }}"
79-
PR_BASE="${{ github.base_ref }}"
80-
PR_ARGS=""
81-
if [ -n "$PR_KEY" ]; then
82-
PR_ARGS="-Dsonar.pullrequest.key=$PR_KEY -Dsonar.pullrequest.branch=$PR_BRANCH -Dsonar.pullrequest.base=$PR_BASE -Dsonar.pullrequest.provider=github"
83-
fi
84-
85-
/opt/sonar-scanner/bin/sonar-scanner \
86-
-Dsonar.organization=ita-social-projects \
87-
-Dsonar.projectKey=ita-social-projects-green-city-client \
88-
-Dsonar.host.url=https://sonarcloud.io \
89-
-Dsonar.login=$SONAR_TOKEN \
90-
-Dsonar.sources=src \
91-
-Dsonar.exclusions=**/node_modules/**,src/app/component/user/components/profile/calendar/calendar-image.*,src/app/component/user/components/profile/calendar/calendar-week/calendar-image.*,src/environments/environment.prod.*,src/app/image-pathes/auth-images.*,src/app/image-pathes/profile-icons.*,src/app/image-pathes/profile-images.*,src/app/image-pathes/single-news-images.*,src/app/image-pathes/sign-in-icons.*,src/app/component/about/about-routing.module.*,src/app/component/about/about.module.*,src/app/component/eco-news/eco-news-routing.module.*,src/app/component/eco-news/eco-news.module.*,src/app/component/map/map-routing.module.*,src/app/component/map/map.module.*,src/app/component/user/user-routing.module.*,src/app/component/user/user.module.*,src/app/app-routing.module.*,src/app/component/shared/shared.module.*,src/app/component/admin/admin-routing.module.*,src/app/component/admin/admin.module.*,src/app/app.module.*,src/app/component/auth/auth.module.*,src/app/component/core/core.module.*,src/app/component/home/home.module.*,src/app/component/layout/layout.module.*,src/app/model/weekDays.model.*,src/app/model/achievement/AchievementDto.*,src/app/model/advice/AdviceDto.*,src/app/model/filtering/filter-discount-dto.model.*,src/app/model/filtering/filter-distance-dto.model.*,src/app/model/filtering/filter-place-dto.model.*,src/app/model/habit-fact/HabitFactDto.*,src/app/model/habit/HabitStatisticLogDto.*,src/app/model/habit/HabitStatisticMapDto.*,src/app/model/habit/HabitStatisticsDto.*,src/app/model/habit/NewHabitDto.*,src/app/component/home/models/NewsDto.*,src/app/service/subscription/SubscriptionDto.*,src/app/model/user/userFilterDto.model.*,src/app/store/effects/ecoEvents.effects.*,src/app/ubs/ubs-admin/components/ubs-admin-certificate/ubs-admin-certificate.component.*,src/app/shared/interceptors/interceptor.service.*,src/app/store/reducers/ecoEvents.reducer.*,**/*.mock.ts,**/greencity.routing.module.*,**/*.model.ts \
92-
-Dsonar.tests=src \
93-
-Dsonar.test.inclusions=**/*.spec.ts \
94-
-Dsonar.javascript.lcov.reportPaths=coverage/GreenCityClient/lcov.info \
95-
$PR_ARGS
82+
with:
83+
args: >
84+
-Dsonar.organization=ita-social-projects
85+
-Dsonar.projectKey=ita-social-projects-green-city-client
86+
-Dsonar.host.url=https://sonarcloud.io
87+
-Dsonar.sources=src
88+
-Dsonar.exclusions=**/node_modules/**,src/app/component/user/components/profile/calendar/calendar-image.*,src/app/component/user/components/profile/calendar/calendar-week/calendar-image.*,src/environments/environment.prod.*,src/app/image-pathes/auth-images.*,src/app/image-pathes/profile-icons.*,src/app/image-pathes/profile-images.*,src/app/image-pathes/single-news-images.*,src/app/image-pathes/sign-in-icons.*,src/app/component/about/about-routing.module.*,src/app/component/about/about.module.*,src/app/component/eco-news/eco-news-routing.module.*,src/app/component/eco-news/eco-news.module.*,src/app/component/map/map-routing.module.*,src/app/component/map/map.module.*,src/app/component/user/user-routing.module.*,src/app/component/user/user.module.*,src/app/app-routing.module.*,src/app/component/shared/shared.module.*,src/app/component/admin/admin-routing.module.*,src/app/component/admin/admin.module.*,src/app/app.module.*,src/app/component/auth/auth.module.*,src/app/component/core/core.module.*,src/app/component/home/home.module.*,src/app/component/layout/layout.module.*,src/app/model/weekDays.model.*,src/app/model/achievement/AchievementDto.*,src/app/model/advice/AdviceDto.*,src/app/model/filtering/filter-discount-dto.model.*,src/app/model/filtering/filter-distance-dto.model.*,src/app/model/filtering/filter-place-dto.model.*,src/app/model/habit-fact/HabitFactDto.*,src/app/model/habit/HabitStatisticLogDto.*,src/app/model/habit/HabitStatisticMapDto.*,src/app/model/habit/HabitStatisticsDto.*,src/app/model/habit/NewHabitDto.*,src/app/component/home/models/NewsDto.*,src/app/service/subscription/SubscriptionDto.*,src/app/model/user/userFilterDto.model.*,src/app/store/effects/ecoEvents.effects.*,src/app/ubs/ubs-admin/components/ubs-admin-certificate/ubs-admin-certificate.component.*,src/app/shared/interceptors/interceptor.service.*,src/app/store/reducers/ecoEvents.reducer.*,**/*.mock.ts,**/greencity.routing.module.*,**/*.model.ts
89+
-Dsonar.test.inclusions=**/*.spec.ts
90+
-Dsonar.javascript.lcov.reportPaths=coverage/GreenCityClient/lcov.info
9691
9792
# - name: E2E Tests
9893
# run: npx ng e2e --protractor-config=e2e/protractor-ci.conf.js
9994

95+
- name: Build Environment
96+
env:
97+
PROD_SECRET: ${{ secrets.ENV_PROD }}
98+
STAGE_SECRET: ${{ secrets.ENV_STAGE }}
99+
run: |
100+
if [[ "${{ github.ref }}" == "refs/heads/prod-branch" ]]; then
101+
echo "${{ env.PROD_SECRET }}" > .env.prod
102+
npx ts-node ./scripts/setenv.ts prod
103+
else
104+
echo "${{ env.STAGE_SECRET }}" > .env.stage
105+
npx ts-node ./scripts/setenv.ts stage
106+
fi
107+
100108
- name: Build
101109
run: |
102-
npx ng build --configuration=stage --base-href=/GreenCityClient/
103-
# npx ng build --prod --delete-output-path --base-href=/GreenCityClient/ --outputPath=dist_aot && rm -rf dist_aot
104-
# npx ng build --prod --base-href=/GreenCityClient/ --aot=false --build-optimizer=false
110+
if [[ "${{ github.ref }}" == "refs/heads/prod-branch" ]]; then
111+
npx ng build --configuration production --base-href=/GreenCityClient/
112+
else
113+
npx ng build --configuration=stage --base-href=/GreenCityClient/
114+
fi
105115
106116
- name: Set outputs
107117
run: echo "GITHUB_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
@@ -151,4 +161,3 @@ jobs:
151161
# BRANCH: gh-pages
152162
# FOLDER: dist/GreenCityClient
153163
# CLEAN: true
154-

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,13 @@ Thumbs.db
4949

5050
# Logs
5151
*.log
52+
53+
.env
54+
.env.stage
55+
.env.prod
56+
.env.copy
57+
58+
src/environments/environment.copy.ts
59+
src/environments/environment.stage.ts
60+
src/environments/environment.ts
61+
src/environments/environment.prod.ts

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
greencity-client-chart
1212
Dockerfile
1313
chart-test
14-
.gitignore
14+
.gitignore

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.1.
44

5+
## Build Environments
6+
7+
Before building the project, run `npm run config` to generate `src/environments/environment.ts`.
8+
To generate a specific file, run `npm run config <key>` (for example: `npm run config stage`) to produce `environment.<key>.ts`.
9+
Prerequisite: ensure the corresponding `.env.<key>` is available locally or provided by CI (see `scripts/setenv.ts`).
10+
511
## Development server
612

713
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
@@ -60,7 +66,6 @@ You should install Angular CLI 16.2.10 writting this in console: npm install -g
6066

6167
3. /src/
6268
This is where we keep our application source code.
63-
6469
- /app/
6570
This folder contains templates, styles, images, angular components and anything else In angular project inside src folder. Any files outside of this folder are meant to support building your app.
6671

angular.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@
124124
"options": {
125125
"polyfills": ["src/polyfills.ts", "zone.js/testing"],
126126
"tsConfig": "tsconfig.spec.json",
127-
"sourceMap": false,
128127
"karmaConfig": "./karma.conf.js",
129128
"assets": ["src/favicon.ico", "src/assets", "src/manifest.webmanifest"],
130129
"styles": [

azure-pipelines-prod.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ trigger:
1010
pr: none
1111

1212
variables:
13+
azureSub: GreenCity2022
1314
agentOS: ubuntu-latest
1415
docker_repo: skyere/greencity-front
1516
artifactName: drop
@@ -21,6 +22,20 @@ stages:
2122
pool:
2223
vmImage: $(agentOS)
2324
steps:
25+
- script: |
26+
mkdir -p src/environments
27+
set -euo pipefail
28+
test -d src/environments
29+
chmod -R u+w -- src/environments
30+
displayName: Ensure environment directory exists and has permissions
31+
32+
- task: AzureKeyVault@2
33+
displayName: Retrieve secrets from Azure Key Vault
34+
inputs:
35+
azureSubscription: '$(azureSub)'
36+
KeyVaultName: 'greencity-values'
37+
SecretsFilter: 'ENV-PROD'
38+
2439
- task: NodeTool@0
2540
displayName: Set up Node js
2641
inputs:
@@ -32,6 +47,20 @@ stages:
3247
command: 'install'
3348
workingDir: '.'
3449

50+
- script: |
51+
set -euo pipefail
52+
trap 'rm -f .env.prod' EXIT
53+
umask 177
54+
55+
cat > .env.prod <<-EOF
56+
$ENV_PROD
57+
EOF
58+
59+
npx ts-node ./scripts/setenv.ts prod
60+
displayName: Generate Environment File
61+
env:
62+
ENV_PROD: $(ENV-PROD)
63+
3564
- task: Npm@1
3665
displayName: Build
3766
inputs:

azure-pipelines.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ trigger:
1010
pr: none
1111

1212
variables:
13+
azureSub: GreenCity2022
1314
agentOS: ubuntu-latest
1415
docker_repo: skyere/greencity-front
1516
artifactName: drop
@@ -21,6 +22,20 @@ stages:
2122
pool:
2223
vmImage: $(agentOS)
2324
steps:
25+
- script: |
26+
mkdir -p src/environments
27+
set -euo pipefail
28+
test -d src/environments
29+
chmod -R u+w -- src/environments
30+
displayName: Ensure environment directory exists and has permissions
31+
32+
- task: AzureKeyVault@2
33+
displayName: Retrieve secrets from Azure Key Vault
34+
inputs:
35+
azureSubscription: '$(azureSub)'
36+
KeyVaultName: 'greencity-app'
37+
SecretsFilter: 'ENV-STAGE'
38+
2439
- task: NodeTool@0
2540
displayName: Set up Node js
2641
inputs:
@@ -32,6 +47,20 @@ stages:
3247
command: 'install'
3348
workingDir: '.'
3449

50+
- script: |
51+
set -euo pipefail
52+
trap 'rm -f .env.stage' EXIT
53+
umask 177
54+
55+
cat > .env.stage <<-EOF
56+
$ENV_STAGE
57+
EOF
58+
59+
npx ts-node ./scripts/setenv.ts stage
60+
displayName: Generate Environment File
61+
env:
62+
ENV_STAGE: $(ENV-STAGE)
63+
3564
- task: Npm@1
3665
displayName: Build
3766
inputs:

package-lock.json

Lines changed: 30 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"bootstrap": "^4.3.1",
5050
"chart.js": "^2.9.3",
5151
"chartjs-plugin-labels": "^1.1.0",
52+
"dotenv": "^17.2.1",
5253
"google-libphonenumber": "^3.2.34",
5354
"google-oauth-gsi": "^4.0.1",
5455
"hammerjs": "^2.0.8",
@@ -100,6 +101,7 @@
100101
"eslint-config-prettier": "^10.1.5",
101102
"husky": "^4.3.8",
102103
"jasmine-core": "5.1.2",
104+
"jasmine-marbles": "^0.9.2",
103105
"karma": "~6.4.3",
104106
"karma-chrome-launcher": "~3.2.0",
105107
"karma-coverage": "^2.2.1",
@@ -122,7 +124,7 @@
122124
"husky": {
123125
"hooks": {
124126
"pre-commit": "npm run precommit",
125-
"pre-push": "npm run lint && npm run stylelint && ng test --watch=false --progress=false --code-coverage=true --browsers=ChromeHeadless"
127+
"pre-push": "npm run config && npm run lint && npm run stylelint && ng test --watch=false --progress=false --code-coverage=true --browsers=ChromeHeadless"
126128
}
127129
}
128130
}

0 commit comments

Comments
 (0)