Skip to content

Commit

Permalink
1.3.0 - Needs Update flag
Browse files Browse the repository at this point in the history
  • Loading branch information
dncrews committed Apr 20, 2015
1 parent d0c2cd8 commit 6170a69
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 41 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ Generic Options
- In addition to any specific options for fields, all fields also get a "Exists" and "! Exists" option


## External Changes && Initial State
If you want to pass in an initial state (or if you make changes to the query externally), you'll need to
set the configuration flag `needsUpdate` to `true`. Any time this flag changes to `true`, this directive
will overwrite the current state and data with whatever is now defined in your configuration object.


## Local Development
To work on this module locally, you will need to clone it and run `gulp watch`. This will ensure that your changes get compiled properly. You will also need to make sure you run `gulp` to build the "dist" files before commit.

Expand Down
30 changes: 14 additions & 16 deletions dist/angular-elastic-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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\">&gt;</option>\n <option value=\"gte\">&ge;</option>\n <option value=\"lt\">&lt;</option>\n <option value=\"lte\">&le;</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
*
Expand Down Expand Up @@ -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\">&gt;</option>\n <option value=\"gte\">&ge;</option>\n <option value=\"lt\">&lt;</option>\n <option value=\"lte\">&le;</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);
Loading

0 comments on commit 6170a69

Please sign in to comment.