-
Notifications
You must be signed in to change notification settings - Fork 0
Add settings section to configure dataSet #5
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
base: master
Are you sure you want to change the base?
Conversation
…feature/generic-config-CU-869bd706j
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds a comprehensive DataSet configuration system that allows administrators to manage dataset approval workflows through a UI. The implementation replaces hardcoded configuration files with a dynamic dataStore-based solution.
Key changes:
- Introduces DataSet configuration management (CRUD operations) accessible only to super admins
- Implements granular permission system for dataset actions (read, complete, incomplete, revoke, submit, approve) based on users and user groups
- Adds custom workflow logic for submit/complete and revoke/incomplete actions
- Migrates from static configuration files to dynamic dataStore-based configuration
Reviewed changes
Copilot reviewed 71 out of 73 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock, package.json | Updates react-router-dom to 6.30.2, adds real-cancellable-promise and typed-immutable-map dependencies |
| src/domain/entities/DataSetConfiguration.ts | New entity representing dataset configuration with validation and permission checking logic |
| src/domain/usecases/GetApprovalConfigurationsUseCase.ts | Use case to retrieve dataset configurations with permissions for current user |
| src/data/DataSetConfigurationD2Repository.ts | Repository implementation for storing/retrieving configurations from dataStore |
| src/webapp/pages/*.tsx | New pages for managing dataset configurations (list, add, edit) |
| src/webapp/components/dataset-config/*.tsx | UI components for dataset configuration table and form |
| src/data/common/Dhis2ConfigRepository.ts | Removes hardcoded approval settings, simplifies configuration loading |
| src/domain/reports/mal-data-approval/usecases/*.ts | Updates use cases to use dynamic configurations instead of static settings |
| src/data/reports/mal-data-approval/MalDataApprovalDefaultRepository.ts | Refactors to use dataSet configurations for approval operations |
| src/webapp/reports/Reports.tsx | Adds routing for dataset settings pages with loader pattern |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/data/UserD2Repository.ts
Outdated
| return new User({ | ||
| id: d2User.id, | ||
| name: d2User.displayName, | ||
| userGroups: d2User.userGroups, | ||
| ...d2User.userCredentials, | ||
| isSuperAdmin: true, |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hard-coded value 'true' should be replaced with a proper check for whether the user is a super admin. Currently, all users will be marked as super admin.
| return new User({ | |
| id: d2User.id, | |
| name: d2User.displayName, | |
| userGroups: d2User.userGroups, | |
| ...d2User.userCredentials, | |
| isSuperAdmin: true, | |
| const isSuperAdmin = | |
| !!d2User.userCredentials && | |
| Array.isArray(d2User.userCredentials.userRoles) && | |
| d2User.userCredentials.userRoles.some( | |
| role => Array.isArray(role.authorities) && role.authorities.includes("ALL") | |
| ); | |
| return new User({ | |
| id: d2User.id, | |
| name: d2User.displayName, | |
| userGroups: d2User.userGroups, | |
| ...d2User.userCredentials, | |
| isSuperAdmin, |
| organisationUnits: { id: true }, | ||
| }, | ||
| filter: { code: { in: dataSetCodes } }, | ||
| filter: { code: { in: [] } }, |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filter with an empty array filter: { code: { in: [] } } will always return no results. This appears to be a placeholder that should either use the malDataSetCodes or be removed if dataSets are now configured differently.
| filter: { code: { in: [] } }, | |
| filter: { code: { in: malDataSetCodes } }, |
| // const settings = await this.getSettingByDataSet([originalDataSetId]); | ||
| // const dataSetSettings = settings.find(setting => setting.dataSetId === originalDataSetId); | ||
| // if (!dataSetSettings) throw new Error(`Data set settings not found: ${originalDataSetId}`); |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commented-out code should be removed rather than left in the codebase. If this logic is no longer needed, it should be deleted to improve code cleanliness.
| // const settings = await this.getSettingByDataSet([originalDataSetId]); | |
| // const dataSetSettings = settings.find(setting => setting.dataSetId === originalDataSetId); | |
| // if (!dataSetSettings) throw new Error(`Data set settings not found: ${originalDataSetId}`); |
| ): Promise<boolean> { | ||
| try { | ||
| const { approvalDataSetId, dataSetId } = await this.getApprovalDataSetId(dataValues); | ||
| // const { approvalDataSetId } = await this.getApprovalDataSetId(dataValues); |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commented-out code should be removed rather than left in the codebase. This appears to be old logic that has been replaced.
| // const { approvalDataSetId } = await this.getApprovalDataSetId(dataValues); |
| import { promiseMap } from "../utils/promises"; | ||
| import { WmrDiffReport } from "../domain/reports/WmrDiffReport"; | ||
| import { AppSettingsD2Repository } from "../data/AppSettingsD2Repository"; | ||
| import { dataSetApprovalName, WmrDiffReport } from "../domain/reports/WmrDiffReport"; |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import dataSetApprovalName.
📌 References
📝 Implementation
📹 Screenshots/Screen capture
List dataSet configurations
Create/Edit dataSet configuration Form
Delete a dataSet configuration
🔥 Notes to the tester
dataset-approval#869bd706j