Skip to content
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

feat: tei filter update #2014

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/components/JobSummary/Summary/Summary.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import i18n from '@dhis2/d2-i18n'
import { NoticeBox } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import { typeReportParse } from '../helper.js'
Expand All @@ -6,7 +8,7 @@ import { TypeReportSummary } from '../TypeReportSummary/TypeReportSummary.js'
import styles from './Summary.module.css'

const extractStats = (summary) => {
if (summary.responseType == 'ImportSummaries') {
if (summary.responseType === 'ImportSummaries') {
const { imported, deleted, ignored, updated, total } = summary
return { imported, deleted, ignored, updated, total }
} else if (summary.importCount) {
Expand All @@ -18,7 +20,26 @@ const extractStats = (summary) => {
}
}

const Summary = ({ summary, importType }) => {
const Summary = ({ summary, importType, dryRun }) => {
// Check for dry run
if (dryRun) {
const { ignored, total } = extractStats(summary)
return (
<div data-test="job-summary-summary" className={styles.container}>
<div
className={styles.rest}
data-test="job-summary-summary-rest"
>
<NoticeBox title="Summary">
{i18n.t(
`${ignored} entities will be ignored out of ${total} entities⁠`
)}
</NoticeBox>
</div>
</div>
)
}

// gml import type object return
if (summary.typeReports) {
const overviewStats = {
Expand Down Expand Up @@ -56,8 +77,9 @@ const Summary = ({ summary, importType }) => {
}
/>
)

const allSummaries =
summary.responseType == 'ImportSummaries' && summary.importSummaries
summary.responseType === 'ImportSummaries' && summary.importSummaries
? summary.importSummaries.map((s, i) => {
const importCount = extractStats(s)
return (
Expand Down Expand Up @@ -86,6 +108,7 @@ const Summary = ({ summary, importType }) => {

Summary.propTypes = {
summary: PropTypes.object.isRequired,
dryRun: PropTypes.bool,
importType: PropTypes.string,
}

Expand Down
1 change: 1 addition & 0 deletions src/components/ResourcePicker/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const programQuery = {
resource: 'programs',
params: {
fields: 'id,displayName',
filter: 'programType:eq:WITH_REGISTRATION',
paging: 'false',
},
},
Expand Down
Loading