Skip to content

Commit

Permalink
#2043 Use custom field ID instead fof name in management page
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed May 28, 2021
1 parent 2d0cd30 commit 0d453eb
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions frontend/app/scripts/services/api/CustomFieldsSrv.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
(function() {
(function () {
'use strict';
angular.module('theHiveServices')
.service('CustomFieldsSrv', function($http, $q) {
.service('CustomFieldsSrv', function ($http, $q) {
var self = this;

this.cache = null;

this.removeField = function(field) {
return $http.delete('./api/customField/' + field.reference);
this.removeField = function (field) {
return $http.delete('./api/customField/' + field.id);
};

this.usage = function(field) {
return $http.get('./api/customFields/' + field.reference + '/use');
this.usage = function (field) {
return $http.get('./api/customFields/' + field.id + '/use');
};

this.list = function() {
this.list = function () {
return $http.get('./api/customField');
};

this.get = function(idOrReference) {
this.get = function (idOrReference) {
return $http.get('./api/customField/' + idOrReference);
};

this.create = function(field) {
this.create = function (field) {
//return $http.post('./api/customField', self._convert(field));
return $http.post('./api/customField', field);
};

this.update = function(id, field) {
this.update = function (id, field) {
//return $http.patch('./api/customField/'+id, self._convert(field));
return $http.patch('./api/customField/'+id, field);
return $http.patch('./api/customField/' + id, field);
};

this.remove = function(id) {
this.remove = function (id) {
return $http.delete('./api/customField/' + id);
};

this.clearCache = function() {
this.clearCache = function () {
self.cache = null;
};

this.getCache = function(name) {
this.getCache = function (name) {
return self.cache[name];
};

this.all = function() {
this.all = function () {
var deferred = $q.defer();

if (self.cache === null) {
$http.get('./api/customField')
.then(function(response) {
.then(function (response) {
self.cache = {};

_.each(response.data, function(field) {
_.each(response.data, function (field) {
self.cache[field.reference] = field;
});

Expand Down

0 comments on commit 0d453eb

Please sign in to comment.