extensions css

This commit is contained in:
Mo Bitar
2017-01-28 10:28:06 -06:00
parent 2b0aa2d4ca
commit 92c8892054
7 changed files with 74 additions and 217 deletions

View File

@@ -58,7 +58,7 @@ class Extension extends Item {
actionsInGlobalContext() {
return this.actions.filter(function(action){
return action.context == "global" || action.sync_provider == true;
return action.context == "global";
})
}

View File

@@ -167,12 +167,6 @@ angular.module('app.frontend')
})
}
/*
Sync
*/
/*
Import
*/

View File

@@ -31,9 +31,7 @@ class GlobalExtensionsMenu {
}
$scope.selectedAction = function(action, extension) {
action.running = true;
extensionManager.executeAction(action, extension, null, function(response){
action.running = false;
if(response && response.error) {
action.error = true;
alert("There was an error performing this action. Please try again.");

View File

@@ -6,7 +6,6 @@ class ExtensionManager {
this.authManager = authManager;
this.enabledRepeatActionUrls = JSON.parse(localStorage.getItem("enabledRepeatActionUrls")) || [];
this.decryptedExtensions = JSON.parse(localStorage.getItem("decryptedExtensions")) || [];
this.extensionEks = JSON.parse(localStorage.getItem("extensionEks")) || {};
this.syncManager = syncManager;
modelManager.addItemSyncObserver("extensionManager", "Extension", function(items){
@@ -33,15 +32,6 @@ class ExtensionManager {
})
}
ekForExtension(extension) {
return this.extensionEks[extension.url];
}
setEkForExtension(extension, ek) {
this.extensionEks[extension.url] = ek;
localStorage.setItem("extensionEks", JSON.stringify(this.extensionEks));
}
actionWithURL(url) {
for (var extension of this.extensions) {
return _.find(extension.actions, {url: url})
@@ -146,23 +136,30 @@ class ExtensionManager {
executeAction(action, extension, item, callback) {
//todo
if(this.extensionUsesEncryptedData(extension)) {
if(this.extensionUsesEncryptedData(extension) && this.authManager.offline()) {
alert("To send data encrypted, you must have an encryption key, and must therefore be signed in.");
callback(null);
return;
}
var customCallback = function(response) {
action.running = false;
callback(response);
}
action.running = true;
switch (action.verb) {
case "get": {
this.Restangular.oneUrl(action.url, action.url).get().then(function(response){
action.error = false;
var items = response.items;
this.modelManager.mapResponseItemsToLocalModels(items);
callback(items);
customCallback(items);
}.bind(this))
.catch(function(response){
action.error = true;
customCallback(null);
})
break;
@@ -171,7 +168,7 @@ class ExtensionManager {
case "show": {
var win = window.open(action.url, '_blank');
win.focus();
callback();
customCallback();
break;
}
@@ -190,7 +187,7 @@ class ExtensionManager {
}
this.performPost(action, extension, params, function(response){
callback(response);
customCallback(response);
});
break;
@@ -274,14 +271,18 @@ class ExtensionManager {
var params = this.outgoingParamsForItem(item, extension);
return params;
}.bind(this))
this.performPost(action, extension, params, null);
action.running = true;
this.performPost(action, extension, params, function(){
action.running = false;
});
} else {
// todo
}
}
outgoingParamsForItem(item, extension) {
var itemParams = new itemParams(item, extension.ek);
var itemParams = new ItemParams(item, this.syncManager.masterKey);
return itemParams.paramsForExtension();
}