Fix remoteEnabled bug
This commit is contained in:
parent
c87abafec8
commit
3628bd5be8
|
@ -73,7 +73,7 @@ function DataSource(name, settings) {
|
|||
accepts: fn.accepts,
|
||||
returns: fn.returns,
|
||||
http: fn.http,
|
||||
remoteEnabled: fn.share,
|
||||
remoteEnabled: fn.shared || false,
|
||||
fn: fn
|
||||
});
|
||||
}
|
||||
|
@ -282,8 +282,6 @@ DataSource.prototype.mixin = function (ModelCtor) {
|
|||
|
||||
// mixin enabled operations as alias functions
|
||||
Object.keys(ops).forEach(function (name) {
|
||||
console.log(name);
|
||||
|
||||
var op = ops[name];
|
||||
var fn = op.fn;
|
||||
var scope;
|
||||
|
@ -1177,9 +1175,10 @@ DataSource.prototype.enableRemote = function (operation) {
|
|||
DataSource.prototype.disable = function (operation) {
|
||||
var op = this.getOperation(operation);
|
||||
if(op) {
|
||||
op.enabled = false;
|
||||
op.enabled =
|
||||
op.remoteEnabled = false;
|
||||
} else {
|
||||
throw new Error(operation + ' is provided by the attached connector');
|
||||
throw new Error(operation + ' is not provided by the attached connector');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1192,7 +1191,7 @@ DataSource.prototype.disableRemote = function (operation) {
|
|||
if(op) {
|
||||
op.remoteEnabled = false;
|
||||
} else {
|
||||
throw new Error(operation + ' is provided by the attached connector');
|
||||
throw new Error(operation + ' is not provided by the attached connector');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1202,9 +1201,10 @@ DataSource.prototype.disableRemote = function (operation) {
|
|||
|
||||
DataSource.prototype.getOperation = function (operation) {
|
||||
var ops = this.operations();
|
||||
var opKeys = Object.keys(ops);
|
||||
|
||||
for(var i = 0; i < ops.length; i++) {
|
||||
var op = ops[i];
|
||||
for(var i = 0; i < opKeys.length; i++) {
|
||||
var op = ops[opKeys[i]];
|
||||
|
||||
if(op.name === operation) {
|
||||
return op;
|
||||
|
@ -1226,6 +1226,7 @@ DataSource.prototype.operations = function () {
|
|||
|
||||
DataSource.prototype.defineOperation = function (name, options, fn) {
|
||||
options.fn = fn;
|
||||
options.name = name;
|
||||
options.enabled = true;
|
||||
this._operations[name] = options;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue