Skip to content

Commit

Permalink
handle validation feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
hornmo committed Apr 26, 2023
1 parent 8699975 commit 2bb2449
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
"KBARTIngest": "KBART-Import",
"KBART Ingest": "KBART-Import",
"KBARTSourceIngest": "Automatisierter KBART-Import",
"KBARTSourceIngestDryRun": "Automatisierter KBART-Import (Testlauf)",
"KBARTIngestDryRun": "KBART-Import (Testlauf)",
"PackageTitleMatch": "Referenztitel-Abgleich",
"EZBCollectionIngest": "EZB-Kollektionsimport"
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
"KBARTIngest": "KBART Package Ingest",
"KBART Ingest": "KBART Package Ingest",
"KBARTSourceIngest": "Automated KBART Ingest",
"KBARTSourceIngestDryRun": "Automated KBART Ingest (Dry Run)",
"KBARTIngestDryRun": "KBART Package Ingest (Dry Run)",
"PackageTitleMatch": "Reference Title Matching",
"EZBCollectionIngest": "EZB Collection Ingest"
Expand Down
57 changes: 44 additions & 13 deletions src/shared/popups/gokb-edit-job-popup/gokb-edit-job-popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
/>
</v-col>
</v-row>
<v-row v-if="selectedItem.componentId">
<v-row v-if="!!selectedItem.componentId">
<v-col>
<div
v-if="selectedItem.link"
v-if="!!selectedItem.link"
class="primary--text"
>
{{ $i18n.tc('component.package.label') }}
</div>
<router-link
v-if="selectedItem.link"
v-if="!!selectedItem.link"
:style="{ color: 'primary' }"
:to="{ name: '/package', params: { 'id': selectedItem.componentId } }"
>
Expand All @@ -47,28 +47,29 @@
/>
</v-col>
</v-row>
<v-row v-if="selectedItem.results">
<v-row v-if="!!selectedItem.results">
<v-col>
<div
class="primary--text"
>
{{ selectedItem.dryRun ? $i18n.t('job.report.dryRunLabel') : $i18n.t('job.report.label') }}
</div>
<div v-if="selectedItem.results.report">
<div v-if="!!selectedItem.results.report">
<span class="mr-4">{{ $i18n.t('job.report.invalid.label') }}: {{ selectedItem.results.report.invalid }}/{{ selectedItem.results.report.numRows }}</span>
<span class="mr-4">{{ $i18n.t('job.report.previous.label') }}: {{ selectedItem.results.report.previous }}</span>
<span class="mr-4">{{ $i18n.t('job.report.matched.label') }}: {{ selectedItem.results.report.matched }}</span>
<span class="mr-4">{{ $i18n.t('job.report.partial.label') }}: {{ selectedItem.results.report.partial }}</span>
<span class="mr-4">{{ $i18n.t('job.report.created.label') }}: {{ selectedItem.results.report.created }}</span>
<span v-if="!selectedItem.dryRun">{{ $i18n.t('job.report.retired.label') }}: {{ selectedItem.results.report.retired }}</span>
<span v-if="!!selectedItem.results.report.previous" class="mr-4">{{ $i18n.t('job.report.previous.label') }}: {{ selectedItem.results.report.previous }}</span>
<span v-if="!!selectedItem.results.report.matched" class="mr-4">{{ $i18n.t('job.report.matched.label') }}: {{ selectedItem.results.report.matched }}</span>
<span v-if="!!selectedItem.results.report.partial" class="mr-4">{{ $i18n.t('job.report.partial.label') }}: {{ selectedItem.results.report.partial }}</span>
<span v-if="!!selectedItem.results.report.created" class="mr-4">{{ $i18n.t('job.report.created.label') }}: {{ selectedItem.results.report.created }}</span>
<span v-if="!!selectedItem.results.report.reviews" class="mr-4">{{ $i18n.t('job.report.created.label') }}: {{ selectedItem.results.report.reviews }}</span>
<span v-if="!selectedItem.dryRun && !!selectedItem.results.report.retired">{{ $i18n.t('job.report.retired.label') }}: {{ selectedItem.results.report.retired }}</span>
</div>
<div v-else-if="!!selectedItem.results.matched">
<span class="mr-4">{{ $i18n.t('job.report.matched.label') }}: {{ selectedItem.results.matched }}</span>
<span class="mr-4">{{ $i18n.t('job.report.created.label') }}: {{ selectedItem.results.created }}</span>
<span class="mr-4">{{ $i18n.t('job.report.unmatched.label') }}: {{ selectedItem.results.unmatched }}</span>
<span class="mr-4">{{ $i18n.tc('default.error.label', 2) }}: {{ selectedItem.results.error }}</span>
</div>
<div v-else-if="results.validation">
<div v-else-if="!!selectedItem.results.validation">
<span class="mr-4">{{ $i18n.t('job.report.invalid.label') }}: {{ selectedItem.results.validation.rows.error }}/{{ selectedItem.results.validation.rows.total }}</span>
<span class="mr-4">{{ $i18n.tc('kbart.processing.warning.label', 2) }}: {{ selectedItem.results.validation.rows.warning }}</span>
</div>
Expand All @@ -91,7 +92,7 @@
</ul>
</v-col>
</v-row>
<v-row v-if="selectedItem.results?.badrows">
<v-row v-if="rowErrors.length > 0">
<v-col md="12">
<v-expansion-panels accordion>
<v-expansion-panel>
Expand All @@ -108,6 +109,23 @@
</v-expansion-panels>
</v-col>
</v-row>
<v-row v-if="rowWarnings.length > 0">
<v-col md="12">
<v-expansion-panels accordion>
<v-expansion-panel>
<v-expansion-panel-header>{{ $tc('kbart.processing.warning.label', 2) }}</v-expansion-panel-header>
<v-expansion-panel-content>
<v-data-table
:items="rowWarnings"
:headers="errorHeaders"
sort-by="row"
group-by="row"
/>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</v-col>
</v-row>
<v-row v-if="selectedItem.results">
<v-col md="12">
<v-expansion-panels accordion>
Expand Down Expand Up @@ -166,7 +184,8 @@
messages: []
},
items: [],
rowErrors: []
rowErrors: [],
rowWarnings: []
}
},
computed: {
Expand Down Expand Up @@ -242,6 +261,18 @@
this.rowErrors.push({ row: badrow.row, column: colname, reason: this.$i18n.t(v.messageCode, v.args) })
})
})
} else if (!!record.job_result?.validation) {
Object.entries(record.job_result.validation.errors.rows).forEach(([rownum, colobj]) =>
Object.entries(colobj).forEach(([colname, eo]) =>
this.rowErrors.push({ row: rownum, column: colname, reason: this.$i18n.t(eo.messageCode, eo.args)})
)
)
Object.entries(record.job_result.validation.warnings.rows).forEach(([rownum, colobj]) =>
Object.entries(colobj).forEach(([colname, wo]) =>
this.rowWarnings.push({ row: rownum, column: colname, reason: this.$i18n.t(wo.messageCode, wo.args)})
)
)
}
}
},
Expand Down

0 comments on commit 2bb2449

Please sign in to comment.