Link to disable monitoring
This commit is contained in:
parent
0bdce5debb
commit
5a5c70cfb1
10 changed files with 230 additions and 0 deletions
server/resources
|
@ -34,9 +34,36 @@ angular.module('ffffng').factory('MonitoringResource', function (
|
|||
hostname: node.hostname,
|
||||
mac: node.mac,
|
||||
email: node.email,
|
||||
monitoring: node.monitoring,
|
||||
monitoringConfirmed: node.monitoringConfirmed
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
disable: function (req, res) {
|
||||
var data = Resources.getData(req);
|
||||
|
||||
var mac = Strings.normalizeMac(data.mac);
|
||||
if (!isValidMac(mac)) {
|
||||
return Resources.error(res, {data: 'Invalid MAC.', type: ErrorTypes.badRequest});
|
||||
}
|
||||
|
||||
var token = Strings.normalizeString(data.token);
|
||||
if (!isValidToken(token)) {
|
||||
return Resources.error(res, {data: 'Invalid token.', type: ErrorTypes.badRequest});
|
||||
}
|
||||
|
||||
return MonitoringService.disable(mac, token, function (err, node) {
|
||||
if (err) {
|
||||
return Resources.error(res, err);
|
||||
}
|
||||
return Resources.success(res, {
|
||||
hostname: node.hostname,
|
||||
mac: node.mac,
|
||||
email: node.email,
|
||||
monitoring: node.monitoring
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue