Skip to content

Commit

Permalink
Merge pull request #27 from citizennet/API-1794-optimize-call-for-bul…
Browse files Browse the repository at this point in the history
…k-add-dmas

change call for bulk when using single query option
  • Loading branch information
jojordan3 authored Nov 4, 2021
2 parents ae25314 + c4e02e5 commit b9be5ae
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
16 changes: 15 additions & 1 deletion dist/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
dropdownIcon: [Boolean, false],
tagsStyle: [String, 'tags'],
allowBulk: [Boolean, false],
bulkSingleRequest: [String, ''],
bulkDelimiter: [RegExp, /, ?|\n/],
bulkPlaceholder: [String, 'Enter a list separated by commas or new lines'],
sortFilteredResults: [Boolean, false],
Expand Down Expand Up @@ -1257,7 +1258,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope

tagsInput.registerProcessBulk(function (bulkTags) {
var tags = bulkTags.split(options.tagsInput.bulkDelimiter);

var addTags = function addTags(i) {
return function (data) {
_.times(i, function (i) {
Expand All @@ -1266,6 +1266,20 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
};
};

if (options.tagsInput.bulkSingleRequest) {
var request_config = JSON.parse(options.tagsInput.bulkSingleRequest);
return Api.post({
url: request_config.url,
data: {
location_types: request_config.location_types,
terms: tags
}
}).then(function (response) {
response.map(function (item) {
tagsInput.addTag(item);
});
});
}
// in case a query is involved...doesn't hurt to use even if not
return Api.batch(function () {
for (var i = 0, l = tags.length; i < l; i++) {
Expand Down
Loading

0 comments on commit b9be5ae

Please sign in to comment.