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