-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
46 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* # angular-elastic-builder | ||
* ## Angular Module for building an Elasticsearch Query | ||
* | ||
* @version v1.2.0 | ||
* @version v1.3.0 | ||
* @link https://github.com/dncrews/angular-elastic-builder.git | ||
* @license MIT | ||
* @author Dan Crews <[email protected]> | ||
|
@@ -78,16 +78,15 @@ | |
}; | ||
|
||
/** | ||
* this Watcher gets used only once on initial setting of the query and then not again | ||
* Any time "outside forces" change the query, they should tell us so via | ||
* `data.needsUpdate` | ||
*/ | ||
var unwatcher = scope.$watch('data.query', function(curr) { | ||
scope.$watch('data.needsUpdate', function(curr, prev) { | ||
if (! curr) return; | ||
|
||
scope.filters = elasticQueryService.toFilters(data.query, scope.data.fields); | ||
|
||
/* Stop Watching */ | ||
unwatcher(); | ||
}, true); | ||
scope.data.needsUpdate = false; | ||
}); | ||
|
||
/** | ||
* Changes on the page update the Query | ||
|
@@ -313,6 +312,14 @@ | |
|
||
})(window.angular); | ||
|
||
(function(angular) {"use strict"; angular.module("angular-elastic-builder").run(["$templateCache", function($templateCache) {$templateCache.put("angular-elastic-builder/BuilderDirective.html","<div class=\"elastic-builder\">\n <div class=\"filter-panels\">\n <div class=\"list-group form-inline\">\n <div\n data-ng-repeat=\"filter in filters\"\n data-elastic-builder-chooser=\"filter\"\n data-elastic-fields=\"data.fields\"\n data-on-remove=\"removeChild($index)\"\n data-depth=\"0\"></div>\n <div class=\"list-group-item actions\">\n <a class=\"btn btn-xs btn-primary\" title=\"Add Rule\" data-ng-click=\"addRule()\">\n <i class=\"fa fa-plus\"></i>\n </a>\n <a class=\"btn btn-xs btn-primary\" title=\"Add Group\" data-ng-click=\"addGroup()\">\n <i class=\"fa fa-list\"></i>\n </a>\n </div>\n </div>\n </div>\n</div>\n"); | ||
$templateCache.put("angular-elastic-builder/ChooserDirective.html","<div\n class=\"list-group-item elastic-builder-chooser\"\n data-ng-class=\"getGroupClassName()\">\n\n <div data-ng-if=\"item.type === \'group\'\"\n data-elastic-builder-group=\"item\"\n data-depth=\"{{ depth }}\"\n data-elastic-fields=\"elasticFields\"\n data-on-remove=\"onRemove()\"></div>\n\n <div data-ng-if=\"item.type !== \'group\'\"\n data-elastic-builder-rule=\"item\"\n data-elastic-fields=\"elasticFields\"\n data-on-remove=\"onRemove()\"></div>\n\n</div>\n"); | ||
$templateCache.put("angular-elastic-builder/GroupDirective.html","<div class=\"elastic-builder-group\">\n <h5>If\n <select data-ng-model=\"group.subType\" class=\"form-control\">\n <option value=\"and\">all</option>\n <option value=\"or\">any</option>\n </select>\n of these conditions are met\n </h5>\n <div\n data-ng-repeat=\"rule in group.rules\"\n data-elastic-builder-chooser=\"rule\"\n data-elastic-fields=\"elasticFields\"\n data-depth=\"{{ +depth + 1 }}\"\n data-on-remove=\"removeChild($index)\"></div>\n\n <div class=\"list-group-item actions\" data-ng-class=\"getGroupClassName()\">\n <a class=\"btn btn-xs btn-primary\" title=\"Add Sub-Rule\" data-ng-click=\"addRule()\">\n <i class=\"fa fa-plus\"></i>\n </a>\n <a class=\"btn btn-xs btn-primary\" title=\"Add Sub-Group\" data-ng-click=\"addGroup()\">\n <i class=\"fa fa-list\"></i>\n </a>\n </div>\n\n <a class=\"btn btn-xs btn-danger remover\" data-ng-click=\"onRemove()\">\n <i class=\"fa fa-minus\"></i>\n </a>\n</div>\n"); | ||
$templateCache.put("angular-elastic-builder/RuleDirective.html","<div class=\"elastic-builder-rule\">\n <select class=\"form-control\" data-ng-model=\"rule.field\" data-ng-options=\"key as key for (key, value) in elasticFields\"></select>\n\n <span data-elastic-type=\"getType()\" data-rule=\"rule\" data-guide=\"elasticFields[rule.field]\"></span>\n\n <a class=\"btn btn-xs btn-danger remover\" data-ng-click=\"onRemove()\">\n <i class=\"fa fa-minus\"></i>\n </a>\n\n</div>\n"); | ||
$templateCache.put("angular-elastic-builder/types/Boolean.html","<span class=\"boolean-rule\">\n Equals\n\n <!-- This is a weird hack to make sure these are numbers -->\n <select\n data-ng-model=\"rule.value\"\n class=\"form-control\"\n data-ng-options=\"booleans.indexOf(choice) as choice for choice in booleansOrder\">\n </select>\n</span>\n"); | ||
$templateCache.put("angular-elastic-builder/types/Multi.html","<span class=\"multi-rule\">\n <span data-ng-repeat=\"choice in guide.choices\">\n <label class=\"checkbox\">\n <input type=\"checkbox\" data-ng-model=\"rule.values[choice]\">\n {{ choice }}\n </label>\n </span>\n</span>\n"); | ||
$templateCache.put("angular-elastic-builder/types/Number.html","<span class=\"number-rule\">\n <select data-ng-model=\"rule.subType\" class=\"form-control\">\n <optgroup label=\"Numeral\">\n <option value=\"equals\">=</option>\n <option value=\"gt\">></option>\n <option value=\"gte\">≥</option>\n <option value=\"lt\"><</option>\n <option value=\"lte\">≤</option>\n </optgroup>\n\n <optgroup label=\"Generic\">\n <option value=\"exists\">Exists</option>\n <option value=\"notExists\">! Exists</option>\n </optgroup>\n </select>\n\n <!-- Range Fields -->\n <input data-ng-if=\"inputNeeded()\"\n class=\"form-control\"\n data-ng-model=\"rule.value\"\n type=\"number\"\n min=\"{{ guide.minimum }}\"\n max=\"{{ guide.maximum }}\">\n</span>\n"); | ||
$templateCache.put("angular-elastic-builder/types/Term.html","<span class=\"elastic-term\">\n <select data-ng-model=\"rule.subType\" class=\"form-control\">\n <!-- Term Options -->\n <optgroup label=\"Text\">\n <option value=\"equals\">Equals</option>\n <option value=\"notEquals\">! Equals</option>\n </optgroup>\n\n <!-- Generic Options -->\n <optgroup label=\"Generic\">\n <option value=\"exists\">Exists</option>\n <option value=\"notExists\">! Exists</option>\n </optgroup>\n\n </select>\n <input\n data-ng-if=\"inputNeeded()\"\n class=\"form-control\"\n data-ng-model=\"rule.value\"\n type=\"text\">\n</span>\n");}]);})(window.angular); | ||
/** | ||
* angular-elastic-builder | ||
* | ||
|
@@ -539,12 +546,3 @@ | |
} | ||
|
||
})(window.angular); | ||
|
||
(function(angular) {"use strict"; angular.module("angular-elastic-builder").run(["$templateCache", function($templateCache) {$templateCache.put("angular-elastic-builder/BuilderDirective.html","<div class=\"elastic-builder\">\n <div class=\"filter-panels\">\n <div class=\"list-group form-inline\">\n <div\n data-ng-repeat=\"filter in filters\"\n data-elastic-builder-chooser=\"filter\"\n data-elastic-fields=\"data.fields\"\n data-on-remove=\"removeChild($index)\"\n data-depth=\"0\"></div>\n <div class=\"list-group-item actions\">\n <button class=\"btn btn-xs btn-primary\" title=\"Add Rule\" data-ng-click=\"addRule()\">\n <i class=\"fa fa-plus\"></i>\n </button>\n <button class=\"btn btn-xs btn-primary\" title=\"Add Group\" data-ng-click=\"addGroup()\">\n <i class=\"fa fa-list\"></i>\n </button>\n </div>\n </div>\n </div>\n</div>\n"); | ||
$templateCache.put("angular-elastic-builder/ChooserDirective.html","<div\n class=\"list-group-item elastic-builder-chooser\"\n data-ng-class=\"getGroupClassName()\">\n\n <div data-ng-if=\"item.type === \'group\'\"\n data-elastic-builder-group=\"item\"\n data-depth=\"{{ depth }}\"\n data-elastic-fields=\"elasticFields\"\n data-on-remove=\"onRemove()\"></div>\n\n <div data-ng-if=\"item.type !== \'group\'\"\n data-elastic-builder-rule=\"item\"\n data-elastic-fields=\"elasticFields\"\n data-on-remove=\"onRemove()\"></div>\n\n</div>\n"); | ||
$templateCache.put("angular-elastic-builder/GroupDirective.html","<div class=\"elastic-builder-group\">\n <h5>If\n <select data-ng-model=\"group.subType\" class=\"form-control\">\n <option value=\"and\">all</option>\n <option value=\"or\">any</option>\n </select>\n of these conditions are met\n </h5>\n <div\n data-ng-repeat=\"rule in group.rules\"\n data-elastic-builder-chooser=\"rule\"\n data-elastic-fields=\"elasticFields\"\n data-depth=\"{{ +depth + 1 }}\"\n data-on-remove=\"removeChild($index)\"></div>\n\n <div class=\"list-group-item actions\" data-ng-class=\"getGroupClassName()\">\n <button class=\"btn btn-xs btn-primary\" title=\"Add Sub-Rule\" data-ng-click=\"addRule()\">\n <i class=\"fa fa-plus\"></i>\n </button>\n <button class=\"btn btn-xs btn-primary\" title=\"Add Sub-Group\" data-ng-click=\"addGroup()\">\n <i class=\"fa fa-list\"></i>\n </button>\n </div>\n\n <button class=\"btn btn-xs btn-danger remover\" data-ng-click=\"onRemove()\">\n <i class=\"fa fa-minus\"></i>\n </button>\n</div>\n"); | ||
$templateCache.put("angular-elastic-builder/RuleDirective.html","<div class=\"elastic-builder-rule\">\n <select class=\"form-control\" data-ng-model=\"rule.field\" data-ng-options=\"key as key for (key, value) in elasticFields\"></select>\n\n <span data-elastic-type=\"getType()\" data-rule=\"rule\" data-guide=\"elasticFields[rule.field]\"></span>\n\n <button class=\"btn btn-xs btn-danger remover\" data-ng-click=\"onRemove()\">\n <i class=\"fa fa-minus\"></i>\n </button>\n\n</div>\n"); | ||
$templateCache.put("angular-elastic-builder/types/Boolean.html","<span class=\"boolean-rule\">\n Equals\n\n <!-- This is a weird hack to make sure these are numbers -->\n <select\n data-ng-model=\"rule.value\"\n class=\"form-control\"\n data-ng-options=\"booleans.indexOf(choice) as choice for choice in booleansOrder\">\n </select>\n</span>\n"); | ||
$templateCache.put("angular-elastic-builder/types/Multi.html","<span class=\"multi-rule\">\n <span data-ng-repeat=\"choice in guide.choices\">\n <label class=\"checkbox state\">\n <input type=\"checkbox\" data-ng-model=\"rule.values[choice]\">\n {{ choice }}\n </label>\n </span>\n</span>\n"); | ||
$templateCache.put("angular-elastic-builder/types/Number.html","<span class=\"number-rule\">\n <select data-ng-model=\"rule.subType\" class=\"form-control\">\n <optgroup label=\"Numeral\">\n <option value=\"equals\">=</option>\n <option value=\"gt\">></option>\n <option value=\"gte\">≥</option>\n <option value=\"lt\"><</option>\n <option value=\"lte\">≤</option>\n </optgroup>\n\n <optgroup label=\"Generic\">\n <option value=\"exists\">Exists</option>\n <option value=\"notExists\">! Exists</option>\n </optgroup>\n </select>\n\n <!-- Range Fields -->\n <input data-ng-if=\"inputNeeded()\"\n class=\"form-control\"\n data-ng-model=\"rule.value\"\n type=\"number\"\n min=\"{{ guide.minimum }}\"\n max=\"{{ guide.maximum }}\">\n</span>\n"); | ||
$templateCache.put("angular-elastic-builder/types/Term.html","<span class=\"elastic-term\">\n <select data-ng-model=\"rule.subType\" class=\"form-control\">\n <!-- Term Options -->\n <optgroup label=\"Text\">\n <option value=\"equals\">Equals</option>\n <option value=\"notEquals\">! Equals</option>\n </optgroup>\n\n <!-- Generic Options -->\n <optgroup label=\"Generic\">\n <option value=\"exists\">Exists</option>\n <option value=\"notExists\">! Exists</option>\n </optgroup>\n\n </select>\n <input\n data-ng-if=\"inputNeeded()\"\n class=\"form-control\"\n data-ng-model=\"rule.value\"\n type=\"text\">\n</span>\n");}]);})(window.angular); |
Oops, something went wrong.