sync providers wip
This commit is contained in:
@@ -56,9 +56,13 @@ class Extension extends Item {
|
||||
this.content_type = "Extension";
|
||||
}
|
||||
|
||||
syncProviderAction() {
|
||||
return _.find(this.actions, {sync_provider: true})
|
||||
}
|
||||
|
||||
actionsInGlobalContext() {
|
||||
return this.actions.filter(function(action){
|
||||
return action.context == "global";
|
||||
return action.context == "global" || action.sync_provider == true;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
class SyncProvider {
|
||||
constructor(obj) {
|
||||
_.merge(this, obj);
|
||||
}
|
||||
|
||||
addPendingItems(items) {
|
||||
if(!this.pendingItems) {
|
||||
this.pendingItems = [];
|
||||
}
|
||||
|
||||
this.pendingItems = this.pendingItems.concat(items);
|
||||
}
|
||||
|
||||
removePendingItems(items) {
|
||||
this.pendingItems = _.difference(this.pendingItems, items);
|
||||
}
|
||||
|
||||
get status() {
|
||||
if(!this.enabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(this.primary) return "primary";
|
||||
else return "secondary";
|
||||
}
|
||||
|
||||
asJSON() {
|
||||
return {
|
||||
enabled: this.enabled,
|
||||
url: this.url,
|
||||
encrypted: this.encrypted,
|
||||
ek: this.ek
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user