-
Notifications
You must be signed in to change notification settings - Fork 101
Fixes #1830 Merge v1.3.0 into develop for admin-ui #858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| # AGENTS.md | ||
|
|
||
| This file provides guidance to AI agents when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| MOSIP Admin Portal — an Angular 8 SPA used by privileged administrative personnel to manage master data (Registration Centers, Devices, Machines, Users), run key management operations, check packet/RID status, and perform bulk uploads. It is the **authoritative interface** for post-deployment master data updates in a MOSIP deployment; changes should go through the portal (not raw DB scripts) to enforce business rule constraints. | ||
|
|
||
| The repo has two independently buildable modules: | ||
| - `admin-ui/` — the Angular frontend | ||
| - `uitest-admin/` — a Selenium + TestNG automation test suite (Java 21, Maven) | ||
|
|
||
| --- | ||
|
|
||
| ## Commands | ||
|
|
||
| ### Frontend (`admin-ui/`) | ||
|
|
||
| ```bash | ||
| cd admin-ui | ||
| npm install # install dependencies | ||
| ng serve # dev server at http://localhost:4200 (auto-reloads) | ||
| ng build # development build → dist/ | ||
| ng build --prod # production build (AOT, minified) | ||
| ng test # unit tests via Karma | ||
| ng lint # lint | ||
| ng e2e # end-to-end tests via Protractor | ||
| ``` | ||
|
|
||
| ### UI Test Suite (`uitest-admin/`) | ||
|
|
||
| ```bash | ||
| cd uitest-admin | ||
| mvn clean install # build and package the fat JAR | ||
|
|
||
| # Run tests against a deployed environment | ||
| java -Dpath=https://admin.<env>.mosip.net/ \ | ||
| -DKeyclockURL=https://iam.<env>.mosip.net \ | ||
| -Denv.user=api-internal.<env> \ | ||
| -Denv.endpoint=https://api-internal.<env>.mosip.net \ | ||
| -jar target/uitest-admin-1.3.0-jar-with-dependencies.jar | ||
| ``` | ||
|
|
||
| Control test execution via `src/main/resources/TestData.json`: | ||
| - `setExcludedGroups`: comma-separated group tags to skip (e.g. `"BL,CT"`) | ||
| - `headless`: `"yes"` for headless Chrome | ||
|
|
||
| --- | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Runtime Configuration | ||
|
|
||
| The app does **not** use Angular `environment.ts` for the API base URL. At startup, `AppConfigService` fetches `assets/config.json` and exposes it globally. `app.constants.ts` reads `config.baseUrl` at module load time. This means API targets are set at deploy time, not build time. Key config fields: `baseUrl`, `primaryLangCode`, `locationHierarchyLevel`, `supportedLanguages`, `countryCode`, `filterValueMaxRecords`. | ||
|
|
||
| ### Module & Routing Structure | ||
|
|
||
| Hash routing (`useHash: true`) with `PreloadAllModules`. The root route redirects to `/admin`, which is guarded by `LanguageGuard` (initialises i18n) and `AuthguardService` (Keycloak token check). | ||
|
|
||
| All feature areas are **lazy-loaded modules** under `/admin`: | ||
|
|
||
| | Route | Module | Roles | | ||
| |---|---|---| | ||
| | `/admin/resources` | ResourcesModule | GLOBAL_ADMIN, ZONAL_ADMIN, MASTERDATA_ADMIN | | ||
| | `/admin/masterdata` | MasterdataModule | GLOBAL_ADMIN, ZONAL_ADMIN, MASTERDATA_ADMIN | | ||
| | `/admin/bulkupload` | BulkuploadModule | all roles | | ||
| | `/admin/keymanager` | KeymanagerModule | KEY_MAKER | | ||
| | `/admin/packet-status`, `/admin/rid-status`, `/admin/lost-rid-status` | — | REGISTRATION_ADMIN | | ||
|
|
||
| Menu item visibility is driven by `RolesService` reading Keycloak roles from the JWT. | ||
|
|
||
| ### HTTP & Auth | ||
|
|
||
| `AuthInterceptor` (registered in `CoreModule`) attaches the Keycloak bearer token to every outgoing request and handles 401/403 redirects. All API calls go through Angular's `HttpClient` — never `fetch` or XHR directly. | ||
|
|
||
| API paths are constructed in `app.constants.ts` as `<baseUrl> + <MASTERDATA_BASE_URL> + <entity>/search` (POST with filter/sort/pagination payloads). The search pattern is uniform across all master data entities. | ||
|
|
||
| ### Core Services | ||
|
|
||
| - **`DataStorageService`** — in-memory cache for filter values, languages, and lookup data to avoid redundant API calls across components. | ||
| - **`AuditService`** — logs every significant user action with MOSIP audit event IDs (ADM-002 through ADM-085+). Every feature interaction should call this. | ||
| - **`CommonService`** — shared utility calls (language list, zone tree, etc.). | ||
| - **`CanDeactivateGuard`** — prevents navigation away from forms with unsaved changes. | ||
|
|
||
| ### MOSIP Domain Concepts (relevant to code decisions) | ||
|
|
||
| - **Zone hierarchy**: Admins are assigned to a zone; `ZONAL_ADMIN` can only see/edit resources within their zone. Zone filtering is applied server-side via the masterdata APIs. | ||
| - **Master data search API**: All list/search pages POST to `.../search` with a `{ filters: [], sort: [], pagination: {} }` body — not GET with query params. | ||
| - **Language support**: All master data entities have language-specific fields. The UI sends `langCode` in payloads. Supported: `eng`, `ara`, `fra`, `tam`, `kan`, `hin`. i18n strings live in `admin-ui/src/assets/i18n/<lang>.json`. | ||
| - **Deactivation vs deletion**: Master data records are deactivated (`isActive: false`), not deleted. UI should reflect this. | ||
|
|
||
| ### UI Test Suite Structure | ||
|
|
||
| 15 test classes run in parallel (8 threads) via TestNG, one per master-data entity/feature. `KnownIssueListener` cross-references `Known_Issues.txt` to suppress known failures. Test reports go to `admintest/Reports/` (ExtentReports) and `testng-report/`. | ||
|
|
||
| --- | ||
|
|
||
| ## CI/CD | ||
|
|
||
| `.github/workflows/push-trigger.yml` triggers on push to `develop`, `release-*`, `master`, `1.*`, and on PRs. Pipeline jobs in order: | ||
|
GOKULRAJ136 marked this conversation as resolved.
|
||
|
|
||
| 1. `build-admin-ui` — npm build | ||
| 2. `build-docker-admin-ui` — Docker image | ||
| 3. `sonar-analysis` — SonarCloud (skipped on PRs) | ||
| 4. `build-maven-uitest-admin` → `build-uitest-admin-local` → `build-docker-uitest-admin` | ||
| 5. `sonar-analysis-uitest-admin` | ||
|
|
||
| Helm chart publishing is triggered by changes under `helm/**` via `chart-lint-publish.yml`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| charts/ | ||
| Chart.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.