Conflict window option to export

This commit is contained in:
Mo Bitar
2018-09-07 10:57:22 -05:00
parent 97ef57ea27
commit cc782d2031
5 changed files with 1990 additions and 1443 deletions

View File

@@ -22,7 +22,7 @@ class ConflictResolutionModal {
}
}
controller($scope, modelManager, syncManager) {
controller($scope, modelManager, syncManager, archiveManager) {
'ngInject';
$scope.createContentString = function(item) {
@@ -65,6 +65,10 @@ class ConflictResolutionModal {
$scope.dismiss();
}
$scope.export = function() {
archiveManager.downloadBackupOfItems([$scope.item1, $scope.item2], true);
}
$scope.applyCallback = function() {
$scope.callback && $scope.callback();
}

View File

@@ -11,6 +11,10 @@ class ArchiveManager {
*/
async downloadBackup(encrypted) {
return this.downloadBackupOfItems(this.modelManager.allItems, encrypted);
}
async downloadBackupOfItems(items, encrypted) {
// download in Standard File format
var keys, authParams;
if(encrypted) {
@@ -22,7 +26,7 @@ class ArchiveManager {
authParams = await this.authManager.getAuthParams();
}
}
this.__itemsData(keys, authParams).then((data) => {
this.__itemsData(items, keys, authParams).then((data) => {
this.__downloadData(data, `SN Archive - ${new Date()}.txt`);
// download as zipped plain text files
@@ -37,8 +41,8 @@ class ArchiveManager {
Private
*/
async __itemsData(keys, authParams) {
let data = await this.modelManager.getAllItemsJSONData(keys, authParams);
async __itemsData(items, keys, authParams) {
let data = await this.modelManager.getJSONDataForItems(items, keys, authParams);
let blobData = new Blob([data], {type: 'text/json'});
return blobData;
}

View File

@@ -8,6 +8,7 @@
%a.close-button.info{"ng-click" => "keepItem1()"} Keep left
%a.close-button.info{"ng-click" => "keepItem2()"} Keep right
%a.close-button.info{"ng-click" => "keepBoth()"} Keep both
%a.close-button.info{"ng-click" => "export()"} Export
%a.close-button.info{"ng-click" => "dismiss(); $event.stopPropagation()"} Close
.content.selectable
.panel-section

3414
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,7 @@
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.2",
"sn-stylekit": "1.0.15",
"standard-file-js": "0.3.14",
"standard-file-js": "0.3.15",
"sn-models": "0.1.1",
"connect": "^3.6.6",
"mocha": "^5.2.0",