Skip to content

Commit

Permalink
Error messages are displayed in the import modal
Browse files Browse the repository at this point in the history
  • Loading branch information
falkodev committed Apr 30, 2021
1 parent ceae3fb commit 71c2100
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

** 2.2.0

* Error messages are displayed in the import modal.

** 2.1.6

* Updates eslint test.
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ module.exports = {
$inc: {
errors: 1,
processed: 1
},
$addToSet: {
errorMessages: err
}
}, callback);
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apostrophe-pieces-import",
"version": "2.1.6",
"version": "2.2.0",
"description": "Import pieces from CSV, TSV, Excel and formats you add yourself as pieces in Apostrophe, with a nice UI",
"main": "index.js",
"scripts": {
Expand Down
11 changes: 8 additions & 3 deletions public/css/user.less
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,24 @@
background-color: @apos-primary;
}

.apos-pieces-import-error-message
{
list-style-type: disc;
}

input
{
background-color: lighten(@apos-primary, 5%);
display: inline-block;
padding: 24px;
}

h3
{
font-size: 24px;
margin-bottom: 24px;
}

table
{
td, th {
Expand All @@ -63,5 +68,5 @@
}

}

}
10 changes: 10 additions & 0 deletions views/importProgress.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ <h3>{{ __('Import finished') }}</h3>
<tr class="{{ 'apos-pieces-import-errors' if data.errors }}">
<th>{{ __('Errors') }}</th><td>{{ data.errors }}</td>
</tr>
<tr class="{{ 'apos-pieces-import-errors' if data.errors }}">
<th>{{ __('Error Messages') }}</th>
<td>
<ul>
{% for message in data.errorMessages %}
<li class="apos-pieces-import-error-message">{{ message }}</li>
{% endfor %}
<ul>
</td>
</tr>
</table>
{% elif data.failed %}
<h3 class="apos-pieces-import-failed">{{ __('Import failed, the file is most likely not in a supported format') }}</h3>
Expand Down

0 comments on commit 71c2100

Please sign in to comment.