kanaui 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +41 -0
- data/Rakefile +40 -0
- data/app/assets/images/back_disabled.png +0 -0
- data/app/assets/images/back_enabled.png +0 -0
- data/app/assets/images/back_enabled_hover.png +0 -0
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/images/forward_disabled.png +0 -0
- data/app/assets/images/forward_enabled.png +0 -0
- data/app/assets/images/forward_enabled_hover.png +0 -0
- data/app/assets/images/sort_asc.png +0 -0
- data/app/assets/images/sort_asc_disabled.png +0 -0
- data/app/assets/images/sort_both.png +0 -0
- data/app/assets/images/sort_desc.png +0 -0
- data/app/assets/images/sort_desc_disabled.png +0 -0
- data/app/assets/javascripts/application.js +19 -0
- data/app/assets/javascripts/kanaui/dashboard.js +131 -0
- data/app/assets/javascripts/kanaui/killbill.js +1114 -0
- data/app/assets/javascripts/kanaui/purl.js +271 -0
- data/app/assets/javascripts/kanaui/reports.dataTables.js +31 -0
- data/app/assets/javascripts/kanaui/reports.graphs.js +190 -0
- data/app/assets/javascripts/kanaui/reports.js +201 -0
- data/app/assets/javascripts/kanaui/reports.urls.js +44 -0
- data/app/assets/javascripts/kanaui/tests.js +2 -0
- data/app/assets/stylesheets/application.css +8 -0
- data/app/assets/stylesheets/bootstrap_and_overrides.css +7 -0
- data/app/assets/stylesheets/kanaui/dashboard.css +121 -0
- data/app/assets/stylesheets/kanaui/tests.css +4 -0
- data/app/controllers/kanaui/dashboard_controller.rb +59 -0
- data/app/controllers/kanaui/engine_controller.rb +18 -0
- data/app/helpers/kanaui/application_helper.rb +6 -0
- data/app/helpers/kanaui/dashboard_helper.rb +28 -0
- data/app/models/kanaui/dashboard.rb +5 -0
- data/app/views/kanaui/dashboard/index.html.erb +48 -0
- data/app/views/kanaui/layouts/kanaui_application.html.erb +43 -0
- data/config/locales/en.bootstrap.yml +18 -0
- data/config/routes.rb +10 -0
- data/lib/kanaui/engine.rb +7 -0
- data/lib/kanaui/version.rb +3 -0
- data/lib/kanaui.rb +22 -0
- data/lib/tasks/kanaui_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/config/application.rb +64 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +39 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/killbill_client.rb +4 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/production.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +6 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/tmp/cache/assets/C49/370/sprockets%2Fe0912451e460967cb546e2ac00632667 +0 -0
- data/test/dummy/tmp/cache/assets/C59/3D0/sprockets%2F22311d65dd6f27979f0144f4e9603762 +0 -0
- data/test/dummy/tmp/cache/assets/C5C/180/sprockets%2F6b609032785fe05974b318057b808dc9 +0 -0
- data/test/dummy/tmp/cache/assets/C60/440/sprockets%2F9e401779c0877cf93949e930228032ac +0 -0
- data/test/dummy/tmp/cache/assets/C61/8F0/sprockets%2Fe8f725654ee48124c086d488379340e0 +0 -0
- data/test/dummy/tmp/cache/assets/C70/FA0/sprockets%2F43c86018a096a0a65a0905da2b709455 +0 -0
- data/test/dummy/tmp/cache/assets/C7A/180/sprockets%2F19b994259f9c7b6f2879718c3275f359 +0 -0
- data/test/dummy/tmp/cache/assets/C8A/AB0/sprockets%2Fdc2f837cd27313996699c80342b07e04 +0 -0
- data/test/dummy/tmp/cache/assets/C8C/2E0/sprockets%2F8ef8759ba58c509567a8444201c19b24 +0 -0
- data/test/dummy/tmp/cache/assets/C97/750/sprockets%2F34d94639228f869665db78f42ca3118e +0 -0
- data/test/dummy/tmp/cache/assets/CA2/C20/sprockets%2F1d186d79051934c85a0594a610a1ab6b +0 -0
- data/test/dummy/tmp/cache/assets/CB3/D00/sprockets%2F6e18e78b81412e49d335a04a68f16c35 +0 -0
- data/test/dummy/tmp/cache/assets/CBF/560/sprockets%2Fe944ecb8026957a176e29a392a069f46 +0 -0
- data/test/dummy/tmp/cache/assets/CC5/C70/sprockets%2Fc4dacfb400c37f046545be4501065313 +0 -0
- data/test/dummy/tmp/cache/assets/CCA/090/sprockets%2Fc04069b3046b34950b843e32bbdf2a60 +0 -0
- data/test/dummy/tmp/cache/assets/CCF/750/sprockets%2F0512cc5ddae07c2bf0861332668640e4 +0 -0
- data/test/dummy/tmp/cache/assets/CCF/FC0/sprockets%2F09d578e3a00293a0e60b65f01ed551c4 +0 -0
- data/test/dummy/tmp/cache/assets/CD0/E60/sprockets%2F34b252a436ea97340eb6a33353ec7c60 +0 -0
- data/test/dummy/tmp/cache/assets/CD9/960/sprockets%2F9faf733d3c943879081f001120abfc09 +0 -0
- data/test/dummy/tmp/cache/assets/CDA/100/sprockets%2F1421707c6cd2bf4619c218d15c5ed449 +0 -0
- data/test/dummy/tmp/cache/assets/CDD/750/sprockets%2F51c5d9b965a7a23e2703b0d8c74d1358 +0 -0
- data/test/dummy/tmp/cache/assets/CE3/750/sprockets%2Fc54b480c74716d0ff447cc13f9471f25 +0 -0
- data/test/dummy/tmp/cache/assets/CE6/EF0/sprockets%2F358f2a7450053d2e7e60d219787ede7a +0 -0
- data/test/dummy/tmp/cache/assets/CF1/600/sprockets%2F758e0f59cc7d377813b72e9f17109c2d +0 -0
- data/test/dummy/tmp/cache/assets/CF4/4C0/sprockets%2F66ae774f6007684bc3ce544d15a879f9 +0 -0
- data/test/dummy/tmp/cache/assets/CF4/910/sprockets%2F47246555fd8dde5f73d513149bd7d495 +0 -0
- data/test/dummy/tmp/cache/assets/CFB/570/sprockets%2F70a944fdac8557dc70819ec989604e95 +0 -0
- data/test/dummy/tmp/cache/assets/D04/E10/sprockets%2F32fb56262b67a8013f6d1fe3bc45263b +0 -0
- data/test/dummy/tmp/cache/assets/D0A/8E0/sprockets%2Faaccd4041294c01f9d52b59d90e61649 +0 -0
- data/test/dummy/tmp/cache/assets/D0D/B20/sprockets%2F83c8c6d067f200b94289a27ae217cd2d +0 -0
- data/test/dummy/tmp/cache/assets/D16/140/sprockets%2F71765207ccd3c89388ba290d1ead7e73 +0 -0
- data/test/dummy/tmp/cache/assets/D16/610/sprockets%2Fc45f9a1f74ae89810e305307c8c2c98a +0 -0
- data/test/dummy/tmp/cache/assets/D1A/1A0/sprockets%2Fa9e56834936cc1d4e033ed75459f7ac1 +0 -0
- data/test/dummy/tmp/cache/assets/D1D/880/sprockets%2Fe29808c67d12f86b83bb3f545e0685cc +0 -0
- data/test/dummy/tmp/cache/assets/D28/2F0/sprockets%2F0c216cfb363ad008c4dd27e21e286e20 +0 -0
- data/test/dummy/tmp/cache/assets/D29/350/sprockets%2Fa251294b0bc12651ee0dd16fb427ed08 +0 -0
- data/test/dummy/tmp/cache/assets/D2E/DD0/sprockets%2F4aab8120d7fdda3c3101795fc937044a +0 -0
- data/test/dummy/tmp/cache/assets/D33/E20/sprockets%2F01e77b5ab7c8f25d7e007e42d210e60f +0 -0
- data/test/dummy/tmp/cache/assets/D3A/5A0/sprockets%2F3205c58e5fc648bb07247dd6fc1aa058 +0 -0
- data/test/dummy/tmp/cache/assets/D3B/B20/sprockets%2Ff25927a9a796c888c93f9892db4ded57 +0 -0
- data/test/dummy/tmp/cache/assets/D3C/BA0/sprockets%2F499c3460b0df4ea435a25d1fa3776ae7 +0 -0
- data/test/dummy/tmp/cache/assets/D3D/FD0/sprockets%2F6cd2d6e10e5aa7649192213d87ae1dd8 +0 -0
- data/test/dummy/tmp/cache/assets/D40/880/sprockets%2Fa65183bd762da798d82ca16b2384ae3e +0 -0
- data/test/dummy/tmp/cache/assets/D4A/220/sprockets%2Fc3fa86c7916fd5cf3448a46c2701d48f +0 -0
- data/test/dummy/tmp/cache/assets/D4A/710/sprockets%2F19bdf938259f801b6bc26fda54907c3f +0 -0
- data/test/dummy/tmp/cache/assets/D50/880/sprockets%2F6491c413570f9b5ee67b43dae6fb988b +0 -0
- data/test/dummy/tmp/cache/assets/D5C/600/sprockets%2Fdd005cf1e2da44e307bfb30f6e711177 +0 -0
- data/test/dummy/tmp/cache/assets/D62/6B0/sprockets%2Feb40cf55d9fba5bb18801041e5a755b4 +0 -0
- data/test/dummy/tmp/cache/assets/D65/7F0/sprockets%2Fc431bdd5c16d69e6d48b025be24e07b3 +0 -0
- data/test/dummy/tmp/cache/assets/D6D/170/sprockets%2Fe7474ced980c0a511ab3ed94ca66507f +0 -0
- data/test/dummy/tmp/cache/assets/D6F/2F0/sprockets%2Ff83749b55e1a31b4bc71d8f10c9c8ed1 +0 -0
- data/test/dummy/tmp/cache/assets/D71/CA0/sprockets%2F2efce3b73b5a0834d61c30f3e88f943e +0 -0
- data/test/dummy/tmp/cache/assets/D71/D00/sprockets%2F8f431cf56efe254dc4ad2f39f1f05325 +0 -0
- data/test/dummy/tmp/cache/assets/D72/FC0/sprockets%2F0e88a2c64eef7d00ae16ec3d6587446b +0 -0
- data/test/dummy/tmp/cache/assets/D74/AA0/sprockets%2F2a2594863afdfb329cf44429c3f4cdb6 +0 -0
- data/test/dummy/tmp/cache/assets/D78/5F0/sprockets%2Fd779c87f1d25bc5e67e24be981ab005e +0 -0
- data/test/dummy/tmp/cache/assets/D7D/230/sprockets%2F0d9f8069a79511caa7b72d8f7e9ba3e6 +0 -0
- data/test/dummy/tmp/cache/assets/D7E/D40/sprockets%2Fbb1ee49d28b0f4826af433e66b99f68b +0 -0
- data/test/dummy/tmp/cache/assets/D7F/D40/sprockets%2F5df2d7d854a34efce561038973fea75e +0 -0
- data/test/dummy/tmp/cache/assets/D80/C00/sprockets%2F807575a6bca580997ea68b2849eeebab +0 -0
- data/test/dummy/tmp/cache/assets/D8D/640/sprockets%2F3cb906dcb26ce1bb8b148a9ec38151a0 +0 -0
- data/test/dummy/tmp/cache/assets/D8F/740/sprockets%2Fc28d091b6eec75f690312b1babac173e +0 -0
- data/test/dummy/tmp/cache/assets/D99/810/sprockets%2F40a77b8fdb5dbb4a8be79582930bac11 +0 -0
- data/test/dummy/tmp/cache/assets/D9B/590/sprockets%2F415dfd73bc9dcf11a3c443636a7cc85d +0 -0
- data/test/dummy/tmp/cache/assets/D9F/0E0/sprockets%2Fe225dd3abeea78368f1e094da4d6e038 +0 -0
- data/test/dummy/tmp/cache/assets/DA0/D50/sprockets%2Fbe08c987f77ac1cf011f2c295f64ae0e +0 -0
- data/test/dummy/tmp/cache/assets/DA0/DF0/sprockets%2F54a3fbb89812981e0ddd9f293ee0cca0 +0 -0
- data/test/dummy/tmp/cache/assets/DA2/9A0/sprockets%2Fc217dc63d5bb979ab458f9440b8aaeb5 +0 -0
- data/test/dummy/tmp/cache/assets/DAC/420/sprockets%2F8419ce35fe9f11d3ea2c9f8edb48a661 +0 -0
- data/test/dummy/tmp/cache/assets/DB0/FA0/sprockets%2Ff3e0e6737d4f66ef48581ed3f26cc2fc +0 -0
- data/test/dummy/tmp/cache/assets/DB7/B30/sprockets%2Fa35d57efd41de3d595e79db74d99a6a7 +0 -0
- data/test/dummy/tmp/cache/assets/DBD/520/sprockets%2F646b4ef551d2e6dbcafc30ec6a1a1921 +0 -0
- data/test/dummy/tmp/cache/assets/DC3/A40/sprockets%2Fec0ae4ff1ed6a72c0fc4ec564700195b +0 -0
- data/test/dummy/tmp/cache/assets/DCA/970/sprockets%2Fa5b14cb6e98a7b2f9dfdd413420d3be7 +0 -0
- data/test/dummy/tmp/cache/assets/DCD/570/sprockets%2Fdacdabcd4b599417317af696f0bc70f3 +0 -0
- data/test/dummy/tmp/cache/assets/DD0/630/sprockets%2F1a6f238c9a7e8609caef71fff2ad1a16 +0 -0
- data/test/dummy/tmp/cache/assets/DD4/F20/sprockets%2Fe280ef07c4f086afbc447e8a3df6e4e2 +0 -0
- data/test/dummy/tmp/cache/assets/DD5/460/sprockets%2F6670c88dab8f5cb0b36bd51caf58a87f +0 -0
- data/test/dummy/tmp/cache/assets/DD9/7A0/sprockets%2Fa913b7e4c6665cd4d75cd5e4efa46b8c +0 -0
- data/test/dummy/tmp/cache/assets/DE8/770/sprockets%2Fce3edfabfb12520c063ee21bd2ea1858 +0 -0
- data/test/dummy/tmp/cache/assets/DEA/910/sprockets%2F96c4857b4f859eef5c6bf113ecdb8ce9 +0 -0
- data/test/dummy/tmp/cache/assets/DEF/590/sprockets%2Fb8d8adfe3d233e16821faf0cbd03a09d +0 -0
- data/test/dummy/tmp/cache/assets/DF6/EA0/sprockets%2Fda2b70e5c0a5e5e5b2b8e4f3438aaf6f +0 -0
- data/test/dummy/tmp/cache/assets/E01/6A0/sprockets%2Feeec15d595b932dabdbb8f2fd66266b1 +0 -0
- data/test/dummy/tmp/cache/assets/E60/DF0/sprockets%2F7dced5bcfe17976cc5e41ffc1c33dbd2 +0 -0
- data/test/dummy/tmp/cache/assets/E8B/700/sprockets%2F3bd227fedfbfab5ede67a13feec45e14 +0 -0
- data/test/fixtures/kanaui/dashboards.yml +11 -0
- data/test/functional/kanaui/tests_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/kanaui_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/helpers/kanaui/tests_helper_test.rb +6 -0
- metadata +551 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0062306c09c83f340e9d80dadaeddb70e3ee2b06
|
4
|
+
data.tar.gz: 6e7adf09c68bdfcdadac7572647e7dd74e0bb809
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f9af0d7e567c1817c08a9d937d544c430a5a13f66408ccafd7be2f2e5a04e2674794157144fdb91082637bd0d8166bfcb7d236335f3108f6a0d26fed15322b03
|
7
|
+
data.tar.gz: f0840efa5328480aee4b3be35b387889b4d6ae043a29049c3b4eb30cfbddb714a4fbfe58e5c544322a37b5f653f771855ac35efd06d040b205fdb72f0ac7f102
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
Overview
|
3
|
+
========
|
4
|
+
|
5
|
+
`Kanaui` stands for Kill Bill Analytics UI. This is a mountable rails engine which allows to view the analytics dashboard. In order to work correctly:
|
6
|
+
* Kill Bill must be running somewhere with the analytics plugin
|
7
|
+
* Kanaui can be started locally or can be mounted in a rails APP.
|
8
|
+
|
9
|
+
|
10
|
+
Getting Started
|
11
|
+
===============
|
12
|
+
|
13
|
+
You can run Kanaui locally by using the test/dummy app provided and interracting with a running version of Kill Bill along with the analytics plugin. In that mode,
|
14
|
+
there is no support for authorization and no support for multi-tenancy. Instead, Kanaui will use the default user `admin:password` and rely on static configuration
|
15
|
+
to provide the tenant apiKey and apiSecret.
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
Kanaui Configuration
|
20
|
+
--------------------
|
21
|
+
|
22
|
+
Specify your Kill Bill server url, api key and secret in ```test/dummy/config/initializers/killbill_client.rb```:
|
23
|
+
|
24
|
+
```
|
25
|
+
KillBillClient.url = 'http://127.0.0.1:8080/'
|
26
|
+
KillBillClient.api_key = 'bob'
|
27
|
+
KillBillClient.api_secret = 'lazar'
|
28
|
+
```
|
29
|
+
|
30
|
+
Running Kanaui
|
31
|
+
--------------
|
32
|
+
|
33
|
+
You can run Kanaui locally by using the test/dummy app provided:
|
34
|
+
|
35
|
+
```
|
36
|
+
bundle install
|
37
|
+
cd test/dummy
|
38
|
+
export RAILS_ENV=development
|
39
|
+
bundle install
|
40
|
+
rails server
|
41
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Kanaui'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require js-routes
|
8
|
+
//= require log4javascript
|
9
|
+
//= require moment.min
|
10
|
+
//= require spin.min
|
11
|
+
//= require jquery
|
12
|
+
//= require jquery_ujs
|
13
|
+
//= require twitter/bootstrap
|
14
|
+
//= require bootstrap-datepicker
|
15
|
+
//= require bootstrap
|
16
|
+
//= require jquery.dataTables.min
|
17
|
+
//= require jquery.spin
|
18
|
+
//= require d3
|
19
|
+
//= require_tree ./kanaui
|
@@ -0,0 +1,131 @@
|
|
1
|
+
$(document).ready(function() {
|
2
|
+
|
3
|
+
setupDebugLog();
|
4
|
+
|
5
|
+
var reports = new Reports();
|
6
|
+
reports.init();
|
7
|
+
|
8
|
+
// https://github.com/twbs/bootstrap/issues/2097
|
9
|
+
$('.dropdown-menu').on('click', function(e){
|
10
|
+
if ($(this).hasClass('dropdown-menu-form')){
|
11
|
+
e.stopPropagation();
|
12
|
+
}
|
13
|
+
});
|
14
|
+
|
15
|
+
initializeDatePicker(reports);
|
16
|
+
|
17
|
+
// Configure the refresh button callback
|
18
|
+
$('#refresh-graphs').click(function() {
|
19
|
+
$(location).attr('href', reports.buildRefreshURL());
|
20
|
+
});
|
21
|
+
|
22
|
+
// Configure the default graphs
|
23
|
+
$('#reset-dashboards').click(function() {
|
24
|
+
$(location).attr('href', reports.buildRefreshURL({}));
|
25
|
+
});
|
26
|
+
$('#standard-analytics-dashboards').click(function() {
|
27
|
+
$(location).attr('href', reports.buildRefreshURL(reports.ANALYTICS_REPORTS.reports) + '&__preset=ANALYTICS');
|
28
|
+
});
|
29
|
+
$('#standard-system-dashboards').click(function() {
|
30
|
+
$(location).attr('href', reports.buildRefreshURL(reports.SYSTEM_REPORTS.reports) + '&__preset=SYSTEM');
|
31
|
+
});
|
32
|
+
// Highlight the menu links
|
33
|
+
var preset = $.url().param('__preset');
|
34
|
+
if (preset == 'ANALYTICS') {
|
35
|
+
$('#standard-analytics-dashboards-wrapper').addClass('active');
|
36
|
+
} else if (preset == 'SYSTEM') {
|
37
|
+
$('#standard-system-dashboards-wrapper').addClass('active');
|
38
|
+
}
|
39
|
+
|
40
|
+
// Display the loading indicator
|
41
|
+
var spinOptions = {
|
42
|
+
top: '150px',
|
43
|
+
lines: 10,
|
44
|
+
length: 8,
|
45
|
+
width: 4,
|
46
|
+
radius: 8,
|
47
|
+
speed: 1
|
48
|
+
}
|
49
|
+
$('#loading-spinner').spin(spinOptions);
|
50
|
+
|
51
|
+
// Finally, draw the graphs
|
52
|
+
reports.getDataForReports(function(dataForAllReports) {
|
53
|
+
// As a hint the AJAX requests are done, accelerate the spinner
|
54
|
+
spinOptions['speed'] = 4;
|
55
|
+
$('#loading-spinner').spin(spinOptions);
|
56
|
+
|
57
|
+
try {
|
58
|
+
if (dataForAllReports.length == 0) {
|
59
|
+
displayInfo("Use the menu to select reports");
|
60
|
+
} else {
|
61
|
+
var reportsGraphs = new ReportsGraphs(reports);
|
62
|
+
reportsGraphs.drawAll(dataForAllReports);
|
63
|
+
}
|
64
|
+
} finally {
|
65
|
+
// Hide the loading indicator
|
66
|
+
$('#loading-spinner').spin(false);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
});
|
70
|
+
|
71
|
+
//
|
72
|
+
// Utils
|
73
|
+
//
|
74
|
+
|
75
|
+
function initializeDatePicker(reports) {
|
76
|
+
|
77
|
+
//
|
78
|
+
// We are using http://www.eyecon.ro/bootstrap-datepicker/ but thgere seems to be a fork of it:
|
79
|
+
// https://github.com/eternicode/bootstrap-datepicker that seems better.
|
80
|
+
//
|
81
|
+
$('#start-date').datepicker()
|
82
|
+
.on('changeDate', function(ev){
|
83
|
+
var newDate = new Date(ev.date.valueOf()).toISOString().split('T')[0]
|
84
|
+
reports.startDate = newDate;
|
85
|
+
$(this).datepicker('hide');
|
86
|
+
}).data('datepicker');
|
87
|
+
|
88
|
+
$('#end-date').datepicker()
|
89
|
+
.on('changeDate', function(ev){
|
90
|
+
var newDate = new Date(ev.date.valueOf()).toISOString().split('T')[0]
|
91
|
+
reports.endDate = newDate;
|
92
|
+
$(this).datepicker('hide');
|
93
|
+
}).data('datepicker');
|
94
|
+
|
95
|
+
$('#start-date').datepicker('setValue', reports.startDate);
|
96
|
+
$('#end-date').datepicker('setValue', reports.endDate);
|
97
|
+
}
|
98
|
+
|
99
|
+
function setupDebugLog() {
|
100
|
+
// Setup the debug logs
|
101
|
+
var consoleAppender = new log4javascript.BrowserConsoleAppender();
|
102
|
+
consoleAppender.setThreshold(log4javascript.Level.INFO);
|
103
|
+
var layout = new log4javascript.PatternLayout("%d [%-5p] %m{5}");
|
104
|
+
consoleAppender.setLayout(layout);
|
105
|
+
window.log = log4javascript.getLogger();
|
106
|
+
window.log.addAppender(consoleAppender);
|
107
|
+
}
|
108
|
+
|
109
|
+
function dateFromDatepicker(datepicker) {
|
110
|
+
if (datepicker && datepicker.dates.length > 0) {
|
111
|
+
var date = datepicker.getDate();
|
112
|
+
return moment(date).format('YYYY[-]MM[-]DD');
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
function displayInfo(msg) {
|
117
|
+
$('#alert-info').html(msg);
|
118
|
+
$('#alert-info').show();
|
119
|
+
}
|
120
|
+
|
121
|
+
function displayError(msg) {
|
122
|
+
$('#alert-error').html(msg);
|
123
|
+
$('#alert-error').show();
|
124
|
+
}
|
125
|
+
|
126
|
+
// http://stackoverflow.com/questions/646628/javascript-startswith
|
127
|
+
if (typeof String.prototype.startsWith != 'function') {
|
128
|
+
String.prototype.startsWith = function(str) {
|
129
|
+
return this.slice(0, str.length) == str;
|
130
|
+
};
|
131
|
+
}
|