+
Please wait...
No document.
-
+
The following documents will be
removed from CouchDB:
diff --git a/public/res/providers/couchdbProvider.js b/public/res/providers/couchdbProvider.js
index cf5fd62f..9c762baf 100644
--- a/public/res/providers/couchdbProvider.js
+++ b/public/res/providers/couchdbProvider.js
@@ -19,6 +19,9 @@ define([
var PROVIDER_COUCHDB = "couchdb";
var couchdbProvider = new Provider(PROVIDER_COUCHDB, "CouchDB");
+ couchdbProvider.importPreferencesInputIds = [
+ PROVIDER_COUCHDB + "-tag"
+ ];
function createSyncIndex(id) {
return "sync." + PROVIDER_COUCHDB + "." + id;
@@ -250,15 +253,17 @@ define([
$(modalElt.querySelectorAll('.delete-mode')).toggleClass('hide', mode != 'delete');
$(modalElt.querySelectorAll('.byid-mode')).toggleClass('hide', mode != 'byid');
}
- function updateDocumentList() {
+
+ var updateDocumentList = _.debounce(function() {
$pleaseWaitElt.removeClass('hide');
$noDocumentElt.addClass('hide');
$moreDocumentsElt.addClass('hide');
- couchdbHelper.listDocuments(undefined, lastDocument && lastDocument.updated, function(err, result) {
+ couchdbHelper.listDocuments($selectTagElt.val(), lastDocument && lastDocument.updated, function(err, result) {
+ $pleaseWaitElt.addClass('hide');
if(err) {
+ $moreDocumentsElt.removeClass('hide');
return;
}
- $pleaseWaitElt.addClass('hide');
if(result.length === 3) {
$moreDocumentsElt.removeClass('hide');
lastDocument = result.pop();
@@ -277,10 +282,14 @@ define([
}
});
setMode('list');
- }
+ }, 10, true);
var tagList = utils.retrieveIgnoreError(PROVIDER_COUCHDB + '.tagList') || [];
- var $selectTagElt = $('#select-sync-import-couchdb-tag');
+ var $selectTagElt = $('#input-sync-import-couchdb-tag')
+ .on('change', function() {
+ clear();
+ updateDocumentList();
+ });
function updateTagList() {
$selectTagElt.empty().append(crel('option', {
value: ''
@@ -293,12 +302,12 @@ define([
}, tag));
});
}
+ updateTagList();
$(modalElt)
.on('show.bs.modal', function() {
+ clear();
updateDocumentList();
- updateTagList();
})
- .on('hidden.bs.modal', clear)
.on('click', '.document-list .document', function() {
$(this).toggleClass('active');
doSelect();
diff --git a/public/res/synchronizer.js b/public/res/synchronizer.js
index c22397be..0a01342b 100644
--- a/public/res/synchronizer.js
+++ b/public/res/synchronizer.js
@@ -282,7 +282,7 @@ define([
utils.resetModalInputs();
var preferences = utils.retrieveIgnoreError(provider.providerId + '.' + action + 'Preferences');
if(preferences) {
- _.each(provider.exportPreferencesInputIds, function(inputId) {
+ _.each(provider[action + 'PreferencesInputIds'], function(inputId) {
var exportPreferenceValue = preferences[inputId];
var setValue = utils.setInputValue;
if(_.isBoolean(exportPreferenceValue)) {
@@ -328,6 +328,20 @@ define([
// Provider's import button
$(".action-sync-import-" + provider.providerId).click(function(event) {
provider.importFiles(event);
+
+ // Store input values as preferences for next time we open the
+ // import dialog
+ var importPreferences = {};
+ _.each(provider.importPreferencesInputIds, function(inputId) {
+ var inputElt = document.getElementById("input-sync-import-" + inputId);
+ if(inputElt.type == 'checkbox') {
+ importPreferences[inputId] = inputElt.checked;
+ }
+ else {
+ importPreferences[inputId] = inputElt.value;
+ }
+ });
+ storage[provider.providerId + ".importPreferences"] = JSON.stringify(importPreferences);
});
// Provider's import dialog action
$(".action-sync-import-dialog-" + provider.providerId).click(function() {