├── .gitignore
├── LICENSE
├── NOTICE
├── README.md
├── bigdesk-1.0.0.jpg
├── bigdesk-2.0.0-SNAPSHOT.jpg
├── css
├── CssGrid_2
│ ├── 1140.css
│ ├── License.txt
│ ├── ie.css
│ └── styles.css
├── bigdesk.css
├── normalize.css
└── reset.css
├── images
├── 1license.txt
├── award_star_gold.png
├── es-logo.png
└── favicon.png
├── index.html
└── js
├── bigdeskApp.js
├── charts
├── bigdesk_charts.js
├── common.css
├── not-available
│ ├── not-available-chart.css
│ ├── not-available-chart.js
│ └── test-not-available-chart.html
├── pack
│ └── pack.css
├── time-area
│ ├── test-time-area-chart.html
│ ├── time-area-chart.css
│ └── time-area-chart.js
└── time-series
│ ├── test-time-series-chart.html
│ ├── time-series-chart.css
│ └── time-series-chart.js
├── lib
├── D3-v2.8.1
│ ├── LICENSE
│ └── d3.v2.min.js
├── backbone
│ ├── LICENSE
│ └── backbone-min.js
├── css3-mediaqueries
│ ├── License.txt
│ └── css3-mediaqueries.js
├── jquery
│ └── jquery-1.7.1.min.js
├── mustache
│ ├── LICENSE
│ └── mustache.js
├── tinysort
│ ├── License.txt
│ └── jquery.tinysort.min.js
└── underscore
│ ├── LICENSE
│ └── underscore-min.js
├── models
├── Hello.js
└── cluster
│ ├── ClusterHealth.js
│ ├── ClusterState.js
│ ├── IndicesStatus.js
│ ├── NodeInfo.js
│ ├── NodesState.js
│ └── NodesStats.js
├── store
└── BigdeskStore.js
├── util
└── bigdesk_extension.js
└── views
├── ClusterHealthView.js
├── ClusterNodesListView.js
├── ClusterStateView.js
├── SelectedClusterNodeView.js
└── templates.js
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | bigdesk.iml
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | =========================================================================
2 | == Bigdesk - Live charts and statistics for elasticsearch cluster. ==
3 | =========================================================================
4 |
5 | Copyright 2011-2014 Lukas Vlcek
6 |
7 | This product includes:
8 |
9 | Meyer CSS reset
10 | http://meyerweb.com/eric/tools/css/reset/
11 | License: none (public domain)
12 |
13 | normalize.css
14 | http://github.com/necolas/normalize.css
15 | Copyright (c) Nicolas Gallagher and Jonathan Neal
16 | License: https://github.com/necolas/normalize.css/blob/master/LICENSE.md
17 |
18 | CssGrid
19 | http://cssgrid.net
20 | Copyright (c) Andy Taylor
21 | License: http://creativecommons.org/licenses/by/3.0/au/
22 |
23 | D3.js
24 | http://d3js.org
25 | Copyright (c) 2012, Michael Bostock
26 | License: http://opensource.org/licenses/BSD-3-Clause
27 |
28 | Backbone.js
29 | http://backbonejs.org
30 | Copyright (c) 2010-2012 Jeremy Ashkenas, DocumentCloud
31 | License: MIT License, https://github.com/documentcloud/backbone/blob/master/LICENSE
32 |
33 | CSS3-mediaqueries.js
34 | http://code.google.com/p/css3-mediaqueries-js/
35 | License: MIT License, http://www.opensource.org/licenses/mit-license.php
36 |
37 | jQuery
38 | Copyright 2012 jQuery Foundation and other contributors
39 | http://jquery.com
40 | License: MIT License, http://jquery.org/license/
41 |
42 | Mustache.js
43 | Copyright (c) 2009 Chris Wanstrath (Ruby)
44 | Copyright (c) 2010 Jan Lehnardt (JavaScript)
45 | http://mustache.github.com
46 | License: MIT License
47 |
48 | Tinysort.js
49 | http://code.google.com/p/tinysort/
50 | http://tinysort.sjeiti.com/
51 | License: MIT License
52 |
53 | Underscore.js
54 | http://underscorejs.org
55 | Copyright (c) 2009-2012 Jeremy Ashkenas, DocumentCloud
56 | License: MIT License, https://github.com/documentcloud/underscore/blob/master/LICENSE
57 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ——— This repository is archived. Thanks :purple_heart: to all contributors. ———
3 |
4 |
5 | # Bigdesk
6 |
7 | Live charts and statistics for Elasticsearch cluster.
8 |
9 | ## Contents
10 |
11 | - [Support Matrix](#support-matrix)
12 | - [Release Notes](#release-notes)
13 | - [Installation Instructions](#installation-instructions)
14 | - [How to use Bigdesk](#how-to-use-bigdesk)
15 | - [Screenshots](#screenshots)
16 | - [Supported Web Browsers](#supported-web-browsers)
17 | - [Credits](#credits)
18 |
19 | ## Support Matrix
20 |
21 |
22 |
23 | Bigdesk
24 | Elasticsearch
25 |
26 |
27 | 2.5.0
28 | 1.3.0 ... 1.3.x
29 |
30 |
31 | 2.4.1 (2.4.0)
32 | 1.0.0.RC1 ... 1.2.x
33 |
34 |
35 | n/a
36 | 1.0.0.Beta1 ... 1.0.0.Beta2
37 |
38 |
39 | 2.2.3
40 | 0.90.10 ... 0.90.x
41 |
42 |
43 | 2.2.2 (2.2.1)
44 | 0.90.0 ... 0.90.9
45 |
46 |
47 | 2.1.0
48 | 0.20.0 ... 0.20.x
49 |
50 |
51 | 2.0.0
52 | 0.19.0 ... 0.20.x
53 |
54 |
55 | 1.0.0
56 | 0.17.0 ... 0.18.x
57 |
58 |
59 |
60 | ## Release Notes
61 |
62 | #### 2.5.0 (09-08-2014)
63 |
64 | - Support for Elasticsearch `1.3.x` and later by switching from JSONP to XHR (thanks to [@hmarcelino](https://github.com/hmarcelino)).
65 |
66 | #### 2.4.1 (09-08-2014)
67 |
68 | - Improvements to charting: namely added tick format to `y-axis` (thanks to [@slingler](https://github.com/slingler))
69 | and increased size of the cluster diagram (thanks to [@tylerlong](https://github.com/tylerlong)).
70 |
71 | #### 2.4.0 (21-02-2014)
72 |
73 | - Support for Elasticsearch `1.0.0.RC1` and later.
74 | - Added ID cache series into Indices Cache Size chart.
75 | - Fixed display of hostname.
76 | - There is no Bigdesk release with support for Elasticsearch `1.0.0.Beta1` and `1.0.0.Beta2` for now.
77 | We can add support later if there is urgent need. This is the reason why release number 2.3.0 is skipped.
78 |
79 | #### 2.2.3 (14-02-2014)
80 |
81 | - Support for Elasticsearch `0.90.10` and above in `0.90.x`. (Main changes introduced in [#4661](https://github.com/elasticsearch/elasticsearch/issues/4661))
82 | - JVM GC (Garbage Collection) Chart shows separated series for Young and Old generations.
83 | - Fixed node get stats retrieval.
84 |
85 | #### 2.2.2 (14-10-2013)
86 |
87 | Reducing the amount of data pulled over HTTP and kept in the memory.
88 |
89 | - Show Elasticsearch version as part of node information [#38](https://github.com/lukas-vlcek/bigdesk/issues/38)
90 | - Reduce the amount of the data pulled via HTTP/REST [#41](https://github.com/lukas-vlcek/bigdesk/issues/41)
91 | - Further reduce the amount of the data kept in web browser memory [#42](https://github.com/lukas-vlcek/bigdesk/issues/42)
92 |
93 | #### 2.2.1 (02-07-2013)
94 |
95 | - This release is a recommended upgrade from 2.2.0
96 | - Fix bug: Update filter cache stats for latest stats API [#35](https://github.com/lukas-vlcek/bigdesk/issues/35) (kudos to [@cbcase](https://github.com/cbcase))
97 | - Improvement: Tolerate ES version 1.0.x [#32](https://github.com/lukas-vlcek/bigdesk/issues/32) (kudos to [@hmalphettes](https://github.com/hmalphettes))
98 |
99 | #### 2.2.0 (24-04-2013)
100 |
101 | - Upgrade to Elasticsearch `0.90.0` and later (kudos to [@mrflip](https://github.com/mrflip) and [@hustonhoburg](https://github.com/hustonhoburg))
102 |
103 | #### 2.1.0
104 |
105 | - Added threadpool row to the metrics for Elasticsearch `0.20.0` and higher (kudos to [@jgagnon1](https://github.com/jgagnon1))
106 |
107 | #### 2.0.0
108 |
109 | - Complete reimplementation (based on backbone and underscore)
110 | - Switched to D3.js (mainly due to friendly License)
111 |
112 | #### 1.0.0
113 |
114 | - Initial version (jQuery and Highcharts)
115 |
116 | ## Installation Instructions
117 |
118 | There are couple of options how to get and install Bigdesk. Which one to use can depend on your use case.
119 |
120 | #### 1) Use it as an Elasticsearch plugin
121 |
122 | Install Elasticsearch then navigate to `` and execute the following command on command line:
123 |
124 | $ ./bin/plugin -install lukas-vlcek/bigdesk/
125 |
126 | where `` specify particular Bigdesk version. For instance to install version 2.4.0 run:
127 |
128 | $ ./bin/plugin -install lukas-vlcek/bigdesk/2.4.0
129 |
130 | Elasticsearch plugin manager then downloads and install Bigdesk sources:
131 |
132 | -> Installing lukas-vlcek/bigdesk/2.4.0...
133 | Trying http://download.elasticsearch.org/lukas-vlcek/bigdesk/bigdesk-2.4.0.zip...
134 | Trying http://search.maven.org/remotecontent?filepath=lukas-vlcek/bigdesk/2.4.0/bigdesk-2.4.0.zip...
135 | Trying https://oss.sonatype.org/service/local/repositories/releases/content/lukas-vlcek/bigdesk/2.4.0/bigdesk-2.4.0.zip...
136 | Trying https://github.com/lukas-vlcek/bigdesk/archive/v2.4.0.zip...
137 | Downloading ............................................................DONE
138 | Installed lukas-vlcek/bigdesk/2.4.0 into /Users/lukas/projects/elasticsearch-1.0.0/plugins/bigdesk
139 | Identified as a _site plugin, moving to _site structure ...
140 |
141 | Then you can open web browser and navigate to `http://localhost:9200/_plugin/bigdesk/` it will open installed Bigdesk
142 | and automatically auto-connect to local node.
143 |
144 | #### 2) Clone Bigdesk repo into local filesystem and checkout specific tag
145 |
146 | Clone Bigdesk repo (the master branch) and checkout specific release tag.
147 |
148 | $ git clone https://github.com/lukas-vlcek/bigdesk.git
149 | Cloning into 'bigdesk'...
150 | remote: Counting objects: 4947, done.
151 | remote: Compressing objects: 100% (2726/2726), done.
152 | remote: Total 4947 (delta 1831), reused 4883 (delta 1792)
153 | Receiving objects: 100% (4947/4947), 17.78 MiB | 1.08 MiB/s, done.
154 | Resolving deltas: 100% (1831/1831), done.
155 |
156 | $ cd bigdesk/
157 | $ git tag
158 | [... some tags left out for brevity ....]
159 | v2.2.2
160 | v2.2.3
161 | v2.4.0
162 |
163 | $ git checkout v2.4.0
164 | Note: checking out 'v2.4.0'.
165 | [... optional git messages ...]
166 | HEAD is now at 4a23042... Release v2.4.0 - Extract the cluster status CSS and make it more readable
167 |
168 | Now you should be able to open index.html in web browser and point it to the Elasticsearch node.
169 |
170 | #### 3) You can download archives from GitHub
171 |
172 | See
173 |
174 | BTW these archives are provided by GitHub and are based on above discussed git tags.
175 |
176 | #### 4) You can use Bigdesk online
177 |
178 | See
179 |
180 | ## How to use Bigdesk
181 |
182 | Once you open Bigdesk in your web browser, you need to **point it to the Elasticsearch node REST endpoint**.
183 | For example if you run Elasticsearch locally the REST endpoint would be `http://localhost:9200/` by default.
184 | You simply specify any endpoint URL in the text field on top of the Bigdesk screen (or via URL parameter, see below).
185 |
186 | If you are using Bigdesk **1.0.0** (ie. you want to connect Bigdesk to elasticsearch 0.17.x - 0.18.x) then you need
187 | to fill into two different text fields. First you specify **hostname** of the Elasticsearch node into the first
188 | text field and its **port** number into the second text field (but in some situations this can be limiting,
189 | for example if you run Elasticsearch behind firewall).
190 |
191 | Then you hit **Connect** button (it is called **GO!** button in Bigdesk 1.0.0) and that's it.
192 |
193 | Now you should see cluster name and list of its nodes. You can switch between nodes in the cluster, new nodes are added
194 | and old nodes are removed automatically on the fly.
195 |
196 | You can change the Bigdesk **refresh interval** and **amount of data** that is displayed by charts.
197 |
198 | ### URL parameters
199 |
200 | If you are using **Bigdesk 1.0.0** you can immediately connect to a particular host, add the
201 | `host`, `port`, and `go` parameters to the query string:
202 |
203 | index.html?host=search.example.com&port=9200&go
204 |
205 | If you are using **Bigdesk 2.x** you can use any of the following URL parameters to immediately connect to
206 | a particular host or set history or refresh interval:
207 |
208 | - `endpoint` = URL of ES node REST endpoint (you might want to use URL encoded value). Defaults to `http://localhost:9200`.
209 | - `refresh` = refresh interval in milliseconds. Defaults to `2000` (2 sec).
210 | - `history` = number of milliseconds to keep in history. Defaults to `300000` (5 min).
211 | - `connect` = if set to `true` Bigdesk will try to connect immediately to the endpoint. Defaults to `false`.
212 |
213 | Example connecting to `http://127.0.0.1:9201` with 3 sec refresh interval:
214 |
215 | index.html?endpoint=http%3A%2F%2F127.0.0.1%3A9201&refresh=3000&connect=true
216 |
217 | ## Screenshots
218 |
219 | ### Bigdesk 1.0.0
220 |
221 | 
222 |
223 | ### Bigdesk 2.x
224 |
225 | 
226 |
227 | ## Supported Web Browsers
228 |
229 | Bigdesk should work in all modern web browsers as long as they support SVG. It has been tested in Safari, Firefox and Chrome.
230 |
231 | ## Credits
232 |
233 | Lukas Vlcek and [contributors](https://github.com/lukas-vlcek/bigdesk/contributors).
234 |
--------------------------------------------------------------------------------
/bigdesk-1.0.0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukas-vlcek/bigdesk/0199ef5b249e48817c87c7ad33cc7bd04c3334b6/bigdesk-1.0.0.jpg
--------------------------------------------------------------------------------
/bigdesk-2.0.0-SNAPSHOT.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukas-vlcek/bigdesk/0199ef5b249e48817c87c7ad33cc7bd04c3334b6/bigdesk-2.0.0-SNAPSHOT.jpg
--------------------------------------------------------------------------------
/css/CssGrid_2/1140.css:
--------------------------------------------------------------------------------
1 | /* CSS Resets */
2 |
3 | html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,address,cite,code,del,dfn,em,img,ins,q,small,strong,sub,sup,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{border:0;margin:0;padding:0}article,aside,figure,figure img,figcaption,hgroup,footer,header,nav,section,video,object{display:block}a img{border:0}figure{position:relative}figure img{width:100%}
4 |
5 |
6 | /* ==================================================================================================================== */
7 | /* ! The 1140px Grid V2 by Andy Taylor \ http://cssgrid.net \ http://www.twitter.com/andytlr \ http://www.andytlr.com */
8 | /* ==================================================================================================================== */
9 |
10 | .container {
11 | padding-left: 20px;
12 | padding-right: 20px;
13 | }
14 |
15 | .row {
16 | width: 100%;
17 | max-width: 1140px;
18 | min-width: 755px;
19 | margin: 0 auto;
20 | overflow: hidden;
21 | }
22 |
23 | .onecol, .twocol, .threecol, .fourcol, .fivecol, .sixcol, .sevencol, .eightcol, .ninecol, .tencol, .elevencol {
24 | margin-right: 3.8%;
25 | float: left;
26 | min-height: 1px;
27 | }
28 |
29 | .row .onecol {
30 | width: 4.85%;
31 | }
32 |
33 | .row .twocol {
34 | width: 13.45%;
35 | }
36 |
37 | .row .threecol {
38 | width: 22.05%;
39 | }
40 |
41 | .row .fourcol {
42 | width: 30.75%;
43 | }
44 |
45 | .row .fivecol {
46 | width: 39.45%;
47 | }
48 |
49 | .row .sixcol {
50 | width: 48%;
51 | }
52 |
53 | .row .sevencol {
54 | width: 56.75%;
55 | }
56 |
57 | .row .eightcol {
58 | width: 65.4%;
59 | }
60 |
61 | .row .ninecol {
62 | width: 74.05%;
63 | }
64 |
65 | .row .tencol {
66 | width: 82.7%;
67 | }
68 |
69 | .row .elevencol {
70 | width: 91.35%;
71 | }
72 |
73 | .row .twelvecol {
74 | width: 100%;
75 | float: left;
76 | }
77 |
78 | .last {
79 | margin-right: 0px;
80 | }
81 |
82 | img, object, embed {
83 | max-width: 100%;
84 | }
85 |
86 | img {
87 | height: auto;
88 | }
89 |
90 |
91 | /* Smaller screens */
92 |
93 | @media only screen and (max-width: 1023px) {
94 |
95 | body {
96 | font-size: 0.8em;
97 | line-height: 1.5em;
98 | }
99 |
100 | }
101 |
102 |
103 | /* Mobile */
104 |
105 | @media handheld, only screen and (max-width: 767px) {
106 |
107 | body {
108 | font-size: 16px;
109 | -webkit-text-size-adjust: none;
110 | }
111 |
112 | .row, body, .container {
113 | width: 100%;
114 | min-width: 0;
115 | margin-left: 0px;
116 | margin-right: 0px;
117 | padding-left: 0px;
118 | padding-right: 0px;
119 | }
120 |
121 | .row .onecol, .row .twocol, .row .threecol, .row .fourcol, .row .fivecol, .row .sixcol, .row .sevencol, .row .eightcol, .row .ninecol, .row .tencol, .row .elevencol, .row .twelvecol {
122 | width: auto;
123 | float: none;
124 | margin-left: 0px;
125 | margin-right: 0px;
126 | padding-left: 20px;
127 | padding-right: 20px;
128 | }
129 |
130 | }
--------------------------------------------------------------------------------
/css/CssGrid_2/License.txt:
--------------------------------------------------------------------------------
1 | http://cssgrid.net/
2 |
3 | License:
4 | http://creativecommons.org/licenses/by/3.0/au/
--------------------------------------------------------------------------------
/css/CssGrid_2/ie.css:
--------------------------------------------------------------------------------
1 | .onecol {
2 | width: 4.7%;
3 | }
4 |
5 | .twocol {
6 | width: 13.2%;
7 | }
8 |
9 | .threecol {
10 | width: 22.05%;
11 | }
12 |
13 | .fourcol {
14 | width: 30.6%;
15 | }
16 |
17 | .fivecol {
18 | width: 39%;
19 | }
20 |
21 | .sixcol {
22 | width: 48%;
23 | }
24 |
25 | .sevencol {
26 | width: 56.75%;
27 | }
28 |
29 | .eightcol {
30 | width: 61.6%;
31 | }
32 |
33 | .ninecol {
34 | width: 74.05%;
35 | }
36 |
37 | .tencol {
38 | width: 82%;
39 | }
40 |
41 | .elevencol {
42 | width: 91.35%;
43 | }
--------------------------------------------------------------------------------
/css/CssGrid_2/styles.css:
--------------------------------------------------------------------------------
1 | /* ============================== */
2 | /* ! Layout for desktop version */
3 | /* ============================== */
4 |
5 | body {}
6 | .container p {
7 | font-size: 14px;
8 | }
9 |
10 | .masterNode {
11 | background: url("../../images/award_star_gold.png") no-repeat 1px 3px;
12 | }
13 |
14 | @media only screen and (max-width: 1023px) {
15 |
16 | body {}
17 | .container p {
18 | font-size: 12px;
19 | }
20 | .masterNode {
21 | background: url("../../images/award_star_gold.png") no-repeat 1px 1px;
22 | }
23 | }
24 |
25 | /* ============================= */
26 | /* ! Layout for mobile version */
27 | /* ============================= */
28 |
29 | @media handheld, only screen and (max-width: 767px) {
30 |
31 | body {}
32 | .container p {
33 | font-size: 12px;
34 | }
35 | .masterNode {
36 | background: url("../../images/award_star_gold.png") no-repeat 1px 1px;
37 | }
38 | }
39 |
40 |
41 | /* ========================================== */
42 | /* ! Provide higher res assets for iPhone 4 */
43 | /* ========================================== */
44 |
45 | @media only screen and (-webkit-min-device-pixel-ratio: 2) {
46 |
47 | /* .logo {
48 | background: url(logo2x.jpg) no-repeat;
49 | background-size: 212px 303px;
50 | }*/
51 |
52 | }
--------------------------------------------------------------------------------
/css/bigdesk.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2012 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | html {
18 | overflow: -moz-scrollbars-vertical;
19 | overflow-y: scroll;
20 | }
21 |
22 | body {
23 | /*font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;*/
24 | line-height: 1.3;
25 | }
26 |
27 | .row.newSection {
28 | border-top: 1px solid #9bf;
29 | }
30 |
31 | .container p {
32 | color: #777;
33 | /*line-height: 100px;*/
34 | /*background: #000;*/
35 | /*text-align: center;*/
36 | margin: 15px 0 10px 0;
37 | font-family: sans-serif;
38 | /*font-size: 14px;*/
39 | }
40 |
41 | h2 {
42 | color: #0055ff;
43 | margin-bottom: 10px;
44 | font-family: serif;
45 | font-size: 16px;
46 | font-weight: bold;
47 | }
48 |
49 | h3 {
50 | color: #555;
51 | font-size: 85%;
52 | margin-top: 9px;
53 | margin-bottom: 5px;
54 | font-weight: bold;
55 | }
56 |
57 | .invisible p {
58 | display: none;
59 | }
60 |
61 | .connectionPanel {
62 | padding: 3px 0 3px 0;
63 | color: #555;
64 | background-color: #eee;
65 | border-bottom: 1px solid #aaa;
66 | white-space: nowrap;
67 | }
68 |
69 | .connectionPanel.settings {
70 | background-color: #d6d6d6;
71 | }
72 |
73 | .connectionPanelSection {
74 | border-right: 1px solid lightgray;
75 | padding: 0 5px 0 7px;
76 | }
77 |
78 | .connectionPanelSectionWithoutDecoration {
79 | padding: 0 2px 0 7px;
80 | }
81 |
82 | #clusterHealth {
83 | /*border: 1px solid black;*/
84 | }
85 |
86 | #clusterNodes {
87 | /*border: 1px solid blue;*/
88 | }
89 |
90 | #selectedClusterNode p {
91 | /*border: 1px solid blue;*/
92 | }
93 |
94 | .clusterNode {
95 | border: 1px solid black;
96 | margin: 0 4px 4px 0px;
97 | padding: 2px 5px 2px 5px;
98 | cursor: pointer;
99 | float: left;
100 | }
101 |
102 | .clusterNode:hover {
103 | background-color: #d1d1d1;
104 | }
105 |
106 | .clusterNode.selectedNode {
107 | background-color: lightgray;
108 | color: white;
109 | }
110 |
111 | .masterNode {
112 | padding-left: 20px;
113 | /*background: url("../images/award_star_gold.png") no-repeat 1px 3px;*/
114 | }
115 |
116 | .clusterStatus {
117 | padding: 1px 2px;
118 | }
119 | .clusterStatus.red {
120 | background-color: red;
121 | color: white;
122 | }
123 | .clusterStatus.yellow {
124 | background-color: yellow;
125 | }
126 | .clusterStatus.green {
127 | background-color: green;
128 | color: white;
129 | }
130 |
131 | /* TODO css for chart, move it into different file */
132 | .line {
133 | fill: none;
134 | stroke: #000;
135 | stroke-width: 1px;
136 | }
137 |
138 | .area {
139 | fill: #969696;
140 | }
141 |
142 | /* Courtesy of Jeff Starr, http://perishablepress.com/wrapping-content/ */
143 | span.pre {
144 | white-space: pre; /* CSS 2.0 */
145 | white-space: pre-wrap; /* CSS 2.1 */
146 | white-space: pre-line; /* CSS 3.0 */
147 | white-space: -pre-wrap; /* Opera 4-6 */
148 | white-space: -o-pre-wrap; /* Opera 7 */
149 | white-space: -moz-pre-wrap; /* Mozilla */
150 | white-space: -hp-pre-wrap; /* HP Printers */
151 | word-wrap: break-word; /* IE 5+ */
152 | }
153 |
154 | label {
155 | cursor: pointer;
156 | }
157 |
158 | .center {
159 | text-align: center;
160 | }
161 |
--------------------------------------------------------------------------------
/css/normalize.css:
--------------------------------------------------------------------------------
1 | /*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
2 |
3 | /* =============================================================================
4 | HTML5 display definitions
5 | ========================================================================== */
6 |
7 | /*
8 | * Corrects block display not defined in IE6/7/8/9 & FF3
9 | */
10 |
11 | article,
12 | aside,
13 | details,
14 | figcaption,
15 | figure,
16 | footer,
17 | header,
18 | hgroup,
19 | nav,
20 | section,
21 | summary {
22 | display: block;
23 | }
24 |
25 | /*
26 | * Corrects inline-block display not defined in IE6/7/8/9 & FF3
27 | */
28 |
29 | audio,
30 | canvas,
31 | video {
32 | display: inline-block;
33 | *display: inline;
34 | *zoom: 1;
35 | }
36 |
37 | /*
38 | * Prevents modern browsers from displaying 'audio' without controls
39 | * Remove excess height in iOS5 devices
40 | */
41 |
42 | audio:not([controls]) {
43 | display: none;
44 | height: 0;
45 | }
46 |
47 | /*
48 | * Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4
49 | * Known issue: no IE6 support
50 | */
51 |
52 | [hidden] {
53 | display: none;
54 | }
55 |
56 |
57 | /* =============================================================================
58 | Base
59 | ========================================================================== */
60 |
61 | /*
62 | * 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units
63 | * http://clagnut.com/blog/348/#c790
64 | * 2. Prevents iOS text size adjust after orientation change, without disabling user zoom
65 | * www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/
66 | */
67 |
68 | html {
69 | font-size: 100%; /* 1 */
70 | -webkit-text-size-adjust: 100%; /* 2 */
71 | -ms-text-size-adjust: 100%; /* 2 */
72 | }
73 |
74 | /*
75 | * Addresses font-family inconsistency between 'textarea' and other form elements.
76 | */
77 |
78 | html,
79 | button,
80 | input,
81 | select,
82 | textarea {
83 | font-family: sans-serif;
84 | }
85 |
86 | /*
87 | * Addresses margins handled incorrectly in IE6/7
88 | */
89 |
90 | body {
91 | margin: 0;
92 | }
93 |
94 |
95 | /* =============================================================================
96 | Links
97 | ========================================================================== */
98 |
99 | /*
100 | * Addresses outline displayed oddly in Chrome
101 | */
102 |
103 | a:focus {
104 | outline: thin dotted;
105 | }
106 |
107 | /*
108 | * Improves readability when focused and also mouse hovered in all browsers
109 | * people.opera.com/patrickl/experiments/keyboard/test
110 | */
111 |
112 | a:hover,
113 | a:active {
114 | outline: 0;
115 | }
116 |
117 |
118 | /* =============================================================================
119 | Typography
120 | ========================================================================== */
121 |
122 | /*
123 | * Addresses font sizes and margins set differently in IE6/7
124 | * Addresses font sizes within 'section' and 'article' in FF4+, Chrome, S5
125 | */
126 |
127 | h1 {
128 | font-size: 2em;
129 | margin: 0.67em 0;
130 | }
131 |
132 | h2 {
133 | font-size: 1.5em;
134 | margin: 0.83em 0;
135 | }
136 |
137 | h3 {
138 | font-size: 1.17em;
139 | margin: 1em 0;
140 | }
141 |
142 | h4 {
143 | font-size: 1em;
144 | margin: 1.33em 0;
145 | }
146 |
147 | h5 {
148 | font-size: 0.83em;
149 | margin: 1.67em 0;
150 | }
151 |
152 | h6 {
153 | font-size: 0.75em;
154 | margin: 2.33em 0;
155 | }
156 |
157 | /*
158 | * Addresses styling not present in IE7/8/9, S5, Chrome
159 | */
160 |
161 | abbr[title] {
162 | border-bottom: 1px dotted;
163 | }
164 |
165 | /*
166 | * Addresses style set to 'bolder' in FF3+, S4/5, Chrome
167 | */
168 |
169 | b,
170 | strong {
171 | font-weight: bold;
172 | }
173 |
174 | blockquote {
175 | margin: 1em 40px;
176 | }
177 |
178 | /*
179 | * Addresses styling not present in S5, Chrome
180 | */
181 |
182 | dfn {
183 | font-style: italic;
184 | }
185 |
186 | /*
187 | * Addresses styling not present in IE6/7/8/9
188 | */
189 |
190 | mark {
191 | background: #ff0;
192 | color: #000;
193 | }
194 |
195 | /*
196 | * Addresses margins set differently in IE6/7
197 | */
198 |
199 | p,
200 | pre {
201 | margin: 1em 0;
202 | }
203 |
204 | /*
205 | * Corrects font family set oddly in IE6, S4/5, Chrome
206 | * en.wikipedia.org/wiki/User:Davidgothberg/Test59
207 | */
208 |
209 | pre,
210 | code,
211 | kbd,
212 | samp {
213 | font-family: monospace, serif;
214 | _font-family: 'courier new', monospace;
215 | font-size: 1em;
216 | }
217 |
218 | /*
219 | * Improves readability of pre-formatted text in all browsers
220 | */
221 |
222 | pre {
223 | white-space: pre;
224 | white-space: pre-wrap;
225 | word-wrap: break-word;
226 | }
227 |
228 | /*
229 | * 1. Addresses CSS quotes not supported in IE6/7
230 | * 2. Addresses quote property not supported in S4
231 | */
232 |
233 | /* 1 */
234 |
235 | q {
236 | quotes: none;
237 | }
238 |
239 | /* 2 */
240 |
241 | q:before,
242 | q:after {
243 | content: '';
244 | content: none;
245 | }
246 |
247 | small {
248 | font-size: 75%;
249 | }
250 |
251 | /*
252 | * Prevents sub and sup affecting line-height in all browsers
253 | * gist.github.com/413930
254 | */
255 |
256 | sub,
257 | sup {
258 | font-size: 75%;
259 | line-height: 0;
260 | position: relative;
261 | vertical-align: baseline;
262 | }
263 |
264 | sup {
265 | top: -0.5em;
266 | }
267 |
268 | sub {
269 | bottom: -0.25em;
270 | }
271 |
272 |
273 | /* =============================================================================
274 | Lists
275 | ========================================================================== */
276 |
277 | /*
278 | * Addresses margins set differently in IE6/7
279 | */
280 |
281 | dl,
282 | menu,
283 | ol,
284 | ul {
285 | margin: 1em 0;
286 | }
287 |
288 | dd {
289 | margin: 0 0 0 40px;
290 | }
291 |
292 | /*
293 | * Addresses paddings set differently in IE6/7
294 | */
295 |
296 | menu,
297 | ol,
298 | ul {
299 | padding: 0 0 0 40px;
300 | }
301 |
302 | /*
303 | * Corrects list images handled incorrectly in IE7
304 | */
305 |
306 | nav ul,
307 | nav ol {
308 | list-style: none;
309 | list-style-image: none;
310 | }
311 |
312 |
313 | /* =============================================================================
314 | Embedded content
315 | ========================================================================== */
316 |
317 | /*
318 | * 1. Removes border when inside 'a' element in IE6/7/8/9, FF3
319 | * 2. Improves image quality when scaled in IE7
320 | * code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/
321 | */
322 |
323 | img {
324 | border: 0; /* 1 */
325 | -ms-interpolation-mode: bicubic; /* 2 */
326 | }
327 |
328 | /*
329 | * Corrects overflow displayed oddly in IE9
330 | */
331 |
332 | svg:not(:root) {
333 | overflow: hidden;
334 | }
335 |
336 |
337 | /* =============================================================================
338 | Figures
339 | ========================================================================== */
340 |
341 | /*
342 | * Addresses margin not present in IE6/7/8/9, S5, O11
343 | */
344 |
345 | figure {
346 | margin: 0;
347 | }
348 |
349 |
350 | /* =============================================================================
351 | Forms
352 | ========================================================================== */
353 |
354 | /*
355 | * Corrects margin displayed oddly in IE6/7
356 | */
357 |
358 | form {
359 | margin: 0;
360 | }
361 |
362 | /*
363 | * Define consistent border, margin, and padding
364 | */
365 |
366 | fieldset {
367 | border: 1px solid #c0c0c0;
368 | margin: 0 2px;
369 | padding: 0.35em 0.625em 0.75em;
370 | }
371 |
372 | /*
373 | * 1. Corrects color not being inherited in IE6/7/8/9
374 | * 2. Corrects text not wrapping in FF3
375 | * 3. Corrects alignment displayed oddly in IE6/7
376 | */
377 |
378 | legend {
379 | border: 0; /* 1 */
380 | padding: 0;
381 | white-space: normal; /* 2 */
382 | *margin-left: -7px; /* 3 */
383 | }
384 |
385 | /*
386 | * 1. Corrects font size not being inherited in all browsers
387 | * 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome
388 | * 3. Improves appearance and consistency in all browsers
389 | */
390 |
391 | button,
392 | input,
393 | select,
394 | textarea {
395 | font-size: 100%; /* 1 */
396 | margin: 0; /* 2 */
397 | vertical-align: baseline; /* 3 */
398 | *vertical-align: middle; /* 3 */
399 | }
400 |
401 | /*
402 | * Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet
403 | */
404 |
405 | button,
406 | input {
407 | line-height: normal; /* 1 */
408 | }
409 |
410 | /*
411 | * 1. Improves usability and consistency of cursor style between image-type 'input' and others
412 | * 2. Corrects inability to style clickable 'input' types in iOS
413 | * 3. Removes inner spacing in IE7 without affecting normal text inputs
414 | * Known issue: inner spacing remains in IE6
415 | */
416 |
417 | button,
418 | input[type="button"],
419 | input[type="reset"],
420 | input[type="submit"] {
421 | cursor: pointer; /* 1 */
422 | -webkit-appearance: button; /* 2 */
423 | *overflow: visible; /* 3 */
424 | }
425 |
426 | /*
427 | * Re-set default cursor for disabled elements
428 | */
429 |
430 | button[disabled],
431 | input[disabled] {
432 | cursor: default;
433 | }
434 |
435 | /*
436 | * 1. Addresses box sizing set to content-box in IE8/9
437 | * 2. Removes excess padding in IE8/9
438 | * 3. Removes excess padding in IE7
439 | Known issue: excess padding remains in IE6
440 | */
441 |
442 | input[type="checkbox"],
443 | input[type="radio"] {
444 | box-sizing: border-box; /* 1 */
445 | padding: 0; /* 2 */
446 | *height: 13px; /* 3 */
447 | *width: 13px; /* 3 */
448 | }
449 |
450 | /*
451 | * 1. Addresses appearance set to searchfield in S5, Chrome
452 | * 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof)
453 | */
454 |
455 | input[type="search"] {
456 | -webkit-appearance: textfield; /* 1 */
457 | -moz-box-sizing: content-box;
458 | -webkit-box-sizing: content-box; /* 2 */
459 | box-sizing: content-box;
460 | }
461 |
462 | /*
463 | * Removes inner padding and search cancel button in S5, Chrome on OS X
464 | */
465 |
466 | input[type="search"]::-webkit-search-decoration,
467 | input[type="search"]::-webkit-search-cancel-button {
468 | -webkit-appearance: none;
469 | }
470 |
471 | /*
472 | * Removes inner padding and border in FF3+
473 | * www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/
474 | */
475 |
476 | button::-moz-focus-inner,
477 | input::-moz-focus-inner {
478 | border: 0;
479 | padding: 0;
480 | }
481 |
482 | /*
483 | * 1. Removes default vertical scrollbar in IE6/7/8/9
484 | * 2. Improves readability and alignment in all browsers
485 | */
486 |
487 | textarea {
488 | overflow: auto; /* 1 */
489 | vertical-align: top; /* 2 */
490 | }
491 |
492 |
493 | /* =============================================================================
494 | Tables
495 | ========================================================================== */
496 |
497 | /*
498 | * Remove most spacing between table cells
499 | */
500 |
501 | table {
502 | border-collapse: collapse;
503 | border-spacing: 0;
504 | }
--------------------------------------------------------------------------------
/css/reset.css:
--------------------------------------------------------------------------------
1 | /* http://meyerweb.com/eric/tools/css/reset/
2 | v2.0 | 20110126
3 | License: none (public domain)
4 | */
5 |
6 | html, body, div, span, applet, object, iframe,
7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8 | a, abbr, acronym, address, big, cite, code,
9 | del, dfn, em, img, ins, kbd, q, s, samp,
10 | small, strike, strong, sub, sup, tt, var,
11 | b, u, i, center,
12 | dl, dt, dd, ol, ul, li,
13 | fieldset, form, label, legend,
14 | table, caption, tbody, tfoot, thead, tr, th, td,
15 | article, aside, canvas, details, embed,
16 | figure, figcaption, footer, header, hgroup,
17 | menu, nav, output, ruby, section, summary,
18 | time, mark, audio, video {
19 | margin: 0;
20 | padding: 0;
21 | border: 0;
22 | font-size: 100%;
23 | font: inherit;
24 | vertical-align: baseline;
25 | }
26 | /* HTML5 display-role reset for older browsers */
27 | article, aside, details, figcaption, figure,
28 | footer, header, hgroup, menu, nav, section {
29 | display: block;
30 | }
31 | body {
32 | line-height: 1;
33 | }
34 | ol, ul {
35 | list-style: none;
36 | }
37 | blockquote, q {
38 | quotes: none;
39 | }
40 | blockquote:before, blockquote:after,
41 | q:before, q:after {
42 | content: '';
43 | content: none;
44 | }
45 | table {
46 | border-collapse: collapse;
47 | border-spacing: 0;
48 | }
--------------------------------------------------------------------------------
/images/1license.txt:
--------------------------------------------------------------------------------
1 | The icons are free for personal use and also free for commercial use, but we require linking to our web site.
2 |
3 | http://creativecommons.org/licenses/by-sa/3.0/
4 |
5 | You are free:
6 | * to Share � to copy, distribute and transmit the work
7 |
8 | Under the following conditions:
9 | Attribution � You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
10 |
11 | Attribute this work:
12 | What does "Attribute this work" mean?
13 | The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. Doing so will also include metadata on your page so that others can find the original work as well.
14 | Share Alike � If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license.
15 |
16 | led24.de
17 | 31/05/2009
--------------------------------------------------------------------------------
/images/award_star_gold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukas-vlcek/bigdesk/0199ef5b249e48817c87c7ad33cc7bd04c3334b6/images/award_star_gold.png
--------------------------------------------------------------------------------
/images/es-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukas-vlcek/bigdesk/0199ef5b249e48817c87c7ad33cc7bd04c3334b6/images/es-logo.png
--------------------------------------------------------------------------------
/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukas-vlcek/bigdesk/0199ef5b249e48817c87c7ad33cc7bd04c3334b6/images/favicon.png
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Bigdesk
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/js/bigdeskApp.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // bigdesk store keeps track of state of clusters
18 | var bigdeskStore = new BigdeskStore();
19 |
20 | // declare views
21 | var nodesView = {
22 |
23 | clusterHealthView: undefined,
24 | clusterNodesListView: undefined,
25 |
26 | render: function(cluster) {
27 |
28 | var nodesViewTemplate = Mustache.render(templates.nodesViewTemplate, {});
29 | $("#selectedViewDetail").empty().append(nodesViewTemplate);
30 |
31 | this.clusterHealthView = new ClusterHealthView({el: $("#clusterHealth"), model: cluster});
32 | this.clusterHealthView.render();
33 |
34 | this.clusterNodesListView = new ClusterNodesListView({el: $("#clusterNodes"), model: cluster});
35 | this.clusterNodesListView.render();
36 | },
37 |
38 | showNodeDetail: function(cluster, nodeId) {
39 | if (this.clusterNodesListView == undefined) {
40 | this.clusterNodesListView = new ClusterNodesListView({el: $("#clusterNodes"), model: cluster});
41 | this.clusterNodesListView.render();
42 | }
43 | this.clusterNodesListView.showNodeDetail(nodeId);
44 | },
45 |
46 | clear: function() {
47 | if (this.clusterHealthView != undefined) {
48 | this.clusterHealthView.clear();
49 | }
50 | if (this.clusterNodesListView != undefined) {
51 | this.clusterNodesListView.clear();
52 | this.clusterNodesListView.undelegateEvents();
53 | }
54 | }
55 | };
56 |
57 | var clusterView = {
58 |
59 | clusterHealthView: undefined,
60 | clusterStateView: undefined,
61 |
62 | render: function(cluster) {
63 |
64 | var clusterViewTemplate = Mustache.render(templates.clusterViewTemplate, {});
65 | $("#selectedViewDetail").empty().append(clusterViewTemplate);
66 |
67 | this.clusterHealthView = new ClusterHealthView({el: $("#clusterHealth"), model: cluster});
68 | this.clusterHealthView.render();
69 |
70 | this.clusterStateView = new ClusterStateView({el: $("#clusterChart"), model: cluster});
71 | // this.clusterStateView.render();
72 | },
73 |
74 | clear: function() {
75 | if (this.clusterHealthView != undefined) {
76 | this.clusterHealthView.clear();
77 | }
78 | if (this.clusterStateView != undefined) {
79 | this.clusterStateView.clear();
80 | }
81 | }
82 | };
83 |
84 | var selectedView = undefined;
85 |
86 | var selectedClusterName = undefined;
87 |
88 | var connectTo = function(url, refreshInterval, storeSize, dispatcher, selectedView, callback) {
89 |
90 | var connectionConfig = { baseUrl: url };
91 | var clusterHealth = new ClusterHealth({},connectionConfig);
92 |
93 | clusterHealth.fetch({
94 |
95 | success: function(model, response) {
96 |
97 | var clusterName = model.get("cluster_name");
98 | var cluster = bigdeskStore.getCluster(clusterName);
99 |
100 | selectedClusterName = clusterName;
101 |
102 | if (cluster == undefined) {
103 |
104 | console.log("Found a new cluster [" + clusterName + "]");
105 |
106 | bigdeskStore.addCluster(
107 |
108 | // Keep in mind 'new Cluster()' is a heavy operation
109 | // because it performs several AJAX calls.
110 | new Cluster({
111 | id: clusterName,
112 | baseUrl: connectionConfig.baseUrl,
113 | storeSize: storeSize,
114 | refreshInterval: refreshInterval,
115 | dispatcher: dispatcher
116 | })
117 | );
118 |
119 | // get cluster reference so that it can be used in view later...
120 | cluster = bigdeskStore.getCluster(clusterName);
121 | selectedView.render(cluster);
122 |
123 | } else {
124 |
125 | console.log("Cluster [" + clusterName + "] found in store");
126 |
127 | cluster.setStoreSize(storeSize);
128 |
129 | // init view first, then fetch the update!
130 | selectedView.render(cluster);
131 | cluster.startFetch(refreshInterval, connectionConfig.baseUrl);
132 | }
133 | if (callback) {
134 | callback();
135 | }
136 | },
137 |
138 | error: function(model, response) { /* can not handle in JSONP */ }
139 |
140 | });
141 | };
142 |
143 | var disconnectFrom = function(url, callback) {
144 |
145 | var disconnectFromCluster = function(cluster) {
146 | cluster.clearIntervals();
147 | cluster.clearTimeouts();
148 | selectedView.clear();
149 | };
150 |
151 | // Iterate through all clusters having baseUrl == url and disconnect from them.
152 | var disconnectFromURL = function(url) {
153 | _.each(bigdeskStore.get("cluster")
154 | .filter(function(cluster){
155 | return cluster.get("health").get("baseUrl") == url;
156 | }),
157 | function(cluster){
158 | console.log("Disconnecting from ["+cluster.id+"]");
159 | disconnectFromCluster(cluster);
160 | });
161 | if (callback) {
162 | callback();
163 | }
164 | };
165 |
166 | disconnectFromURL(url);
167 | };
168 |
169 | var changeRefreshInterval = function(url, newRefreshInterval) {
170 |
171 | var connectionConfig = { baseUrl: url };
172 | var clusterHealth = new ClusterHealth({},connectionConfig);
173 |
174 | // we need to do the health.fetch to get cluster name.
175 | clusterHealth.fetch({
176 |
177 | success: function(model, response) {
178 | var clusterName = model.get("cluster_name");
179 | var cluster = bigdeskStore.getCluster(clusterName);
180 | if (cluster) {
181 | // we do not want to change URL just refresh interval
182 | cluster.startFetch(newRefreshInterval/*, connectionConfig.baseUrl*/);
183 | }
184 | },
185 |
186 | error: function(model, response) { /* can not handle in JSONP */ }
187 |
188 | });
189 | };
190 |
191 | var changeStoreSize = function(url, newStoreSize) {
192 |
193 | var connectionConfig = { baseUrl: url };
194 | var clusterHealth = new ClusterHealth({},connectionConfig);
195 |
196 | // we need to do the health.fetch to get cluster name.
197 | clusterHealth.fetch({
198 |
199 | success: function(model, response) {
200 | var clusterName = model.get("cluster_name");
201 | var cluster = bigdeskStore.getCluster(clusterName);
202 | if (cluster) {
203 | cluster.setStoreSize(newStoreSize);
204 | }
205 | },
206 |
207 | error: function(model, response) { /* can not handle in JSONP */ }
208 |
209 | });
210 | };
211 |
212 | $(document).ready(
213 | function($) {
214 |
215 | var restEndPoint = $("#restEndPoint"),
216 | refreshInterval = $("#refreshInterval"),
217 | storeSize = $("#storeSize"),
218 | button = $("#connectButton"),
219 | ajaxIndicator = $("#ajaxIndicator");
220 |
221 | var isConnected = function() {
222 | return (button.val() !== "Connect");
223 | };
224 |
225 | var getRefreshInterval = function() {
226 | return refreshInterval.find(":selected").val();
227 | };
228 |
229 | var getStoreSize = function() {
230 | return storeSize.find(":selected").val();
231 | };
232 |
233 | var switchButtonText = function() {
234 | if (isConnected()) {
235 | button.val("Connect");
236 | restEndPoint.removeAttr('disabled');
237 | } else {
238 | button.val("Disconnect");
239 | restEndPoint.attr('disabled','disabled');
240 | }
241 | };
242 |
243 | refreshInterval.change(function(){
244 | if (isConnected()) {
245 | changeRefreshInterval(restEndPoint.val(), getRefreshInterval());
246 | }
247 | });
248 |
249 | storeSize.change(function(){
250 | if (isConnected()) {
251 | changeStoreSize(restEndPoint.val(), getStoreSize());
252 | }
253 | });
254 |
255 | var ajaxResponseCallback = function(clusterName, restApiName, response) {
256 | // console.log("["+clusterName+"] ["+restApiName+"]", response);
257 | // var iterator = function(nodeStats) {return nodeStats.id; };
258 | // if (restApiName == "cluster > NodesStats") {
259 | // console.log(response);
260 | // var nodesCollection = this.get("nodesStats");
261 | // console.log("collection length",nodesCollection.length);
262 | // console.log("collection max",nodesCollection.max(iterator).id);
263 | // console.log("collection min",nodesCollection.min(iterator).id);
264 | // }
265 | ajaxIndicator.show().css("background-color", "lightgreen").fadeOut("slow");
266 | };
267 |
268 | var newDataCallback = function(description, data) {
269 | // console.log(description, data);
270 | };
271 |
272 | var bigdeskEventDispatcher = _.clone(Backbone.Events);
273 | bigdeskEventDispatcher.on("onAjaxResponse", ajaxResponseCallback);
274 | bigdeskEventDispatcher.on("onNewData", newDataCallback);
275 |
276 | button.click(function(){
277 | if (isConnected()) {
278 | disconnectFrom(restEndPoint.val(), switchButtonText);
279 | } else {
280 | connectTo(restEndPoint.val(), getRefreshInterval(), getStoreSize(), bigdeskEventDispatcher, selectedView, switchButtonText);
281 | }
282 | });
283 |
284 | restEndPoint.bind("keypress",function(event){
285 | if (typeof event == 'undefined' && window.event) { event = window.event; }
286 | if(event.keyCode == 13){
287 | if (event.cancelable && event.preventDefault) {
288 | event.preventDefault();
289 | button.click();
290 | } else {
291 | button.click();
292 | }
293 | return false;
294 | }
295 | return true;
296 | });
297 |
298 | var getSearchUrlVar = function(key) {
299 | var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
300 | return decodeURIComponent(result && result[1] || "");
301 | };
302 |
303 | var parseUrlParams = function() {
304 | return {
305 | endpoint: getSearchUrlVar("endpoint") || "http://localhost:9200",
306 | refresh: getSearchUrlVar("refresh") || 2000,
307 | history: getSearchUrlVar("history") || 300000,
308 | connect: getSearchUrlVar("connect") || false
309 | }
310 | };
311 |
312 | // If any URL params are found (i.e. they are provided by the user)
313 | // then they are applied/set into appropriate form fields.
314 | var applyUrlParams = function() {
315 |
316 | var params = parseUrlParams();
317 |
318 | // assume this is a plugin running in ES node
319 | if (window.location.href.indexOf("/_plugin/") != -1) {
320 | // if "endpoint" or "connect" values provided as an URL parameter, do not change them
321 | if (!getSearchUrlVar("endpoint")) {
322 | params.endpoint = window.location.protocol + "//" + window.location.host;
323 | var index = window.location.pathname.indexOf("/_plugin");
324 | if (index > 0){
325 | params.endpoint += window.location.pathname.substr(0, index);
326 | }
327 | }
328 | if (!getSearchUrlVar("connect")) {
329 | params.connect = true;
330 | }
331 | }
332 |
333 | restEndPoint.val(params.endpoint);
334 | refreshInterval.val(params.refresh);
335 | storeSize.val(params.history);
336 | return params;
337 | };
338 |
339 | var applyUrlParamsCalled = false;
340 |
341 | var BigdeskRouter = Backbone.Router.extend({
342 |
343 | routes: {
344 | "nodes" : "nodes",
345 | "nodes/master" : "nodes_master",
346 | "nodes/:nodeId" : "nodes",
347 | "cluster" : "cluster",
348 | "*other" : "defaultRoute"
349 | },
350 |
351 | cluster: function() {
352 | // console.log("change route: cluster");
353 | if (selectedView && _.isFunction(selectedView.clear)) {
354 | selectedView.clear();
355 | }
356 | selectedView = clusterView;
357 | if (!isConnected() && !applyUrlParamsCalled) {
358 | var params = applyUrlParams();
359 | applyUrlParamsCalled = true;
360 | if (params.connect == true || params.connect == "true") {
361 | button.click();
362 | }
363 | } else {
364 | selectedView.render(
365 | bigdeskStore.getCluster(selectedClusterName)
366 | )
367 | }
368 | },
369 |
370 | nodes_master: function() {
371 | // console.log("try to connect to the master node");
372 | var masterNodeId = "";
373 | if (!isConnected() && !applyUrlParamsCalled) {
374 | // we are not connected and master node id is not known yet
375 | } else {
376 | masterNodeId = "/" + bigdeskStore.getCluster(selectedClusterName).getMasterNodeId();
377 | }
378 |
379 | this.navigate("nodes" + masterNodeId, {trigger: true, replace: true});
380 | },
381 |
382 | nodes: function(nodeId) {
383 | // console.log("change route: nodes("+(nodeId||"")+")");
384 | if (selectedView && _.isFunction(selectedView.clear)) {
385 | selectedView.clear();
386 | }
387 | selectedView = nodesView;
388 | if (!isConnected() && !applyUrlParamsCalled) {
389 | if (nodeId) {
390 | // If not connected yet but nodeId is provided, then redirect to "nodes" route
391 | // i.e. remove the nodeId form the URL fragment.
392 | this.navigate("nodes", {trigger: true, replace: true});
393 | return;
394 | }
395 | var params = applyUrlParams();
396 | applyUrlParamsCalled = true;
397 | if (params.connect == true || params.connect == "true") {
398 | button.click();
399 | }
400 | } else {
401 | selectedView.render(
402 | bigdeskStore.getCluster(selectedClusterName)
403 | );
404 | if (nodeId) {
405 | selectedView.showNodeDetail(bigdeskStore.getCluster(selectedClusterName), nodeId);
406 | }
407 | }
408 | },
409 |
410 | defaultRoute: function(other) {
411 | this.navigate("nodes", {trigger: true, replace: true});
412 | }
413 |
414 | });
415 |
416 | new BigdeskRouter();
417 |
418 | Backbone.history.start();
419 |
420 | }
421 | );
422 |
--------------------------------------------------------------------------------
/js/charts/common.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2012 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | .chart_box {
18 | fill: none;
19 | /*stroke: #999;*/
20 | stroke: none;
21 | }
22 |
23 | .plot_box {
24 | fill: none;
25 | stroke-width: 0.1;
26 | /*stroke: #444;*/
27 | stroke: none;
28 | }
29 |
30 | .area {
31 | fill: #969696;
32 | }
33 |
34 | .tick {
35 | stroke: #000;
36 | stroke-width: 0.6;
37 | }
38 |
39 | .domain {
40 | fill: none;
41 | stroke: #000;
42 | stroke-width: 0.6;
43 | /*shape-rendering: crispEdges;*/ /* does not look good on FF and Chrome */
44 | }
45 |
46 | .axis {
47 | font-size: 70%;
48 | font-family: Verdana;
49 | }
50 |
51 | .circle_line1 {
52 | stroke: #44c;
53 | stroke-width: 0.7;
54 | fill: white;
55 | }
56 |
57 | .circle_line2 {
58 | stroke: #c77;
59 | stroke-width: 0.7;
60 | fill: white;
61 | }
62 |
63 | .circle_line3 {
64 | stroke: #7c9;
65 | stroke-width: 0.7;
66 | fill: white;
67 | }
68 |
69 | .legend_background {
70 | stroke: #ccc;
71 | stroke-width: 0.7;
72 | fill: white;
73 | opacity: 0.7;
74 | }
75 |
76 | .legend_text {
77 | fill: #555;
78 | }
79 |
80 | .legend_caption {
81 | fill: black;
82 | font-size: 14px;
83 | font-weight: bolder;
84 | font-family: serif;
85 | }
86 |
87 | .legend_circle_line1 {
88 | stroke: #44c;
89 | stroke-width: 1.5;
90 | fill: white;
91 | }
92 |
93 | .legend_circle_line2 {
94 | stroke: #c77;
95 | stroke-width: 1.5;
96 | fill: white;
97 | }
98 |
99 | .legend_circle_line3 {
100 | stroke: #7c9;
101 | stroke-width: 1.5;
102 | fill: white;
103 | }
104 |
--------------------------------------------------------------------------------
/js/charts/not-available/not-available-chart.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2012 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | .na_chart_box {
18 | fill: #ddd;
19 | /*stroke: #aaa;*/
20 | stroke: none;
21 | }
22 |
23 | .na_chart_text {
24 | fill: #888;
25 | }
26 |
--------------------------------------------------------------------------------
/js/charts/not-available/not-available-chart.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | function chartNotAvailable() {
18 |
19 | var svg = undefined,
20 | width = undefined,
21 | height = undefined;
22 |
23 | function chart() {};
24 |
25 | chart.show = function() {
26 |
27 | if (!svg || svg.length == 0) throw "svg element must be set";
28 |
29 | var clip_id = svg.attr("clip_id");
30 | if (!clip_id || clip_id.length == 0) {
31 | throw "svg element must have 'clip_id' attribute";
32 | }
33 |
34 | svg.append("rect")
35 | .attr("width", width)
36 | .attr("height",height)
37 | .attr("class","na_chart_box");
38 |
39 | svg.append("text")
40 | .text("Chart not available")
41 | .attr("transform","translate("+((width/2)-70)+","+(height/2)+")")
42 | .attr("class","na_chart_text");
43 |
44 | return chart;
45 | };
46 |
47 | chart.width = function(_) {
48 | if (!arguments.length) return width;
49 | width = _;
50 | return chart;
51 | };
52 |
53 | chart.height = function(_) {
54 | if (!arguments.length) return height;
55 | height = _;
56 | return chart;
57 | };
58 |
59 | chart.svg = function(_) {
60 | if (!arguments.length) return svg;
61 | svg = _;
62 | return chart;
63 | };
64 |
65 | return chart;
66 | }
67 |
--------------------------------------------------------------------------------
/js/charts/not-available/test-not-available-chart.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | Test of not-available-chart
6 |
7 |
8 |
9 |
10 |
11 |
12 |
19 |
20 |
21 |
22 |
23 |
24 | Chart not available.
25 |
26 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/js/charts/pack/pack.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2012 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | circle {
18 | /*fill: rgb(31, 119, 180);*/
19 | /*fill-opacity: .25;*/
20 | stroke: rgb(31, 119, 180);
21 | stroke-width: 1px;
22 | }
23 |
24 | circle:hover {
25 | stroke-width: 3px;
26 | cursor: pointer;
27 | }
28 |
29 | .leaf circle {
30 | fill: #ff7f0e;
31 | fill-opacity: 0.5;
32 | }
33 |
34 | .leaf.primary circle {
35 | fill: #ff7f0e;
36 | fill-opacity: 1;
37 | }
38 |
39 | .node {
40 | fill: rgb(31, 119, 180);
41 | fill-opacity: .25;
42 | }
43 |
44 | .master.node {
45 | fill-opacity: .45;
46 | }
47 |
48 | text {
49 | font: 10px sans-serif;
50 | fill: rgb(10, 10, 10);
51 | fill-opacity: 1;
52 | }
53 |
54 | /*text:hover {*/
55 | /*font: 10px sans-serif;*/
56 | /*cursor: pointer;*/
57 | /*}*/
58 |
--------------------------------------------------------------------------------
/js/charts/time-area/test-time-area-chart.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | Test of time-area-chart
6 |
7 |
8 |
9 |
10 |
11 |
12 |
19 |
20 |
21 |
22 |
23 |
24 | Click at least 3 times:
25 | animated
26 |
27 | Chart holds series up to 20 data points.
28 |
29 |
30 | Click at least 3 times:
31 | animated
32 |
33 | Chart holds series up to 20 data points.
34 |
35 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/js/charts/time-area/time-area-chart.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2012 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | .area1 {
18 | fill: #88d;
19 | }
20 |
21 | .area2 {
22 | fill: #daa;
23 | }
24 |
25 | .area3 {
26 | fill: #deb;
27 | }
28 |
29 | .line1 {
30 | fill: none;
31 | stroke: #44c;
32 | stroke-width: 1;
33 | }
34 |
35 | .line2 {
36 | fill: none;
37 | stroke: #c77;
38 | stroke-width: 1;
39 | }
40 |
41 | .line3 {
42 | fill: none;
43 | /*stroke: #c77;*/
44 | /*stroke-width: 1;*/
45 | }
46 |
--------------------------------------------------------------------------------
/js/charts/time-area/time-area-chart.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | function timeAreaChart() {
18 |
19 | var width = 330,
20 | height = 150,
21 | margin = { top: 17, right: 40, bottom :30, left: 7, axes: 0 },
22 | legend = { caption: "Time area", series1: "series1", series2: "series2", width: 110 },
23 | svg = undefined,
24 | initialized = false,
25 | animate = true,
26 |
27 | time_scale = undefined,
28 | time_scale_axis = undefined,
29 | value_scale = undefined,
30 |
31 | xAxis = undefined,
32 | yAxis = undefined,
33 |
34 | line = undefined,
35 | path1 = undefined,
36 | path2 = undefined,
37 | path3 = undefined,
38 |
39 | area = undefined,
40 | area1 = undefined,
41 | area2 = undefined,
42 | area3 = undefined;
43 |
44 | function chart() {};
45 |
46 | function init() {
47 |
48 | if (!svg || svg.length == 0) throw "svg element must be set";
49 |
50 | var clip_id = svg.attr("clip_id");
51 | if (!clip_id || clip_id.length == 0) {
52 | throw "svg element must have 'clip_id' attribute";
53 | }
54 |
55 | time_scale = d3.time.scale()
56 | .range([0 + margin.left, width - margin.right]);
57 |
58 | time_scale_axis = d3.time.scale()
59 | .range([0 + margin.left, width - margin.right]);
60 |
61 | value_scale = d3.scale.linear()
62 | .range([height - margin.bottom, 0 + margin.top]);
63 |
64 | xAxis = d3.svg.axis().scale(time_scale_axis).orient("bottom").ticks(4).tickSize(6,3,0).tickSubdivide(true);
65 | yAxis = d3.svg.axis().scale(value_scale).orient("right").ticks(4).tickFormat(d3.format("s"));
66 |
67 | line = d3.svg.line()
68 | // .interpolate("monotone")
69 | .x(function(d){return time_scale( new Date(d.timestamp));})
70 | .y(function(d){return value_scale(d.value);});
71 |
72 | area = d3.svg.area()
73 | // .interpolate("monotone")
74 | .x(function(d) { return time_scale( new Date(d.timestamp)); })
75 | .y0(height)
76 | .y1(function(d) { return value_scale(d.value); });
77 |
78 | // chart box
79 | svg.append("rect")
80 | .attr("width", width)
81 | .attr("height",height)
82 | .attr("class","chart_box");
83 |
84 | // plot box
85 | svg.append("rect")
86 | .attr("x", margin.left)
87 | .attr("y", margin.top)
88 | .attr("width", width - margin.left - margin.right)
89 | .attr("height",height - margin.top - margin.bottom)
90 | .attr("class","plot_box");
91 |
92 | svg.append("defs").append("clipPath")
93 | .attr("id", clip_id)
94 | .append("rect")
95 | .attr("x", margin.left)
96 | .attr("y", margin.top)
97 | .attr("width", width - margin.left - margin.right)
98 | .attr("height",height - margin.top - margin.bottom);
99 |
100 | // areas and paths
101 | area3 = svg.append("g")
102 | .attr("clip-path", "url(#"+clip_id+")")
103 | .append("path");
104 |
105 | path3 = svg.append("g")
106 | .attr("clip-path", "url(#"+clip_id+")")
107 | .append("path");
108 |
109 | area2 = svg.append("g")
110 | .attr("clip-path", "url(#"+clip_id+")")
111 | .append("path");
112 |
113 | path2 = svg.append("g")
114 | .attr("clip-path", "url(#"+clip_id+")")
115 | .append("path");
116 |
117 | area1 = svg.append("g")
118 | .attr("clip-path", "url(#"+clip_id+")")
119 | .append("path");
120 |
121 | path1 = svg.append("g")
122 | .attr("clip-path", "url(#"+clip_id+")")
123 | .append("path");
124 |
125 | // axes
126 | svg.append("svg:g")
127 | .attr("class", "axis x")
128 | .attr("transform","translate(0,"+ (height - margin.bottom + margin.axes) +")")
129 | .call(xAxis);
130 |
131 | svg.append("svg:g")
132 | .attr("class", "axis y")
133 | .attr("transform","translate("+ (width - margin.right + margin.axes) +",0)")
134 | .call(yAxis);
135 |
136 | // legend
137 | var legendSize = { width: legend.width, height: 31 };
138 |
139 | var legendSvg = svg.append("svg:g");
140 |
141 | legendSvg.append("rect")
142 | .attr("width", legendSize.width)
143 | .attr("height", legendSize.height)
144 | .attr("rx", 2)
145 | .attr("ry", 2)
146 | .attr("class","legend_background");
147 |
148 | legendSvg.attr("transform","translate("+(margin.left + legend.margin_left)+","+(height -margin.bottom - legendSize.height - legend.margin_bottom)+")");
149 |
150 | var legend1 = legendSvg.append("text").text(legend.series1).attr("class","legend_text");
151 | var legend2 = legendSvg.append("text").text(legend.series2).attr("class","legend_text");
152 |
153 | legend1.attr("font-size", 10)
154 | .attr("font-family", "Verdana")
155 | .attr("transform","translate("+20+","+(legendSize.height - 5)+")");
156 |
157 | legend2.attr("font-size", 10)
158 | .attr("font-family", "Verdana")
159 | .attr("transform","translate("+20+","+(legendSize.height - 5 - 14)+")");
160 |
161 | legendSvg.append("circle")
162 | .attr("r", 3)
163 | .attr("class", "legend_circle_line1")
164 | .attr("transform","translate("+10+","+(legendSize.height - 8)+")");
165 |
166 | legendSvg.append("circle")
167 | .attr("r", 3)
168 | .attr("class", "legend_circle_line2")
169 | .attr("transform","translate("+10+","+(legendSize.height - 8 - 14)+")");
170 |
171 | // caption
172 | if (legend.caption && legend.caption.length > 0) {
173 |
174 | var captionSvg = svg.append("g");
175 | captionSvg.append("text").text(legend.caption).attr("class","legend_caption");
176 | captionSvg.attr("transform", "translate("+margin.left+",11)");
177 |
178 | }
179 |
180 | initialized = true;
181 |
182 | };
183 |
184 | // data1 and data2 are mandatory
185 | // data3 is optional
186 | chart.update = function(data1, data2, data3) {
187 |
188 | if (!initialized) init();
189 |
190 | if (data3 && data3.length > 0) {
191 | // we assume data3 (if present) is always max
192 | value_scale.domain([0,d3.max(data3, function(d){return d.value})]).nice();
193 | } else {
194 | value_scale.domain([0,
195 | d3.max([
196 | d3.max(data1, function(d){return d.value}),
197 | d3.max(data2, function(d){return d.value})
198 | ])
199 | ]).nice();
200 | }
201 |
202 | if (data1.length > 2)
203 | time_scale_axis.domain([
204 | data1[1].timestamp,
205 | data1[data1.length-1].timestamp
206 | ]);
207 |
208 | if (!animate) {
209 | if (data1.length > 2)
210 | time_scale.domain([
211 | data1[1].timestamp,
212 | data1[data1.length-1].timestamp
213 | ]);
214 | }
215 |
216 | area1.data(data1)
217 | .attr("class", "area1")
218 | .attr("d", area(data1));
219 |
220 | path1.data(data1)
221 | .attr("class", "line1")
222 | .attr("d", line(data1));
223 |
224 | area2.data(data2)
225 | .attr("class", "area2")
226 | .attr("d", area(data2));
227 |
228 | path2.data(data2)
229 | .attr("class", "line2")
230 | .attr("d", line(data2));
231 |
232 | if (data3 && data3.length > 0) {
233 | area3.data(data3)
234 | .attr("class", "area3")
235 | .attr("d", area(data3));
236 |
237 | path3.data(data3)
238 | .attr("class", "line3")
239 | .attr("d", line(data3));
240 | }
241 |
242 | if (animate) {
243 | if (data1.length > 2)
244 | time_scale.domain([
245 | data1[1].timestamp,
246 | data1[data1.length-1].timestamp
247 | ]);
248 | }
249 |
250 | if (animate) {
251 | var t = svg.transition()
252 | .duration(250)
253 | .ease("linear");
254 |
255 | t.select(".x.axis").call(xAxis);
256 | t.select(".y.axis").call(yAxis);
257 |
258 | t.select(".area1").attr("d", area(data1));
259 | t.select(".area2").attr("d", area(data2));
260 | if (data3 && data3.length > 0) {
261 | t.select(".area3").attr("d", area(data3));
262 | }
263 | } else {
264 | svg.select(".x.axis").call(xAxis);
265 | svg.select(".y.axis").call(yAxis);
266 | }
267 |
268 | if (animate) {
269 | path1
270 | .transition().duration(250).ease("linear")
271 | .attr("d", line(data1));
272 |
273 | } else {
274 | path1
275 | .attr("d", line(data1));
276 | }
277 |
278 | if (animate) {
279 | path2
280 | .transition().duration(250).ease("linear")
281 | .attr("d", line(data2));
282 | } else {
283 | path2
284 | .attr("d", line(data2));
285 | }
286 |
287 | if (data3 && data3.length > 0) {
288 | if (animate) {
289 | path3
290 | .transition().duration(250).ease("linear")
291 | .attr("d", line(data3));
292 | } else {
293 | path3
294 | .attr("d", line(data3));
295 | }
296 | }
297 |
298 | };
299 |
300 | chart.width = function(_) {
301 | if (!arguments.length) return width;
302 | width = _;
303 | return chart;
304 | };
305 |
306 | chart.height = function(_) {
307 | if (!arguments.length) return height;
308 | height = _;
309 | return chart;
310 | };
311 |
312 | chart.svg = function(_) {
313 | if (!arguments.length) return svg;
314 | svg = _;
315 | return chart;
316 | };
317 |
318 | chart.legend = function(_) {
319 | if (!arguments.length) return legend;
320 | legend = _;
321 | return chart;
322 | };
323 |
324 | chart.animate = function(_) {
325 | if (!arguments.length) return animate;
326 | animate = _;
327 | return chart;
328 | }
329 |
330 | return chart;
331 | }
332 |
333 |
334 |
--------------------------------------------------------------------------------
/js/charts/time-series/test-time-series-chart.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | Test of time-series-chart
6 |
7 |
8 |
9 |
10 |
11 |
12 |
19 |
20 |
21 |
22 |
23 |
24 | Click at least 3 times:
25 | animated
26 |
27 | Chart holds series up to 20 data points.
28 |
29 |
30 | Click at least 3 times:
31 | animated
32 |
33 | Chart holds series up to 20 data points.
34 |
35 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/js/charts/time-series/time-series-chart.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2012 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | .line1 {
18 | fill: none;
19 | stroke: #44c;
20 | stroke-width: 1;
21 | }
22 |
23 | .line2 {
24 | fill: none;
25 | stroke: #c77;
26 | stroke-width: 1;
27 | }
28 |
29 | .line3 {
30 | fill: none;
31 | stroke: #7c9;
32 | stroke-width: 1;
33 | }
34 |
--------------------------------------------------------------------------------
/js/charts/time-series/time-series-chart.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | function timeSeriesChart() {
18 |
19 | var width = 330,
20 | height = 150,
21 | margin = { top: 17, right: 40, bottom :30, left: 7, axes: 0 },
22 | legend = { caption: "Time series", series1: "series1", series2: "series2", width: 110 },
23 | svg = undefined,
24 | initialized = false,
25 | animate = true,
26 |
27 | line = undefined,
28 | path1 = undefined,
29 | path2 = undefined,
30 | path3 = undefined,
31 |
32 | circlesContainer = undefined,
33 |
34 | time_scale = undefined,
35 | time_scale_axis = undefined,
36 | value_scale = undefined,
37 |
38 | xAxis = undefined,
39 | yAxis = undefined;
40 |
41 | function chart() {};
42 |
43 | function init(data1, data2, data3) {
44 |
45 | if (!svg || svg.length == 0) throw "svg element must be set";
46 |
47 | var clip_id = svg.attr("clip_id");
48 | if (!clip_id || clip_id.length == 0) {
49 | throw "svg element must have 'clip_id' attribute";
50 | }
51 |
52 | time_scale = d3.time.scale()
53 | .range([0 + margin.left, width - margin.right]);
54 |
55 | time_scale_axis = d3.time.scale()
56 | .range([0 + margin.left, width - margin.right]);
57 |
58 | value_scale = d3.scale.linear()
59 | .range([height - margin.bottom, 0 + margin.top]);
60 |
61 | xAxis = d3.svg.axis().scale(time_scale_axis).orient("bottom").ticks(4).tickSize(6,3,0).tickSubdivide(true);
62 | yAxis = d3.svg.axis().scale(value_scale).orient("right").ticks(4).tickFormat(d3.format("s"));
63 |
64 | line = d3.svg.line()
65 | // .interpolate("monotone")
66 | .x(function(d){return time_scale( new Date(d.timestamp));})
67 | .y(function(d){return value_scale(d.value);});
68 |
69 | // chart box
70 | svg.append("rect")
71 | .attr("width", width)
72 | .attr("height",height)
73 | .attr("class","chart_box");
74 |
75 | // plot box
76 | svg.append("rect")
77 | .attr("x", margin.left)
78 | .attr("y", margin.top)
79 | .attr("width", width - margin.left - margin.right)
80 | .attr("height",height - margin.top - margin.bottom)
81 | .attr("class","plot_box");
82 |
83 | svg.append("defs").append("clipPath")
84 | .attr("id", clip_id)
85 | .append("rect")
86 | .attr("x", margin.left)
87 | .attr("y", margin.top)
88 | .attr("width", width - margin.left - margin.right)
89 | .attr("height",height - margin.top - margin.bottom);
90 |
91 | // paths
92 | path1 = svg.append("g")
93 | .attr("clip-path", "url(#"+clip_id+")")
94 | .append("path");
95 |
96 | path2 = svg.append("g")
97 | .attr("clip-path", "url(#"+clip_id+")")
98 | .append("path");
99 |
100 | if (data3) {
101 | path3 = svg.append("g")
102 | .attr("clip-path", "url(#"+clip_id+")")
103 | .append("path");
104 | }
105 |
106 | circlesContainer = svg.append("g")
107 | .attr("clip-path", "url(#"+clip_id+")")
108 | .attr("id","circlesContainer");
109 |
110 | // axes
111 | svg.append("svg:g")
112 | .attr("class", "axis x")
113 | .attr("transform","translate(0,"+ (height - margin.bottom + margin.axes) +")")
114 | .call(xAxis);
115 |
116 | svg.append("svg:g")
117 | .attr("class", "axis y")
118 | .attr("transform","translate("+ (width - margin.right + margin.axes) +",0)")
119 | .call(yAxis);
120 |
121 | // legend
122 | var legendSize = { width: legend.width, height: (data3 ? 47 : 31)};
123 |
124 | var legendSvg = svg.append("svg:g");
125 |
126 | legendSvg.append("rect")
127 | .attr("width", legendSize.width)
128 | .attr("height", legendSize.height)
129 | .attr("rx", 2)
130 | .attr("ry", 2)
131 | .attr("class","legend_background");
132 |
133 | legendSvg.attr("transform","translate("+(margin.left + legend.margin_left)+","+(height -margin.bottom - legendSize.height - legend.margin_bottom)+")");
134 |
135 | var legend1 = legendSvg.append("text").text(legend.series1).attr("class","legend_text");
136 | var legend2 = legendSvg.append("text").text(legend.series2).attr("class","legend_text");
137 | var legend3 = legendSvg.append("text").text(legend.series3).attr("class","legend_text");
138 |
139 | legend1.attr("font-size", 10)
140 | .attr("font-family", "Verdana")
141 | .attr("transform","translate("+20+","+(legendSize.height - 5)+")");
142 |
143 | legend2.attr("font-size", 10)
144 | .attr("font-family", "Verdana")
145 | .attr("transform","translate("+20+","+(legendSize.height - 5 - 14)+")");
146 |
147 | legendSvg.append("circle")
148 | .attr("r", 3)
149 | .attr("class", "legend_circle_line1")
150 | .attr("transform","translate("+10+","+(legendSize.height - 8)+")");
151 |
152 | legendSvg.append("circle")
153 | .attr("r", 3)
154 | .attr("class", "legend_circle_line2")
155 | .attr("transform","translate("+10+","+(legendSize.height - 8 - 14)+")");
156 |
157 | if (data3) {
158 |
159 | legend3.attr("font-size", 10)
160 | .attr("font-family", "Verdana")
161 | .attr("transform","translate("+20+","+(legendSize.height - 5 - 14 - 14)+")");
162 |
163 | legendSvg.append("circle")
164 | .attr("r", 3)
165 | .attr("class", "legend_circle_line3")
166 | .attr("transform","translate("+10+","+(legendSize.height - 8 - 14 - 14)+")");
167 |
168 | }
169 |
170 | // caption
171 | if (legend.caption && legend.caption.length > 0) {
172 |
173 | var captionSvg = svg.append("g");
174 | captionSvg.append("text").text(legend.caption).attr("class","legend_caption");
175 | captionSvg.attr("transform", "translate("+margin.left+",11)");
176 |
177 | }
178 |
179 | initialized = true;
180 |
181 | };
182 |
183 | // data1 and data2 are mandatory
184 | // data3 is optional
185 | chart.update = function(data1, data2, data3) {
186 |
187 | if (!initialized) init(data1, data2, data3);
188 |
189 | var circles1 = circlesContainer.selectAll("circle.circle_line1")
190 | .data(data1, function(d){return d.timestamp});
191 |
192 | var circles2 = circlesContainer.selectAll("circle.circle_line2")
193 | .data(data2, function(d){return d.timestamp});
194 |
195 | circles1.enter()
196 | .append("circle")
197 | .attr("class","circle_line1")
198 | .attr("r", 1.5);
199 |
200 | circles2.enter()
201 | .append("circle")
202 | .attr("class","circle_line2")
203 | .attr("r", 1.5);
204 |
205 | var circles3 = undefined;
206 |
207 | if (data3) {
208 |
209 | circles3 = circlesContainer.selectAll("circle.circle_line3")
210 | .data(data3, function(d){return d.timestamp});
211 |
212 | circles3.enter()
213 | .append("circle")
214 | .attr("class","circle_line3")
215 | .attr("r", 1.5);
216 |
217 | }
218 |
219 | value_scale.domain([0,
220 | d3.max([
221 | d3.max(data1, function(d){return d.value}),
222 | d3.max(data2, function(d){return d.value}),
223 | d3.max(data3 ? data3 : [], function(d){return d.value})
224 | ])
225 | ]).nice();
226 |
227 | if (data1.length > 2)
228 | time_scale_axis.domain([
229 | data1[1].timestamp,
230 | data1[data1.length-1].timestamp
231 | ]);
232 |
233 | if (!animate) {
234 | if (data1.length > 2)
235 | time_scale.domain([
236 | data1[1].timestamp,
237 | data1[data1.length-1].timestamp
238 | ]);
239 | }
240 |
241 | circles1.attr("cx", function(d){return time_scale(new Date(d.timestamp))})
242 | .attr("cy", function(d){return value_scale(d.value)});
243 |
244 | circles2.attr("cx", function(d){return time_scale(new Date(d.timestamp))})
245 | .attr("cy", function(d){return value_scale(d.value)});
246 |
247 | if (animate) {
248 | circles1
249 | .transition().duration(250).ease("linear")
250 | .attr("cx", function(d){return time_scale(new Date(d.timestamp))})
251 | .attr("cy", function(d){return value_scale(d.value)});
252 | } else {
253 | circles1
254 | .attr("cx", function(d){return time_scale(new Date(d.timestamp))})
255 | .attr("cy", function(d){return value_scale(d.value)});
256 | }
257 |
258 | if (animate) {
259 | circles2
260 | .transition().duration(250).ease("linear")
261 | .attr("cx", function(d){return time_scale(new Date(d.timestamp))})
262 | .attr("cy", function(d){return value_scale(d.value)});
263 | } else {
264 | circles2
265 | .attr("cx", function(d){return time_scale(new Date(d.timestamp))})
266 | .attr("cy", function(d){return value_scale(d.value)});
267 | }
268 |
269 | path1.data(data1)
270 | .attr("class", "line1")
271 | .attr("d", line(data1));
272 |
273 | path2.data(data2)
274 | .attr("class", "line2")
275 | .attr("d", line(data2));
276 |
277 | if (data3) {
278 |
279 | circles3.attr("cx", function(d){return time_scale(new Date(d.timestamp))})
280 | .attr("cy", function(d){return value_scale(d.value)});
281 |
282 | if (animate) {
283 | circles3
284 | .transition().duration(250).ease("linear")
285 | .attr("cx", function(d){return time_scale(new Date(d.timestamp))})
286 | .attr("cy", function(d){return value_scale(d.value)});
287 | } else {
288 | circles3
289 | .attr("cx", function(d){return time_scale(new Date(d.timestamp))})
290 | .attr("cy", function(d){return value_scale(d.value)});
291 | }
292 |
293 | path3.data(data3)
294 | .attr("class", "line3")
295 | .attr("d", line(data3));
296 |
297 | }
298 |
299 | if (animate) {
300 | if (data1.length > 2)
301 | time_scale.domain([
302 | data1[1].timestamp,
303 | data1[data1.length-1].timestamp
304 | // new Date(d3.min(data1, function(d){return d.timestamp})),
305 | // new Date(d3.max(data1, function(d){return d.timestamp}))
306 | ]);
307 | }
308 |
309 | if (animate) {
310 | var t = svg.transition()
311 | .duration(250)
312 | .ease("linear");
313 |
314 | t.select(".x.axis").call(xAxis);
315 | t.select(".y.axis").call(yAxis);
316 | } else {
317 | svg.select(".x.axis").call(xAxis);
318 | svg.select(".y.axis").call(yAxis);
319 | }
320 |
321 | if (animate) {
322 | path1
323 | .transition().duration(250).ease("linear")
324 | .attr("d", line(data1));
325 | } else {
326 | path1
327 | .attr("d", line(data1));
328 | }
329 |
330 | if (animate) {
331 | path2
332 | .transition().duration(250).ease("linear")
333 | .attr("d", line(data2));
334 | } else {
335 | path2
336 | .attr("d", line(data2));
337 | }
338 |
339 | circles1.exit().remove();
340 | circles2.exit().remove();
341 |
342 | if (data3) {
343 |
344 | if (animate) {
345 | path3
346 | .transition().duration(250).ease("linear")
347 | .attr("d", line(data3));
348 | } else {
349 | path3
350 | .attr("d", line(data3));
351 | }
352 |
353 | circles3.exit().remove();
354 | }
355 |
356 | };
357 |
358 | chart.width = function(_) {
359 | if (!arguments.length) return width;
360 | width = _;
361 | return chart;
362 | };
363 |
364 | chart.height = function(_) {
365 | if (!arguments.length) return height;
366 | height = _;
367 | return chart;
368 | };
369 |
370 | chart.svg = function(_) {
371 | if (!arguments.length) return svg;
372 | svg = _;
373 | return chart;
374 | };
375 |
376 | chart.legend = function(_) {
377 | if (!arguments.length) return legend;
378 | legend = _;
379 | return chart;
380 | };
381 |
382 | chart.animate = function(_) {
383 | if (!arguments.length) return animate;
384 | animate = _;
385 | return chart;
386 | }
387 |
388 | return chart;
389 | }
390 |
391 |
--------------------------------------------------------------------------------
/js/lib/D3-v2.8.1/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012, Michael Bostock
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | * The name Michael Bostock may not be used to endorse or promote products
15 | derived from this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------
/js/lib/backbone/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2012 Jeremy Ashkenas, DocumentCloud
2 |
3 | Permission is hereby granted, free of charge, to any person
4 | obtaining a copy of this software and associated documentation
5 | files (the "Software"), to deal in the Software without
6 | restriction, including without limitation the rights to use,
7 | copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the
9 | Software is furnished to do so, subject to the following
10 | conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/js/lib/backbone/backbone-min.js:
--------------------------------------------------------------------------------
1 | // Backbone.js 0.9.1
2 |
3 | // (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc.
4 | // Backbone may be freely distributed under the MIT license.
5 | // For all details and documentation:
6 | // http://backbonejs.org
7 | (function(){var i=this,r=i.Backbone,s=Array.prototype.slice,t=Array.prototype.splice,g;g="undefined"!==typeof exports?exports:i.Backbone={};g.VERSION="0.9.1";var f=i._;!f&&"undefined"!==typeof require&&(f=require("underscore"));var h=i.jQuery||i.Zepto||i.ender;g.setDomLibrary=function(a){h=a};g.noConflict=function(){i.Backbone=r;return this};g.emulateHTTP=!1;g.emulateJSON=!1;g.Events={on:function(a,b,c){for(var d,a=a.split(/\s+/),e=this._callbacks||(this._callbacks={});d=a.shift();){d=e[d]||(e[d]=
8 | {});var f=d.tail||(d.tail=d.next={});f.callback=b;f.context=c;d.tail=f.next={}}return this},off:function(a,b,c){var d,e,f;if(a){if(e=this._callbacks)for(a=a.split(/\s+/);d=a.shift();)if(f=e[d],delete e[d],b&&f)for(;(f=f.next)&&f.next;)if(!(f.callback===b&&(!c||f.context===c)))this.on(d,f.callback,f.context)}else delete this._callbacks;return this},trigger:function(a){var b,c,d,e;if(!(d=this._callbacks))return this;e=d.all;for((a=a.split(/\s+/)).push(null);b=a.shift();)e&&a.push({next:e.next,tail:e.tail,
9 | event:b}),(c=d[b])&&a.push({next:c.next,tail:c.tail});for(e=s.call(arguments,1);c=a.pop();){b=c.tail;for(d=c.event?[c.event].concat(e):e;(c=c.next)!==b;)c.callback.apply(c.context||this,d)}return this}};g.Events.bind=g.Events.on;g.Events.unbind=g.Events.off;g.Model=function(a,b){var c;a||(a={});b&&b.parse&&(a=this.parse(a));if(c=j(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection);this.attributes={};this._escapedAttributes={};this.cid=f.uniqueId("c");if(!this.set(a,
10 | {silent:!0}))throw Error("Can't create an invalid model");delete this._changed;this._previousAttributes=f.clone(this.attributes);this.initialize.apply(this,arguments)};f.extend(g.Model.prototype,g.Events,{idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;b=this.attributes[a];return this._escapedAttributes[a]=f.escape(null==b?"":""+b)},has:function(a){return null!=
11 | this.attributes[a]},set:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c||(c={});if(!d)return this;d instanceof g.Model&&(d=d.attributes);if(c.unset)for(e in d)d[e]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var b=this.attributes,k=this._escapedAttributes,n=this._previousAttributes||{},h=this._setting;this._changed||(this._changed={});this._setting=!0;for(e in d)if(a=d[e],f.isEqual(b[e],a)||delete k[e],c.unset?delete b[e]:b[e]=
12 | a,this._changing&&!f.isEqual(this._changed[e],a)&&(this.trigger("change:"+e,this,a,c),this._moreChanges=!0),delete this._changed[e],!f.isEqual(n[e],a)||f.has(b,e)!=f.has(n,e))this._changed[e]=a;h||(!c.silent&&this.hasChanged()&&this.change(c),this._setting=!1);return this},unset:function(a,b){(b||(b={})).unset=!0;return this.set(a,null,b)},clear:function(a){(a||(a={})).unset=!0;return this.set(f.clone(this.attributes),a)},fetch:function(a){var a=a?f.clone(a):{},b=this,c=a.success;a.success=function(d,
13 | e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)};a.error=g.wrapError(a.error,b,a);return(this.sync||g.sync).call(this,"read",this,a)},save:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c=c?f.clone(c):{};c.wait&&(e=f.clone(this.attributes));a=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c))return!1;var k=this,h=c.success;c.success=function(a,b,e){b=k.parse(a,e);c.wait&&(b=f.extend(d||{},b));if(!k.set(b,c))return!1;h?h(k,a):k.trigger("sync",k,a,c)};c.error=g.wrapError(c.error,
14 | k,c);b=this.isNew()?"create":"update";b=(this.sync||g.sync).call(this,b,this,c);c.wait&&this.set(e,a);return b},destroy:function(a){var a=a?f.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d();a.success=function(e){a.wait&&d();c?c(b,e):b.trigger("sync",b,e,a)};a.error=g.wrapError(a.error,b,a);var e=(this.sync||g.sync).call(this,"delete",this,a);a.wait||d();return e},url:function(){var a=j(this.collection,"url")||j(this,"urlRoot")||o();return this.isNew()?
15 | a:a+("/"==a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){if(this._changing||!this.hasChanged())return this;this._moreChanges=this._changing=!0;for(var b in this._changed)this.trigger("change:"+b,this,this._changed[b],a);for(;this._moreChanges;)this._moreChanges=!1,this.trigger("change",this,a);this._previousAttributes=f.clone(this.attributes);
16 | delete this._changed;this._changing=!1;return this},hasChanged:function(a){return!arguments.length?!f.isEmpty(this._changed):this._changed&&f.has(this._changed,a)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this._changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)if(!f.isEqual(d[e],b=a[e]))(c||(c={}))[e]=b;return c},previous:function(a){return!arguments.length||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},
17 | isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;var a=f.extend({},this.attributes,a),c=this.validate(a,b);if(!c)return!0;b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b);return!1}});g.Collection=function(a,b){b||(b={});b.comparator&&(this.comparator=b.comparator);this._reset();this.initialize.apply(this,arguments);a&&this.reset(a,{silent:!0,parse:b.parse})};f.extend(g.Collection.prototype,g.Events,{model:g.Model,initialize:function(){},
18 | toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){var c,d,e,g,h,i={},j={};b||(b={});a=f.isArray(a)?a.slice():[a];for(c=0,d=a.length;c=b))this.iframe=h('').hide().appendTo("body")[0].contentWindow,this.navigate(a);this._hasPushState?h(window).bind("popstate",
28 | this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!b?h(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval));this.fragment=a;l=!0;a=window.location;b=a.pathname==this.options.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!b)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&b&&a.hash&&
29 | (this.fragment=a.hash.replace(m,""),window.history.replaceState({},document.title,a.protocol+"//"+a.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},stop:function(){h(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl);clearInterval(this._checkUrlInterval);l=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();a==this.fragment&&this.iframe&&(a=this.getFragment(this.iframe.location.hash));
30 | if(a==this.fragment||a==decodeURIComponent(this.fragment))return!1;this.iframe&&this.navigate(a);this.loadUrl()||this.loadUrl(window.location.hash)},loadUrl:function(a){var b=this.fragment=this.getFragment(a);return f.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0})},navigate:function(a,b){if(!l)return!1;if(!b||!0===b)b={trigger:b};var c=(a||"").replace(m,"");this.fragment==c||this.fragment==decodeURIComponent(c)||(this._hasPushState?(0!=c.indexOf(this.options.root)&&(c=
31 | this.options.root+c),this.fragment=c,window.history[b.replace?"replaceState":"pushState"]({},document.title,c)):this._wantsHashChange?(this.fragment=c,this._updateHash(window.location,c,b.replace),this.iframe&&c!=this.getFragment(this.iframe.location.hash)&&(b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,c,b.replace))):window.location.assign(this.options.root+a),b.trigger&&this.loadUrl(a))},_updateHash:function(a,b,c){c?a.replace(a.toString().replace(/(javascript:|#).*$/,
32 | "")+"#"+b):a.hash=b}});g.View=function(a){this.cid=f.uniqueId("view");this._configure(a||{});this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var y=/^(\S+)\s*(.*)$/,p="model,collection,el,id,attributes,className,tagName".split(",");f.extend(g.View.prototype,g.Events,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();return this},make:function(a,b,c){a=document.createElement(a);
33 | b&&h(a).attr(b);c&&h(a).html(c);return a},setElement:function(a,b){this.$el=h(a);this.el=this.$el[0];!1!==b&&this.delegateEvents();return this},delegateEvents:function(a){if(a||(a=j(this,"events"))){this.undelegateEvents();for(var b in a){var c=a[b];f.isFunction(c)||(c=this[a[b]]);if(!c)throw Error('Event "'+a[b]+'" does not exist');var d=b.match(y),e=d[1],d=d[2],c=f.bind(c,this),e=e+(".delegateEvents"+this.cid);""===d?this.$el.bind(e,c):this.$el.delegate(d,e,c)}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+
34 | this.cid)},_configure:function(a){this.options&&(a=f.extend({},this.options,a));for(var b=0,c=p.length;b96&&ab<123;if(!I){if(x=="["){var D=S.length,M=D?S[D-1]:X,w=g.substr(ad+1).match(/[^\]]*/)[0],R=w.match(/{[^}]*}/g);if(R){for(ac=0,Z=R.length;acak?1:0));if(!au&&T.charOrder){if(m){for(var ax in f){var al=f[ax];am=am.replace(ax,al);ak=ak.replace(ax,al)}}if(am.match(c)!==d||ak.match(c)!==d){for(var ap=0,ao=q(am.length,ak.length);api?1:0))){break}}}}return ai}}Q.each(function(ak,al){var am=b(al),ai=W?(J?C.filter(al):am.find(V)):am,an=ah?ai.data(T.data):(H?ai.attr(T.attr):(T.useVal?ai.val():ai.text())),aj=am.parent();if(!ae[aj]){ae[aj]={s:[],n:[]}}if(ai.length>0){ae[aj].s.push({s:an,e:am,n:ak})}else{ae[aj].n.push({e:am,n:ak})}});for(v in ae){ae[v].s.sort(F)}for(v in ae){var ag=ae[v],K=[],Y=z,af=[0,0],ad;switch(T.place){case"first":b.each(ag.s,function(ai,aj){Y=q(Y,aj.n)});break;case"org":b.each(ag.s,function(ai,aj){K.push(aj.n)});break;case"end":Y=ag.n.length;break;default:Y=0}for(ad=0;ad=Y&&ad2;a==
12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};
24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e /g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),
28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+
29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
32 |
--------------------------------------------------------------------------------
/js/models/Hello.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // the only REST API that gives ES node version
18 |
19 | var Hello = Backbone.Model.extend({
20 | url: function() { return '/'; }
21 | });
22 |
--------------------------------------------------------------------------------
/js/models/cluster/ClusterHealth.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | /**
18 | * REST end point: _cluster/health
19 | * @see cluster health
20 | */
21 |
22 | var ClusterHealth = Backbone.Model.extend({
23 |
24 | url: function() { return '/_cluster/health'; },
25 |
26 | parse: function(data) {
27 | // we do not need all data for now
28 | // let's get just the basic info and nodes level data
29 | var model = {};
30 | model.cluster_name = data.cluster_name;
31 | model.status = data.status;
32 | model.timed_out = data.timed_out;
33 | model.number_of_nodes = data.number_of_nodes;
34 | model.number_of_data_nodes = data.number_of_data_nodes;
35 | return model;
36 | }
37 | });
38 |
39 |
--------------------------------------------------------------------------------
/js/models/cluster/ClusterState.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | /**
18 | * REST end point: _cluster/state/nodes,routing_table?human=true
19 | * @see cluster state
20 | */
21 |
22 | var ClusterStateTimestamp = Backbone.Model;
23 |
24 | var ClusterState = Backbone.Collection.extend({
25 |
26 | model: ClusterStateTimestamp,
27 |
28 | url: function() {
29 | return '/_cluster/state/nodes,routing_table?human=true';
30 | },
31 |
32 | parse: function(data) {
33 | // add key
34 | data.id = new Date().getTime();
35 | return data;
36 | },
37 |
38 | add: function(models, options) {
39 | delete options.silent;
40 | if (options && options.now && options.storeSize) {
41 | var iterator = function(clusterStateTimestamp) {
42 | return !(clusterStateTimestamp.id < (options.now - options.storeSize));
43 | };
44 |
45 | var rejected = this.reject(iterator);
46 | if (rejected.length > 0) {
47 | this.remove(rejected, options);
48 | }
49 | }
50 | var parentCall = Backbone.Collection.prototype.add.call(this, models, options);
51 |
52 | // custom trigger: collection has been updated
53 | this.trigger("clusterStateUpdated", {});
54 |
55 | return parentCall;
56 | },
57 |
58 | // make sure models are ordered by time
59 | comparator: function(model) {
60 | return model.id;
61 | }
62 | });
63 |
64 |
--------------------------------------------------------------------------------
/js/models/cluster/IndicesStatus.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | /**
18 | * REST end point: _status
19 | * @see indices status
20 | */
21 |
22 | var IndicesStatusTimestamp = Backbone.Model;
23 |
24 | var IndicesStatus = Backbone.Collection.extend({
25 |
26 | model: IndicesStatusTimestamp,
27 |
28 | url: function() {
29 | return '/_status';
30 | },
31 |
32 | parse: function(data) {
33 | // add key
34 | data.id = new Date().getTime();
35 | if (data.indices) {
36 | for (var i in data.indices) {
37 | if (data.indices.hasOwnProperty(i)) {
38 | // drop unused data about index
39 | delete data.indices[i].docs;
40 | delete data.indices[i].flush;
41 | delete data.indices[i].index;
42 | delete data.indices[i].merges;
43 | delete data.indices[i].refresh;
44 | delete data.indices[i].translog;
45 | if (data.indices[i].shards) {
46 | var _shards = data.indices[i].shards;
47 | if (_shards) {
48 | for (var _s in _shards) {
49 | if (_shards.hasOwnProperty(_s)) {
50 | for (var _i in _shards[_s]) {
51 | var _tmp = _shards[_s][_i];
52 | if (_tmp) {
53 | // drop unused data about index shards
54 | delete _tmp.docs;
55 | delete _tmp.flush;
56 | delete _tmp.merges;
57 | delete _tmp.refresh;
58 | // delete _tmp.routing;
59 | delete _tmp.translog;
60 | }
61 | }
62 | }
63 | }
64 | }
65 | }
66 | }
67 | }
68 | }
69 | return data;
70 | },
71 |
72 | add: function(models, options) {
73 | delete options.silent;
74 | if (options && options.now && options.storeSize) {
75 | var iterator = function(indicesStatusTimestamp) {
76 | return !(indicesStatusTimestamp.id < (options.now - options.storeSize));
77 | };
78 |
79 | var rejected = this.reject(iterator);
80 | if (rejected.length > 0) {
81 | this.remove(rejected, options);
82 | }
83 | }
84 | var parentCall = Backbone.Collection.prototype.add.call(this, models, options);
85 |
86 | // custom trigger: collection has been updated
87 | this.trigger("indicesStatusUpdated", {});
88 |
89 | return parentCall;
90 | },
91 |
92 | // make sure models are ordered by time
93 | comparator: function(model) {
94 | return model.id;
95 | }
96 |
97 | });
98 |
--------------------------------------------------------------------------------
/js/models/cluster/NodeInfo.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | /**
18 | * REST end point: _nodes/{nodeId}?human=true
19 | * @see cluster nodes
20 | */
21 |
22 | var NodeInfo = Backbone.Model.extend({
23 |
24 | url: function() {
25 | return '/_nodes/' + this.get("nodeId") + '?human=true';
26 | },
27 |
28 | validate: function(attrs) {
29 | if (!attrs.nodeId) {
30 | // return "nodeId must be set"; // not working correctly, see fetch()
31 | }
32 | },
33 |
34 | parse: function(data) {
35 | var nodeId = this.get("nodeId");
36 | if (data.nodes && data.nodes[nodeId]) {
37 | var _data = data.nodes[nodeId];
38 | _data.id = nodeId;
39 | // console.log(_data);
40 | return _data;
41 | }
42 | },
43 |
44 | fetch: function(options){
45 | if (options.nodeId) {
46 | this.set({nodeId: options.nodeId});
47 | } else {
48 | // this should be handled in initialize() but that breaks URI, not sure why...???
49 | throw "nodeId must be set";
50 | }
51 | return Backbone.Model.prototype.fetch.call(this, options);
52 | }
53 |
54 | });
55 |
56 |
57 |
--------------------------------------------------------------------------------
/js/models/cluster/NodesState.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | /**
18 | * REST end point: _cluster/state/nodes,master_node
19 | * @see cluster state
20 | */
21 |
22 | var NodeState = Backbone.Model.extend({
23 | defaults: {
24 | master: false
25 | }
26 | });
27 |
28 | var NodesState = Backbone.Collection.extend({
29 |
30 | model: NodeState,
31 |
32 | url: function() {
33 | return '/_cluster/state/nodes,master_node';
34 | },
35 |
36 | // Move important keys into values.
37 | parse: function(data) {
38 | var nodes = data.nodes;
39 | var masterId = data.master_node;
40 | nodes[masterId].master = true;
41 | var nodeIds = _.keys(nodes);
42 | var nodeValues = _.values(nodes);
43 | for (var i = 0; i < nodeIds.length; i++) {
44 | nodeValues[i].id = nodeIds[i];
45 | }
46 | return nodeValues;
47 | },
48 |
49 | // Keep nodes collection up to date.
50 | add: function(models, options) {
51 | var collection = this;
52 | delete options.silent;
53 |
54 | // add new nodes
55 | _.each(models, function(model){
56 | if (collection.get(model.id) == undefined) {
57 | Backbone.Collection.prototype.add.call(collection, model, options);
58 | } else {
59 | collection.get(model.id).set(model);
60 | }
61 | });
62 |
63 | // remove gone nodes
64 | var iterator = function(nodeState) {
65 | return (_.find(models, function(m){ return m.id == nodeState.id; }));
66 | };
67 |
68 | var rejected = collection.reject(iterator);
69 | collection.remove(rejected, options);
70 | },
71 |
72 | // return master node id if available, otherwise return empty string
73 | getMasterNodeId: function() {
74 | var masterNodeId = "";
75 | var collection = this;
76 | var masterNode = collection.find(function(node){
77 | return node.get("master");
78 | });
79 | if (masterNode) {
80 | masterNodeId = masterNode.id;
81 | }
82 | return masterNodeId;
83 | }
84 | });
85 |
--------------------------------------------------------------------------------
/js/models/cluster/NodesStats.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | /**
18 | * REST end point: _nodes/stats?human=true
19 | * @see nodes statistics
20 | */
21 |
22 | var NodeStats = Backbone.Model;
23 |
24 | var NodeStatsCollection = Backbone.Collection.extend({
25 | model: NodeStats
26 | });
27 |
28 | var NodeStatsTimestamp = Backbone.Model.extend({
29 | initialize: function(attributes){
30 | var nodes = attributes.nodes;
31 | var nodeIds = _.keys(nodes);
32 | var nodeValues = _.values(nodes);
33 | for (var i = 0; i < nodeIds.length; i++) {
34 | nodeValues[i].id = nodeIds[i];
35 | }
36 | this.set({nodes: new NodeStatsCollection(nodeValues)});
37 | this.set("id", new Date().getTime());
38 | }
39 | });
40 |
41 | var NodesStats = Backbone.Collection.extend({
42 | model: NodeStatsTimestamp,
43 | url: function() {
44 | return '/_nodes/stats?human=true';
45 | },
46 | parse: function(response) {
47 | delete response.cluster_name;
48 | return response;
49 | },
50 |
51 | // Here comes the backbone hack:
52 | //
53 | // Cluster health status is fetched using {add:true} option, which means that it will always
54 | // add incoming data, but we also need to remove data that are older then storeSize threshold.
55 | //
56 | // So we call fetch with {silent:true}, then we override add method in which we remove {silent}
57 | // from the options and "delegate to parent" to trigger the 'add' event. When we remove old data,
58 | // we call remove method which triggers 'remove' event.
59 | // As a result we can subscribe to NodesStats collection on 'add' and 'remove' events which will be
60 | // fired correctly only for those items that are added or removed.
61 | //
62 | // Also note that when we call the fetch we inject some additional metadata into options: now, storeSize.
63 | // Probably that is the way how to go about this in backbone.
64 | //
65 | // Theoretically we would not need to use {silent:true} and omit "delegation to parent". But this
66 | // way we have finer control over the flow and we can theoretically decide not to add incoming data
67 | // in the future which will allow us to control triggering 'add' event correctly.
68 | //
69 | add: function(models, options) {
70 | delete options.silent;
71 | if (options && options.now && options.storeSize) {
72 | var iterator = function(nodeStatsTimestamp) {
73 | return !(nodeStatsTimestamp.id < (options.now - options.storeSize));
74 | };
75 |
76 | var rejected = this.reject(iterator);
77 | if (rejected.length > 0) {
78 | this.remove(rejected, options);
79 | }
80 | }
81 | var parentCall = Backbone.Collection.prototype.add.call(this, models, options);
82 |
83 | // custom trigger: collection has been updated
84 | this.trigger("nodesStatsUpdated", {});
85 |
86 | return parentCall;
87 | },
88 |
89 | // make sure models are ordered by time (in case AJAX responses are returned in wrong order)
90 | comparator: function(model) {
91 | return model.id;
92 | }
93 | });
94 |
95 |
96 |
--------------------------------------------------------------------------------
/js/store/BigdeskStore.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | /*
18 | {
19 | cluster: {
20 | cluster_name: {
21 | connectionVerified: bool,
22 | intervals: {_all_active_intervals_},
23 | timeouts: {_all_active_timeouts_},
24 | storeSize: int,
25 | health: {},
26 | nodesStats: [
27 | timestamp_x: {
28 | [nodeStats, nodeStats, ...]
29 | },
30 | timestamp_y: {[...]},
31 | timestamp_z: {[...]},
32 | ...
33 | ],
34 | nodesState: [
35 | {node_with_id},
36 | {node_with_id},
37 | ...
38 | ],
39 | nodeInfo: {}, //relevant to selected node
40 | clusterState: [
41 | clusterStateTimestamp: {},
42 | ...
43 | ],
44 | indicesStatus: [
45 | indicesStatusTimestamp: {},
46 | ...
47 | ]
48 | }
49 | }
50 | }
51 | */
52 |
53 | var Cluster = Backbone.Model.extend({
54 | defaults: {
55 | id: "not_set_yet",
56 | connectionVerified: false,
57 | health: undefined,
58 | nodesStats: undefined,
59 | nodesState: undefined,
60 | nodeInfo: undefined,
61 | clusterState: undefined,
62 | indicesStatus: undefined,
63 | storeSize: 60000, // 1min
64 | intervals: {},
65 | timeouts: {},
66 | dispatcher: undefined
67 | },
68 | // id: "cluster_name"
69 | // baseUrl: "complete URL for REST API including port number"
70 | // refreshInterval: _some_number_ [optional, defaults to 2000ms]
71 | // dispatcher: function [optional].
72 | initialize: function(attrs){
73 | var _model = this;
74 | var _conn = _model.get("connectionVerified");
75 | if (_conn == false) {
76 | // ensure default dispatcher (in case user explicitly provided "undefined" value instead of function)
77 | if (this.get("dispatcher") == undefined /*|| typeof this.get("dispatcher") != "function"*/) {
78 | console.log("using default dispatcher");
79 | var _dispatcher = _.clone(Backbone.Events);
80 | _dispatcher.on("onAjaxResponse", function(clusterName, restApiName, response) {
81 | console.log("["+clusterName+"] ["+restApiName+"]", response)
82 | });
83 | this.set({dispatcher: _dispatcher});
84 | }
85 | var connection = {
86 | baseUrl: attrs.baseUrl,
87 | refreshInterval: attrs.refreshInterval || 2000
88 | };
89 | var hello = new Hello({},connection);
90 | hello.fetch({
91 | success: function(model, response){
92 | var version = hello.get("version");
93 | if (version && version.number) {
94 | version = version.number;
95 | var _vArray = version.split(".");
96 | if (_vArray.length > 2 && _model.checkVersion(_vArray)) {
97 | _model.versionVerified(version);
98 | _model.initCluster(connection);
99 | } else {
100 | _model.yellAboutVersion(version);
101 | }
102 | } else {
103 | _model.yellAboutVersion("n/a");
104 | }
105 | },
106 | error: function(model, response) {
107 | console.log("[Error] something wrong happened...", model, response);
108 | }
109 | });
110 | }
111 | },
112 |
113 | // When creating a new cluster, client has to provide both REST URL endpoint and cluster name.
114 | // The idea is that the cluster name is obtained by client upfront using cluster health API for example.
115 | validate: function(attrs){
116 | // this must be constructor call
117 | if (this.get("connectionVerified") == undefined) {
118 | if (!attrs.id || !attrs.baseUrl) {
119 | return "Both cluster name and URL must be provided.\n" +
120 | "Example: { " +
121 | "id: \"_cluster_name_\", " +
122 | "baseUrl: \"_ES_REST_end_point_\" " +
123 | "}";
124 | }
125 | if (attrs.dispatcher != undefined) {
126 | if (typeof attrs.dispatcher != "function") {
127 | return "dispatcher must be a function.";
128 | }
129 | }
130 | }
131 | },
132 |
133 | // returns false or true depending on given version numbers
134 | checkVersion: function(parsedArray) {
135 | var major = parsedArray[0];
136 | var minor = parsedArray[1];
137 | var maintenance = parsedArray[2];
138 | var build = undefined;
139 | if (parsedArray.length > 3) {
140 | build = parsedArray[3]; // Betax, RCx, GAx ...
141 | }
142 | return (major == 1 && minor >= 0 && maintenance >= 0 && (build != 'Beta1' || build != 'Beta2'));
143 | },
144 |
145 | versionVerified: function(version) {
146 | console.log("Check ES node version: " + version + " [ok]");
147 | },
148 |
149 | yellAboutVersion: function(version) {
150 | var message =
151 | "*********************************\n" +
152 | "Bigdesk may not work correctly!\n" +
153 | "Found ES node version: " + version + "\n" +
154 | "Requires ES node version: >= 1.0.0.RC1\n" +
155 | "*********************************";
156 | console.log(message);
157 | if (alert) { alert(message); }
158 | },
159 |
160 | // connection.baseUrl
161 | // connection.refreshInterval
162 | initCluster: function(connection) {
163 | var _model = this;
164 | // connection has been already verified
165 | _model.set({connectionVerified: true});
166 |
167 | _model.set({ health: new ClusterHealth({}, connection) });
168 | _model.set({ nodesStats: new NodesStats([], connection) });
169 | _model.set({ nodesState: new NodesState([], connection) });
170 | _model.set({ nodeInfo: new NodeInfo({}, connection) });
171 | _model.set({ clusterState: new ClusterState([], connection) });
172 | _model.set({ indicesStatus: new IndicesStatus([], connection) });
173 |
174 | this.startFetch(connection.refreshInterval);
175 |
176 | },
177 |
178 | clearTimeouts: function() {
179 | var _cluster = this;
180 | var timeouts = _cluster.get("timeouts");
181 | _.each(timeouts, function(num, key){
182 | _cluster.clearTimeout(key);
183 | });
184 | },
185 |
186 | clearTimeout: function(timeoutId) {
187 | var timeouts = this.get("timeouts");
188 | if (timeouts && timeouts[timeoutId]) {
189 | window.clearTimeout(timeouts[timeoutId]);
190 | delete timeouts[timeoutId];
191 | this.set({timeouts: timeouts});
192 | }
193 | },
194 |
195 | clearIntervals: function() {
196 | var _cluster = this;
197 | var intervals = this.get("intervals");
198 | _.each(intervals, function(num, key){
199 | _cluster.clearInterval(key);
200 | });
201 | },
202 |
203 | clearInterval: function(intervalId) {
204 | // console.log("stop interval " + intervalId);
205 | var intervals = this.get("intervals");
206 | if (intervals && intervals[intervalId]) {
207 | window.clearInterval(intervals[intervalId]);
208 | delete intervals[intervalId];
209 | this.set({intervals: intervals});
210 | }
211 | },
212 |
213 | startTimeout: function(timeoutId, functionCall, interval) {
214 | var _model = this;
215 | var timeouts = _model.get("timeouts");
216 | if (timeouts) {
217 | if (timeouts[timeoutId]) {
218 | console.log("[WARN] clearing and replacing existing timeout");
219 | _model.clearTimeout(timeoutId);
220 | }
221 |
222 | var timeoutFn = function() {
223 | functionCall();
224 | timeouts[timeoutId] = window.setTimeout(timeoutFn, interval);
225 | _model.set({timeouts: timeouts});
226 | };
227 |
228 | timeoutFn();
229 | }
230 | },
231 |
232 | startInterval: function(intervalId, functionCall, interval) {
233 | var _model = this;
234 | var intervals = this.get("intervals");
235 | if (intervals) {
236 | if (intervals[intervalId]) {
237 | console.log("[WARN] clearing and replacing existing interval");
238 | _model.clearInterval(intervalId);
239 | }
240 | intervals[intervalId] = window.setInterval(functionCall, interval);
241 | this.set({intervals: intervals});
242 | // fire callback right now
243 | functionCall();
244 | }
245 | },
246 |
247 | // start fetching bigdesk models and collections
248 | // params:
249 | // refreshInterval
250 | // baseUrl [optional] can override baseUrl that was passed into Cluster constructor
251 | startFetch: function(refreshInterval, baseUrl) {
252 | var _cluster = this;
253 | var _dispatcher = _cluster.get("dispatcher");
254 | var _clusterName = _cluster.get("id");
255 |
256 | if (baseUrl && typeof baseUrl == "string") {
257 | _cluster.get("health").setBaseUrl(baseUrl);
258 | _cluster.get("nodesStats").setBaseUrl(baseUrl);
259 | _cluster.get("nodesState").setBaseUrl(baseUrl);
260 | _cluster.get("nodeInfo").setBaseUrl(baseUrl);
261 | _cluster.get("clusterState").setBaseUrl(baseUrl);
262 | _cluster.get("indicesStatus").setBaseUrl(baseUrl);
263 | }
264 |
265 | var healthRefreshFunction = function(){
266 | _cluster.get("health").fetch({
267 | success: function(model, response){
268 | _dispatcher.trigger("onAjaxResponse", _clusterName, "cluster > Health", response);
269 | }
270 | });
271 | };
272 |
273 | var nodesStatsRefreshFunction = function(){
274 | _cluster.get("nodesStats").fetch({
275 | add: true,
276 | storeSize: _cluster.get("storeSize"),
277 | now: new Date().getTime(),
278 | silent: true,
279 | success: function(model, response){
280 | _dispatcher.trigger("onAjaxResponse", _clusterName, "cluster > NodesStats", response);
281 | }
282 | });
283 | };
284 |
285 | var nodesStateRefreshFunction = function(){
286 | _cluster.get("nodesState").fetch({
287 | add: true,
288 | silent: true,
289 | success: function(model, response){
290 | _dispatcher.trigger("onAjaxResponse", _clusterName, "cluster > NodesState", response);
291 | }
292 | });
293 | };
294 |
295 | var clusterStateRefreshFunction = function(){
296 | _cluster.get("clusterState").fetch({
297 | add: true,
298 | storeSize: _cluster.get("storeSize"),
299 | now: new Date().getTime(),
300 | silent: true,
301 | success: function(model, response){
302 | _dispatcher.trigger("onAjaxResponse", _clusterName, "cluster > State", response);
303 | _dispatcher.trigger("newClusterState");
304 | }
305 | });
306 | };
307 |
308 | var indicesStatusRefreshFunction = function(){
309 | _cluster.get("indicesStatus").fetch({
310 | add: true,
311 | storeSize: _cluster.get("storeSize"),
312 | now: new Date().getTime(),
313 | silent: true,
314 | success: function(model, response){
315 | _dispatcher.trigger("onAjaxResponse", _clusterName, "indices > Status", response);
316 | _dispatcher.trigger("newIndicesStatus");
317 | }
318 | });
319 | };
320 |
321 | this.clearInterval("nodesStateInterval");
322 | this.clearInterval("nodesStatsInterval");
323 | this.clearInterval("healthInterval");
324 | this.clearTimeout("clusterStateInterval");
325 | this.clearTimeout("indicesStatusInterval");
326 |
327 | this.startInterval("nodesStateInterval", nodesStateRefreshFunction, refreshInterval);
328 | this.startInterval("nodesStatsInterval", nodesStatsRefreshFunction, refreshInterval);
329 | this.startInterval("healthInterval", healthRefreshFunction, refreshInterval);
330 | this.startTimeout("clusterStateInterval", clusterStateRefreshFunction, refreshInterval);
331 | this.startTimeout("indicesStatusInterval", indicesStatusRefreshFunction, refreshInterval);
332 | },
333 |
334 | // set storeSize value of the cluster
335 | setStoreSize: function(storeSize) {
336 | var _cluster = this;
337 | _cluster.set({storeSize: storeSize});
338 | },
339 |
340 | // return master node id if available, otherwise return empty string
341 | getMasterNodeId: function() {
342 | var _cluster = this;
343 | return _cluster.get("nodesState").getMasterNodeId();
344 | }
345 | });
346 |
347 | var ClusterCollection = Backbone.Collection.extend({
348 | model: Cluster
349 | });
350 |
351 | var BigdeskStore = Backbone.Model.extend({
352 |
353 | defaults: {
354 | cluster: new ClusterCollection()
355 | },
356 |
357 | // Returns an instance of a Cluster model with given name (id)
358 | // or undefined
if no instance if found.
359 | getCluster: function(clusterName) {
360 | return this.get("cluster").get(clusterName);
361 | },
362 |
363 | // Add a new cluster into store. Parameter is an instance of a Cluster model.
364 | // Throws error if there already is a cluster with the same id.
365 | addCluster: function(clusterModel) {
366 | var _c = this.get("cluster");
367 | if (_c.get(clusterModel.get("id")) == undefined) {
368 | _c.add(clusterModel)
369 | } else {
370 | throw "Cluster already exists.";
371 | }
372 | }
373 | });
374 |
--------------------------------------------------------------------------------
/js/util/bigdesk_extension.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Override jQuery AJAX settings to use jsonp
18 | // Add some helper methods into both Model and Collection to support "baseUrl"
19 |
20 | Backbone.Model = Backbone.Model.extend({
21 | sync: function(method, model, options) {
22 | // options.timeout = 10000; // required, or the application won't pick up on 404 responses
23 | //options.dataType = 'jsonp';
24 | options.url = this.getBaseUrl() + this.url();
25 | return Backbone.sync(method, model, options);
26 | },
27 | getBaseUrl: function() {
28 | return this.get("baseUrl");
29 | },
30 | setBaseUrl: function(url) {
31 | this.set({baseUrl: url});
32 | },
33 | initialize: function(attributes, options) {
34 | if (options && options.baseUrl) {
35 | this.setBaseUrl(options.baseUrl);
36 | }
37 | }
38 | });
39 |
40 | Backbone.Collection = Backbone.Collection.extend({
41 | sync: function(method, model, options) {
42 | //options.dataType = 'jsonp';
43 | options.url = this.getBaseUrl() + this.url();
44 | return Backbone.sync(method, model, options);
45 | },
46 | // Did not find much information about how to store metadata with collection.
47 | // Direct set/get of property seems to work fine.
48 | getBaseUrl: function() {
49 | return this.baseUrl;
50 | },
51 | setBaseUrl: function(url) {
52 | this.baseUrl = url;
53 | },
54 | initialize: function(models, options) {
55 | if (options && options.baseUrl) {
56 | this.setBaseUrl(options.baseUrl);
57 | }
58 | }
59 | });
60 |
--------------------------------------------------------------------------------
/js/views/ClusterHealthView.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | var ClusterHealthView = Backbone.View.extend({
18 |
19 | initialize: function() {
20 |
21 | var _view = this;
22 | _view.clear();
23 |
24 | var health = _view.model.get("health");
25 | if (health) {
26 | // First, try to bind to event if health model is already there...
27 | _view.registerHealthChangeHandler(health, _view);
28 | } else {
29 | // ... if the model is not available yet (because it is loaded via AJAX) then
30 | // wait for it to be loaded to bind to its events.
31 | this.model.on("change:health",
32 | function(model){
33 | var health = model.get("health");
34 | _view.registerHealthChangeHandler(health, _view);
35 | });
36 | }
37 | },
38 |
39 | registerHealthChangeHandler: function(health, _view) {
40 | health.on("change:status", function(){
41 | _view.render();
42 | });
43 |
44 | health.on("change:number_of_nodes", function(){
45 | _view.render();
46 | });
47 | },
48 |
49 | render: function() {
50 | var health = this.model.get("health");
51 | if (health) {
52 | $(this.el).html(
53 | "Cluster: " + health.get("cluster_name") +
54 | " Number of nodes: " + health.get("number_of_nodes") +
55 | " Status: " + health.get("status") +" ");
56 | }
57 | return this;
58 | },
59 |
60 | clear: function() {
61 | // TODO off all events from initialize()
62 | $(this.el).html("No cluster connected.");
63 | }
64 | });
65 |
--------------------------------------------------------------------------------
/js/views/ClusterNodesListView.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | var ClusterNodesListView = Backbone.View.extend({
18 |
19 | selectedClusterNodeView: undefined,
20 |
21 | events: {
22 | "click" : "nodeClicked"
23 | },
24 |
25 | initialize: function() {
26 |
27 | var _view = this;
28 | _view.clear();
29 |
30 | var nodes = _view.model.get("nodesState");
31 | if (nodes) {
32 | // First, try to bind to event if nodesState model is already there...
33 | _view.registerMasterNodeChangeHandler(nodes, _view);
34 | } else {
35 | // ... if the model is not available yet (because it is loaded via AJAX) then
36 | // wait for it to be loaded to bind to its events.
37 | this.model.on("change:nodesState",
38 | function(model){
39 | var nodes = model.get("nodesState");
40 | _view.registerMasterNodeChangeHandler(nodes, _view);
41 | });
42 | }
43 | },
44 |
45 | registerMasterNodeChangeHandler: function(nodes, view) {
46 | nodes.on("add", function(model){
47 | // We also want to be able to notice when existing node becomes a master or is
48 | // no longer a master. Thus every node gets a "master" attribute change listener.
49 | model.on("change:master", function(){
50 | view.updateMaster(model);
51 | });
52 | view.addNode(model);
53 | });
54 |
55 | nodes.on("remove", function(model){
56 | model.off(); // remove change:master listener
57 | view.removeNode(model);
58 | });
59 |
60 | // nodes.on("all", function(eventName){
61 | // console.log(eventName);
62 | // });
63 | },
64 |
65 | addNode: function(model) {
66 | var _view = this;
67 | var _class = "clusterNode";
68 | if (model.get("master")) {
69 | _class += " masterNode";
70 | }
71 | var div = _view.make("div", {
72 | "class": _class,
73 | "style": "display:none",
74 | "nodeId" : model.get("id")
75 | },
76 | model.get("name"));
77 | _view.$el.append(div);
78 | _view.$el.find("div").tsort();
79 | $(div).fadeIn("slow");
80 | return _view;
81 | },
82 |
83 | removeNode: function(model) {
84 |
85 | var _view = this;
86 |
87 | // if removing selected node, destroy detail view
88 | if (_view.selectedClusterNodeView != undefined) {
89 | if (_view.selectedClusterNodeView.nodeId() == model.id) {
90 | _view.selectedClusterNodeView.destroy();
91 | }
92 | }
93 |
94 | var toRemove = _view.$el.find("[nodeId=\""+model.id+"\"]");
95 | toRemove.removeClass("masterNode"); // looks better if master node goes away
96 | toRemove.fadeOut("slow", function(){toRemove.remove();});
97 | return _view;
98 | },
99 |
100 | updateMaster: function(model) {
101 |
102 | var _view = this;
103 |
104 | var nodeToUpdate = _view.$el.find("[nodeId=\""+model.id+"\"]");
105 |
106 | if (nodeToUpdate) {
107 | if (model.get("master")) {
108 | nodeToUpdate.addClass("masterNode");
109 | } else {
110 | nodeToUpdate.removeClass("masterNode");
111 | }
112 | }
113 | },
114 |
115 | setNodeAsSelected: function(nodeId) {
116 |
117 | var _view = this;
118 |
119 | _view.$el.find(".clusterNode").removeClass("selectedNode");
120 |
121 | var nodeToUpdate = _view.$el.find("[nodeId=\""+nodeId+"\"]");
122 | if (nodeToUpdate) {
123 | nodeToUpdate.addClass("selectedNode");
124 | }
125 | },
126 |
127 | render: function() {
128 | var _view = this;
129 | _view.clear();
130 | var nodes = _view.model.get("nodesState");
131 | if (nodes) {
132 | var iterator = function(node) { return node.get("name"); };
133 | var sorted = _.sortBy(nodes.models, iterator);
134 | var output = _.map(sorted, function(node){
135 | var _class = "clusterNode";
136 | if (node.get("master")) {
137 | _class += " masterNode";
138 | }
139 | return _view.make("div", {
140 | "class": _class,
141 | "style": "display:none",
142 | "nodeId" : node.get("id")
143 | },
144 | node.get("name"));
145 | });
146 | _.each(output, function(div){
147 | _view.$el.append(div);
148 | $(div).fadeIn("slow");
149 | });
150 | }
151 | return _view;
152 | },
153 |
154 | // clean list of nodes and destroy node detail view
155 | clear: function() {
156 | // TODO off all events from initialize()
157 | this.$el.empty();
158 | if (this.selectedClusterNodeView) {
159 | this.selectedClusterNodeView.destroy();
160 | this.selectedClusterNodeView = undefined;
161 | }
162 | },
163 |
164 | nodeClicked: function(event) {
165 | var _view = this;
166 | var target = event.target || event.srcElement;
167 | if (target && target.className) {
168 | if (target.className.indexOf("clusterNode") > -1) {
169 |
170 | var nodeId = $(target).attr("nodeId");
171 | _view.showNodeDetail(nodeId);
172 |
173 | }
174 | }
175 | },
176 |
177 | // if no node detail exists (no node is selected) then create a new view for selected node,
178 | // if some node is already selected and it differs from selected one, destroy view and create a new one
179 | // else ignore...
180 | showNodeDetail: function(nodeId) {
181 |
182 | var _view = this;
183 | var _model = _view.model;
184 |
185 | _view.setNodeAsSelected(nodeId);
186 |
187 | if (!this.selectedClusterNodeView) {
188 | this.selectedClusterNodeView = new SelectedClusterNodeView(
189 | {
190 | nodeId: nodeId,
191 | model: _model
192 | }
193 | );
194 | this.selectedClusterNodeView.render();
195 | }
196 | else if (this.selectedClusterNodeView.nodeId() != nodeId) {
197 | this.selectedClusterNodeView.destroy();
198 | this.selectedClusterNodeView = undefined;
199 | this.selectedClusterNodeView = new SelectedClusterNodeView(
200 | {
201 | nodeId: nodeId,
202 | model: _model
203 | }
204 | );
205 | this.selectedClusterNodeView.render();
206 | };
207 |
208 | }
209 | });
210 |
211 |
--------------------------------------------------------------------------------
/js/views/ClusterStateView.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | var ClusterStateView = Backbone.View.extend({
18 |
19 | initialize: function() {
20 |
21 | var _view = this;
22 | _view.clear();
23 |
24 | var indicesStatus = _view.model.get("indicesStatus");
25 | var clusterState = _view.model.get("clusterState");
26 |
27 | if (indicesStatus && clusterState) {
28 | // both are present, we can register handler
29 | _view.registerChangeCheckHandler();
30 | } else {
31 | // else make sure to fire handler as soon as both are available
32 | _view.model.on("change:indicesStatus", function(model) {
33 | if (_view.model.get("clusterState")) {
34 | _view.registerChangeCheckHandler();
35 | }
36 | });
37 | _view.model.on("change:clusterState", function(model) {;
38 | if (_view.model.get("indicesStatus")) {
39 | _view.registerChangeCheckHandler();
40 | }
41 | });
42 | }
43 | },
44 |
45 | registerChangeCheckHandler: function() {
46 | var _view = this;
47 | _view.render();
48 | _view.model.get("dispatcher").on("newClusterState", _view.redrawIfChanged, _view);
49 | _view.model.get("dispatcher").on("newIndicesStatus", _view.redrawIfChanged, _view);
50 | },
51 |
52 | redrawIfChanged: function() {
53 | var _view = this;
54 | // TODO redraw only if change...
55 | _view.render();
56 | },
57 |
58 | render: function() {
59 | var _view = this;
60 | _view.emptyElement();
61 |
62 | var indicesStatus = _view.model.get("indicesStatus");
63 | var theLatestIndicesStatus = (indicesStatus ? indicesStatus.at(indicesStatus.length-1) : undefined);
64 | var clusterState = _view.model.get("clusterState");
65 |
66 | if (clusterState && clusterState.length > 0) {
67 |
68 | var theLatest = clusterState.at(clusterState.length-1);
69 | // console.log(theLatest.toJSON());
70 | if (theLatest) {
71 |
72 | var packData = {
73 | name: theLatest.get("cluster_name"),
74 | children: []
75 | };
76 |
77 | var nodes = theLatest.get("nodes");
78 |
79 | for (var nodeId in theLatest.get("routing_nodes").nodes) {
80 |
81 | var node = {
82 | name: nodes[nodeId].name,
83 | children: [],
84 | master: (nodeId == theLatest.get("master_node") ? true : false)
85 | };
86 |
87 | for (var shardCnt in theLatest.get("routing_nodes").nodes[nodeId]) {
88 |
89 | var shard = theLatest.get("routing_nodes").nodes[nodeId][shardCnt];
90 |
91 | node.children.push({
92 |
93 | name: shard.index,
94 | size: _view.getIndexShardSize(theLatestIndicesStatus, shard.index, shard.shard, nodeId),
95 |
96 | // optional
97 | primary: shard.primary,
98 | relocating_node: shard.relocating_node,
99 | shard: shard.shard,
100 | state: shard.state
101 |
102 | });
103 | };
104 |
105 | packData.children.push(node);
106 | }
107 |
108 | // console.log("pack", packData);
109 |
110 | var width = 600,
111 | height = 600,
112 | format = d3.format(",d"),
113 | span = 5;
114 |
115 | var pack = d3.layout.pack()
116 | .size([width - (span*2), height - (span*2)])
117 | .value(function(d) { return d.size; });
118 |
119 | var vis = d3.select("#clusterChart").append("svg")
120 | .attr("width", width)
121 | .attr("height", height)
122 | .attr("class", "pack")
123 | .append("g")
124 | .attr("transform", "translate("+span+", "+span+")");
125 |
126 | var node = vis.data([packData]).selectAll("g.node")
127 | .data(pack.nodes)
128 | .enter().append("g")
129 | .attr("class", function(d){
130 | if (d.children) {
131 | if (d.master) {
132 | return "master node";
133 | } else {
134 | return "node";
135 | }
136 | } else {
137 | if (d.primary) {
138 | return "primary leaf node";
139 | } else {
140 | return "leaf node";
141 | }
142 | }
143 | })
144 | .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
145 |
146 | node.append("title")
147 | .text(function(d) { return d.name + (d.children ? "" : ": " + format(d.size)); });
148 |
149 | node.append("circle")
150 | .attr("r", function(d) { return d.r; });
151 |
152 | node.filter(function(d) { return d.children && d != undefined}).append("text")
153 | .attr("text-anchor", "middle")
154 | .attr("dy", function(d){ return -d.r+3; })
155 | .text(function(d) { return d.name; });
156 |
157 | node.filter(function(d) { return !d.children; }).append("text")
158 | .attr("text-anchor", "middle")
159 | .attr("dy", ".3em")
160 | .text(function(d) { return (d.name+" ["+ d.shard+"]").substring(0, d.r / 3); });
161 |
162 | }
163 | }
164 |
165 | },
166 |
167 | // try to extract shard size in bytes, otherwise returns 1
168 | getIndexShardSize: function(theLatestIndicesStatus, indexName, shard, nodeId) {
169 | if (theLatestIndicesStatus) {
170 | var indices = theLatestIndicesStatus.get("indices");
171 | var _shards = indices[indexName].shards[shard];
172 | for (var _shard in _shards) {
173 | if (_shards[_shard].routing.node == nodeId) {
174 | return _shards[_shard].index.size_in_bytes;
175 | }
176 | }
177 | }
178 | return 1;
179 | },
180 |
181 | emptyElement: function() {
182 | var _view = this;
183 | _view.$el.empty();
184 | },
185 |
186 | clear: function() {
187 | var _view = this;
188 | // TODO off all events from initialize()
189 | _view.model.get("dispatcher").off("newClusterState", _view.redrawIfChanged);
190 | _view.model.get("dispatcher").off("newIndicesStatus", _view.redrawIfChanged);
191 | _view.emptyElement();
192 | }
193 | });
194 |
--------------------------------------------------------------------------------
/js/views/templates.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011-2014 Lukas Vlcek
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | var templates = {
18 |
19 | avgCalculationType: [
20 | ""
27 | ].join(""),
28 |
29 | nodesViewTemplate: [
30 | "",
31 | "
",
34 | "
",
37 | "
",
38 | ""
41 | ].join(""),
42 |
43 | clusterViewTemplate: [
44 | "",
45 | "
",
48 | "
",
51 | "
",
52 | "",
53 | "
",
54 | "
Experimental cluster Pack diagram: ",
55 | "",
56 | "
",
57 | "",
58 | "
",
59 | "
Loading cluster chart...
",
60 | "
",
61 | "
"
62 | ].join(""),
63 |
64 | selectedClusterNode : {
65 |
66 | selectedNodeInfoTemplate: [
67 | "Selected node: " +
68 | "Name: {{name}}",
69 | "ID: {{nodeId}}
",
70 | "Hostname: {{host}}",
71 | "Elasticsearch version: {{version}}"
72 | ].join(" "),
73 |
74 | selectedNodeHTTPTemplate: [
75 | "HTTP address: {{http_address}}",
76 | "",
77 | "Bound address: {{http.bound_address}}",
78 | "",
79 | "Publish address: {{http.publish_address}}"
80 | ].join(" "),
81 |
82 | selectedNodeTransportTemplate: [
83 | "Transport address: {{transport_address}}",
84 | "",
85 | "Bound address: {{transport.bound_address}}",
86 | "",
87 | "Publish address: {{transport.publish_address}}"
88 | ].join(" "),
89 |
90 | jvmHeapMem: [
91 | "Committed: n/a
",
92 | "Used: n/a
"
93 | ].join(""),
94 |
95 | jvmNonHeapMem: [
96 | "Committed: n/a
",
97 | "Used: n/a
"
98 | ].join(""),
99 |
100 | jvmThreads: [
101 | "Peak: n/a
",
102 | "Count: n/a
"
103 | ].join(""),
104 |
105 | jvmGC: [
106 | "Total time (O/Y): n/a
",
107 | "Total count (O/Y): n/a
"
108 | ].join(""),
109 |
110 | threadPoolSearch: [
111 | "Queue: n/a
",
112 | "Peak: n/a
",
113 | "Count: n/a
"
114 | ].join(""),
115 |
116 | threadPoolIndex: [
117 | "Queue: n/a
",
118 | "Peak: n/a
",
119 | "Count: n/a
"
120 | ].join(""),
121 |
122 | threadPoolBulk: [
123 | "Queue: n/a
",
124 | "Peak: n/a
",
125 | "Count: n/a
"
126 | ].join(""),
127 |
128 | threadPoolRefresh: [
129 | "Queue: n/a
",
130 | "Peak: n/a
",
131 | "Count: n/a
"
132 | ].join(""),
133 |
134 | fileDescriptorsTemplate: [
135 | "Max: {{process.max_file_descriptors}}
",
136 | "Open: n/a
"
137 | // "Refresh interval: {{process.refresh_interval}}ms
"
138 | ].join(""),
139 |
140 | process_MemTemplate: [
141 | "Total virtual: n/a
",
142 | "Resident: n/a
",
143 | "Share: n/a
"
144 | ].join(""),
145 |
146 | process_CPU_timeTemplate: [
147 | "",
148 | "Sys total: n/a
",
149 | "User total: n/a
"
150 | ].join(""),
151 |
152 | process_CPU_pctTemplate: [
153 | "Total: n/a
",
154 | "Process: n/a
"
155 | ].join(""),
156 |
157 | osCpu: [
158 | "Total: 100%
",
159 | "User: n/a
",
160 | "Sys: n/a
"
161 | ].join(""),
162 |
163 | osMem: [
164 | "Free: n/a
",
165 | "Used: n/a
"
166 | ].join(""),
167 |
168 | osSwap: [
169 | "Free: n/a
",
170 | "Used: n/a
"
171 | ].join(""),
172 |
173 | osLoad: [
174 | "2: n/a
",
175 | "1: n/a
",
176 | "0: n/a
"
177 | ].join(""),
178 |
179 | channelsTemplate: [
180 | "Transport: n/a
",
181 | "HTTP: n/a
",
182 | "HTTP total opened: na
"
183 | ].join(""),
184 |
185 | transportRxTx: [
186 | "",
187 | "Rx: n/a , #n/a
",
188 | "Tx: n/a , #n/a
"
189 | ].join(""),
190 |
191 | TDBTemplate: [
192 | "" +
193 | " " +
194 | " "
195 | ].join(""),
196 |
197 | jvmInfoTemplate1: [
198 | "VM name: {{vm_name}}",
199 | "VM vendor: {{vm_vendor}}",
200 | "VM version: {{vm_version}}"
201 | ].join(" "),
202 |
203 | jvmInfoTemplate2: [
204 | "Uptime: n/a ",
205 | "Java version: {{version}}",
206 | "PID: {{pid}}"
207 | ].join(" "),
208 |
209 | osInfoTemplate1: [
210 | "CPU vendor: {{#cpu.vendor}}{{cpu.vendor}}{{/cpu.vendor}}{{^cpu.vendor}}n/a{{/cpu.vendor}}",
211 | "CPU model: {{#cpu.model}}{{cpu.model}} ({{cpu.mhz}} MHz){{/cpu.model}}{{^cpu.model}}n/a{{/cpu.model}}",
212 | "CPU total logical cores: {{#cpu.total_cores}}{{cpu.total_cores}}{{/cpu.total_cores}}{{^cpu.total_cores}}n/a{{/cpu.total_cores}}",
213 | // "CPU sockets: {{cpu.total_sockets}} with {{cpu.cores_per_socket}} cores each", // seems like there is a sigar bug?
214 | "CPU cache: {{#cpu.cache_size}}{{cpu.cache_size}}{{/cpu.cache_size}}{{^cpu.cache_size}}n/a{{/cpu.cache_size}}"
215 | ].join(" "),
216 |
217 | osInfoTemplate2: [
218 | "Uptime: n/a ",
219 | "Refresh interval: {{refresh_interval}}ms",
220 | "Total mem: {{#mem.total}}{{mem.total}} ({{mem.total_in_bytes}} b){{/mem.total}}{{^mem.total}}n/a{{/mem.total}}",
221 | "Total swap: {{#swap.total}}{{swap.total}} ({{swap.total_in_bytes}} b){{/swap.total}}{{^swap.total}}n/a{{/swap.total}}"
222 | ].join(" "),
223 |
224 | indices1Template1: [
225 | "Docs count: n/a ",
226 | "Docs deleted: n/a "
227 | ].join(" "),
228 |
229 | indices1Template2: [
230 | "Flush: n/a ",
231 | "Refresh: n/a "
232 | ].join(" "),
233 |
234 | indices1Template3: [
235 | "Size: n/a "//,
236 | //"Filter cache size: n/a "
237 | ].join(" "),
238 |
239 | indicesSearchReqsTemplate: [
240 | "Query: n/a ",
241 | "Fetch: n/a "
242 | ].join(" "),
243 |
244 | indicesSearchTimeTemplate: [
245 | "Query: n/a ",
246 | "Fetch: n/a "
247 | ].join(" "),
248 |
249 | indicesGetReqsTemplate: [
250 | "Get: n/a ",
251 | "Exists: n/a ",
252 | "Missing: n/a "
253 | ].join(" "),
254 |
255 | indicesGetTimeTemplate: [
256 | "Get: n/a ",
257 | "Exists: n/a ",
258 | "Missing: n/a "
259 | ].join(" "),
260 |
261 | indicesCacheSizeTemplate: [
262 | "ID: n/a ",
263 | "Filter: n/a ",
264 | "Field: n/a "
265 | ].join(" "),
266 |
267 | indicesCacheEvictionsTemplate: [
268 | "Filter: n/a ",
269 | "Field: n/a "
270 | ].join(" "),
271 |
272 | indicesIndexingReqsTemplate: [
273 | "Delete: n/a ",
274 | "Index: n/a "
275 | ].join(" "),
276 |
277 | indicesIndexingTimeTemplate: [
278 | "Delete: n/a ",
279 | "Index: n/a "
280 | ].join(" "),
281 |
282 | fsDataInfoTemplate: [
283 | "Device: {{#dev}}{{dev}} {{/dev}}{{^dev}}n/a{{/dev}}
",
284 | "Mount: {{#mount}}{{mount}} {{/mount}}{{^mount}}n/a{{/mount}}
",
285 | "Path: {{path}}
",
286 | "Free: {{free}}
",
287 | "Available: {{available}}
",
288 | "Total: {{total}}
"
289 | ].join(""),
290 |
291 | fsDataInfo_cntTemplate: [
292 | "Writes: n/a
",
293 | "Reads: n/a
"
294 | ].join(""),
295 |
296 | fsDataInfo_sizeTemplate: [
297 | "Write: n/a
",
298 | "Read: n/a
"
299 | ].join("")
300 |
301 | }
302 |
303 | };
304 |
--------------------------------------------------------------------------------