sync errors

This commit is contained in:
Antelle 2015-12-12 00:25:20 +03:00
parent 5bd6cf88b4
commit f59cdeb10c
4 changed files with 21 additions and 6 deletions

View File

@ -490,10 +490,21 @@ var AppModel = Backbone.Model.extend({
} else {
Storage[storage].stat(path, function (err, stat) {
if (err) {
// TODO: save to cache if storage save failed
return complete(err);
}
if (stat.rev === fileInfo.get('rev')) {
if (file.get('dirty')) {
file.getData(function (data) {
if (data) {
Storage.cache.save(fileInfo.id, data, function (e) {
if (!e) {
file.set('dirty', false);
}
complete(err);
});
}
});
} else {
complete(err);
}
} else if (stat.rev === fileInfo.get('rev')) {
if (file.get('modified')) {
saveToCacheAndStorage();
} else {

View File

@ -32,6 +32,7 @@
right: 1em;
top: 1em;
@include th { color: action-color(); }
&--error { @include th { color: error-color(); } }
}
}

View File

@ -59,3 +59,4 @@ $all-colors: (
}
.muted-color { @include th { color: muted-color(); }; }
.action-color { @include th { color: action-color(); }; }
.error-color { @include th { color: error-color(); }; }

View File

@ -2,8 +2,10 @@
<% files.forEach(function(file) { %>
<div class="footer__db footer__db-item <%= file.get('open') ? '' : 'footer__db--dimmed' %>" data-file-id="<%= file.cid %>">
<i class="fa fa-<%= file.get('open') ? 'unlock' : 'lock' %>"></i> <%- file.get('name') %>
<% if (file.get('modified') && !file.get('syncing')) { %><i class="fa fa-circle footer__db-sign"></i><% } %>
<% if (file.get('syncing')) { %><i class="fa fa-refresh fa-spin footer__db-sign"></i><% } %>
<% if (file.get('syncing')) { %><i class="fa fa-refresh fa-spin footer__db-sign"></i><% }
else if (file.get('syncError')) { %><i class="fa fa-circle footer__db-sign footer__db-sign--error"
title="Sync error: <%- file.get('syncError') %>"></i><% }
else if (file.get('modified')) { %><i class="fa fa-circle footer__db-sign"></i><% } %>
</div>
<% }); %>
<div class="footer__db footer__db--dimmed footer__db--expanded footer__db-open"><i class="fa fa-plus"></i> Open / New</div>