Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

cameras.controller.js 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. angular.module('camotionAdmin')
  2. .controller('CamerasController', ['$scope', 'CamerasService', 'HelperService', '$q', 'luticateAuthCache',
  3. function($scope, CamerasService, HelperService, $q, luticateAuthCache) {
  4. $scope.foreighLoaded = false;
  5. $scope.hosts = {};
  6. $scope.entityTypes = {};
  7. $scope.luTable = {
  8. columns: [
  9. {
  10. name: "Name",
  11. width: 3,
  12. getValue: function (item) {
  13. return item.Name;
  14. }
  15. },
  16. {
  17. name: "Type",
  18. width: 3,
  19. getValue: function (item) {
  20. return $scope.entityTypes[item.EntityTypeId].Name;
  21. }
  22. }, {
  23. name: "Description",
  24. width: 6,
  25. getValue: function (item) {
  26. return item.Description;
  27. }
  28. }
  29. ],
  30. canAdd: function()
  31. {
  32. return luticateAuthCache.hasAllEffectivePermissions([
  33. 'CAMOTION_CAMERA_ADD',
  34. 'CAMOTION_HOST_GET'
  35. ])
  36. },
  37. canDel: 'CAMOTION_CAMERA_DEL',
  38. canEdit: function()
  39. {
  40. return true;
  41. },
  42. getLoadPagePromise: function (page, perPage, query, promise) {
  43. var defer = $q.defer();
  44. CamerasService.getAll({page: page, perPage: perPage, query: query}, promise)
  45. .then(function(cameras)
  46. {
  47. if (!$scope.foreighLoaded) {
  48. HelperService.getForeignEntities(promise).then(function (data) {
  49. $scope.hosts = data.hosts;
  50. $scope.entityTypes = data.entityTypes;
  51. $scope.foreighLoaded = true;
  52. defer.resolve(cameras);
  53. }, defer.reject);
  54. }
  55. else {
  56. defer.resolve(cameras);
  57. }
  58. }, defer.reject);
  59. return defer.promise;
  60. },
  61. getDelPromise: function (id, promise) {
  62. return CamerasService.del({camera_id: id}, promise);
  63. },
  64. getEditController: function () {
  65. return "CameraEdit";
  66. }
  67. };
  68. }]);