├── .gitignore
├── LICENSE
├── README.md
├── bootstrap-template
├── css
│ ├── sidebar.css
│ └── style.css
├── demo.html
└── js
│ ├── app.js
│ ├── elastic.min.js
│ ├── elasticsearch.angular.min.js
│ ├── elasticui.min.js
│ ├── elif.js
│ └── sidebar.js
├── css
├── sidebar.css
└── style.css
├── demo.html
├── doku
├── demo-materialize1.png
├── demo-materialize2.png
├── demo.png
├── facet-bad.png
└── facet-good.png
├── js
├── app.js
├── elastic.min.js
├── elasticsearch.angular.min.js
├── elasticui.min.js
├── elif.js
└── sidebar.js
└── materializecss-template
├── css
└── style.css
├── demo.html
└── js
├── app.js
├── elastic.min.js
├── elasticsearch.angular.min.js
└── elasticui.min.js
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ElasticUI-extension
2 | ==================
3 |
4 | ElasticUI is an awesome and very easy to setup framework that enables faceted navigation for ElasticSearch, written in AngularJS.
5 |
6 | There are 2 templates available: one is very basic and built on top of Twitter-Bootstrap and another one is built on top of Materialize-CSS.
7 |
8 | http://materializecss.com/
9 |
10 |
11 | http://www.elasticui.com/
12 |
13 | **Modifications:**
14 |
15 | - Moved configurations into app.js
16 | - Replaced MatchQuery with QueryStringQuery, as the syntax is more powerful
17 |
18 | http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax
19 |
20 | - Added formatting of result-set inspired by Calaca.
21 | - Unifying results was also inspired by Calaca ("track by id")
22 |
23 | https://github.com/romansanchez/Calaca
24 |
25 | - Bootstrap is added, to support media-items for beautifully displaying images and standard attributes.
26 |
27 | http://getbootstrap.com/components/#media
28 |
29 | - ng-elif is added to allow for easy case-control flow in the template. (add to module)
30 | - In combination with the bootstrap media-objects, you can easily display different default-images based on features like category, etc.
31 |
32 | https://github.com/zachsnow/ng-elif
33 |
34 | New features in the template
35 |
36 | - SignificantTerms aggregation
37 | - Sort using buttons (Could be enhanced)
38 |
39 |
40 |
41 | Documentation
42 | ---------------------
43 |
44 | The main part of the project is borrowed from ElasticUI, so that's where a lot of documentation can be found.
45 |
46 | https://github.com/YousefED/ElasticUI
47 |
48 | I just wanted to make a template which has more features builtin in the template, so it could already be used as search-engine and needs just some design enhancements and configuration of queries to use in the backend.
49 |
50 |
51 | Setup
52 | ----------
53 |
54 | Just edit js/app.js and enter your ElasticSearch-Host and index-name.
55 | Then edit demo.html and change all your field-names accordingly.
56 |
57 |
58 | Queries
59 | ----------
60 |
61 | The queries that can be used easily in the backend are documented here:
62 |
63 | https://github.com/fullscale/elastic.js/blob/master/dist/elastic.js
64 | http://docs.fullscale.co/elasticjs/
65 |
66 | And of course on the official ElasticSearch website.
67 |
68 | http://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
69 |
70 | One of the queries that can be used is MatchQuery with all it's parameters, that just need to be added like this in the template:
71 |
72 |
73 | ```
74 |
75 | ```
76 |
77 | All parameters can be added like this:
78 |
79 | ejs.QUERY_TYPE(REQUIRED_PARAMETERS).OPTIONAL_PARAMETERS(VALUE)
80 |
81 |
82 | Mapping considerations
83 | ---------------------------------
84 |
85 | Usually you don't need to create a mapping for an index with ElasticSearch, as it's schemaless, or better, creates a schema on the fly based on the first document.
86 | BUT if you want to provide faceted navigation, you should create an explicit mapping.
87 | Per default each field is analyzed.
88 | A terms facet of an analyzed field, will show you the analyzed tokens.
89 |
90 | Which looks like this:
91 |
92 | 
93 |
94 | What you want instead, is usually this:
95 |
96 | 
97 |
98 | And for this you need to configure your mapping accordingly, before creating the index:
99 |
100 | Usually you want the field both, intuitively searchable and "facetable", so you should use multifields like this:
101 |
102 | ```
103 | "author" : {
104 | "type" : "string",
105 | "analyzer" : "english", #or standard, or any other language. For proper names, it's hard to find a "right way"
106 | "fields": {
107 | "raw": { "type": "string", "index": "not_analyzed" }
108 | }
109 | }
110 | ```
111 |
112 | Your **template** would then look like this:
113 |
114 | ```
115 |
Author
116 |
117 | ```
118 |
119 | http://www.elastic.co/guide/en/elasticsearch/reference/current/_multi_fields.html
120 |
121 |
122 | Security-considerations
123 | --------------------------------
124 |
125 | The app configured like this, is not secure at all.
126 | It works nice for development, but if you use the JS-client everybody can get access to your credentials.
127 | Please consider this:
128 |
129 | http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/host-reference.html#_examples_2
130 |
131 |
132 | Browser-compatibility
133 | ------------------------------
134 |
135 | The app currently works with Chromium (41.xx on Ubuntu), but not with Firefox (36.xxon Ubuntu).
136 |
137 |
138 | Demo Basic Bootstrap template
139 | ----
140 |
141 | 
142 |
143 |
144 | Demo Materialize template
145 | ----
146 | 
147 | 
148 |
--------------------------------------------------------------------------------
/bootstrap-template/css/sidebar.css:
--------------------------------------------------------------------------------
1 | /* All the default sidebar styles */
2 | /* toggle button settings */
3 | /* Note: this disables the navbar-toggle class's hide function. set visibility with the boostrap visible/hidden classes */
4 | /* Note: this also disables the navbar-header class positioning settings in small screens. */
5 | .navbar.navbar-static .navbar-header {
6 | float: left;
7 | }
8 |
9 | .navbar .navbar-toggle.toggle-left {
10 | float: left;
11 | margin-left: 15px;
12 | }
13 |
14 | .navbar .navbar-toggle.toggle-right {
15 | float: right;
16 | margin-right: 15px;
17 | }
18 |
19 | .navbar .navbar-toggle.toggle-sidebar, [data-toggle="sidebar"] {
20 | display: block;
21 | }
22 |
23 | /* sidebar settings */
24 | .sidebar {
25 | position: fixed;
26 | display: block;
27 | top: 51px;
28 | bottom: 0;
29 | z-index: 1000;
30 | min-height: 100%;
31 | max-height: none;
32 | overflow: auto;
33 | }
34 |
35 | .sidebar-left {
36 | left: 0;
37 | }
38 |
39 | .sidebar-right {
40 | right: 0;
41 | }
42 |
43 | /* css to override hiding the sidebar according to different screen sizes */
44 | .row .sidebar.sidebar-left.sidebar-xs-show {
45 | left: 0;
46 | -webkit-transform: translate(0,0);
47 | -ms-transform: translate(0,0);
48 | -o-transform: translate(0,0);
49 | -moz-transform: translate(0,0);
50 | transform: translate(0,0);
51 | }
52 |
53 | /*right sidebar is untested */
54 | .row .sidebar.sidebar-right.sidebar-xs-show {
55 | right: 0;
56 | -webkit-transform: translate(0,0);
57 | -ms-transform: translate(0,0);
58 | -o-transform: translate(0,0);
59 | -moz-transform: translate(0,0);
60 | transform: translate(0,0);
61 | }
62 |
63 | @media (min-width: 768px) {
64 | .row .sidebar.sidebar-left.sidebar-sm-show {
65 | left: 0;
66 | -webkit-transform: translate(0,0);
67 | -ms-transform: translate(0,0);
68 | -o-transform: translate(0,0);
69 | -moz-transform: translate(0,0);
70 | transform: translate(0,0);
71 | }
72 |
73 | /*right sidebar is untested */
74 | .row .sidebar.sidebar-right.sidebar-sm-show {
75 | right: 0;
76 | -webkit-transform: translate(0,0);
77 | -ms-transform: translate(0,0);
78 | -o-transform: translate(0,0);
79 | -moz-transform: translate(0,0);
80 | transform: translate(0,0);
81 | }
82 | }
83 |
84 | @media (min-width: 992px) {
85 | .row .sidebar.sidebar-left.sidebar-md-show {
86 | left: 0;
87 | -webkit-transform: translate(0,0);
88 | -ms-transform: translate(0,0);
89 | -o-transform: translate(0,0);
90 | -moz-transform: translate(0,0);
91 | transform: translate(0,0);
92 | }
93 |
94 | .row .sidebar.sidebar-right.sidebar-md-show {
95 | right: 0;
96 | -webkit-transform: translate(0,0);
97 | -ms-transform: translate(0,0);
98 | -o-transform: translate(0,0);
99 | -moz-transform: translate(0,0);
100 | transform: translate(0,0);
101 | }
102 | }
103 |
104 | @media (min-width: 1170px) {
105 | .row .sidebar.sidebar-left.sidebar-lg-show {
106 | left: 0;
107 | -webkit-transform: translate(0,0);
108 | -moz-transform: translate(0,0);
109 | -ms-transform: translate(0,0);
110 | -o-transform: translate(0,0);
111 | transform: translate(0,0);
112 | }
113 |
114 | .row .sidebar.sidebar-right.sidebar-lg-show {
115 | right: 0;
116 | -webkit-transform: translate(0,0);
117 | -moz-transform: translate(0,0);
118 | -ms-transform: translate(0,0);
119 | -o-transform: translate(0,0);
120 | transform: translate(0,0);
121 | }
122 | }
123 |
124 | /* animation class - optional: without it the sidebar would just pop in and out*/
125 | .sidebar-animate {
126 | -webkit-transition: -webkit-transform 300ms ease;
127 | -moz-transition: -moz-transform 300ms ease;
128 | -o-transition: transform 300ms ease;
129 | transition: transform 300ms ease;
130 | }
131 |
132 | /* Left panel positioning classes */
133 | .sidebar.sidebar-left {
134 | -webkit-transform: translate(-100%,0);
135 | -moz-transform: translate(-100%,0);
136 | -ms-transform: translate(-100%,0);
137 | -o-transform: translate(-100%,0);
138 | transform: translate(-100%,0);
139 | }
140 |
141 | .sidebar.sidebar-left.sidebar-open {
142 | -webkit-transform: translate(0,0);
143 | -moz-transform: translate(0,0);
144 | -ms-transform: translate(0,0);
145 | -o-transform: translate(0,0);
146 | transform: translate(0,0);
147 | }
148 |
149 | .sidebar.sidebar-right {
150 | -webkit-transform: translate(100%,0);
151 | -moz-transform: translate(100%,0);
152 | -ms-transform: translate(100%,0);
153 | -o-transform: translate(100%,0);
154 | transform: translate(100%,0);
155 | }
156 |
157 | .sidebar.sidebar-right.sidebar-open {
158 | -webkit-transform: translate(0,0);
159 | -moz-transform: translate(0,0);
160 | -ms-transform: translate(0,0);
161 | -o-transform: translate(0,0);
162 | transform: translate(0,0);
163 | }
164 |
--------------------------------------------------------------------------------
/bootstrap-template/css/style.css:
--------------------------------------------------------------------------------
1 | .sidebar {
2 | position: fixed;
3 | top: 0;
4 | bottom: 0;
5 | z-index: 1000;
6 | display: block;
7 | padding: 20px;
8 | overflow-x: hidden;
9 | overflow-y: auto;
10 | background-color: #f5f5f5;
11 | border-right: 1px solid #eee;
12 | }
13 |
14 | #sidebarButton {
15 | z-index: 1;
16 | position: fixed;
17 | right: 20px;
18 | top: 20px;
19 | }
20 |
21 | .media-left img {
22 | width: 100px;
23 | }
24 |
25 | /** From calaca.css */
26 |
27 | .result {
28 | margin-bottom: 10px;
29 | padding: 10px;
30 | border-bottom: 10px solid #ecf0f1;
31 | }
32 |
33 | .result h2 {
34 | font-size: 20px;
35 | color: #ed4877;
36 | margin-bottom: 5px;
37 | }
38 |
39 |
40 | /** Bootrtrap **/
41 | .checkbox, .radio {
42 | position: relative;
43 | display: block;
44 | margin-top: 10px;
45 | margin-bottom: 10px;
46 | padding-left: 20px;
47 | }
48 |
49 | .form-control {
50 | width: 200px;
51 | }
52 |
--------------------------------------------------------------------------------
/bootstrap-template/demo.html:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 | ElasticUI-Extension
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
56 |
57 |
58 |
63 |
64 |
65 |
Results
66 |
67 |
68 |
69 |
75 |
76 |
{{(indexVM.results.hits.total | number) || 0}} results ({{indexVM.results.took || 0}}ms)
77 |
78 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/bootstrap-template/js/app.js:
--------------------------------------------------------------------------------
1 | var app = angular.module('demo', ['elasticui', 'elif']);
2 |
3 | app.constant('euiHost', 'http://localhost:9200');
4 | app.controller('IndexController', function($scope) {
5 | $scope.indexName = "INDEX_NAME";
6 | });
7 |
8 |
--------------------------------------------------------------------------------
/bootstrap-template/js/elasticui.min.js:
--------------------------------------------------------------------------------
1 | /*! elasticui - v0.0.6 - 2015-03-21
2 | * http://www.elasticui.com
3 | * Copyright (c) 2015 Yousef El-Dardiry; Licensed Apache */
4 |
5 | var elasticui;!function(a){var b;!function(a){var b=function(){function b(){this.ejsObjects=[],this.jsonObjects=[]}return b.prototype.indexOf=function(b){return this.jsonObjects.indexOf(a.EjsTool.getJsonFromEjsObject(b))},b.prototype.add=function(b){var c=this.indexOf(b);-1==c&&(this.ejsObjects.push(b),this.jsonObjects.push(a.EjsTool.getJsonFromEjsObject(b)))},b.prototype.remove=function(a){var b=this.indexOf(a);b>-1&&(this.ejsObjects.splice(b,1),this.jsonObjects.splice(b,1))},b}();a.EjsCollection=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},elasticui;!function(a){var b;!function(a){var b=function(b){function c(){b.apply(this,arguments)}return __extends(c,b),c.prototype.getAsFilter=function(){return a.FilterTool.combineFilters(this.ejsObjects)},c.prototype.getAsORFilter=function(){return a.FilterTool.combineFiltersShould(this.ejsObjects)},c.prototype.contains=function(a){return this.indexOf(a)>-1},c}(a.EjsCollection);a.FilterCollection=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){}return a.combineFilters=function(a){return 1===a.length?a[0]:a.length>1?ejs.BoolFilter().must(a):null},a.combineFiltersShould=function(a){return 1===a.length?a[0]:a.length>1?ejs.BoolFilter().should(a):null},a}();a.FilterTool=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){a.services=angular.module("elasticui.services",[])}(b=a.services||(a.services={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){a.directives=angular.module("elasticui.directives",[])}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="EAC",b.scope=!0,b.controller=a.controllers.AggregationController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-aggregation")+" | euiCached",function(b){return a.aggregation.agg=b});var e=!0,f=b.attr("eui-filter-self");f&&(a.$watch(f,function(b){return a.aggregation.filterSelf=b}),e=a.$eval(f)),a.aggregation={agg:a.$eval(b.attr("eui-aggregation")+" | euiCached"),filterSelf:e},d.init()},b}return b}();b.AggregationDirective=c,b.directives.directive("euiAggregation",a.directives.AggregationDirective)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.FilterController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-filter")+" | euiCached",function(b){return a.filter.filter=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.filter.enabled=b}),e=a.$eval(f)),a.filter={filter:a.$eval(b.attr("eui-filter")+" | euiCached"),enabled:e},d.init()},b}return b}();b.FilterDirective=c,b.directives.directive("euiFilter",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="EAC",b.scope=!1,b.controller=a.controllers.IndexController,b.link=function(a,b,c,d){a.$watch(c.euiIndex,function(a){d.indexVM.index=a}),d.indexVM.index=a.$eval(c.euiIndex)},b}return b}();b.IndexDirective=c,b.directives.directive("euiIndex",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){var a={};return a.require="ngModel",a.link=function(a,b,c,d){d.$parsers.push(function(a){return!a}),d.$formatters.push(function(a){return!a})},a}return a}();a.InvertedDirective=b,a.directives.directive("euiInverted",b)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="EAC",b.scope=!0,b.controller=a.controllers.OrFilterController,b.link=function(){},b}return b}();b.OrFilterDirective=c,b.directives.directive("euiOrFilter",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.SortController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-sort")+" | euiCached",function(b){return a.sorting.sort=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.sorting.enabled=b}),e=a.$eval(f)),a.sorting={sort:a.$eval(b.attr("eui-sort")+" | euiCached"),enabled:e},d.init()},b}return b}();b.SortDirective=c,b.directives.directive("euiSort",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){var a={};return a.restrict="EAC",a.scope=!1,a.transclude=!1,a.link={pre:function(a,b){var c=b.attr("eui-key");a.$watch(b.attr("eui-value"),function(b,d){angular.equals(b,d)||(a[c]=b)},!0),a[c]=a.$eval(b.attr("eui-value"))}},a}return a.$inject=["$timeout"],a}();a.VarDirective=b,a.directives.directive("euiVar",b)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){a.filters=angular.module("elasticui.filters",[])}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){var a={};return function(b){if(!b)return b;var c=angular.toJson(b.toJSON());return a[c]||(a[c]=b),a[c]}}return a}();a.CachedFilter=b,a.filters.filter("euiCached",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(b,c){if(!b||!b.length)return b;var d=a.parseString(c);return b.map(function(b){return[b.key,a.getValue(b,d)]})}}return a.parseString=function(a){return a.split(".")},a.getValue=function(a,b){var c=a;return angular.forEach(b,function(a){return c?void(c=c[a]):c}),c},a}();a.MapFilter=b,a.filters.filter("euiMap",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a,b,c,d){void 0===d&&(d=5);for(var e=1;b>=e;e++)c+d>=e&&e>=c-d||c>e&&4>c-d||e>c+d&&4>b-(c+d)?a.push(e):1==e?a.push(1,-1):e==b&&a.push(-2,b);return a}}return a}();a.PageRangeFilter=b,a.filters.filter("euiPageRange",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a,b){b=parseInt(b);for(var c=0;b>c;c++)a.push(c);return a}}return a}();a.RangeFilter=b,a.filters.filter("euiRange",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a){return a?Math.round(a):a}}return a}();a.RoundFilter=b,a.filters.filter("euiRound",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a){return new Date(a).getTime()}}return a}();a.TimestampFilter=b,a.filters.filter("euiTimestamp",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={})),angular.module("elasticui.controllers",[]).controller(elasticui.controllers);var elasticui;!function(a){var b;!function(b){var c=function(){function b(a){this.scope=a}return b.prototype.init=function(){var b=this;this.scope.$parent.$watch("indexVM.results",function(){return b.updateResults()}),this.scope.$watch("aggregation.agg",function(c,d){a.util.EjsTool.equals(d,c)||(b.previousProvider&&b.scope.indexVM.aggregationProviders.remove(b.previousProvider),b.updateAgg())}),this.scope.$watch("aggregation.filterSelf",function(a,c){a!==c&&(b.previousProvider&&b.scope.indexVM.aggregationProviders.remove(b.previousProvider),b.updateAgg())}),this.scope.$on("$destroy",function(){b.previousProvider&&b.scope.indexVM.aggregationProviders.remove(b.previousProvider)}),this.updateAgg()},b.prototype.updateResults=function(){var a=this.scope.indexVM.results;if(this.scope.aggregation.agg&&a&&a.aggregations){var c=b.getAggName(this.scope.aggregation.agg),d=Object.keys(a.aggregations).filter(function(a){return a==c||a=="filtered_"+c})[0],e=a.aggregations[d];d=="filtered_"+c&&(e=e[c]),this.scope.aggResult=e}},b.prototype.updateAgg=function(){var a=this,b=null;this.scope.aggregation.agg&&(b=function(b){return a.getAggregation(b)}),b&&this.scope.indexVM.aggregationProviders.add(b),this.previousProvider=b},b.getAggName=function(a){return Object.keys(a.toJSON())[0]},b.prototype.getAggregationExplicit=function(c,d,e){var f=this;if(!c)return null;var g=e;d||(g=g.filter(function(a){return a!=f.scope.combinedFilter&&("undefined"==typeof a.field||a.field()!=c.field())}));var h=a.util.FilterTool.combineFilters(g);return null!=h&&(c=new ejs.FilterAggregation("filtered_"+b.getAggName(c)).filter(h).agg(c)),c},b.prototype.getAggregation=function(a){return this.getAggregationExplicit(this.scope.aggregation.agg,this.scope.aggregation.filterSelf,a)},b.$inject=["$scope"],b}();b.AggregationController=c}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(a){this.scope=a}return b.prototype.init=function(){var b=this;if(this.scope.filter.filter){var c=this.scope.filters.contains(this.scope.filter.filter);!c&&this.scope.filter.enabled&&(this.scope.filters.add(this.scope.filter.filter),c=!0)}this.scope.filter.enabled=c,this.scope.$watch("filter.enabled",function(a,c){a!==c&&b.updateFilter()}),this.scope.$watch("filter.filter",function(c,d){a.util.EjsTool.equals(d,c)||(d&&b.scope.filters.remove(d),b.updateFilter())})},b.prototype.updateFilter=function(){this.scope.filter.filter&&(this.scope.filter.enabled?this.scope.filters.add(this.scope.filter.filter):this.scope.filters.remove(this.scope.filter.filter))},b.$inject=["$scope"],b}();b.FilterController=c}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(b,c,d,e,f){var g=this;this.filters=new a.util.FilterCollection,this.indexVM={host:null,query:null,sort:null,aggregationProviders:new a.util.SimpleSet,filters:this.filters,highlight:null,loaded:!1,page:1,index:null,loading:!1,pageCount:0,pageSize:10,results:null,refresh:function(a){return void 0===a&&(a=!0),g.refresh(a)},error:null,autoLoad:!0},this.searchPromise=null,this.refreshPromise=null,this.es=e,this.$rootScope=f,b.indexVM=this.indexVM,b.ejs=d.ejs,b.filters=this.filters,b.$watchCollection("indexVM.filters.ejsObjects",function(){g.indexVM.page=1,g.search()}),b.$watchCollection("indexVM.aggregationProviders.objects",function(){return g.search()}),b.$watch("indexVM.host",function(){null!=g.indexVM.host&&e.setHost(g.indexVM.host)&&g.search()}),b.$watch("indexVM.sort",function(){g.indexVM.page=1,g.search()}),b.$watch("indexVM.page",function(){return g.search()}),b.$watch("indexVM.index",function(){return g.search()}),b.$watch("indexVM.query",function(){return g.search()}),b.$watch("indexVM.highlight",function(){return g.search()}),c(function(){return g.loaded()},200)}return b.prototype.loaded=function(){this.indexVM.loaded||(this.indexVM.loaded=!0,this.indexVM.autoLoad&&this.search())},b.prototype.getSearchPromise=function(){for(var a=ejs.Request(),b=0;b\r\n \r\n \r\n \r\n {{bucket.key}} ({{bucket.doc_count}})\r\n \r\n \r\n ',d}return c.$inject=["$parse"],c}();b.ChecklistDirective=c,b.directives.directive("euiChecklist",c)}(c=b.directives||(b.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b;!function(a){var b=function(){function a(){var a={};return a.restrict="E",a.scope=!0,a.template='\r\n ',a}return a}();a.SimplePagingDirective=b,a.directives.directive("euiSimplePaging",b)}(b=a.directives||(a.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c;!function(b){var c=function(){function c(c){var d={};return d.restrict="E",d.scope=!0,d.link={pre:function(d,e,f){a.util.AngularTool.setupBinding(c,d,f,["field","size"]),d.agg_name=d.field.replace(/[^a-z_0-9]/gim,"_")+"_"+b.default_agg_count++}},d.template='\r\n ',d}return c.$inject=["$parse"],c}();b.SingleselectDirective=c,b.directives.directive("euiSingleselect",c)}(c=b.directives||(b.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(a){this.scope=a}return a.prototype.init=function(){var a=this;this.scope.$watch("indexVM.highlight",function(){return a.updateEnabled()}),this.scope.$watch("highlighting.highlight",function(){return a.updateHighlight()}),this.scope.$watch("highlighting.enabled",function(b,c){b!==c&&a.updateHighlight()}),this.updateHighlight()},a.prototype.updateHighlight=function(){this.scope.highlighting.enabled?this.scope.indexVM.highlight=this.scope.highlighting.highlight:this.isEnabledOnIndexScope()&&(this.scope.indexVM.highlight=null)},a.prototype.updateEnabled=function(){this.scope.highlighting.enabled=this.isEnabledOnIndexScope()},a.prototype.isEnabledOnIndexScope=function(){return null!=this.scope.indexVM.highlight&&angular.equals(this.scope.indexVM.highlight.toJSON(),this.scope.highlighting.highlight.toJSON())},a.$inject=["$scope"],a}();a.HighlightController=b}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(a){this.scope=a}return a.prototype.init=function(){var a=this;this.scope.$watch("indexVM.host",function(){return a.readHost()}),this.scope.$watch("host",function(){return a.updateHost()}),this.updateHost()},a.prototype.updateHost=function(){null!==this.scope.host&&(this.scope.indexVM.host=this.scope.host)},a.prototype.readHost=function(){this.scope.host=this.scope.indexVM.host},a.$inject=["$scope"],a}();a.HostController=b}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(a){this.scope=a}return b.prototype.init=function(){var b=this;this.scope.$watch("query.enabled",function(a,c){a!==c&&b.updateQuery()}),this.scope.$watch("query.query",function(c,d){a.util.EjsTool.equals(d,c)||b.updateQuery()}),this.updateQuery()},b.prototype.updateQuery=function(){this.scope.query.query&&(this.scope.indexVM.query=this.scope.query.enabled?this.scope.query.query:null)},b.$inject=["$scope"],b}();b.QueryController=c}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.HighlightController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-highlight")+" | euiCached",function(b){return a.highlighting.highlight=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.highlighting.enabled=b}),e=a.$eval(f)),a.highlighting={highlight:a.$eval(b.attr("eui-highlight")+" | euiCached"),enabled:e},d.init()},b}return b}();b.HighlightDirective=c,b.directives.directive("euiHighlight",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.HostController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-host"),function(b){return a.host=b}),a.host=a.$eval(b.attr("eui-host")),d.init()},b}return b}();b.HostDirective=c,b.directives.directive("euiHost",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.QueryController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-query")+" | euiCached",function(b){return a.query.query=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.query.enabled=b}),e=a.$eval(f)),a.query={query:a.$eval(b.attr("eui-query")+" | euiCached"),enabled:e},d.init()},b}return b}();b.QueryDirective=c,b.directives.directive("euiQuery",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){}return a.setupBinding=function(a,b,c,d){angular.forEach(d,function(d){b.$watch(c[d],function(a){b[d]!=a&&(b[d]=a)}),b[d]=a(c[d])(b)})},a}();a.AngularTool=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){}return a.getJsonFromEjsObject=function(a){return angular.toJson(a.toJSON())},a.equals=function(a,b){return!a&&!b||a&&b&&this.getJsonFromEjsObject(a)==this.getJsonFromEjsObject(b)},a}();a.EjsTool=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){this.objects=[]}return a.prototype.indexOf=function(a){return this.objects.indexOf(a)},a.prototype.add=function(a){var b=this.indexOf(a);-1==b&&this.objects.push(a)},a.prototype.remove=function(a){var b=this.indexOf(a);b>-1&&this.objects.splice(b,1)},a}();a.SimpleSet=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c;!function(b){var c=function(){function b(b){var c={};return c.restrict="E",c.scope=!0,c.link={pre:function(c,d,e){a.util.AngularTool.setupBinding(b,c,e,["field"])}},c.template='\r\n \r\n ',c}return b.$inject=["$parse"],b}();b.SearchboxDirective=c,b.directives.directive("euiSearchbox",c)}(c=b.directives||(b.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));
--------------------------------------------------------------------------------
/bootstrap-template/js/elif.js:
--------------------------------------------------------------------------------
1 | /*! elif - v0.1.3 - 2015-03
2 | Copyright (C) 2014 Zach Snow (http://zachsnow.com)
3 | https://github.com/zachsnow/ng-elif
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software),
6 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 |
10 | THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
12 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
13 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | */
15 |
16 | (function(){
17 | var elif = angular.module('elif', []);
18 |
19 | // This is copied from AngularJS because it is not
20 | // part of the public interface.
21 | var getBlockElements = function(nodes){
22 | if(!nodes || !nodes.length){
23 | return $();
24 | }
25 |
26 | var startNode = nodes[0];
27 | var endNode = nodes[nodes.length - 1];
28 |
29 | if(startNode === endNode){
30 | return $(startNode);
31 | }
32 |
33 | var element = startNode;
34 | var elements = [element];
35 |
36 | do {
37 | element = element.nextSibling;
38 | if(!element){
39 | break;
40 | }
41 | elements.push(element);
42 | }
43 | while(element !== endNode);
44 |
45 | return $(elements);
46 | };
47 |
48 | elif.factory('elif', [
49 | function(){
50 | // By requiring the scope have it's own copy of `elif.conditionals`
51 | // we avoid if/else-if/else structures that span AngularJS scopes.
52 | var getConditionals = function(scope){
53 | if(angular.hasOwnProperty.call(scope, 'elif.conditionals')){
54 | var conditionals = scope['elif.conditionals'];
55 | return conditionals[conditionals.length - 1];
56 | }
57 | };
58 |
59 | return {
60 | create: function(scope, fn, callback){
61 | var conditionals = [{
62 | fn: fn,
63 | callback: callback || angular.identity
64 | }];
65 | var conditionalValues = [];
66 |
67 | scope.$watch(function(){
68 | // Watch the boolean conditionals; we only need
69 | // to run through the if/else-if/else chain if one
70 | // of them changes.
71 | conditionalValues.length = conditionals.length;
72 | for(var i = 0, len = conditionals.length; i < len; i++){
73 | conditionalValues[i] = !!conditionals[i].fn();
74 | }
75 | return conditionalValues;
76 | }, function(conditionalValues){
77 | // Find first matching if/else-if.
78 | var index = -1;
79 | for(var i = 0, len = conditionals.length; i < len; i++){
80 | if(conditionalValues[i]){
81 | conditionals[i].callback(true);
82 | index = i;
83 | i++;
84 | break;
85 | }
86 | else {
87 | conditionals[i].callback(false);
88 | }
89 | }
90 |
91 | // Mark the rest of the else-ifs as not matched.
92 | for(; i < len; i++){
93 | conditionals[i].callback(false);
94 | }
95 |
96 | // Handle else, if there is one.
97 | conditionals.fallthrough && conditionals.fallthrough(index === -1);
98 |
99 | return index;
100 | }, true); // Deep watch; we know that it is a simple list of booleans.
101 |
102 | // Keep track of if/else-if/else structures per AngularJS scope.
103 | if(!angular.hasOwnProperty.call(scope, 'elif.conditionals')){
104 | scope['elif.conditionals'] = [];
105 | }
106 | scope['elif.conditionals'].push(conditionals);
107 | },
108 | extend: function(scope, fn, callback){
109 | var conditionals = getConditionals(scope);
110 | if(!conditionals){
111 | throw new Error('elif.extend: no if found at this level');
112 | }
113 | if(conditionals.fallthrough){
114 | throw new Error('elif.extend: else-if after else');
115 | }
116 |
117 | conditionals.push({
118 | fn: fn,
119 | callback: callback
120 | });
121 | },
122 | fallthrough: function(scope, fn, callback){
123 | var conditionals = getConditionals(scope);
124 | if(!conditionals){
125 | throw new Error('elif.fallthrough: no if found at this level');
126 | }
127 | if(conditionals.fallthrough){
128 | throw new Error('elif.fallthrough: else already found at this level');
129 | }
130 | conditionals.fallthrough = callback;
131 | }
132 | };
133 | }
134 | ]);
135 |
136 | // This implementation is basically the built-in `ng-if`, hooked into the `elif` service.
137 | var elifDirective = function(name, method, getter){
138 | elif.directive(name, [
139 | '$animate',
140 | '$document',
141 | '$injector',
142 | 'elif',
143 | function($animate, $document, $injector, elif){
144 | var getterFn = getter && $injector.invoke(getter);
145 |
146 | return {
147 | transclude: 'element',
148 | restrict: 'A',
149 | priority: 600,
150 | terminal: true,
151 | link: function(scope, element, attrs, ctrls, transcludeFn){
152 | var watchFn = getterFn && getterFn(scope, element, attrs);
153 | var childScope;
154 | var childElement;
155 | var previousElements;
156 |
157 | elif[method](scope, watchFn, function(value, conditionals){
158 | if(value){
159 | if(!childScope){
160 | childScope = scope.$new();
161 | transcludeFn(childScope, function(clone){
162 | clone[clone.length + 1] = $document[0].createComment(' end ' + name + ': ' + attrs[name] + ' ');
163 | childElement = clone;
164 | $animate.enter(clone, element.parent(), element);
165 | });
166 | }
167 | }
168 | else {
169 | if(childScope){
170 | childScope.$destroy();
171 | childScope = null;
172 | }
173 | if(previousElements){
174 | previousElements.remove();
175 | previousElements = null;
176 | }
177 | if(childElement){
178 | previousElements = getBlockElements(childElement);
179 | $animate.leave(previousElements, function(){
180 | previousElements = null;
181 | });
182 | childElement = null;
183 | }
184 | }
185 | });
186 | }
187 | };
188 | }
189 | ]);
190 | };
191 |
192 | // Reads the attribute given by `name` and converts it to a boolean.
193 | var getter = function(name){
194 | return [
195 | '$parse',
196 | function($parse){
197 | return function(scope, element, attrs){
198 | var testFn = $parse(attrs[name]);
199 | return function(){
200 | return !!testFn(scope);
201 | };
202 | };
203 | }
204 | ];
205 | };
206 |
207 | // We rely on the built-in `ng-if` directive to actually perform
208 | // the transclusion, and simply tie it in to the `elif` service.
209 | elif.directive('ngIf', [
210 | '$injector',
211 | 'elif',
212 | function($injector, elif){
213 | var getterFn = $injector.invoke(getter('ngIf'));
214 | return {
215 | priority: 600,
216 | link: function(scope, element, attrs){
217 | var watchFn = getterFn(scope, element, attrs);
218 | elif.create(scope, watchFn);
219 | }
220 | }
221 | }
222 | ]);
223 |
224 | // Else-if and else perform their own transclusions.
225 | elifDirective('ngElseIf', 'extend', getter('ngElseIf'));
226 | elifDirective('ngElif', 'extend', getter('ngElif'));
227 |
228 | // Else doesn't take an argument.
229 | elifDirective('ngElse', 'fallthrough');
230 | })();
231 |
--------------------------------------------------------------------------------
/bootstrap-template/js/sidebar.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: sidebar.js v0.1
3 | * ========================================================================
4 | * Copyright 2011-2014 Asyraf Abdul Rahman
5 | * Licensed under MIT
6 | * ======================================================================== */
7 |
8 | +function ($) {
9 | 'use strict';
10 |
11 | // SIDEBAR PUBLIC CLASS DEFINITION
12 | // ================================
13 |
14 | var Sidebar = function (element, options) {
15 | this.$element = $(element)
16 | this.options = $.extend({}, Sidebar.DEFAULTS, options)
17 | this.transitioning = null
18 |
19 | if (this.options.parent) this.$parent = $(this.options.parent)
20 | if (this.options.toggle) this.toggle()
21 | }
22 |
23 | Sidebar.DEFAULTS = {
24 | toggle: true
25 | }
26 |
27 | Sidebar.prototype.show = function () {
28 | if (this.transitioning || this.$element.hasClass('sidebar-open')) return
29 |
30 |
31 | var startEvent = $.Event('show.bs.sidebar')
32 | this.$element.trigger(startEvent);
33 | if (startEvent.isDefaultPrevented()) return
34 |
35 | this.$element
36 | .addClass('sidebar-open')
37 |
38 | this.transitioning = 1
39 |
40 | var complete = function () {
41 | this.$element
42 | this.transitioning = 0
43 | this.$element.trigger('shown.bs.sidebar')
44 | }
45 |
46 | if(!$.support.transition) return complete.call(this)
47 |
48 | this.$element
49 | .one($.support.transition.end, $.proxy(complete, this))
50 | .emulateTransitionEnd(400)
51 | }
52 |
53 | Sidebar.prototype.hide = function () {
54 | if (this.transitioning || !this.$element.hasClass('sidebar-open')) return
55 |
56 | var startEvent = $.Event('hide.bs.sidebar')
57 | this.$element.trigger(startEvent)
58 | if(startEvent.isDefaultPrevented()) return
59 |
60 | this.$element
61 | .removeClass('sidebar-open')
62 |
63 | this.transitioning = 1
64 |
65 | var complete = function () {
66 | this.transitioning = 0
67 | this.$element
68 | .trigger('hidden.bs.sidebar')
69 | }
70 |
71 | if (!$.support.transition) return complete.call(this)
72 |
73 | this.$element
74 | .one($.support.transition.end, $.proxy(complete, this))
75 | .emulateTransitionEnd(400)
76 | }
77 |
78 | Sidebar.prototype.toggle = function () {
79 | this[this.$element.hasClass('sidebar-open') ? 'hide' : 'show']()
80 | }
81 |
82 | var old = $.fn.sidebar
83 |
84 | $.fn.sidebar = function (option) {
85 | return this.each(function (){
86 | var $this = $(this)
87 | var data = $this.data('bs.sidebar')
88 | var options = $.extend({}, Sidebar.DEFAULTS, $this.data(), typeof options == 'object' && option)
89 |
90 | if (!data && options.toggle && option == 'show') option = !option
91 | if (!data) $this.data('bs.sidebar', (data = new Sidebar(this, options)))
92 | if (typeof option == 'string') data[option]()
93 | })
94 | }
95 |
96 | $.fn.sidebar.Constructor = Sidebar
97 |
98 | $.fn.sidebar.noConflict = function () {
99 | $.fn.sidebar = old
100 | return this
101 | }
102 |
103 | $(document).on('click.bs.sidebar.data-api', '[data-toggle="sidebar"]', function (e) {
104 | var $this = $(this), href
105 | var target = $this.attr('data-target')
106 | || e.preventDefault()
107 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')
108 | var $target = $(target)
109 | var data = $target.data('bs.sidebar')
110 | var option = data ? 'toggle' : $this.data()
111 |
112 | $target.sidebar(option)
113 | })
114 |
115 | $('html').on('click.bs.sidebar.autohide', function(event){
116 | var $this = $(event.target);
117 | var isButtonOrSidebar = $this.is('.sidebar, [data-toggle="sidebar"]') || $this.parents('.sidebar, [data-toggle="sidebar"]').length;
118 | if (isButtonOrSidebar) {
119 | return;
120 | } else {
121 | var $target = $('.sidebar');
122 | $target.each(function(i, trgt) {
123 | var $trgt = $(trgt);
124 | if($trgt.data('bs.sidebar') && $trgt.hasClass('sidebar-open')) {
125 | $trgt.sidebar('hide');
126 | }
127 | })
128 | }
129 | });
130 | }(jQuery);
131 |
--------------------------------------------------------------------------------
/css/sidebar.css:
--------------------------------------------------------------------------------
1 | /* All the default sidebar styles */
2 | /* toggle button settings */
3 | /* Note: this disables the navbar-toggle class's hide function. set visibility with the boostrap visible/hidden classes */
4 | /* Note: this also disables the navbar-header class positioning settings in small screens. */
5 | .navbar.navbar-static .navbar-header {
6 | float: left;
7 | }
8 |
9 | .navbar .navbar-toggle.toggle-left {
10 | float: left;
11 | margin-left: 15px;
12 | }
13 |
14 | .navbar .navbar-toggle.toggle-right {
15 | float: right;
16 | margin-right: 15px;
17 | }
18 |
19 | .navbar .navbar-toggle.toggle-sidebar, [data-toggle="sidebar"] {
20 | display: block;
21 | }
22 |
23 | /* sidebar settings */
24 | .sidebar {
25 | position: fixed;
26 | display: block;
27 | top: 51px;
28 | bottom: 0;
29 | z-index: 1000;
30 | min-height: 100%;
31 | max-height: none;
32 | overflow: auto;
33 | }
34 |
35 | .sidebar-left {
36 | left: 0;
37 | }
38 |
39 | .sidebar-right {
40 | right: 0;
41 | }
42 |
43 | /* css to override hiding the sidebar according to different screen sizes */
44 | .row .sidebar.sidebar-left.sidebar-xs-show {
45 | left: 0;
46 | -webkit-transform: translate(0,0);
47 | -ms-transform: translate(0,0);
48 | -o-transform: translate(0,0);
49 | -moz-transform: translate(0,0);
50 | transform: translate(0,0);
51 | }
52 |
53 | /*right sidebar is untested */
54 | .row .sidebar.sidebar-right.sidebar-xs-show {
55 | right: 0;
56 | -webkit-transform: translate(0,0);
57 | -ms-transform: translate(0,0);
58 | -o-transform: translate(0,0);
59 | -moz-transform: translate(0,0);
60 | transform: translate(0,0);
61 | }
62 |
63 | @media (min-width: 768px) {
64 | .row .sidebar.sidebar-left.sidebar-sm-show {
65 | left: 0;
66 | -webkit-transform: translate(0,0);
67 | -ms-transform: translate(0,0);
68 | -o-transform: translate(0,0);
69 | -moz-transform: translate(0,0);
70 | transform: translate(0,0);
71 | }
72 |
73 | /*right sidebar is untested */
74 | .row .sidebar.sidebar-right.sidebar-sm-show {
75 | right: 0;
76 | -webkit-transform: translate(0,0);
77 | -ms-transform: translate(0,0);
78 | -o-transform: translate(0,0);
79 | -moz-transform: translate(0,0);
80 | transform: translate(0,0);
81 | }
82 | }
83 |
84 | @media (min-width: 992px) {
85 | .row .sidebar.sidebar-left.sidebar-md-show {
86 | left: 0;
87 | -webkit-transform: translate(0,0);
88 | -ms-transform: translate(0,0);
89 | -o-transform: translate(0,0);
90 | -moz-transform: translate(0,0);
91 | transform: translate(0,0);
92 | }
93 |
94 | .row .sidebar.sidebar-right.sidebar-md-show {
95 | right: 0;
96 | -webkit-transform: translate(0,0);
97 | -ms-transform: translate(0,0);
98 | -o-transform: translate(0,0);
99 | -moz-transform: translate(0,0);
100 | transform: translate(0,0);
101 | }
102 | }
103 |
104 | @media (min-width: 1170px) {
105 | .row .sidebar.sidebar-left.sidebar-lg-show {
106 | left: 0;
107 | -webkit-transform: translate(0,0);
108 | -moz-transform: translate(0,0);
109 | -ms-transform: translate(0,0);
110 | -o-transform: translate(0,0);
111 | transform: translate(0,0);
112 | }
113 |
114 | .row .sidebar.sidebar-right.sidebar-lg-show {
115 | right: 0;
116 | -webkit-transform: translate(0,0);
117 | -moz-transform: translate(0,0);
118 | -ms-transform: translate(0,0);
119 | -o-transform: translate(0,0);
120 | transform: translate(0,0);
121 | }
122 | }
123 |
124 | /* animation class - optional: without it the sidebar would just pop in and out*/
125 | .sidebar-animate {
126 | -webkit-transition: -webkit-transform 300ms ease;
127 | -moz-transition: -moz-transform 300ms ease;
128 | -o-transition: transform 300ms ease;
129 | transition: transform 300ms ease;
130 | }
131 |
132 | /* Left panel positioning classes */
133 | .sidebar.sidebar-left {
134 | -webkit-transform: translate(-100%,0);
135 | -moz-transform: translate(-100%,0);
136 | -ms-transform: translate(-100%,0);
137 | -o-transform: translate(-100%,0);
138 | transform: translate(-100%,0);
139 | }
140 |
141 | .sidebar.sidebar-left.sidebar-open {
142 | -webkit-transform: translate(0,0);
143 | -moz-transform: translate(0,0);
144 | -ms-transform: translate(0,0);
145 | -o-transform: translate(0,0);
146 | transform: translate(0,0);
147 | }
148 |
149 | .sidebar.sidebar-right {
150 | -webkit-transform: translate(100%,0);
151 | -moz-transform: translate(100%,0);
152 | -ms-transform: translate(100%,0);
153 | -o-transform: translate(100%,0);
154 | transform: translate(100%,0);
155 | }
156 |
157 | .sidebar.sidebar-right.sidebar-open {
158 | -webkit-transform: translate(0,0);
159 | -moz-transform: translate(0,0);
160 | -ms-transform: translate(0,0);
161 | -o-transform: translate(0,0);
162 | transform: translate(0,0);
163 | }
164 |
--------------------------------------------------------------------------------
/css/style.css:
--------------------------------------------------------------------------------
1 | /* Custom Stylesheet */
2 | /**
3 | * Use this file to override Materialize files so you can update
4 | * the core Materialize files in the future
5 | *
6 | * Made By MaterializeCSS.com
7 | */
8 |
9 |
10 | .card .card-image img {
11 | border-radius: 2px 2px 0 0;
12 | position: relative;
13 | left: 25%;
14 | right: 0;
15 | top: 10px;
16 | bottom: 0;
17 | width: 106px;
18 | }
19 |
20 |
21 | .card .card-title {
22 | font-size: 18px;
23 | }
24 |
25 |
26 | label {
27 | font-size: 1.2rem;
28 | }
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/demo.html:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 | ElasticUI-Extension
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
48 |
49 |
50 |
51 |
52 |
53 |
79 |
80 |
81 |
82 |
83 |
Results
84 |
{{(indexVM.results.hits.total | number) || 0}} results ({{indexVM.results.took || 0}}ms)
85 |
86 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
Info
106 |
{{doc._source.title}}
107 |
108 |
109 |
110 |
{{doc._source.title}}
111 |
Link
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/doku/demo-materialize1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/svola/ElasticUI-extension/182fcdbd27c9d22ef2003f719d0a5970aa1aefa1/doku/demo-materialize1.png
--------------------------------------------------------------------------------
/doku/demo-materialize2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/svola/ElasticUI-extension/182fcdbd27c9d22ef2003f719d0a5970aa1aefa1/doku/demo-materialize2.png
--------------------------------------------------------------------------------
/doku/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/svola/ElasticUI-extension/182fcdbd27c9d22ef2003f719d0a5970aa1aefa1/doku/demo.png
--------------------------------------------------------------------------------
/doku/facet-bad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/svola/ElasticUI-extension/182fcdbd27c9d22ef2003f719d0a5970aa1aefa1/doku/facet-bad.png
--------------------------------------------------------------------------------
/doku/facet-good.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/svola/ElasticUI-extension/182fcdbd27c9d22ef2003f719d0a5970aa1aefa1/doku/facet-good.png
--------------------------------------------------------------------------------
/js/app.js:
--------------------------------------------------------------------------------
1 | var app = angular.module('demo', ['elasticui']);
2 |
3 | app.constant('euiHost', 'http://localhost:9200');
4 | app.controller('IndexController', function($scope) {
5 | $scope.indexName = "INDEX_NAME";
6 | });
7 |
8 |
9 |
--------------------------------------------------------------------------------
/js/elasticui.min.js:
--------------------------------------------------------------------------------
1 | /*! elasticui - v0.0.6 - 2015-03-21
2 | * http://www.elasticui.com
3 | * Copyright (c) 2015 Yousef El-Dardiry; Licensed Apache */
4 |
5 | var elasticui;!function(a){var b;!function(a){var b=function(){function b(){this.ejsObjects=[],this.jsonObjects=[]}return b.prototype.indexOf=function(b){return this.jsonObjects.indexOf(a.EjsTool.getJsonFromEjsObject(b))},b.prototype.add=function(b){var c=this.indexOf(b);-1==c&&(this.ejsObjects.push(b),this.jsonObjects.push(a.EjsTool.getJsonFromEjsObject(b)))},b.prototype.remove=function(a){var b=this.indexOf(a);b>-1&&(this.ejsObjects.splice(b,1),this.jsonObjects.splice(b,1))},b}();a.EjsCollection=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},elasticui;!function(a){var b;!function(a){var b=function(b){function c(){b.apply(this,arguments)}return __extends(c,b),c.prototype.getAsFilter=function(){return a.FilterTool.combineFilters(this.ejsObjects)},c.prototype.getAsORFilter=function(){return a.FilterTool.combineFiltersShould(this.ejsObjects)},c.prototype.contains=function(a){return this.indexOf(a)>-1},c}(a.EjsCollection);a.FilterCollection=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){}return a.combineFilters=function(a){return 1===a.length?a[0]:a.length>1?ejs.BoolFilter().must(a):null},a.combineFiltersShould=function(a){return 1===a.length?a[0]:a.length>1?ejs.BoolFilter().should(a):null},a}();a.FilterTool=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){a.services=angular.module("elasticui.services",[])}(b=a.services||(a.services={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){a.directives=angular.module("elasticui.directives",[])}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="EAC",b.scope=!0,b.controller=a.controllers.AggregationController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-aggregation")+" | euiCached",function(b){return a.aggregation.agg=b});var e=!0,f=b.attr("eui-filter-self");f&&(a.$watch(f,function(b){return a.aggregation.filterSelf=b}),e=a.$eval(f)),a.aggregation={agg:a.$eval(b.attr("eui-aggregation")+" | euiCached"),filterSelf:e},d.init()},b}return b}();b.AggregationDirective=c,b.directives.directive("euiAggregation",a.directives.AggregationDirective)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.FilterController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-filter")+" | euiCached",function(b){return a.filter.filter=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.filter.enabled=b}),e=a.$eval(f)),a.filter={filter:a.$eval(b.attr("eui-filter")+" | euiCached"),enabled:e},d.init()},b}return b}();b.FilterDirective=c,b.directives.directive("euiFilter",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="EAC",b.scope=!1,b.controller=a.controllers.IndexController,b.link=function(a,b,c,d){a.$watch(c.euiIndex,function(a){d.indexVM.index=a}),d.indexVM.index=a.$eval(c.euiIndex)},b}return b}();b.IndexDirective=c,b.directives.directive("euiIndex",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){var a={};return a.require="ngModel",a.link=function(a,b,c,d){d.$parsers.push(function(a){return!a}),d.$formatters.push(function(a){return!a})},a}return a}();a.InvertedDirective=b,a.directives.directive("euiInverted",b)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="EAC",b.scope=!0,b.controller=a.controllers.OrFilterController,b.link=function(){},b}return b}();b.OrFilterDirective=c,b.directives.directive("euiOrFilter",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.SortController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-sort")+" | euiCached",function(b){return a.sorting.sort=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.sorting.enabled=b}),e=a.$eval(f)),a.sorting={sort:a.$eval(b.attr("eui-sort")+" | euiCached"),enabled:e},d.init()},b}return b}();b.SortDirective=c,b.directives.directive("euiSort",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){var a={};return a.restrict="EAC",a.scope=!1,a.transclude=!1,a.link={pre:function(a,b){var c=b.attr("eui-key");a.$watch(b.attr("eui-value"),function(b,d){angular.equals(b,d)||(a[c]=b)},!0),a[c]=a.$eval(b.attr("eui-value"))}},a}return a.$inject=["$timeout"],a}();a.VarDirective=b,a.directives.directive("euiVar",b)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){a.filters=angular.module("elasticui.filters",[])}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){var a={};return function(b){if(!b)return b;var c=angular.toJson(b.toJSON());return a[c]||(a[c]=b),a[c]}}return a}();a.CachedFilter=b,a.filters.filter("euiCached",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(b,c){if(!b||!b.length)return b;var d=a.parseString(c);return b.map(function(b){return[b.key,a.getValue(b,d)]})}}return a.parseString=function(a){return a.split(".")},a.getValue=function(a,b){var c=a;return angular.forEach(b,function(a){return c?void(c=c[a]):c}),c},a}();a.MapFilter=b,a.filters.filter("euiMap",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a,b,c,d){void 0===d&&(d=5);for(var e=1;b>=e;e++)c+d>=e&&e>=c-d||c>e&&4>c-d||e>c+d&&4>b-(c+d)?a.push(e):1==e?a.push(1,-1):e==b&&a.push(-2,b);return a}}return a}();a.PageRangeFilter=b,a.filters.filter("euiPageRange",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a,b){b=parseInt(b);for(var c=0;b>c;c++)a.push(c);return a}}return a}();a.RangeFilter=b,a.filters.filter("euiRange",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a){return a?Math.round(a):a}}return a}();a.RoundFilter=b,a.filters.filter("euiRound",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a){return new Date(a).getTime()}}return a}();a.TimestampFilter=b,a.filters.filter("euiTimestamp",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={})),angular.module("elasticui.controllers",[]).controller(elasticui.controllers);var elasticui;!function(a){var b;!function(b){var c=function(){function b(a){this.scope=a}return b.prototype.init=function(){var b=this;this.scope.$parent.$watch("indexVM.results",function(){return b.updateResults()}),this.scope.$watch("aggregation.agg",function(c,d){a.util.EjsTool.equals(d,c)||(b.previousProvider&&b.scope.indexVM.aggregationProviders.remove(b.previousProvider),b.updateAgg())}),this.scope.$watch("aggregation.filterSelf",function(a,c){a!==c&&(b.previousProvider&&b.scope.indexVM.aggregationProviders.remove(b.previousProvider),b.updateAgg())}),this.scope.$on("$destroy",function(){b.previousProvider&&b.scope.indexVM.aggregationProviders.remove(b.previousProvider)}),this.updateAgg()},b.prototype.updateResults=function(){var a=this.scope.indexVM.results;if(this.scope.aggregation.agg&&a&&a.aggregations){var c=b.getAggName(this.scope.aggregation.agg),d=Object.keys(a.aggregations).filter(function(a){return a==c||a=="filtered_"+c})[0],e=a.aggregations[d];d=="filtered_"+c&&(e=e[c]),this.scope.aggResult=e}},b.prototype.updateAgg=function(){var a=this,b=null;this.scope.aggregation.agg&&(b=function(b){return a.getAggregation(b)}),b&&this.scope.indexVM.aggregationProviders.add(b),this.previousProvider=b},b.getAggName=function(a){return Object.keys(a.toJSON())[0]},b.prototype.getAggregationExplicit=function(c,d,e){var f=this;if(!c)return null;var g=e;d||(g=g.filter(function(a){return a!=f.scope.combinedFilter&&("undefined"==typeof a.field||a.field()!=c.field())}));var h=a.util.FilterTool.combineFilters(g);return null!=h&&(c=new ejs.FilterAggregation("filtered_"+b.getAggName(c)).filter(h).agg(c)),c},b.prototype.getAggregation=function(a){return this.getAggregationExplicit(this.scope.aggregation.agg,this.scope.aggregation.filterSelf,a)},b.$inject=["$scope"],b}();b.AggregationController=c}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(a){this.scope=a}return b.prototype.init=function(){var b=this;if(this.scope.filter.filter){var c=this.scope.filters.contains(this.scope.filter.filter);!c&&this.scope.filter.enabled&&(this.scope.filters.add(this.scope.filter.filter),c=!0)}this.scope.filter.enabled=c,this.scope.$watch("filter.enabled",function(a,c){a!==c&&b.updateFilter()}),this.scope.$watch("filter.filter",function(c,d){a.util.EjsTool.equals(d,c)||(d&&b.scope.filters.remove(d),b.updateFilter())})},b.prototype.updateFilter=function(){this.scope.filter.filter&&(this.scope.filter.enabled?this.scope.filters.add(this.scope.filter.filter):this.scope.filters.remove(this.scope.filter.filter))},b.$inject=["$scope"],b}();b.FilterController=c}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(b,c,d,e,f){var g=this;this.filters=new a.util.FilterCollection,this.indexVM={host:null,query:null,sort:null,aggregationProviders:new a.util.SimpleSet,filters:this.filters,highlight:null,loaded:!1,page:1,index:null,loading:!1,pageCount:0,pageSize:10,results:null,refresh:function(a){return void 0===a&&(a=!0),g.refresh(a)},error:null,autoLoad:!0},this.searchPromise=null,this.refreshPromise=null,this.es=e,this.$rootScope=f,b.indexVM=this.indexVM,b.ejs=d.ejs,b.filters=this.filters,b.$watchCollection("indexVM.filters.ejsObjects",function(){g.indexVM.page=1,g.search()}),b.$watchCollection("indexVM.aggregationProviders.objects",function(){return g.search()}),b.$watch("indexVM.host",function(){null!=g.indexVM.host&&e.setHost(g.indexVM.host)&&g.search()}),b.$watch("indexVM.sort",function(){g.indexVM.page=1,g.search()}),b.$watch("indexVM.page",function(){return g.search()}),b.$watch("indexVM.index",function(){return g.search()}),b.$watch("indexVM.query",function(){return g.search()}),b.$watch("indexVM.highlight",function(){return g.search()}),c(function(){return g.loaded()},200)}return b.prototype.loaded=function(){this.indexVM.loaded||(this.indexVM.loaded=!0,this.indexVM.autoLoad&&this.search())},b.prototype.getSearchPromise=function(){for(var a=ejs.Request(),b=0;b\r\n \r\n \r\n \r\n {{bucket.key}} ({{bucket.doc_count}})\r\n \r\n \r\n ',d}return c.$inject=["$parse"],c}();b.ChecklistDirective=c,b.directives.directive("euiChecklist",c)}(c=b.directives||(b.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b;!function(a){var b=function(){function a(){var a={};return a.restrict="E",a.scope=!0,a.template='\r\n ',a}return a}();a.SimplePagingDirective=b,a.directives.directive("euiSimplePaging",b)}(b=a.directives||(a.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c;!function(b){var c=function(){function c(c){var d={};return d.restrict="E",d.scope=!0,d.link={pre:function(d,e,f){a.util.AngularTool.setupBinding(c,d,f,["field","size"]),d.agg_name=d.field.replace(/[^a-z_0-9]/gim,"_")+"_"+b.default_agg_count++}},d.template='\r\n ',d}return c.$inject=["$parse"],c}();b.SingleselectDirective=c,b.directives.directive("euiSingleselect",c)}(c=b.directives||(b.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(a){this.scope=a}return a.prototype.init=function(){var a=this;this.scope.$watch("indexVM.highlight",function(){return a.updateEnabled()}),this.scope.$watch("highlighting.highlight",function(){return a.updateHighlight()}),this.scope.$watch("highlighting.enabled",function(b,c){b!==c&&a.updateHighlight()}),this.updateHighlight()},a.prototype.updateHighlight=function(){this.scope.highlighting.enabled?this.scope.indexVM.highlight=this.scope.highlighting.highlight:this.isEnabledOnIndexScope()&&(this.scope.indexVM.highlight=null)},a.prototype.updateEnabled=function(){this.scope.highlighting.enabled=this.isEnabledOnIndexScope()},a.prototype.isEnabledOnIndexScope=function(){return null!=this.scope.indexVM.highlight&&angular.equals(this.scope.indexVM.highlight.toJSON(),this.scope.highlighting.highlight.toJSON())},a.$inject=["$scope"],a}();a.HighlightController=b}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(a){this.scope=a}return a.prototype.init=function(){var a=this;this.scope.$watch("indexVM.host",function(){return a.readHost()}),this.scope.$watch("host",function(){return a.updateHost()}),this.updateHost()},a.prototype.updateHost=function(){null!==this.scope.host&&(this.scope.indexVM.host=this.scope.host)},a.prototype.readHost=function(){this.scope.host=this.scope.indexVM.host},a.$inject=["$scope"],a}();a.HostController=b}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(a){this.scope=a}return b.prototype.init=function(){var b=this;this.scope.$watch("query.enabled",function(a,c){a!==c&&b.updateQuery()}),this.scope.$watch("query.query",function(c,d){a.util.EjsTool.equals(d,c)||b.updateQuery()}),this.updateQuery()},b.prototype.updateQuery=function(){this.scope.query.query&&(this.scope.indexVM.query=this.scope.query.enabled?this.scope.query.query:null)},b.$inject=["$scope"],b}();b.QueryController=c}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.HighlightController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-highlight")+" | euiCached",function(b){return a.highlighting.highlight=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.highlighting.enabled=b}),e=a.$eval(f)),a.highlighting={highlight:a.$eval(b.attr("eui-highlight")+" | euiCached"),enabled:e},d.init()},b}return b}();b.HighlightDirective=c,b.directives.directive("euiHighlight",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.HostController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-host"),function(b){return a.host=b}),a.host=a.$eval(b.attr("eui-host")),d.init()},b}return b}();b.HostDirective=c,b.directives.directive("euiHost",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.QueryController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-query")+" | euiCached",function(b){return a.query.query=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.query.enabled=b}),e=a.$eval(f)),a.query={query:a.$eval(b.attr("eui-query")+" | euiCached"),enabled:e},d.init()},b}return b}();b.QueryDirective=c,b.directives.directive("euiQuery",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){}return a.setupBinding=function(a,b,c,d){angular.forEach(d,function(d){b.$watch(c[d],function(a){b[d]!=a&&(b[d]=a)}),b[d]=a(c[d])(b)})},a}();a.AngularTool=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){}return a.getJsonFromEjsObject=function(a){return angular.toJson(a.toJSON())},a.equals=function(a,b){return!a&&!b||a&&b&&this.getJsonFromEjsObject(a)==this.getJsonFromEjsObject(b)},a}();a.EjsTool=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){this.objects=[]}return a.prototype.indexOf=function(a){return this.objects.indexOf(a)},a.prototype.add=function(a){var b=this.indexOf(a);-1==b&&this.objects.push(a)},a.prototype.remove=function(a){var b=this.indexOf(a);b>-1&&this.objects.splice(b,1)},a}();a.SimpleSet=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c;!function(b){var c=function(){function b(b){var c={};return c.restrict="E",c.scope=!0,c.link={pre:function(c,d,e){a.util.AngularTool.setupBinding(b,c,e,["field"])}},c.template='\r\n \r\n ',c}return b.$inject=["$parse"],b}();b.SearchboxDirective=c,b.directives.directive("euiSearchbox",c)}(c=b.directives||(b.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));
--------------------------------------------------------------------------------
/js/elif.js:
--------------------------------------------------------------------------------
1 | /*! elif - v0.1.3 - 2015-03
2 | Copyright (C) 2014 Zach Snow (http://zachsnow.com)
3 | https://github.com/zachsnow/ng-elif
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software),
6 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 |
10 | THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
12 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
13 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | */
15 |
16 | (function(){
17 | var elif = angular.module('elif', []);
18 |
19 | // This is copied from AngularJS because it is not
20 | // part of the public interface.
21 | var getBlockElements = function(nodes){
22 | if(!nodes || !nodes.length){
23 | return $();
24 | }
25 |
26 | var startNode = nodes[0];
27 | var endNode = nodes[nodes.length - 1];
28 |
29 | if(startNode === endNode){
30 | return $(startNode);
31 | }
32 |
33 | var element = startNode;
34 | var elements = [element];
35 |
36 | do {
37 | element = element.nextSibling;
38 | if(!element){
39 | break;
40 | }
41 | elements.push(element);
42 | }
43 | while(element !== endNode);
44 |
45 | return $(elements);
46 | };
47 |
48 | elif.factory('elif', [
49 | function(){
50 | // By requiring the scope have it's own copy of `elif.conditionals`
51 | // we avoid if/else-if/else structures that span AngularJS scopes.
52 | var getConditionals = function(scope){
53 | if(angular.hasOwnProperty.call(scope, 'elif.conditionals')){
54 | var conditionals = scope['elif.conditionals'];
55 | return conditionals[conditionals.length - 1];
56 | }
57 | };
58 |
59 | return {
60 | create: function(scope, fn, callback){
61 | var conditionals = [{
62 | fn: fn,
63 | callback: callback || angular.identity
64 | }];
65 | var conditionalValues = [];
66 |
67 | scope.$watch(function(){
68 | // Watch the boolean conditionals; we only need
69 | // to run through the if/else-if/else chain if one
70 | // of them changes.
71 | conditionalValues.length = conditionals.length;
72 | for(var i = 0, len = conditionals.length; i < len; i++){
73 | conditionalValues[i] = !!conditionals[i].fn();
74 | }
75 | return conditionalValues;
76 | }, function(conditionalValues){
77 | // Find first matching if/else-if.
78 | var index = -1;
79 | for(var i = 0, len = conditionals.length; i < len; i++){
80 | if(conditionalValues[i]){
81 | conditionals[i].callback(true);
82 | index = i;
83 | i++;
84 | break;
85 | }
86 | else {
87 | conditionals[i].callback(false);
88 | }
89 | }
90 |
91 | // Mark the rest of the else-ifs as not matched.
92 | for(; i < len; i++){
93 | conditionals[i].callback(false);
94 | }
95 |
96 | // Handle else, if there is one.
97 | conditionals.fallthrough && conditionals.fallthrough(index === -1);
98 |
99 | return index;
100 | }, true); // Deep watch; we know that it is a simple list of booleans.
101 |
102 | // Keep track of if/else-if/else structures per AngularJS scope.
103 | if(!angular.hasOwnProperty.call(scope, 'elif.conditionals')){
104 | scope['elif.conditionals'] = [];
105 | }
106 | scope['elif.conditionals'].push(conditionals);
107 | },
108 | extend: function(scope, fn, callback){
109 | var conditionals = getConditionals(scope);
110 | if(!conditionals){
111 | throw new Error('elif.extend: no if found at this level');
112 | }
113 | if(conditionals.fallthrough){
114 | throw new Error('elif.extend: else-if after else');
115 | }
116 |
117 | conditionals.push({
118 | fn: fn,
119 | callback: callback
120 | });
121 | },
122 | fallthrough: function(scope, fn, callback){
123 | var conditionals = getConditionals(scope);
124 | if(!conditionals){
125 | throw new Error('elif.fallthrough: no if found at this level');
126 | }
127 | if(conditionals.fallthrough){
128 | throw new Error('elif.fallthrough: else already found at this level');
129 | }
130 | conditionals.fallthrough = callback;
131 | }
132 | };
133 | }
134 | ]);
135 |
136 | // This implementation is basically the built-in `ng-if`, hooked into the `elif` service.
137 | var elifDirective = function(name, method, getter){
138 | elif.directive(name, [
139 | '$animate',
140 | '$document',
141 | '$injector',
142 | 'elif',
143 | function($animate, $document, $injector, elif){
144 | var getterFn = getter && $injector.invoke(getter);
145 |
146 | return {
147 | transclude: 'element',
148 | restrict: 'A',
149 | priority: 600,
150 | terminal: true,
151 | link: function(scope, element, attrs, ctrls, transcludeFn){
152 | var watchFn = getterFn && getterFn(scope, element, attrs);
153 | var childScope;
154 | var childElement;
155 | var previousElements;
156 |
157 | elif[method](scope, watchFn, function(value, conditionals){
158 | if(value){
159 | if(!childScope){
160 | childScope = scope.$new();
161 | transcludeFn(childScope, function(clone){
162 | clone[clone.length + 1] = $document[0].createComment(' end ' + name + ': ' + attrs[name] + ' ');
163 | childElement = clone;
164 | $animate.enter(clone, element.parent(), element);
165 | });
166 | }
167 | }
168 | else {
169 | if(childScope){
170 | childScope.$destroy();
171 | childScope = null;
172 | }
173 | if(previousElements){
174 | previousElements.remove();
175 | previousElements = null;
176 | }
177 | if(childElement){
178 | previousElements = getBlockElements(childElement);
179 | $animate.leave(previousElements, function(){
180 | previousElements = null;
181 | });
182 | childElement = null;
183 | }
184 | }
185 | });
186 | }
187 | };
188 | }
189 | ]);
190 | };
191 |
192 | // Reads the attribute given by `name` and converts it to a boolean.
193 | var getter = function(name){
194 | return [
195 | '$parse',
196 | function($parse){
197 | return function(scope, element, attrs){
198 | var testFn = $parse(attrs[name]);
199 | return function(){
200 | return !!testFn(scope);
201 | };
202 | };
203 | }
204 | ];
205 | };
206 |
207 | // We rely on the built-in `ng-if` directive to actually perform
208 | // the transclusion, and simply tie it in to the `elif` service.
209 | elif.directive('ngIf', [
210 | '$injector',
211 | 'elif',
212 | function($injector, elif){
213 | var getterFn = $injector.invoke(getter('ngIf'));
214 | return {
215 | priority: 600,
216 | link: function(scope, element, attrs){
217 | var watchFn = getterFn(scope, element, attrs);
218 | elif.create(scope, watchFn);
219 | }
220 | }
221 | }
222 | ]);
223 |
224 | // Else-if and else perform their own transclusions.
225 | elifDirective('ngElseIf', 'extend', getter('ngElseIf'));
226 | elifDirective('ngElif', 'extend', getter('ngElif'));
227 |
228 | // Else doesn't take an argument.
229 | elifDirective('ngElse', 'fallthrough');
230 | })();
231 |
--------------------------------------------------------------------------------
/js/sidebar.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: sidebar.js v0.1
3 | * ========================================================================
4 | * Copyright 2011-2014 Asyraf Abdul Rahman
5 | * Licensed under MIT
6 | * ======================================================================== */
7 |
8 | +function ($) {
9 | 'use strict';
10 |
11 | // SIDEBAR PUBLIC CLASS DEFINITION
12 | // ================================
13 |
14 | var Sidebar = function (element, options) {
15 | this.$element = $(element)
16 | this.options = $.extend({}, Sidebar.DEFAULTS, options)
17 | this.transitioning = null
18 |
19 | if (this.options.parent) this.$parent = $(this.options.parent)
20 | if (this.options.toggle) this.toggle()
21 | }
22 |
23 | Sidebar.DEFAULTS = {
24 | toggle: true
25 | }
26 |
27 | Sidebar.prototype.show = function () {
28 | if (this.transitioning || this.$element.hasClass('sidebar-open')) return
29 |
30 |
31 | var startEvent = $.Event('show.bs.sidebar')
32 | this.$element.trigger(startEvent);
33 | if (startEvent.isDefaultPrevented()) return
34 |
35 | this.$element
36 | .addClass('sidebar-open')
37 |
38 | this.transitioning = 1
39 |
40 | var complete = function () {
41 | this.$element
42 | this.transitioning = 0
43 | this.$element.trigger('shown.bs.sidebar')
44 | }
45 |
46 | if(!$.support.transition) return complete.call(this)
47 |
48 | this.$element
49 | .one($.support.transition.end, $.proxy(complete, this))
50 | .emulateTransitionEnd(400)
51 | }
52 |
53 | Sidebar.prototype.hide = function () {
54 | if (this.transitioning || !this.$element.hasClass('sidebar-open')) return
55 |
56 | var startEvent = $.Event('hide.bs.sidebar')
57 | this.$element.trigger(startEvent)
58 | if(startEvent.isDefaultPrevented()) return
59 |
60 | this.$element
61 | .removeClass('sidebar-open')
62 |
63 | this.transitioning = 1
64 |
65 | var complete = function () {
66 | this.transitioning = 0
67 | this.$element
68 | .trigger('hidden.bs.sidebar')
69 | }
70 |
71 | if (!$.support.transition) return complete.call(this)
72 |
73 | this.$element
74 | .one($.support.transition.end, $.proxy(complete, this))
75 | .emulateTransitionEnd(400)
76 | }
77 |
78 | Sidebar.prototype.toggle = function () {
79 | this[this.$element.hasClass('sidebar-open') ? 'hide' : 'show']()
80 | }
81 |
82 | var old = $.fn.sidebar
83 |
84 | $.fn.sidebar = function (option) {
85 | return this.each(function (){
86 | var $this = $(this)
87 | var data = $this.data('bs.sidebar')
88 | var options = $.extend({}, Sidebar.DEFAULTS, $this.data(), typeof options == 'object' && option)
89 |
90 | if (!data && options.toggle && option == 'show') option = !option
91 | if (!data) $this.data('bs.sidebar', (data = new Sidebar(this, options)))
92 | if (typeof option == 'string') data[option]()
93 | })
94 | }
95 |
96 | $.fn.sidebar.Constructor = Sidebar
97 |
98 | $.fn.sidebar.noConflict = function () {
99 | $.fn.sidebar = old
100 | return this
101 | }
102 |
103 | $(document).on('click.bs.sidebar.data-api', '[data-toggle="sidebar"]', function (e) {
104 | var $this = $(this), href
105 | var target = $this.attr('data-target')
106 | || e.preventDefault()
107 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')
108 | var $target = $(target)
109 | var data = $target.data('bs.sidebar')
110 | var option = data ? 'toggle' : $this.data()
111 |
112 | $target.sidebar(option)
113 | })
114 |
115 | $('html').on('click.bs.sidebar.autohide', function(event){
116 | var $this = $(event.target);
117 | var isButtonOrSidebar = $this.is('.sidebar, [data-toggle="sidebar"]') || $this.parents('.sidebar, [data-toggle="sidebar"]').length;
118 | if (isButtonOrSidebar) {
119 | return;
120 | } else {
121 | var $target = $('.sidebar');
122 | $target.each(function(i, trgt) {
123 | var $trgt = $(trgt);
124 | if($trgt.data('bs.sidebar') && $trgt.hasClass('sidebar-open')) {
125 | $trgt.sidebar('hide');
126 | }
127 | })
128 | }
129 | });
130 | }(jQuery);
131 |
--------------------------------------------------------------------------------
/materializecss-template/css/style.css:
--------------------------------------------------------------------------------
1 | /* Custom Stylesheet */
2 | /**
3 | * Use this file to override Materialize files so you can update
4 | * the core Materialize files in the future
5 | *
6 | * Made By MaterializeCSS.com
7 | */
8 |
9 |
10 | .card .card-image img {
11 | border-radius: 2px 2px 0 0;
12 | position: relative;
13 | left: 25%;
14 | right: 0;
15 | top: 10px;
16 | bottom: 0;
17 | width: 106px;
18 | }
19 |
20 |
21 | .card .card-title {
22 | font-size: 18px;
23 | }
24 |
25 |
26 | label {
27 | font-size: 1.2rem;
28 | }
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/materializecss-template/demo.html:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 | ElasticUI-Extension
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
48 |
49 |
50 |
51 |
52 |
53 |
79 |
80 |
81 |
82 |
83 |
Results
84 |
{{(indexVM.results.hits.total | number) || 0}} results ({{indexVM.results.took || 0}}ms)
85 |
86 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
Info
106 |
{{doc._source.title}}
107 |
108 |
109 |
110 |
{{doc._source.title}}
111 |
Link
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/materializecss-template/js/app.js:
--------------------------------------------------------------------------------
1 | var app = angular.module('demo', ['elasticui']);
2 |
3 | app.constant('euiHost', 'http://localhost:9200');
4 | app.controller('IndexController', function($scope) {
5 | $scope.indexName = "INDEX_NAME";
6 | });
7 |
8 |
9 |
--------------------------------------------------------------------------------
/materializecss-template/js/elasticui.min.js:
--------------------------------------------------------------------------------
1 | /*! elasticui - v0.0.6 - 2015-03-21
2 | * http://www.elasticui.com
3 | * Copyright (c) 2015 Yousef El-Dardiry; Licensed Apache */
4 |
5 | var elasticui;!function(a){var b;!function(a){var b=function(){function b(){this.ejsObjects=[],this.jsonObjects=[]}return b.prototype.indexOf=function(b){return this.jsonObjects.indexOf(a.EjsTool.getJsonFromEjsObject(b))},b.prototype.add=function(b){var c=this.indexOf(b);-1==c&&(this.ejsObjects.push(b),this.jsonObjects.push(a.EjsTool.getJsonFromEjsObject(b)))},b.prototype.remove=function(a){var b=this.indexOf(a);b>-1&&(this.ejsObjects.splice(b,1),this.jsonObjects.splice(b,1))},b}();a.EjsCollection=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},elasticui;!function(a){var b;!function(a){var b=function(b){function c(){b.apply(this,arguments)}return __extends(c,b),c.prototype.getAsFilter=function(){return a.FilterTool.combineFilters(this.ejsObjects)},c.prototype.getAsORFilter=function(){return a.FilterTool.combineFiltersShould(this.ejsObjects)},c.prototype.contains=function(a){return this.indexOf(a)>-1},c}(a.EjsCollection);a.FilterCollection=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){}return a.combineFilters=function(a){return 1===a.length?a[0]:a.length>1?ejs.BoolFilter().must(a):null},a.combineFiltersShould=function(a){return 1===a.length?a[0]:a.length>1?ejs.BoolFilter().should(a):null},a}();a.FilterTool=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){a.services=angular.module("elasticui.services",[])}(b=a.services||(a.services={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){a.directives=angular.module("elasticui.directives",[])}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="EAC",b.scope=!0,b.controller=a.controllers.AggregationController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-aggregation")+" | euiCached",function(b){return a.aggregation.agg=b});var e=!0,f=b.attr("eui-filter-self");f&&(a.$watch(f,function(b){return a.aggregation.filterSelf=b}),e=a.$eval(f)),a.aggregation={agg:a.$eval(b.attr("eui-aggregation")+" | euiCached"),filterSelf:e},d.init()},b}return b}();b.AggregationDirective=c,b.directives.directive("euiAggregation",a.directives.AggregationDirective)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.FilterController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-filter")+" | euiCached",function(b){return a.filter.filter=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.filter.enabled=b}),e=a.$eval(f)),a.filter={filter:a.$eval(b.attr("eui-filter")+" | euiCached"),enabled:e},d.init()},b}return b}();b.FilterDirective=c,b.directives.directive("euiFilter",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="EAC",b.scope=!1,b.controller=a.controllers.IndexController,b.link=function(a,b,c,d){a.$watch(c.euiIndex,function(a){d.indexVM.index=a}),d.indexVM.index=a.$eval(c.euiIndex)},b}return b}();b.IndexDirective=c,b.directives.directive("euiIndex",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){var a={};return a.require="ngModel",a.link=function(a,b,c,d){d.$parsers.push(function(a){return!a}),d.$formatters.push(function(a){return!a})},a}return a}();a.InvertedDirective=b,a.directives.directive("euiInverted",b)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="EAC",b.scope=!0,b.controller=a.controllers.OrFilterController,b.link=function(){},b}return b}();b.OrFilterDirective=c,b.directives.directive("euiOrFilter",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.SortController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-sort")+" | euiCached",function(b){return a.sorting.sort=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.sorting.enabled=b}),e=a.$eval(f)),a.sorting={sort:a.$eval(b.attr("eui-sort")+" | euiCached"),enabled:e},d.init()},b}return b}();b.SortDirective=c,b.directives.directive("euiSort",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){var a={};return a.restrict="EAC",a.scope=!1,a.transclude=!1,a.link={pre:function(a,b){var c=b.attr("eui-key");a.$watch(b.attr("eui-value"),function(b,d){angular.equals(b,d)||(a[c]=b)},!0),a[c]=a.$eval(b.attr("eui-value"))}},a}return a.$inject=["$timeout"],a}();a.VarDirective=b,a.directives.directive("euiVar",b)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){a.filters=angular.module("elasticui.filters",[])}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){var a={};return function(b){if(!b)return b;var c=angular.toJson(b.toJSON());return a[c]||(a[c]=b),a[c]}}return a}();a.CachedFilter=b,a.filters.filter("euiCached",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(b,c){if(!b||!b.length)return b;var d=a.parseString(c);return b.map(function(b){return[b.key,a.getValue(b,d)]})}}return a.parseString=function(a){return a.split(".")},a.getValue=function(a,b){var c=a;return angular.forEach(b,function(a){return c?void(c=c[a]):c}),c},a}();a.MapFilter=b,a.filters.filter("euiMap",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a,b,c,d){void 0===d&&(d=5);for(var e=1;b>=e;e++)c+d>=e&&e>=c-d||c>e&&4>c-d||e>c+d&&4>b-(c+d)?a.push(e):1==e?a.push(1,-1):e==b&&a.push(-2,b);return a}}return a}();a.PageRangeFilter=b,a.filters.filter("euiPageRange",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a,b){b=parseInt(b);for(var c=0;b>c;c++)a.push(c);return a}}return a}();a.RangeFilter=b,a.filters.filter("euiRange",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a){return a?Math.round(a):a}}return a}();a.RoundFilter=b,a.filters.filter("euiRound",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){return function(a){return new Date(a).getTime()}}return a}();a.TimestampFilter=b,a.filters.filter("euiTimestamp",b)}(b=a.filters||(a.filters={}))}(elasticui||(elasticui={})),angular.module("elasticui.controllers",[]).controller(elasticui.controllers);var elasticui;!function(a){var b;!function(b){var c=function(){function b(a){this.scope=a}return b.prototype.init=function(){var b=this;this.scope.$parent.$watch("indexVM.results",function(){return b.updateResults()}),this.scope.$watch("aggregation.agg",function(c,d){a.util.EjsTool.equals(d,c)||(b.previousProvider&&b.scope.indexVM.aggregationProviders.remove(b.previousProvider),b.updateAgg())}),this.scope.$watch("aggregation.filterSelf",function(a,c){a!==c&&(b.previousProvider&&b.scope.indexVM.aggregationProviders.remove(b.previousProvider),b.updateAgg())}),this.scope.$on("$destroy",function(){b.previousProvider&&b.scope.indexVM.aggregationProviders.remove(b.previousProvider)}),this.updateAgg()},b.prototype.updateResults=function(){var a=this.scope.indexVM.results;if(this.scope.aggregation.agg&&a&&a.aggregations){var c=b.getAggName(this.scope.aggregation.agg),d=Object.keys(a.aggregations).filter(function(a){return a==c||a=="filtered_"+c})[0],e=a.aggregations[d];d=="filtered_"+c&&(e=e[c]),this.scope.aggResult=e}},b.prototype.updateAgg=function(){var a=this,b=null;this.scope.aggregation.agg&&(b=function(b){return a.getAggregation(b)}),b&&this.scope.indexVM.aggregationProviders.add(b),this.previousProvider=b},b.getAggName=function(a){return Object.keys(a.toJSON())[0]},b.prototype.getAggregationExplicit=function(c,d,e){var f=this;if(!c)return null;var g=e;d||(g=g.filter(function(a){return a!=f.scope.combinedFilter&&("undefined"==typeof a.field||a.field()!=c.field())}));var h=a.util.FilterTool.combineFilters(g);return null!=h&&(c=new ejs.FilterAggregation("filtered_"+b.getAggName(c)).filter(h).agg(c)),c},b.prototype.getAggregation=function(a){return this.getAggregationExplicit(this.scope.aggregation.agg,this.scope.aggregation.filterSelf,a)},b.$inject=["$scope"],b}();b.AggregationController=c}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(a){this.scope=a}return b.prototype.init=function(){var b=this;if(this.scope.filter.filter){var c=this.scope.filters.contains(this.scope.filter.filter);!c&&this.scope.filter.enabled&&(this.scope.filters.add(this.scope.filter.filter),c=!0)}this.scope.filter.enabled=c,this.scope.$watch("filter.enabled",function(a,c){a!==c&&b.updateFilter()}),this.scope.$watch("filter.filter",function(c,d){a.util.EjsTool.equals(d,c)||(d&&b.scope.filters.remove(d),b.updateFilter())})},b.prototype.updateFilter=function(){this.scope.filter.filter&&(this.scope.filter.enabled?this.scope.filters.add(this.scope.filter.filter):this.scope.filters.remove(this.scope.filter.filter))},b.$inject=["$scope"],b}();b.FilterController=c}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(b,c,d,e,f){var g=this;this.filters=new a.util.FilterCollection,this.indexVM={host:null,query:null,sort:null,aggregationProviders:new a.util.SimpleSet,filters:this.filters,highlight:null,loaded:!1,page:1,index:null,loading:!1,pageCount:0,pageSize:10,results:null,refresh:function(a){return void 0===a&&(a=!0),g.refresh(a)},error:null,autoLoad:!0},this.searchPromise=null,this.refreshPromise=null,this.es=e,this.$rootScope=f,b.indexVM=this.indexVM,b.ejs=d.ejs,b.filters=this.filters,b.$watchCollection("indexVM.filters.ejsObjects",function(){g.indexVM.page=1,g.search()}),b.$watchCollection("indexVM.aggregationProviders.objects",function(){return g.search()}),b.$watch("indexVM.host",function(){null!=g.indexVM.host&&e.setHost(g.indexVM.host)&&g.search()}),b.$watch("indexVM.sort",function(){g.indexVM.page=1,g.search()}),b.$watch("indexVM.page",function(){return g.search()}),b.$watch("indexVM.index",function(){return g.search()}),b.$watch("indexVM.query",function(){return g.search()}),b.$watch("indexVM.highlight",function(){return g.search()}),c(function(){return g.loaded()},200)}return b.prototype.loaded=function(){this.indexVM.loaded||(this.indexVM.loaded=!0,this.indexVM.autoLoad&&this.search())},b.prototype.getSearchPromise=function(){for(var a=ejs.Request(),b=0;b\r\n \r\n \r\n \r\n {{bucket.key}} ({{bucket.doc_count}})\r\n \r\n \r\n ',d}return c.$inject=["$parse"],c}();b.ChecklistDirective=c,b.directives.directive("euiChecklist",c)}(c=b.directives||(b.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b;!function(a){var b=function(){function a(){var a={};return a.restrict="E",a.scope=!0,a.template='\r\n ',a}return a}();a.SimplePagingDirective=b,a.directives.directive("euiSimplePaging",b)}(b=a.directives||(a.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c;!function(b){var c=function(){function c(c){var d={};return d.restrict="E",d.scope=!0,d.link={pre:function(d,e,f){a.util.AngularTool.setupBinding(c,d,f,["field","size"]),d.agg_name=d.field.replace(/[^a-z_0-9]/gim,"_")+"_"+b.default_agg_count++}},d.template='\r\n ',d}return c.$inject=["$parse"],c}();b.SingleselectDirective=c,b.directives.directive("euiSingleselect",c)}(c=b.directives||(b.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(a){this.scope=a}return a.prototype.init=function(){var a=this;this.scope.$watch("indexVM.highlight",function(){return a.updateEnabled()}),this.scope.$watch("highlighting.highlight",function(){return a.updateHighlight()}),this.scope.$watch("highlighting.enabled",function(b,c){b!==c&&a.updateHighlight()}),this.updateHighlight()},a.prototype.updateHighlight=function(){this.scope.highlighting.enabled?this.scope.indexVM.highlight=this.scope.highlighting.highlight:this.isEnabledOnIndexScope()&&(this.scope.indexVM.highlight=null)},a.prototype.updateEnabled=function(){this.scope.highlighting.enabled=this.isEnabledOnIndexScope()},a.prototype.isEnabledOnIndexScope=function(){return null!=this.scope.indexVM.highlight&&angular.equals(this.scope.indexVM.highlight.toJSON(),this.scope.highlighting.highlight.toJSON())},a.$inject=["$scope"],a}();a.HighlightController=b}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(a){this.scope=a}return a.prototype.init=function(){var a=this;this.scope.$watch("indexVM.host",function(){return a.readHost()}),this.scope.$watch("host",function(){return a.updateHost()}),this.updateHost()},a.prototype.updateHost=function(){null!==this.scope.host&&(this.scope.indexVM.host=this.scope.host)},a.prototype.readHost=function(){this.scope.host=this.scope.indexVM.host},a.$inject=["$scope"],a}();a.HostController=b}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(a){this.scope=a}return b.prototype.init=function(){var b=this;this.scope.$watch("query.enabled",function(a,c){a!==c&&b.updateQuery()}),this.scope.$watch("query.query",function(c,d){a.util.EjsTool.equals(d,c)||b.updateQuery()}),this.updateQuery()},b.prototype.updateQuery=function(){this.scope.query.query&&(this.scope.indexVM.query=this.scope.query.enabled?this.scope.query.query:null)},b.$inject=["$scope"],b}();b.QueryController=c}(b=a.controllers||(a.controllers={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.HighlightController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-highlight")+" | euiCached",function(b){return a.highlighting.highlight=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.highlighting.enabled=b}),e=a.$eval(f)),a.highlighting={highlight:a.$eval(b.attr("eui-highlight")+" | euiCached"),enabled:e},d.init()},b}return b}();b.HighlightDirective=c,b.directives.directive("euiHighlight",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.HostController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-host"),function(b){return a.host=b}),a.host=a.$eval(b.attr("eui-host")),d.init()},b}return b}();b.HostDirective=c,b.directives.directive("euiHost",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c=function(){function b(){var b={};return b.restrict="A",b.scope=!0,b.controller=a.controllers.QueryController,b.link=function(a,b,c,d){a.$watch(b.attr("eui-query")+" | euiCached",function(b){return a.query.query=b});var e=!1,f=b.attr("eui-enabled");f&&(a.$watch(f,function(b){return a.query.enabled=b}),e=a.$eval(f)),a.query={query:a.$eval(b.attr("eui-query")+" | euiCached"),enabled:e},d.init()},b}return b}();b.QueryDirective=c,b.directives.directive("euiQuery",c)}(b=a.directives||(a.directives={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){}return a.setupBinding=function(a,b,c,d){angular.forEach(d,function(d){b.$watch(c[d],function(a){b[d]!=a&&(b[d]=a)}),b[d]=a(c[d])(b)})},a}();a.AngularTool=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){}return a.getJsonFromEjsObject=function(a){return angular.toJson(a.toJSON())},a.equals=function(a,b){return!a&&!b||a&&b&&this.getJsonFromEjsObject(a)==this.getJsonFromEjsObject(b)},a}();a.EjsTool=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(a){var b=function(){function a(){this.objects=[]}return a.prototype.indexOf=function(a){return this.objects.indexOf(a)},a.prototype.add=function(a){var b=this.indexOf(a);-1==b&&this.objects.push(a)},a.prototype.remove=function(a){var b=this.indexOf(a);b>-1&&this.objects.splice(b,1)},a}();a.SimpleSet=b}(b=a.util||(a.util={}))}(elasticui||(elasticui={}));var elasticui;!function(a){var b;!function(b){var c;!function(b){var c=function(){function b(b){var c={};return c.restrict="E",c.scope=!0,c.link={pre:function(c,d,e){a.util.AngularTool.setupBinding(b,c,e,["field"])}},c.template='\r\n \r\n ',c}return b.$inject=["$parse"],b}();b.SearchboxDirective=c,b.directives.directive("euiSearchbox",c)}(c=b.directives||(b.directives={}))}(b=a.widgets||(a.widgets={}))}(elasticui||(elasticui={}));
--------------------------------------------------------------------------------