diff --git a/.github/workflows/build-on-pull-request.yml b/.github/workflows/build-on-pull-request.yml index 8c95bf2..dc2862b 100644 --- a/.github/workflows/build-on-pull-request.yml +++ b/.github/workflows/build-on-pull-request.yml @@ -12,6 +12,11 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} + submodules: true + fetch-depth: 0 + + - name: Update submodules + run: git submodule update --init --recursive - name: Setup JDK 17 uses: actions/setup-java@v2 diff --git a/.github/workflows/lint_audit.yml b/.github/workflows/lint_audit.yml new file mode 100644 index 0000000..43a64ce --- /dev/null +++ b/.github/workflows/lint_audit.yml @@ -0,0 +1,11 @@ +name: ESLint and NPM Audit + +on: + push: + branches: [main, master, develop] + pull_request: + branches: [main, master, develop] + +jobs: + lint-and-audit: + uses: PSMRI/.github/.github/workflows/lint_audit.yml@main diff --git a/.github/workflows/package-prod.yml b/.github/workflows/package-prod.yml index 39c11dd..075ab0f 100644 --- a/.github/workflows/package-prod.yml +++ b/.github/workflows/package-prod.yml @@ -46,4 +46,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: TM-UI - path: dist/tm-ui-next/tm-ui-next.war + path: dist/tm-ui/tm-ui.war diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index e703a6d..e85ae14 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -17,6 +17,12 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + with: + submodules: true # Include submodules + fetch-depth: 0 # Ensure the full history is fetched + + - name: Update submodules + run: git submodule update --init --recursive - name: Set up Java uses: actions/setup-java@v3 @@ -40,10 +46,10 @@ jobs: npm run build - name: Create WAR file - run: jar -cvf tm-ui-next.war -C dist . + run: jar -cvf tm-ui.war -C dist . - name: Upload WAR file as artifact uses: actions/upload-artifact@v2 with: name: TM-UI - path: tm-ui-next.war + path: tm-ui.war diff --git a/.github/workflows/sast.yml b/.github/workflows/sast.yml deleted file mode 100644 index e2f5953..0000000 --- a/.github/workflows/sast.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: ["develop"] - paths-ignore: - - target/** - - dist/** - pull_request: - # The branches below must be a subset of the branches above - branches: ["develop"] - paths-ignore: - - target/** - - dist/** -jobs: - analyze: - name: Analyze - - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: ["javascript"] - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..eacb61e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Common-UI"] + path = Common-UI + url = https://github.com/PSMRI/Common-UI diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..3f430af --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v18 diff --git a/Common-UI b/Common-UI new file mode 160000 index 0000000..d0d8d3b --- /dev/null +++ b/Common-UI @@ -0,0 +1 @@ +Subproject commit d0d8d3b75a7813ac54eba59a02eb05e7d2c953fb diff --git a/README.md b/README.md index 1bb9cd7..128687a 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,10 @@ Telemedicine plays a crucial role in the services provided by Health and Wellnes This microservice is built using Java and the Spring Boot framework, with MySQL as the underlying database. Before building the TM module, ensure you have the following prerequisites: -- JDK 17 -- Maven -- NPM/YARN -- Spring Boot V2 -- MySQL +* JDK 17 +* Maven +* Nodejs v18.10.0 +* MySQL To build the TM module from source, follow these steps: @@ -59,3 +58,29 @@ Refer to `src/environments/environment.ci.template` file and ensure that the rig Packing with `ci` profile calls `build-ci` script in `package.json`. It creates a `environment.ci.ts` file with all environment variables used in the generated build. + +### Initializing Submodule `Common-UI` + +To initialize the `Common-UI` submodule, follow these steps: + +1. Clone the `tm-ui` project: + + git clone https://github.com/PSMRI/TM-UI + +2. Navigate to the project directory and pull the latest changes from the develop branch + cd tm-ui + git checkout develop + git pull origin develop + +3. Open the integrated terminal for the common-ui submodule and initialize it + + cd Common-UI + git init + git remote add origin https://github.com/PSMRI/Common-UI + git submodule update --init --recursive + +4. Check the available branches and switch to the develop branch + + git branch + git checkout develop + git pull origin develop diff --git a/WEB-INF/jboss-web.xml b/WEB-INF/jboss-web.xml new file mode 100644 index 0000000..8507ce7 --- /dev/null +++ b/WEB-INF/jboss-web.xml @@ -0,0 +1,3 @@ + + /tm + \ No newline at end of file diff --git a/angular.json b/angular.json index fbd0ba3..ffac380 100644 --- a/angular.json +++ b/angular.json @@ -3,7 +3,7 @@ "version": 1, "newProjectRoot": "projects", "projects": { - "TM-UI-NEXT": { + "TM-UI": { "projectType": "application", "schematics": {}, "root": "", @@ -13,7 +13,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist/tm-ui-next", + "outputPath": "dist/", "index": "src/index.html", "main": "src/main.ts", "polyfills": [ @@ -22,7 +22,12 @@ "tsConfig": "tsconfig.app.json", "assets": [ "src/favicon.ico", - "src/assets" + "src/assets", + { + "glob": "**/*", + "input": "WEB-INF", + "output": "WEB-INF" + } ], "styles": [ "@angular/material/prebuilt-themes/indigo-pink.css", @@ -54,6 +59,36 @@ "extractLicenses": false, "sourceMap": true, "namedChunks": true + }, + "ci": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "5mb", + "maximumError": "6mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "1mb", + "maximumError": "2mb" + } + ], + "outputHashing": "all", + "optimization": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.ci.ts" + } + ] + }, + "test":{ + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.test.ts" + } + ] } }, "defaultConfiguration": "production" @@ -62,10 +97,10 @@ "builder": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "TM-UI-NEXT:build:production" + "browserTarget": "TM-UI:build:production" }, "development": { - "browserTarget": "TM-UI-NEXT:build:development" + "browserTarget": "TM-UI:build:development" } }, "defaultConfiguration": "development" @@ -73,7 +108,7 @@ "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "TM-UI-NEXT:build" + "browserTarget": "TM-UI:build" } }, "test": { diff --git a/package-lock.json b/package-lock.json index 84a5ec2..0027e28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "tm-ui-next", + "name": "tm-ui", "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "tm-ui-next", + "name": "tm-ui", "version": "0.0.0", "dependencies": { "@angular/animations": "^16.2.0", @@ -15,6 +15,7 @@ "@angular/core": "^16.2.0", "@angular/forms": "^16.2.0", "@angular/material": "^16.2.12", + "@angular/material-moment-adapter": "^18.0.6", "@angular/platform-browser": "^16.2.12", "@angular/platform-browser-dynamic": "^16.2.0", "@angular/router": "^16.2.0", @@ -49,6 +50,7 @@ "@angular/compiler-cli": "^16.2.0", "@types/crypto-js": "^4.2.1", "@types/jasmine": "~5.1.4", + "@types/jquery": "^3.5.30", "@typescript-eslint/eslint-plugin": "5.62.0", "@typescript-eslint/parser": "5.62.0", "eslint": "^8.51.0", @@ -945,6 +947,19 @@ "rxjs": "^6.5.3 || ^7.4.0" } }, + "node_modules/@angular/material-moment-adapter": { + "version": "18.0.6", + "resolved": "https://registry.npmjs.org/@angular/material-moment-adapter/-/material-moment-adapter-18.0.6.tgz", + "integrity": "sha512-cNGYGQhIsTw1qxpKUK9iTRxEcdzndLhDvkBIGwpIDf0ovtOsTeEEhqC3rESN9U19yKVmMppljedhv3MhNALS+w==", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@angular/core": "^18.0.0 || ^19.0.0", + "@angular/material": "18.0.6", + "moment": "^2.18.1" + } + }, "node_modules/@angular/platform-browser": { "version": "16.2.12", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-16.2.12.tgz", @@ -5209,6 +5224,15 @@ "integrity": "sha512-px7OMFO/ncXxixDe1zR13V1iycqWae0MxTaw62RpFlksUi5QuNWgQJFkTQjIOvrmutJbI7Fp2Y2N1F6D2R4G6w==", "dev": true }, + "node_modules/@types/jquery": { + "version": "3.5.30", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.30.tgz", + "integrity": "sha512-nbWKkkyb919DOUxjmRVk8vwtDb0/k8FKncmUKFi+NY+QXqWltooxTrswvz4LspQwxvLdvzBN1TImr6cw3aQx2A==", + "dev": true, + "dependencies": { + "@types/sizzle": "*" + } + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -5298,6 +5322,12 @@ "@types/node": "*" } }, + "node_modules/@types/sizzle": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.8.tgz", + "integrity": "sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg==", + "dev": true + }, "node_modules/@types/sockjs": { "version": "0.3.36", "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", @@ -18461,6 +18491,14 @@ "tslib": "^2.3.0" } }, + "@angular/material-moment-adapter": { + "version": "18.0.6", + "resolved": "https://registry.npmjs.org/@angular/material-moment-adapter/-/material-moment-adapter-18.0.6.tgz", + "integrity": "sha512-cNGYGQhIsTw1qxpKUK9iTRxEcdzndLhDvkBIGwpIDf0ovtOsTeEEhqC3rESN9U19yKVmMppljedhv3MhNALS+w==", + "requires": { + "tslib": "^2.3.0" + } + }, "@angular/platform-browser": { "version": "16.2.12", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-16.2.12.tgz", @@ -21624,6 +21662,15 @@ "integrity": "sha512-px7OMFO/ncXxixDe1zR13V1iycqWae0MxTaw62RpFlksUi5QuNWgQJFkTQjIOvrmutJbI7Fp2Y2N1F6D2R4G6w==", "dev": true }, + "@types/jquery": { + "version": "3.5.30", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.30.tgz", + "integrity": "sha512-nbWKkkyb919DOUxjmRVk8vwtDb0/k8FKncmUKFi+NY+QXqWltooxTrswvz4LspQwxvLdvzBN1TImr6cw3aQx2A==", + "dev": true, + "requires": { + "@types/sizzle": "*" + } + }, "@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -21713,6 +21760,12 @@ "@types/node": "*" } }, + "@types/sizzle": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.8.tgz", + "integrity": "sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg==", + "dev": true + }, "@types/sockjs": { "version": "0.3.36", "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", diff --git a/package.json b/package.json index 8cbaf20..c2be926 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "tm-ui-next", + "name": "tm-ui", "version": "0.0.0", "scripts": { "ng": "ng", @@ -9,7 +9,11 @@ "test": "ng test", "lint": "ng lint", "lint:fix": "ng lint --fix", - "prepare": "husky install" + "prepare": "husky install", + "build-dev": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration=development --aot", + "build-prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration=production --aot", + "build-ci": "chmod +x ./scripts/*.js && ./scripts/ci-prebuild.js && node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration=ci --aot", + "build-test": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration=test --aot" }, "lint-staged": { "src/**/*.{ts,html}": [ @@ -25,6 +29,7 @@ "@angular/core": "^16.2.0", "@angular/forms": "^16.2.0", "@angular/material": "^16.2.12", + "@angular/material-moment-adapter": "^18.0.6", "@angular/platform-browser": "^16.2.12", "@angular/platform-browser-dynamic": "^16.2.0", "@angular/router": "^16.2.0", @@ -59,6 +64,7 @@ "@angular/compiler-cli": "^16.2.0", "@types/crypto-js": "^4.2.1", "@types/jasmine": "~5.1.4", + "@types/jquery": "^3.5.30", "@typescript-eslint/eslint-plugin": "5.62.0", "@typescript-eslint/parser": "5.62.0", "eslint": "^8.51.0", diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..f02ddc8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,199 @@ + + + 4.0.0 + com.iemr.tm-ui + TM-UI + 1.0 + TM-UI + Piramal - tm: Module ui + war + + + dev + + 10.208.122.38 + 10.208.122.32 + dev + + + true + + + + uat + + 10.208.122.38 + deviemr.piramalswasthya.org + uat + + + + local + + 10.208.122.38 + localhost + local + + + + test + + 10.208.122.32 + 10.208.122.38 + test + + + + ci + + ci + + + + + + + UTF-8 + tm-ui-v3.0.0 + ${maven.build.timestamp} + yyyy-MM-dd HH:mm + 10.208.122.32 + 9990 + localhost + 9990 + deviemr.piramalswasthya.org + 9990 + 10.208.122.38 + 9990 + wildfly-${environment} + {hostname-${environment}} + {port-${environment}} + + + + + tm-ui-v3.0.0 + + + maven-clean-plugin + 3.3.2 + + + + dist + + + + false + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.1.0 + + + npm-install + compile + + exec + + + npm + + install + --legacy-peer-deps + + + + + + + ng-build + compile + + exec + + + + npm + + run + build-${environment} + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + default-copy-resources + prepare-package + + true + ${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/ + + + + ${project.basedir}/dist + + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + false + + + + dist + + + true + src/packaging/ + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 3.1.0 + + + properties-updated 1 + prepare-package + + run + + + + replacing/updating urls ${project.basedir} 2 + + + + + + + + + + + diff --git a/scripts/ci-prebuild.js b/scripts/ci-prebuild.js new file mode 100644 index 0000000..386bc01 --- /dev/null +++ b/scripts/ci-prebuild.js @@ -0,0 +1,60 @@ +#!/usr/bin/env node + +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see https://www.gnu.org/licenses/. +*/ + +const fs = require('fs'); +const path = require('path'); + +const ejs = require('ejs'); + +const environmentFilesDirectory = path.join(__dirname, '../src/environments'); +const targetEnvironmentTemplateFileName = 'environment.ci.ts.template'; +const targetEnvironmentFileName = 'environment.ci.ts'; + +// Load template file +const environmentTemplate = fs.readFileSync( + path.join(environmentFilesDirectory, targetEnvironmentTemplateFileName), + {encoding: 'utf-8'} +); + +const defaultEnvValues = { + SERVER_IP: '', + SWYMED_IP: '', + COMMON_API_BASE: '', + COMMON_API_OPEN_SYNC: '', + TM_API_BASE: '', + SCHEDULER_API_BASE: '', + MMU_API_BASE: '', + ADMIN_API_BASE: '', + IOT_API_BASE: '', + FHIR_API_BASE: '', + SCHEDULER_UI_BASE: '', + INVENTORY_UI_BASE: '', +}; + +// Generate output data +const output = ejs.render(environmentTemplate, Object.assign({}, defaultEnvValues, process.env)); +// Write environment file +fs.writeFileSync(path.join(environmentFilesDirectory, targetEnvironmentFileName), output); + +process.exit(0); diff --git a/src/app/app-modules/core/components/app-header/app-header.component.css b/src/app/app-modules/core/components/app-header/app-header.component.css index 39ef9ce..cb4938e 100644 --- a/src/app/app-modules/core/components/app-header/app-header.component.css +++ b/src/app/app-modules/core/components/app-header/app-header.component.css @@ -39,6 +39,9 @@ .menu-font{ font-size: 14px !important; } +.nav-menu-center{ + text-align: center !important; +} .navbar-iemr { background-color: #253746; color: white; diff --git a/src/app/app-modules/core/components/app-header/app-header.component.html b/src/app/app-modules/core/components/app-header/app-header.component.html index 264a2fc..9ca19f1 100644 --- a/src/app/app-modules/core/components/app-header/app-header.component.html +++ b/src/app/app-modules/core/components/app-header/app-header.component.html @@ -41,6 +41,7 @@ @@ -116,7 +126,7 @@ class="nav navbar-nav ml-auto" *ngFor="let item of filteredNavigation; let isLast = last" > -