From 310f912e0188447ebbff2ed86136229af4336da5 Mon Sep 17 00:00:00 2001 From: chisom chima Date: Thu, 28 Mar 2024 15:24:14 +0100 Subject: [PATCH] feat: update the summary table to display a message in the cases of a dry run --- i18n/en.pot | 76 +++++++++++--------- src/components/JobSummary/JobSummary.js | 6 +- src/components/JobSummary/Summary/Summary.js | 29 ++++++-- 3 files changed, 71 insertions(+), 40 deletions(-) diff --git a/i18n/en.pot b/i18n/en.pot index 673b83104..10043e92f 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2024-03-01T15:50:32.586Z\n" -"PO-Revision-Date: 2024-03-01T15:50:32.586Z\n" +"POT-Creation-Date: 2024-03-28T10:36:03.141Z\n" +"PO-Revision-Date: 2024-03-28T10:36:03.141Z\n" msgid "Something went wrong when loading the current user!" msgstr "Something went wrong when loading the current user!" @@ -688,6 +688,15 @@ msgstr "Updated" msgid "Total" msgstr "Total" +msgid "Reports" +msgstr "Reports" + +msgid "Error Code" +msgstr "Error Code" + +msgid "Tracker Type" +msgstr "Tracker Type" + msgid "Indexes" msgstr "Indexes" @@ -745,8 +754,8 @@ msgstr "Org unit geometry import" msgid "Metadata import" msgstr "Metadata import" -msgid "TEI import" -msgstr "TEI import" +msgid "Tracked entity import" +msgstr "Tracked entity import" msgid "Data export" msgstr "Data export" @@ -760,8 +769,8 @@ msgstr "Metadata dependency export" msgid "Metadata export" msgstr "Metadata export" -msgid "TEI export" -msgstr "TEI export" +msgid "Tracked entity export" +msgstr "Tracked entity export" msgid "Job overview" msgstr "Job overview" @@ -1117,24 +1126,24 @@ msgstr "" "geometry." msgid "" -"Export event data for programs, stages and tracked entities to JSON, CSV, " -"or DXF2 format." +"Export event data for programs, stages and tracked entities to JSON or CSV " +"format." msgstr "" -"Export event data for programs, stages and tracked entities to JSON, CSV, " -"or DXF2 format." +"Export event data for programs, stages and tracked entities to JSON or CSV " +"format." msgid "Export events" msgstr "Export events" msgid "" -"Import event data for programs, stages and tracked entities to JSON, CSV, " -"or DXF2 format." +"Import event data for programs, stages and tracked entities from JSON or " +"CSV format." msgstr "" -"Import event data for programs, stages and tracked entities to JSON, CSV, " -"or DXF2 format." +"Import event data for programs, stages and tracked entities from JSON or " +"CSV format." -msgid "Supported file types: JSON, CSV, and DXF2." -msgstr "Supported file types: JSON, CSV, and DXF2." +msgid "Supported file types: JSON and CSV." +msgstr "Supported file types: JSON and CSV." msgid "Organisation unit geometry import" msgstr "Organisation unit geometry import" @@ -1165,8 +1174,8 @@ msgstr "Export metadata dependencies" msgid "Export metadata" msgstr "Export metadata" -msgid "Export tracked entity instances" -msgstr "Export tracked entity instances" +msgid "Export tracked entities" +msgstr "Export tracked entities" msgid "Import data" msgstr "Import data" @@ -1183,8 +1192,8 @@ msgstr "Import GeoJSON" msgid "Import metadata" msgstr "Import metadata" -msgid "Import tracked entity instances" -msgstr "Import tracked entity instances" +msgid "Import tracked entities" +msgstr "Import tracked entities" msgid "An overview of all import jobs started this session." msgstr "An overview of all import jobs started this session." @@ -1210,17 +1219,14 @@ msgstr "" "Import metadata, such as data elements and organisation units, using JSON " "or CSV format." -msgid "Supported file types: JSON and CSV." -msgstr "Supported file types: JSON and CSV." - msgid "A class key must be selected" msgstr "A class key must be selected" -msgid "Tracked entity instances export" -msgstr "Tracked entity instances export" +msgid "Tracked entities export" +msgstr "Tracked entities export" -msgid "Export tracked entity instances in JSON, CSV, or DXF2 format." -msgstr "Export tracked entity instances in JSON, CSV, or DXF2 format." +msgid "Export tracked entities in JSON or CSV format." +msgstr "Export tracked entities in JSON or CSV format." msgid "Program to export from" msgstr "Program to export from" @@ -1231,14 +1237,14 @@ msgstr "Enrollment date range" msgid "At least one of the 'last updated' date fields must be specified" msgstr "At least one of the 'last updated' date fields must be specified" -msgid "Tracked entity instances import" -msgstr "Tracked entity instances import" +msgid "Tracked entities import" +msgstr "Tracked entities import" -msgid "Import tracked entity instances using JSON or DXF2 format." -msgstr "Import tracked entity instances using JSON or DXF2 format." +msgid "Import tracked entities using JSON format." +msgstr "Import tracked entities using JSON format." -msgid "Supported file types: JSON and DXF2." -msgstr "Supported file types: JSON and DXF2." +msgid "Supported file types: JSON." +msgstr "Supported file types: JSON." msgid "Job started." msgstr "Job started." @@ -1264,5 +1270,5 @@ msgstr "GML" msgid "Metadata" msgstr "Metadata" -msgid "TEI" -msgstr "TEI" +msgid "Tracked entity" +msgstr "Tracked entity" diff --git a/src/components/JobSummary/JobSummary.js b/src/components/JobSummary/JobSummary.js index a013b5747..fadad22de 100644 --- a/src/components/JobSummary/JobSummary.js +++ b/src/components/JobSummary/JobSummary.js @@ -82,7 +82,11 @@ const JobSummary = ({ {task.completed && task.summary && ( - + )}
diff --git a/src/components/JobSummary/Summary/Summary.js b/src/components/JobSummary/Summary/Summary.js index 5fd1f48ca..bdac74f5e 100644 --- a/src/components/JobSummary/Summary/Summary.js +++ b/src/components/JobSummary/Summary/Summary.js @@ -1,4 +1,6 @@ import PropTypes from 'prop-types' +import { NoticeBox } from '@dhis2/ui' +import i18n from '@dhis2/d2-i18n' import React from 'react' import { typeReportParse } from '../helper.js' import { SingleSummary } from '../SingleSummary/SingleSummary.js' @@ -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) { @@ -18,8 +20,25 @@ const extractStats = (summary) => { } } -const Summary = ({ summary, importType }) => { - // gml import type object return +const Summary = ({ summary, importType, dryRun }) => { + if (dryRun) { + const { ignored, total } = extractStats(summary) + return ( +
+
+ + {i18n.t( + `⁠ ${ignored} entities will be ignored out of ${total} entities ⁠` + )} + +
+
+ ) + } + if (summary.typeReports) { const overviewStats = { ...summary.stats, @@ -56,8 +75,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 ( @@ -87,6 +107,7 @@ const Summary = ({ summary, importType }) => { Summary.propTypes = { summary: PropTypes.object.isRequired, importType: PropTypes.string, + dryRun: PropTypes.bool, } export { Summary }