Skip to content

Commit

Permalink
#1778 Use the tagAutoComplete named query for tag auto complete
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Mar 4, 2021
1 parent 58b924a commit 7b82860
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
};

self.getTags = function (query) {
return TagSrv.getTags(query);
return TagSrv.autoComplete(query);
};
});
})();
2 changes: 1 addition & 1 deletion frontend/app/scripts/controllers/case/CaseCreationCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
};

$scope.getTags = function(query) {
return TagSrv.getTags(query);
return TagSrv.autoComplete(query);
};

$scope.keys = function(o) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/scripts/controllers/case/CaseDetailsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
};

$scope.getCaseTags = function(query) {
return TagSrv.getTags(query);
return TagSrv.autoComplete(query);
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
};

$scope.getTags = function(query) {
return TagSrv.getTags(query);
return TagSrv.autoComplete(query);
};

$scope.loadShares = function () {
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/scripts/controllers/case/CaseUpdateCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
};

this.getTags = function(query) {
return TagSrv.getTags(query);
return TagSrv.autoComplete(query);
};

self.fromTagLibrary = function(field) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
};

$scope.getTags = function(query) {
return TagSrv.getTags(query);
return TagSrv.autoComplete(query);
};
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
};

this.getTags = function(query) {
return TagSrv.getTags(query);
return TagSrv.autoComplete(query);
};

self.fromTagLibrary = function(field) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/scripts/directives/dashboard/filter-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
var promise = null;

if(field.name === 'tags') {
return TagSrv.getTags(query);
return TagSrv.autoComplete(query);
} else if(field.type === 'user') {
promise = AuthenticationSrv.current()
.then(function(user) {
Expand Down
20 changes: 19 additions & 1 deletion frontend/app/scripts/services/api/TagSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

QuerySrv.query('v1', operations, {
params: {
name: 'tags-auto-complete'
name: 'list-tags'
}
}).then(function(response) {
defer.resolve(_.map(response.data, function(tag) {
Expand All @@ -31,5 +31,23 @@
return defer.promise;
};

this.autoComplete = function(term) {
var defer = $q.defer();

var operations = [
{ _name: 'tagAutoComplete', freeTag: term, limit: 20}
]

QuerySrv.call('v1', operations, {
name: 'tags-auto-complete'
}).then(function(response) {
defer.resolve(_.map(response, function(tag) {
return {text: tag};
}));
});

return defer.promise;
};

});
})();

0 comments on commit 7b82860

Please sign in to comment.