Commit e7213f93 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: mark a thumbnail in red if the upload failed

parent 527e9c3f
...@@ -68,4 +68,8 @@ div[data-gadget-url$="gadget_document_scanner.html"] > .camera > .thumbnail-list ...@@ -68,4 +68,8 @@ div[data-gadget-url$="gadget_document_scanner.html"] > .camera > .thumbnail-list
div[data-gadget-url$="gadget_document_scanner.html"] .show-img { div[data-gadget-url$="gadget_document_scanner.html"] .show-img {
width: 35%; width: 35%;
}
div[data-gadget-url$="gadget_document_scanner.html"] .upload-error {
border: 3px solid red;
} }
\ No newline at end of file
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1580768900.5</float> <float>1580843720.26</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
}, function () { }, function () {
// XXX TODO: Handle error case // XXX TODO: Handle error case
var state_dict = {}; var state_dict = {};
state_dict['blob_state_' + blob_page] = 'Error'; state_dict['blob_state_' + blob_page] = 'error';
return gadget.changeState(state_dict); return gadget.changeState(state_dict);
}); });
} }
...@@ -177,6 +177,7 @@ ...@@ -177,6 +177,7 @@
function buildPreviousThumbnailDom(gadget) { function buildPreviousThumbnailDom(gadget) {
var i, var i,
img_class,
len = gadget.state.page_count, len = gadget.state.page_count,
thumbnail_dom_list = []; thumbnail_dom_list = [];
...@@ -193,12 +194,17 @@ ...@@ -193,12 +194,17 @@
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
// XXX TODO display a loader when saving // XXX TODO display a loader when saving
if (gadget.state['blob_state_' + i] !== 'deleted') { if (gadget.state['blob_state_' + i] !== 'deleted') {
if (gadget.state['blob_state_' + i] === "error") {
img_class = "show-img upload-error";
} else {
img_class = "show-img";
}
thumbnail_dom_list.push(domsugar('button', { thumbnail_dom_list.push(domsugar('button', {
type: "button", type: "button",
// Do not allow to show again the current image // Do not allow to show again the current image
// or do not allow to show saving image (to simplify button management) // or do not allow to show saving image (to simplify button management)
disabled: (i === gadget.state.page) || (gadget.state['blob_state_' + i] === 'saving') disabled: (i === gadget.state.page) || (gadget.state['blob_state_' + i] === 'saving')
}, [domsugar("img", {"class": "show-img", }, [domsugar("img", {"class": img_class,
'data-page': i, 'data-page': i,
src: gadget.state['blob_url_' + i]})])); src: gadget.state['blob_url_' + i]})]));
} }
...@@ -362,7 +368,7 @@ ...@@ -362,7 +368,7 @@
], ],
div; div;
if (gadget.state['blob_state_' + gadget.state.page] === 'failed') { if (gadget.state['blob_state_' + gadget.state.page] === 'error') {
button_list.push( button_list.push(
// XXX TODO improve icon // XXX TODO improve icon
domsugar('button', {type: 'button', domsugar('button', {type: 'button',
...@@ -475,7 +481,7 @@ ...@@ -475,7 +481,7 @@
// XXX TODO use a more precise selector // XXX TODO use a more precise selector
return buildPreviousThumbnailDom(gadget) return buildPreviousThumbnailDom(gadget)
.push(function (result) { .push(function (result) {
thumbnail_container = gadget.element.querySelector('ol'); thumbnail_container = gadget.element.querySelector('.thumbnail-list');
thumbnail_container.parentElement.replaceChild( thumbnail_container.parentElement.replaceChild(
result, result,
thumbnail_container thumbnail_container
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>981.39871.25821.10052</string> </value> <value> <string>981.40903.42421.64529</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1580832330.08</float> <float>1580845018.98</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment