diff --git a/frontend/app/scripts/services/api/TagSrv.js b/frontend/app/scripts/services/api/TagSrv.js index 8df9873fe8..e961ec91d4 100644 --- a/frontend/app/scripts/services/api/TagSrv.js +++ b/frontend/app/scripts/services/api/TagSrv.js @@ -1,45 +1,43 @@ (function() { 'use strict'; angular.module('theHiveServices') - .service('TagSrv', function(StatSrv, $q) { - - var getPromiseFor = function(objectType) { - return StatSrv.getPromise({ - objectType: objectType, - field: 'tags', - limit: 1000 - }); - }; - - var mapTags = function(collection, term) { - return _.map(_.filter(_.keys(collection), function(tag) { - var regex = new RegExp(term, 'gi'); - return regex.test(tag); - }), function(tag) { - return {text: tag}; - }); - }; + .service('TagSrv', function(QuerySrv, $q) { var getTags = function(objectType, term) { var defer = $q.defer(); - getPromiseFor(objectType).then(function(response) { - defer.resolve(mapTags(response.data, term) || []); - }); + var operations = [ + { _name: 'listTag' }, + { _name: objectType }, + { + _name: 'filter', + _like: { + _field: 'text', + _value: '*' + term + '*' + } + }, + { + _name: 'text' + } + ]; + + // Get the list + QuerySrv.call('v0', operations) + .then(function(data) { + defer.resolve(_.map(data, function(tag) { + return {text: tag}; + })); + }); return defer.promise; }; this.fromCases = function(term) { - return getTags('case', term); - }; - - this.fromAlerts = function(term) { - return getTags('alert', term); + return getTags('fromCase', term); }; this.fromObservables = function(term) { - return getTags('case/artifact', term); + return getTags('fromObservable', term); }; }); diff --git a/frontend/app/views/directives/updatable-tags.html b/frontend/app/views/directives/updatable-tags.html index 16e23ba3c2..46ceceb402 100644 --- a/frontend/app/views/directives/updatable-tags.html +++ b/frontend/app/views/directives/updatable-tags.html @@ -16,7 +16,7 @@
- +
diff --git a/frontend/app/views/partials/case/case.creation.html b/frontend/app/views/partials/case/case.creation.html index 14c97a22a1..6e5e150af1 100644 --- a/frontend/app/views/partials/case/case.creation.html +++ b/frontend/app/views/partials/case/case.creation.html @@ -14,7 +14,7 @@

Case details

-
+
{{template.titlePrefix}}
@@ -71,7 +71,7 @@

Case details

min-length="2" ng-model="tags" replace-spaces-with-dashes="false"> - +
diff --git a/frontend/app/views/partials/case/case.details.html b/frontend/app/views/partials/case/case.details.html index 0b8fcab35a..076f07ef0c 100644 --- a/frontend/app/views/partials/case/case.details.html +++ b/frontend/app/views/partials/case/case.details.html @@ -68,7 +68,7 @@

Summary

-
+
Tags
diff --git a/frontend/app/views/partials/observables/creation/form.html b/frontend/app/views/partials/observables/creation/form.html index bc652cb16f..aedf952384 100644 --- a/frontend/app/views/partials/observables/creation/form.html +++ b/frontend/app/views/partials/observables/creation/form.html @@ -121,7 +121,7 @@
- +

The observable(s) description or tags are required.

diff --git a/frontend/app/views/partials/observables/observable.update.html b/frontend/app/views/partials/observables/observable.update.html index 690cba2a9a..1959126add 100644 --- a/frontend/app/views/partials/observables/observable.update.html +++ b/frontend/app/views/partials/observables/observable.update.html @@ -48,7 +48,7 @@ - + @@ -60,7 +60,7 @@ - +