Merge branch 'develop'
commit
ed6941545a
|
@ -1,7 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
app.controller('CombinedEquipmentController', function ($scope, $translate, $uibModal, CombinedEquipmentService, CostCenterService, toaster, SweetAlert) {
|
||||
|
||||
app.controller('CombinedEquipmentController', function (
|
||||
$scope,
|
||||
$window,
|
||||
$translate,
|
||||
$uibModal,
|
||||
CombinedEquipmentService,
|
||||
CostCenterService,
|
||||
toaster,
|
||||
SweetAlert) {
|
||||
$scope.cur_user = JSON.parse($window.localStorage.getItem("myems_admin_ui_current_user"));
|
||||
$scope.getAllCombinedEquipments = function () {
|
||||
CombinedEquipmentService.getAllCombinedEquipments(function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 200) {
|
||||
|
@ -36,7 +44,8 @@ app.controller('CombinedEquipmentController', function ($scope, $translate, $uib
|
|||
});
|
||||
modalInstance.result.then(function (combinedequipment) {
|
||||
combinedequipment.cost_center_id = combinedequipment.cost_center.id;
|
||||
CombinedEquipmentService.addCombinedEquipment(combinedequipment, function (response) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
CombinedEquipmentService.addCombinedEquipment(combinedequipment, headers,function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 201) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
@ -76,8 +85,9 @@ app.controller('CombinedEquipmentController', function ($scope, $translate, $uib
|
|||
});
|
||||
|
||||
modalInstance.result.then(function (modifiedCombinedEquipment) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
modifiedCombinedEquipment.cost_center_id = modifiedCombinedEquipment.cost_center.id;
|
||||
CombinedEquipmentService.editCombinedEquipment(modifiedCombinedEquipment, function (response) {
|
||||
CombinedEquipmentService.editCombinedEquipment(modifiedCombinedEquipment, headers, function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 200) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
@ -115,7 +125,8 @@ app.controller('CombinedEquipmentController', function ($scope, $translate, $uib
|
|||
},
|
||||
function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
CombinedEquipmentService.deleteCombinedEquipment(combinedequipment, function (response) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
CombinedEquipmentService.deleteCombinedEquipment(combinedequipment, headers, function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 204) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
app.controller('CombinedEquipmentEquipmentController', function ($scope, $translate, CombinedEquipmentService, EquipmentService, CombinedEquipmentEquipmentService, toaster, SweetAlert) {
|
||||
app.controller('CombinedEquipmentEquipmentController', function (
|
||||
$scope,
|
||||
$window,
|
||||
$translate,
|
||||
CombinedEquipmentService,
|
||||
EquipmentService,
|
||||
CombinedEquipmentEquipmentService,
|
||||
toaster,
|
||||
SweetAlert) {
|
||||
$scope.cur_user = JSON.parse($window.localStorage.getItem("myems_admin_ui_current_user"));
|
||||
$scope.currentCombinedEquipment = {selected:undefined};
|
||||
|
||||
$scope.getAllEquipments = function () {
|
||||
|
@ -42,7 +51,8 @@ app.controller('CombinedEquipmentEquipmentController', function ($scope, $transl
|
|||
$scope.pairEquipment = function (dragEl, dropEl) {
|
||||
var equipmentid = angular.element('#' + dragEl).scope().equipment.id;
|
||||
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
||||
CombinedEquipmentEquipmentService.addPair(combinedequipmentid, equipmentid, function (response) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
CombinedEquipmentEquipmentService.addPair(combinedequipmentid, equipmentid, headers, function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 201) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
@ -69,7 +79,8 @@ app.controller('CombinedEquipmentEquipmentController', function ($scope, $transl
|
|||
}
|
||||
var combinedequipmentequipmentid = angular.element('#' + dragEl).scope().combinedequipmentequipment.id;
|
||||
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
||||
CombinedEquipmentEquipmentService.deletePair(combinedequipmentid, combinedequipmentequipmentid, function (response) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
CombinedEquipmentEquipmentService.deletePair(combinedequipmentid, combinedequipmentequipmentid, headers, function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 204) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
|
|
@ -1,6 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
app.controller('CombinedEquipmentMeterController', function ($scope, $timeout, $uibModal, $translate, MeterService, VirtualMeterService, OfflineMeterService, CombinedEquipmentMeterService, CombinedEquipmentService, toaster, SweetAlert) {
|
||||
app.controller('CombinedEquipmentMeterController', function (
|
||||
$scope,
|
||||
$window,
|
||||
$timeout,
|
||||
$uibModal,
|
||||
$translate,
|
||||
MeterService,
|
||||
VirtualMeterService,
|
||||
OfflineMeterService,
|
||||
CombinedEquipmentMeterService,
|
||||
CombinedEquipmentService,
|
||||
toaster,
|
||||
SweetAlert) {
|
||||
$scope.cur_user = JSON.parse($window.localStorage.getItem("myems_admin_ui_current_user"));
|
||||
$scope.currentCombinedEquipment = { selected: undefined };
|
||||
|
||||
$scope.getAllCombinedEquipments = function (id) {
|
||||
|
@ -111,7 +124,8 @@ app.controller('CombinedEquipmentMeterController', function ($scope, $timeout, $
|
|||
modalInstance.result.then(function (is_output) {
|
||||
var meterid = angular.element('#' + dragEl).scope().meter.id;
|
||||
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
||||
CombinedEquipmentMeterService.addPair(combinedequipmentid, meterid, $scope.currentMeterType, is_output, function (response) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
CombinedEquipmentMeterService.addPair(combinedequipmentid, meterid, $scope.currentMeterType, is_output, headers, function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 201) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
@ -141,7 +155,8 @@ app.controller('CombinedEquipmentMeterController', function ($scope, $timeout, $
|
|||
var combinedequipmentmeterid = angular.element('#' + dragEl).scope().combinedequipmentmeter.id;
|
||||
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
||||
var metertype = angular.element('#' + dragEl).scope().combinedequipmentmeter.metertype;
|
||||
CombinedEquipmentMeterService.deletePair(combinedequipmentid, combinedequipmentmeterid, metertype, function (response) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
CombinedEquipmentMeterService.deletePair(combinedequipmentid, combinedequipmentmeterid, metertype, headers, function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 204) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
|
|
@ -73,8 +73,8 @@ app.controller('CombinedEquipmentParameterController', function (
|
|||
if (combinedequipmentparameter.denominator_meter != null) {
|
||||
combinedequipmentparameter.denominator_meter_uuid = combinedequipmentparameter.denominator_meter.uuid;
|
||||
}
|
||||
|
||||
CombinedEquipmentParameterService.addCombinedEquipmentParameter(combinedequipmentid, combinedequipmentparameter, function (response) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
CombinedEquipmentParameterService.addCombinedEquipmentParameter(combinedequipmentid, combinedequipmentparameter, headers, function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 201) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
@ -123,7 +123,8 @@ app.controller('CombinedEquipmentParameterController', function (
|
|||
if (modifiedCombinedEquipmentParameter.denominator_meter != null) {
|
||||
modifiedCombinedEquipmentParameter.denominator_meter_uuid = modifiedCombinedEquipmentParameter.denominator_meter.uuid;
|
||||
}
|
||||
CombinedEquipmentParameterService.editCombinedEquipmentParameter($scope.currentCombinedEquipment.id, modifiedCombinedEquipmentParameter, function (response) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
CombinedEquipmentParameterService.editCombinedEquipmentParameter($scope.currentCombinedEquipment.id, modifiedCombinedEquipmentParameter, headers, function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 200) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
@ -160,7 +161,8 @@ app.controller('CombinedEquipmentParameterController', function (
|
|||
},
|
||||
function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
CombinedEquipmentParameterService.deleteCombinedEquipmentParameter($scope.currentCombinedEquipment.id, combinedequipmentparameter.id, function (response) {
|
||||
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||
CombinedEquipmentParameterService.deleteCombinedEquipmentParameter($scope.currentCombinedEquipment.id, combinedequipmentparameter.id, headers, function (response) {
|
||||
if (angular.isDefined(response.status) && response.status === 204) {
|
||||
toaster.pop({
|
||||
type: "success",
|
||||
|
|
|
@ -17,24 +17,24 @@ app.factory('CombinedEquipmentService', function($http) {
|
|||
callback(response);
|
||||
});
|
||||
},
|
||||
addCombinedEquipment: function(combinedequipment, callback) {
|
||||
$http.post(getAPI()+'combinedequipments',{data:combinedequipment})
|
||||
addCombinedEquipment: function(combinedequipment, headers, callback) {
|
||||
$http.post(getAPI()+'combinedequipments',{data:combinedequipment}, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
callback(response);
|
||||
});
|
||||
},
|
||||
editCombinedEquipment: function(combinedequipment, callback) {
|
||||
$http.put(getAPI()+'combinedequipments/'+combinedequipment.id,{data:combinedequipment})
|
||||
editCombinedEquipment: function(combinedequipment, headers, callback) {
|
||||
$http.put(getAPI()+'combinedequipments/'+combinedequipment.id,{data:combinedequipment}, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
callback(response);
|
||||
});
|
||||
},
|
||||
deleteCombinedEquipment: function(combinedequipment, callback) {
|
||||
$http.delete(getAPI()+'combinedequipments/'+combinedequipment.id)
|
||||
deleteCombinedEquipment: function(combinedequipment, headers, callback) {
|
||||
$http.delete(getAPI()+'combinedequipments/'+combinedequipment.id, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict';
|
||||
app.factory('CombinedEquipmentEquipmentService', function($http) {
|
||||
return {
|
||||
addPair: function(combinedequipmentID,equipmentID,callback) {
|
||||
$http.post(getAPI()+'combinedequipments/'+combinedequipmentID+'/equipments',{data:{'equipment_id':equipmentID}})
|
||||
addPair: function(combinedequipmentID,equipmentID, headers, callback) {
|
||||
$http.post(getAPI()+'combinedequipments/'+combinedequipmentID+'/equipments', {data:{'equipment_id':equipmentID}}, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
|
@ -10,8 +10,8 @@ app.factory('CombinedEquipmentEquipmentService', function($http) {
|
|||
});
|
||||
},
|
||||
|
||||
deletePair: function(combinedequipmentID, equipmentID, callback) {
|
||||
$http.delete(getAPI()+'combinedequipments/'+combinedequipmentID+'/equipments/'+equipmentID)
|
||||
deletePair: function(combinedequipmentID, equipmentID, headers, callback) {
|
||||
$http.delete(getAPI()+'combinedequipments/'+combinedequipmentID+'/equipments/'+equipmentID, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
app.factory('CombinedEquipmentMeterService', function ($http) {
|
||||
return {
|
||||
addPair: function (combinedequipmentID, meterID, metertype, is_output, callback) {
|
||||
addPair: function (combinedequipmentID, meterID, metertype, is_output, headers, callback) {
|
||||
var meter = {};
|
||||
if (metertype == 'meters') {
|
||||
meter = { 'meter_id': meterID, is_output: is_output };
|
||||
|
@ -10,7 +10,7 @@ app.factory('CombinedEquipmentMeterService', function ($http) {
|
|||
} else {
|
||||
meter = { 'offline_meter_id': meterID, is_output: is_output };
|
||||
}
|
||||
$http.post(getAPI() + 'combinedequipments/' + combinedequipmentID + '/' + metertype, { data: meter })
|
||||
$http.post(getAPI() + 'combinedequipments/' + combinedequipmentID + '/' + metertype, { data: meter }, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
|
@ -18,8 +18,8 @@ app.factory('CombinedEquipmentMeterService', function ($http) {
|
|||
});
|
||||
},
|
||||
|
||||
deletePair: function (combinedequipmentID, meterID, metertype, callback) {
|
||||
$http.delete(getAPI() + 'combinedequipments/' + combinedequipmentID + '/' + metertype + '/' + meterID)
|
||||
deletePair: function (combinedequipmentID, meterID, metertype, headers, callback) {
|
||||
$http.delete(getAPI() + 'combinedequipments/' + combinedequipmentID + '/' + metertype + '/' + meterID, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
app.factory('CombinedEquipmentParameterService', function($http) {
|
||||
return {
|
||||
|
||||
getParametersByCombinedEquipmentID: function(id, callback) {
|
||||
$http.get(getAPI()+'combinedequipments/'+id+'/parameters')
|
||||
.then(function (response) {
|
||||
|
@ -10,16 +9,17 @@ app.factory('CombinedEquipmentParameterService', function($http) {
|
|||
callback(response);
|
||||
});
|
||||
},
|
||||
addCombinedEquipmentParameter: function(combinedequipmentID, combinedequipmentparameter,callback) {
|
||||
$http.post(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters',{data:combinedequipmentparameter})
|
||||
addCombinedEquipmentParameter: function(combinedequipmentID, combinedequipmentparameter, headers, callback) {
|
||||
$http.post(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters',{data:combinedequipmentparameter}, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
callback(response);
|
||||
});
|
||||
},
|
||||
editCombinedEquipmentParameter: function(combinedequipmentID,combinedequipmentparameter,callback) {
|
||||
$http.put(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters/'+combinedequipmentparameter.id,{data:combinedequipmentparameter})
|
||||
editCombinedEquipmentParameter: function(combinedequipmentID,combinedequipmentparameter, headers, callback) {
|
||||
$http.put(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters/'+combinedequipmentparameter.id,
|
||||
{data:combinedequipmentparameter}, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
|
@ -27,8 +27,8 @@ app.factory('CombinedEquipmentParameterService', function($http) {
|
|||
});
|
||||
},
|
||||
|
||||
deleteCombinedEquipmentParameter: function(combinedequipmentID, parameterID, callback) {
|
||||
$http.delete(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters/'+parameterID)
|
||||
deleteCombinedEquipmentParameter: function(combinedequipmentID, parameterID, headers, callback) {
|
||||
$http.delete(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters/'+parameterID, {headers})
|
||||
.then(function (response) {
|
||||
callback(response);
|
||||
}, function (response) {
|
||||
|
|
|
@ -12,14 +12,10 @@
|
|||
"name": "Combined Equipment",
|
||||
"item": [
|
||||
{
|
||||
"name": "POST Create New Combined Equipment",
|
||||
"name": "GET All Combined Equipments",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"MyEMS Chiller Plant\", \"is_input_counted\":true, \"is_output_counted\":false, \"cost_center_id\":1, \"description\":\"equipment description\"}}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments",
|
||||
"host": [
|
||||
|
@ -33,10 +29,27 @@
|
|||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GET All Combined Equipments",
|
||||
"name": "POST Create New Combined Equipment",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"MyEMS Chiller Plant\", \"is_input_counted\":true, \"is_output_counted\":false, \"cost_center_id\":1, \"description\":\"equipment description\"}}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments",
|
||||
"host": [
|
||||
|
@ -71,7 +84,20 @@
|
|||
"name": "PUT Update a Combined Equipment by ID",
|
||||
"request": {
|
||||
"method": "PUT",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"MyEMS Combined Chiller Plant\", \"is_input_counted\":true, \"is_output_counted\":true, \"cost_center_id\":1, \"description\":\"equipment description\"}}"
|
||||
|
@ -93,7 +119,20 @@
|
|||
"name": "POST Clone a Combined Equipment by ID",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{}}"
|
||||
|
@ -115,7 +154,20 @@
|
|||
"name": "DELETE a Combined Equipment by ID",
|
||||
"request": {
|
||||
"method": "DELETE",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments/6",
|
||||
"host": [
|
||||
|
@ -133,7 +185,20 @@
|
|||
"name": "POST Bind an Equipment to a Combined Equipment",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"equipment_id\":1}}"
|
||||
|
@ -175,7 +240,20 @@
|
|||
"name": "DELETE an Equipment from a Combined Equipment",
|
||||
"request": {
|
||||
"method": "DELETE",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments/1/equipments/1",
|
||||
"host": [
|
||||
|
@ -191,29 +269,6 @@
|
|||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "POST Bind a Meter to a Combined Equipment",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"meter_id\":1, \"is_output\":false}}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments/1/meters",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"combinedequipments",
|
||||
"1",
|
||||
"meters"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GET All Meters of a Combined Equipment",
|
||||
"request": {
|
||||
|
@ -233,11 +288,60 @@
|
|||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "POST Bind a Meter to a Combined Equipment",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"meter_id\":1, \"is_output\":false}}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments/1/meters",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"combinedequipments",
|
||||
"1",
|
||||
"meters"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "DELETE a Meter from a Combined Equipment",
|
||||
"request": {
|
||||
"method": "DELETE",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments/1/meters/1",
|
||||
"host": [
|
||||
|
@ -257,7 +361,20 @@
|
|||
"name": "POST Bind a Offline Meter to a Combined Equipment",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"offline_meter_id\":1, \"is_output\":false}}"
|
||||
|
@ -299,7 +416,20 @@
|
|||
"name": "DELETE an Offline Meter from a Combined Equipment",
|
||||
"request": {
|
||||
"method": "DELETE",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments/1/offlinemeters/1",
|
||||
"host": [
|
||||
|
@ -358,7 +488,20 @@
|
|||
"name": "POST Create a point Parameter for a Combined Equipment",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"test parameter\", \"parameter_type\":\"point\", \"constant\":null, \"point_id\":1, \"numerator_meter_uuid\":null, \"denominator_meter_uuid\":null}}"
|
||||
|
@ -382,7 +525,20 @@
|
|||
"name": "PUT Update a point Parameter for a Combined Equipment",
|
||||
"request": {
|
||||
"method": "PUT",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"test parameter\", \"parameter_type\":\"point\", \"constant\":null, \"point_id\":3, \"numerator_meter_uuid\":null, \"denominator_meter_uuid\":null}}"
|
||||
|
@ -407,7 +563,20 @@
|
|||
"name": "POST Create a constant Parameter for a Combined Equipment",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"test constant parameter\", \"parameter_type\":\"constant\", \"constant\":\"test constant\", \"point_id\":null, \"numerator_meter_uuid\":null, \"denominator_meter_uuid\":null}}"
|
||||
|
@ -431,7 +600,20 @@
|
|||
"name": "PUT Update a constant Parameter for a Combined Equipment",
|
||||
"request": {
|
||||
"method": "PUT",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"test parameter1\", \"parameter_type\":\"constant\", \"constant\":\"test constant1\", \"point_id\":null, \"numerator_meter_uuid\":null, \"denominator_meter_uuid\":null}}"
|
||||
|
@ -456,7 +638,20 @@
|
|||
"name": "POST Create a fraction Parameter for a Combined Equipment",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"test fraction parameter\", \"parameter_type\":\"fraction\", \"constant\":null, \"point_id\":null, \"numerator_meter_uuid\":\"8449878f-b368-4ad9-a41c-e2c49189297a\", \"denominator_meter_uuid\":\"3f8a66c4-8fbe-4e6d-8b40-15dee5290afd\"}}"
|
||||
|
@ -480,7 +675,20 @@
|
|||
"name": "PUT Update a fraction Parameter for a Combined Equipment",
|
||||
"request": {
|
||||
"method": "PUT",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"test fraction parameter\", \"parameter_type\":\"fraction\", \"constant\":null, \"point_id\":null, \"numerator_meter_uuid\":\"8449878f-b368-4ad9-a41c-e2c49189297a\", \"denominator_meter_uuid\":\"3f8a66c4-8fbe-4e6d-8b40-15dee5290afd\"}}"
|
||||
|
@ -505,7 +713,20 @@
|
|||
"name": "DELETE a Parameter from a Combined Equipment",
|
||||
"request": {
|
||||
"method": "DELETE",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments/1/parameters/16",
|
||||
"host": [
|
||||
|
@ -525,7 +746,20 @@
|
|||
"name": "POST Bind a Virtual Meter to a Combined Equipment",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"virtual_meter_id\":1, \"is_output\":false}}"
|
||||
|
@ -567,7 +801,20 @@
|
|||
"name": "DELETE a Virtual Meter from a Combined Equipment",
|
||||
"request": {
|
||||
"method": "DELETE",
|
||||
"header": [],
|
||||
"header": [
|
||||
{
|
||||
"key": "User-UUID",
|
||||
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
|
||||
"type": "text",
|
||||
"description": "Any admin users' UUID"
|
||||
},
|
||||
{
|
||||
"key": "Token",
|
||||
"value": "c5f872b51ed40ccf55f1c1d6dbd8cb86eefba5d1010e23b2386bd82be431f3eafc0e3360dee18a5327d9e9852e3cf7caad3b81e252f9f311790c22f7a62a90e1",
|
||||
"type": "text",
|
||||
"description": "Login to get a valid token"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/combinedequipments/1/virtualmeters/1",
|
||||
"host": [
|
||||
|
@ -582,17 +829,6 @@
|
|||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "New Request",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": ""
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ import simplejson as json
|
|||
import mysql.connector
|
||||
import config
|
||||
import uuid
|
||||
from core.useractivity import user_logger
|
||||
from core.useractivity import user_logger, access_control
|
||||
|
||||
|
||||
class CombinedEquipmentCollection:
|
||||
|
@ -62,6 +62,7 @@ class CombinedEquipmentCollection:
|
|||
@user_logger
|
||||
def on_post(req, resp):
|
||||
"""Handles POST requests"""
|
||||
access_control(req)
|
||||
try:
|
||||
raw_json = req.stream.read().decode('utf-8')
|
||||
except Exception as ex:
|
||||
|
@ -204,6 +205,7 @@ class CombinedEquipmentItem:
|
|||
@staticmethod
|
||||
@user_logger
|
||||
def on_delete(req, resp, id_):
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
@ -279,6 +281,7 @@ class CombinedEquipmentItem:
|
|||
@user_logger
|
||||
def on_put(req, resp, id_):
|
||||
"""Handles PUT requests"""
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
@ -376,6 +379,7 @@ class CombinedEquipmentItem:
|
|||
@user_logger
|
||||
def on_post(req, resp, id_):
|
||||
"""Handles PUT requests"""
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
@ -566,6 +570,7 @@ class CombinedEquipmentEquipmentCollection:
|
|||
@user_logger
|
||||
def on_post(req, resp, id_):
|
||||
"""Handles POST requests"""
|
||||
access_control(req)
|
||||
try:
|
||||
raw_json = req.stream.read().decode('utf-8')
|
||||
except Exception as ex:
|
||||
|
@ -640,6 +645,7 @@ class CombinedEquipmentEquipmentItem:
|
|||
@staticmethod
|
||||
@user_logger
|
||||
def on_delete(req, resp, id_, eid):
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
@ -824,6 +830,7 @@ class CombinedEquipmentParameterCollection:
|
|||
@user_logger
|
||||
def on_post(req, resp, id_):
|
||||
"""Handles POST requests"""
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
@ -1132,6 +1139,7 @@ class CombinedEquipmentParameterItem:
|
|||
@staticmethod
|
||||
@user_logger
|
||||
def on_delete(req, resp, id_, pid):
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
@ -1180,6 +1188,7 @@ class CombinedEquipmentParameterItem:
|
|||
@user_logger
|
||||
def on_put(req, resp, id_, pid):
|
||||
"""Handles PUT requests"""
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
@ -1439,6 +1448,7 @@ class CombinedEquipmentMeterCollection:
|
|||
@user_logger
|
||||
def on_post(req, resp, id_):
|
||||
"""Handles POST requests"""
|
||||
access_control(req)
|
||||
try:
|
||||
raw_json = req.stream.read().decode('utf-8')
|
||||
except Exception as ex:
|
||||
|
@ -1519,6 +1529,7 @@ class CombinedEquipmentMeterItem:
|
|||
@staticmethod
|
||||
@user_logger
|
||||
def on_delete(req, resp, id_, mid):
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
@ -1629,6 +1640,7 @@ class CombinedEquipmentOfflineMeterCollection:
|
|||
@user_logger
|
||||
def on_post(req, resp, id_):
|
||||
"""Handles POST requests"""
|
||||
access_control(req)
|
||||
try:
|
||||
raw_json = req.stream.read().decode('utf-8')
|
||||
except Exception as ex:
|
||||
|
@ -1710,6 +1722,7 @@ class CombinedEquipmentOfflineMeterItem:
|
|||
@staticmethod
|
||||
@user_logger
|
||||
def on_delete(req, resp, id_, mid):
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
@ -1820,6 +1833,7 @@ class CombinedEquipmentVirtualMeterCollection:
|
|||
@user_logger
|
||||
def on_post(req, resp, id_):
|
||||
"""Handles POST requests"""
|
||||
access_control(req)
|
||||
try:
|
||||
raw_json = req.stream.read().decode('utf-8')
|
||||
except Exception as ex:
|
||||
|
@ -1901,6 +1915,7 @@ class CombinedEquipmentVirtualMeterItem:
|
|||
@staticmethod
|
||||
@user_logger
|
||||
def on_delete(req, resp, id_, mid):
|
||||
access_control(req)
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||
|
|
Loading…
Reference in New Issue