Skip to content

Commit

Permalink
Cric 1980 add export to review category report (#1845)
Browse files Browse the repository at this point in the history
* CRIC-1980: Add export to review category report
Added new API for getting all records
  • Loading branch information
saakhil authored Aug 22, 2024
1 parent 30bb8f9 commit d2cb383
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class UrlMappings {
"/api/report/get-funding"(controller: 'report', action: "getFunding", method: 'GET')
"/api/report/get-all-fundings"(controller: 'report', action: "getAllFundings", method: 'GET')
"/api/report/review-categories"(controller: 'report', action: "findReviewCategories")
"/api/report/get-review-categories"(controller: 'report', action: "getReviewCategories")
'/api/swagger/**'(controller: 'api', action: 'swagger')

// Compliance report end point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class ReportController extends AuthenticatedController {
response.outputStream << content
}

// Review category report api with backend pagination
def findReviewCategories() {
UtilityClass.registerIssueMarshaller();
PaginationParams pagination = new PaginationParams(
Expand All @@ -68,6 +69,11 @@ class ReportController extends AuthenticatedController {
}
}

// Review category report api without backend pagination
def getReviewCategories() {
render queryService.getReviewCategoryReport() as JSON
}


def findCollectionLinks() {
UtilityClass.registerConsentCollectionReportMarshaller()
Expand Down
25 changes: 25 additions & 0 deletions grails-app/services/org/broadinstitute/orsp/QueryService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2011,4 +2011,29 @@ class QueryService implements Status {
result
}

def getReviewCategoryReport() {
SessionFactory sessionFactory = grailsApplication.getMainContext().getBean('sessionFactory')
final session = sessionFactory.currentSession
def query = new StringBuilder()
query.append('select distinct i.id, i.type, i.project_key, i.summary, i.status, i.approval_status, ')
.append('i.reporter, i.request_date, ie.value as review_category from issue i ')
.append('left outer join issue_extra_property ie on ie.project_key = i.project_key and ie.name = "review-category" ')
.append('where i.type = "IRB Project" and i.deleted = 0 order by project_key asc')
final SQLQuery sqlQuery = session.createSQLQuery(query.toString())
final result = sqlQuery.list().collect {row ->
[
id: row[0],
type: row[1],
projectKey: row[2],
summary: row[3],
status: row[4],
approvalStatus: row[5],
reporter: row[6],
requestDate: row[7],
reviewCategory: row[8]
]
}
result
}

}
3 changes: 2 additions & 1 deletion src/main/webapp/components/TableComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export const TableComponent = hh(class TableComponent extends Component {
paginationFactory({
page: this.props.page,
totalSize: this.props.totalSize,
sizePerPageList: this.props.sizePerPageList
sizePerPageList: this.props.sizePerPageList,
showTotal: this.props.showTotal
}) : null
}
defaultSorted= { this.props.defaultSorted }
Expand Down
23 changes: 6 additions & 17 deletions src/main/webapp/reviewCategories/ReviewCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,10 @@ const ReviewCategories = hh(class ReviewCategories extends Component {
searchValue: search
};
this.props.showSpinner();
Reports.getReviewCategory(query).then(result => {
const lastPage = Math.ceil(result.data.recordsTotal / query.length);
Reports.getReviewCategory().then(result => {
if (this._isMounted) {
this.setState(prev => {
prev.lastPage = lastPage;
prev.currentPage = page;
prev.categories = result.data.data;
prev.recordsTotal = result.data.recordsTotal;
prev.recordsFiltered = result.data.recordsFiltered;
prev.sizePerPage = query.length;
prev.search = query.searchValue;
prev.sort = {
orderColumn : query.orderColumn,
sortDirection: query.sortDirection
};
prev.categories = result.data;
return prev;
}, () => this.props.hideSpinner())
}
Expand Down Expand Up @@ -232,8 +221,7 @@ const ReviewCategories = hh(class ReviewCategories extends Component {
PortalMessage({}),
h1({ style: stylesHeader.pageTitle}, ["Review Category Report"]),
TableComponent({
remoteProp: true,
onTableChange: this.onTableChange,
remoteProp: false,
data: this.state.categories,
columns: columns,
keyField: 'projectKey',
Expand All @@ -243,10 +231,11 @@ const ReviewCategories = hh(class ReviewCategories extends Component {
printComments: this.printContent,
sizePerPageList: SIZE_PER_PAGE_LIST,
page: this.state.currentPage,
totalSize: this.state.recordsFiltered,
totalSize: this.state.categories.length,
showExportButtons: true,
showSearchBar: true,
pagination: true
pagination: true,
showTotal: true
})
])
)
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/util/UrlConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const UrlConstants = {
dataUseRestrictionUrl: context + '/api/data-use/restriction/create',
newRestrictionUrl: context + '/api/data-use/new-restriction',
reviewCategoriesUrl: context + '/api/report/review-categories',
getReviewCategoriesUrl: context + '/api/report/get-review-categories',
qaEventReportUrl: context + '/api/qa-event-report',
qaEventReportForProjectUrl: context + '/api/qa-project-event-report',
fundingReportsUrl: context + '/api/report/get-funding',
Expand Down
5 changes: 4 additions & 1 deletion src/main/webapp/util/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ export const Reports = {
}
})
},
getReviewCategory(query) {
findReviewCategory(query) {
return axios.get(UrlConstants.reviewCategoriesUrl, {
params: {
draw: 1,
Expand All @@ -508,6 +508,9 @@ export const Reports = {
}
})
},
getReviewCategory() {
return axios.get(UrlConstants.getReviewCategoriesUrl)
},
getQaEventReport(tab) {
return axios.get(UrlConstants.qaEventReportUrl, {
params: {
Expand Down

0 comments on commit d2cb383

Please sign in to comment.