-
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.
Adding ability to set min and max on number fields
- Loading branch information
Showing
23 changed files
with
883 additions
and
550 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Angular Elastic Builder</title> | ||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> | ||
</head> | ||
<body data-ng-app="exampleApp"> | ||
|
||
<div data-ng-controller="BasicController as example"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<h3>Filters</h3> | ||
<div data-elastic-builder="example.data"></div> | ||
</div> | ||
<div class="col-md-6"> | ||
<h3>Query</h3> | ||
<pre data-ng-bind="example.showQuery()"></pre> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> | ||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> | ||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> | ||
<script src="angular/angular-recursion.min.js"></script> | ||
<script src="js/angular-elastic-builder.min.js"></script> | ||
<script src="js/exampleApp.js"></script> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var path = require('path'); | ||
var express = require('express'); | ||
|
||
var app = express(); | ||
|
||
app.use(express.static(__dirname)); | ||
app.use('/js', express.static(path.join(__dirname, '../dist'))); | ||
app.use('/angular', express.static(path.join(__dirname, '../node_modules/angular-recursion'))); | ||
|
||
app.listen(process.env.PORT || 3000, function() { | ||
console.log('listening on ' + ( process.env.PORT || 3000)); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
(function(angular) { | ||
|
||
var app = angular.module('exampleApp', [ | ||
'angular-elastic-builder', | ||
]); | ||
|
||
app.controller('BasicController', function() { | ||
|
||
var data = this.data = {}; | ||
|
||
data.query = [ | ||
{ | ||
'and': [ | ||
{ | ||
'range': { | ||
'test.number': { | ||
'gte': 650 | ||
} | ||
} | ||
}, | ||
{ | ||
'range': { | ||
'test.number': { | ||
'lt': 850 | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
'term': { | ||
'test.boolean': 0 | ||
} | ||
}, | ||
{ | ||
'terms': { | ||
'test.state.multi': [ 'AZ', 'CT' ] | ||
} | ||
}, | ||
{ | ||
'not': { | ||
'filter': { | ||
'term': { | ||
'test.term': 'asdfasdf' | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
'exists': { | ||
'field': 'test.term' | ||
} | ||
} | ||
]; | ||
|
||
data.fields = { | ||
'test.number': { type: 'number', minimum: 650 }, | ||
'test.term': { type: 'term' }, | ||
'test.boolean': { type: 'term', subType: 'boolean' }, | ||
'test.state.multi': { type: 'multi', choices: [ 'AZ', 'CA', 'CT' ]} | ||
}; | ||
|
||
this.showQuery = function() { | ||
var queryToShow = { | ||
size: 0, | ||
filter: { and : data.query } | ||
}; | ||
|
||
return JSON.stringify(queryToShow, null, 2); | ||
}; | ||
|
||
}); | ||
|
||
})(window.angular); |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "angular-elastic-builder", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Angular Module for building an Elasticsearch Query", | ||
"author": "Dan Crews <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -13,7 +13,9 @@ | |
"url": "https://github.com/dncrews/angular-elastic-builder.git" | ||
}, | ||
"devDependencies": { | ||
"angular-recursion": "^1.0.5", | ||
"del": "^1.1.1", | ||
"express": "^4.12.3", | ||
"gulp": "^3.8.11", | ||
"gulp-angular-templatecache": "^1.6.0", | ||
"gulp-concat": "^2.5.2", | ||
|
@@ -22,6 +24,7 @@ | |
"gulp-uglifyjs": "^0.6.1" | ||
}, | ||
"scripts": { | ||
"example": "node examples", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
} | ||
} |
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.