-
Notifications
You must be signed in to change notification settings - Fork 921
WEB-678: Restructure Reporting Plugin to Support Branch Model Operations #3541
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
Open
sakshar2303
wants to merge
3
commits into
openMF:dev
Choose a base branch
from
sakshar2303:WEB-678-restructure-reporting-plugin
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
ffa5182
WEB-926: Fix missing i18n translations in Tax Components view
sakshar2303 c474e9f
WEB-678: Restructure Reporting Plugin to Support Branch Model Operations
sakshar2303 4d641ca
WEB-678: Address CodeRabbit review comments on reporting plugin restr…
sakshar2303 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
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
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
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,40 @@ | ||
| /** | ||
| * Copyright since 2025 Mifos Initiative | ||
| * | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
|
|
||
| /** Custom Models */ | ||
| import { SelectOption } from './select-option.model'; | ||
|
|
||
| /** Report Parameter Model */ | ||
| export class ReportParameter { | ||
| name: string; | ||
| variable: string; | ||
| label: string; | ||
| displayType: string; | ||
| formatType: string; | ||
| defaultVal: string | number | boolean | null; | ||
| selectOne: string | null; | ||
| selectAll: string | null; | ||
| parentParameterName: string | null; | ||
| inputName: string; | ||
| selectOptions: SelectOption[] = []; | ||
| childParameters: ReportParameter[] = []; | ||
| pentahoName: string | null; | ||
|
|
||
| constructor(options: (string | number | boolean | null)[]) { | ||
| this.name = options[0] as string; | ||
| this.variable = options[1] as string; | ||
| this.label = options[2] as string; | ||
| this.displayType = options[3] as string; | ||
| this.formatType = options[4] as string; | ||
| this.defaultVal = options[5]; | ||
| this.selectOne = options[6]; | ||
| this.selectAll = options[7]; | ||
| this.parentParameterName = options[8] as string | null; | ||
| this.inputName = `R_${this.variable}`; | ||
| } | ||
| } | ||
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 |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| /** | ||
| * Copyright since 2025 Mifos Initiative | ||
| * | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
|
|
||
| /** Angular Imports */ | ||
| import { Injectable, inject } from '@angular/core'; | ||
| import { HttpClient, HttpParams } from '@angular/common/http'; | ||
|
|
||
| /** rxjs Imports */ | ||
| import { Observable } from 'rxjs'; | ||
| import { map } from 'rxjs/operators'; | ||
|
|
||
| /** Custom Models */ | ||
| import { ReportParameter } from '../models/report-parameter.model'; | ||
| import { SelectOption } from '../models/select-option.model'; | ||
| import { ChartData } from '../models/chart-data.model'; | ||
|
|
||
| /** | ||
| * Reports service. | ||
| */ | ||
| @Injectable({ | ||
| providedIn: 'root' | ||
| }) | ||
| export class ReportsService { | ||
| private http = inject(HttpClient); | ||
|
|
||
| /** | ||
| * @returns {Observable<any>} Reports data | ||
| */ | ||
| getReports(): Observable<any> { | ||
| return this.http.get('/reports'); | ||
| } | ||
|
|
||
| /** | ||
| * @param {string} officeId Office ID to filter reports. | ||
| * @returns {Observable<any>} Reports data for a specific office. | ||
| */ | ||
| getReportsByOffice(officeId: string): Observable<any> { | ||
| const httpParams = new HttpParams().set('officeId', officeId); | ||
| return this.http.get('/reports', { params: httpParams }); | ||
| } | ||
|
|
||
| /** | ||
| * @param {string} reportName Report name for which parameters are needed. | ||
| * @returns {Observable<ReportParameter[]>} | ||
| */ | ||
| getReportParams(reportName: string): Observable<ReportParameter[]> { | ||
| const httpParams = new HttpParams().set('R_reportListing', `'${reportName}'`).set('parameterType', 'true'); | ||
| return this.http | ||
| .get(`/runreports/FullParameterList`, { params: httpParams }) | ||
| .pipe(map((response: any) => response.data.map((entry: any) => new ReportParameter(entry.row)))); | ||
| } | ||
|
|
||
| /** | ||
| * @param {string} inputString URL substring containing object details. | ||
| * @returns {Observable<SelectOption[]>} | ||
| */ | ||
| getSelectOptions(inputString: string): Observable<SelectOption[]> { | ||
| const httpParams = new HttpParams().set('parameterType', 'true'); | ||
| return this.http | ||
| .get(`/runreports/${inputString}`, { params: httpParams }) | ||
| .pipe(map((response: any) => response.data.map((entry: any) => new SelectOption(entry.row)))); | ||
| } | ||
|
|
||
| /** | ||
| * @param {number} reportId Report id for which pentaho parameters are needed. | ||
| * @returns {Observable<any>} | ||
| */ | ||
| getPentahoParams(reportId: number): Observable<any> { | ||
| const httpParams = new HttpParams().set('fields', 'reportParameters'); | ||
| return this.http | ||
| .get(`/reports/${reportId}`, { params: httpParams }) | ||
| .pipe(map((response: any) => response.reportParameters)); | ||
| } | ||
|
|
||
| /** | ||
| * Run Report Data for Table and SMS. | ||
| * @param {any} reportName report name | ||
| * @param {object} formData Form Data. | ||
| * @returns {Observable<any>} | ||
| */ | ||
| getRunReportData(reportName: string, formData: object): Observable<any> { | ||
| let httpParams = new HttpParams(); | ||
| for (const [ | ||
| key, | ||
| value | ||
| ] of Object.entries(formData)) { | ||
| httpParams = httpParams.set(key, value); | ||
| } | ||
| return this.http.get(`/runreports/${reportName}`, { params: httpParams }); | ||
| } | ||
|
|
||
| /** | ||
| * Run Report Data for Charts. | ||
| * @param {any} reportName report name | ||
| * @param {object} formData Form Data. | ||
| * @returns {Observable<ChartData>} | ||
| */ | ||
| getChartRunReportData(reportName: string, formData: object): Observable<ChartData> { | ||
| let httpParams = new HttpParams(); | ||
| for (const [ | ||
| key, | ||
| value | ||
| ] of Object.entries(formData)) { | ||
| httpParams = httpParams.set(key, value); | ||
| } | ||
| return this.http | ||
| .get(`/runreports/${reportName}`, { params: httpParams }) | ||
| .pipe(map((response: any) => new ChartData(response))); | ||
| } | ||
|
|
||
| /** | ||
| * Run Report Data for Pentaho. | ||
| * @param {any} reportName report name | ||
| * @param {object} formData Form Data. | ||
| * @returns {Observable<any>} | ||
| */ | ||
| getPentahoRunReportData( | ||
| reportName: string, | ||
| formData: object, | ||
| tenantIdentifier: string, | ||
| locale: string, | ||
| dateFormat: string | ||
| ): Observable<any> { | ||
| let httpParams = new HttpParams() | ||
| .set('tenantIdentifier', tenantIdentifier) | ||
| .set('locale', locale) | ||
| .set('dateFormat', dateFormat); | ||
| for (const [ | ||
| key, | ||
| value | ||
| ] of Object.entries(formData)) { | ||
| httpParams = httpParams.set(key, value); | ||
| } | ||
| return this.http.get(`/runreports/${reportName}`, { | ||
| responseType: 'arraybuffer', | ||
| observe: 'response', | ||
| params: httpParams | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * @param {number} reportId | ||
| * @returns {Observable<any>} | ||
| */ | ||
| getBirtParams(reportId: number): Observable<any> { | ||
| const httpParams = new HttpParams().set('fields', 'reportParameters'); | ||
| return this.http | ||
| .get(`/reports/${reportId}`, { params: httpParams }) | ||
| .pipe(map((response: any) => response.reportParameters)); | ||
| } | ||
|
|
||
| /** | ||
| * Run Report Data for BIRT. | ||
| * @param {any} reportName | ||
| * @param {object} formData | ||
| * @returns {Observable<any>} | ||
| */ | ||
| getBirtRunReportData( | ||
| reportName: string, | ||
| formData: object, | ||
| tenantIdentifier: string, | ||
| locale: string, | ||
| dateFormat: string | ||
| ): Observable<any> { | ||
| let httpParams = new HttpParams() | ||
| .set('tenantIdentifier', tenantIdentifier) | ||
| .set('locale', locale) | ||
| .set('dateFormat', dateFormat); | ||
| for (const [ | ||
| key, | ||
| value | ||
| ] of Object.entries(formData)) { | ||
| httpParams = httpParams.set(key, value); | ||
| } | ||
| return this.http.get(`/runreports/${reportName}`, { | ||
| responseType: 'arraybuffer', | ||
| observe: 'response', | ||
| params: httpParams | ||
| }); | ||
| } | ||
| } |
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.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: openMF/web-app
Length of output: 204
🏁 Script executed:
Repository: openMF/web-app
Length of output: 699
🏁 Script executed:
Repository: openMF/web-app
Length of output: 3000
🏁 Script executed:
Repository: openMF/web-app
Length of output: 258
🏁 Script executed:
# Check main tsconfig.json directly head -50 tsconfig.jsonRepository: openMF/web-app
Length of output: 741
Improve type safety of the constructor by using a tuple type instead of a loose array.
The constructor accepts
(string | number | boolean | null)[]but always accesses exactly 9 indices matching the API payload fromentry.row. This should be a tuple type for better type safety and to allow the compiler to guarantee the correct properties are assigned without casts.Additionally,
pentahoNameis declared on line 26 but never assigned in the constructor and has no usages in the codebase—either initialize it or remove it.🔧 Proposed fix
export class ReportParameter { name: string; variable: string; label: string; displayType: string; formatType: string; defaultVal: string | number | boolean | null; selectOne: string | null; selectAll: string | null; parentParameterName: string | null; inputName: string; selectOptions: SelectOption[] = []; childParameters: ReportParameter[] = []; - pentahoName: string | null; + pentahoName: string | null = null; - constructor(options: (string | number | boolean | null)[]) { - this.name = options[0] as string; - this.variable = options[1] as string; - this.label = options[2] as string; - this.displayType = options[3] as string; - this.formatType = options[4] as string; + constructor( + options: [string, string, string, string, string, string | number | boolean | null, string | null, string | null, string | null] + ) { + this.name = options[0]; + this.variable = options[1]; + this.label = options[2]; + this.displayType = options[3]; + this.formatType = options[4]; this.defaultVal = options[5]; this.selectOne = options[6]; this.selectAll = options[7]; - this.parentParameterName = options[8] as string | null; + this.parentParameterName = options[8]; this.inputName = `R_${this.variable}`; } }🤖 Prompt for AI Agents