mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
now we can upload attachments and delete them from indexeddb afterwards
This commit is contained in:
parent
d92acc87b3
commit
12be0cd6d6
@ -322,9 +322,24 @@ define([
|
||||
var promises = []
|
||||
attachments.forEach(function(attachment)
|
||||
{
|
||||
console.log("sending attachment", attachment.featureId);
|
||||
promises.push( self._uploadAttachment(attachment) );
|
||||
});
|
||||
console.log("sending attachment", attachment.id, "to feature", attachment.featureId);
|
||||
var uploadCompleted = self._uploadAttachment(attachment);
|
||||
var deleteCompleted = new Deferred();
|
||||
uploadCompleted.then(function(attachmentId, deleteCompleted) // closure to keep attachmentId and deleteCompleted value
|
||||
{
|
||||
return function(result)
|
||||
{
|
||||
console.log("upload complete",result,attachmentId);
|
||||
this.attachmentsStore.delete(attachmentId, function(success)
|
||||
{
|
||||
console.log("delete complete", result, success);
|
||||
deleteCompleted.resolve(result);
|
||||
});
|
||||
}.bind(this);
|
||||
}.bind(this)(attachment.id, deleteCompleted)
|
||||
);
|
||||
promises.push( deleteCompleted );
|
||||
}.bind(this));
|
||||
console.log("promises", promises.length);
|
||||
var allPromises = new all(promises);
|
||||
allPromises.then(function(results)
|
||||
@ -337,7 +352,7 @@ define([
|
||||
console.log("error!",err);
|
||||
callback && callback(false);
|
||||
});
|
||||
})
|
||||
}.bind(this))
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -372,7 +372,7 @@ describe("Attachments", function()
|
||||
expect(g_editsStore.pendingEditsCount()).toBe(0);
|
||||
done();
|
||||
});
|
||||
/*
|
||||
|
||||
async.it("no attachments pending", function(done)
|
||||
{
|
||||
g_featureLayers[3].attachmentsStore.getUsage(function(usage)
|
||||
@ -381,9 +381,7 @@ describe("Attachments", function()
|
||||
done();
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
/**/
|
||||
|
||||
async.it("query attachments info - online - 1", function(done)
|
||||
{
|
||||
g_featureLayers[3].queryAttachmentInfos(g1_online.attributes.objectid,
|
||||
@ -417,7 +415,6 @@ describe("Attachments", function()
|
||||
done();
|
||||
});
|
||||
});
|
||||
//*/
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user