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
@@ -0,0 +1,44 @@
|
|
1
|
+
function ReportsUrls(reportName) {
|
2
|
+
this.url = reportName;
|
3
|
+
|
4
|
+
// See com.ning.billing.osgi.bundles.analytics.reports.ReportSpecification
|
5
|
+
this.reportSpecificationsSeparator = '^';
|
6
|
+
this.reportSpecificationSeparator = ':';
|
7
|
+
|
8
|
+
// See com.ning.billing.osgi.bundles.analytics.reports.sql.Cases
|
9
|
+
this.groupsSeparator = '|';
|
10
|
+
}
|
11
|
+
|
12
|
+
ReportsUrls.prototype.addDimension = function(dimension, groups) {
|
13
|
+
var dimensionWithGroups = dimension;
|
14
|
+
|
15
|
+
var that = this;
|
16
|
+
$.each(groups || [], function(i, group) {
|
17
|
+
if (i == 0) {
|
18
|
+
dimensionWithGroups += '(';
|
19
|
+
}
|
20
|
+
|
21
|
+
dimensionWithGroups += groups[i];
|
22
|
+
|
23
|
+
if (i == groups.length - 1) {
|
24
|
+
dimensionWithGroups += ')';
|
25
|
+
} else {
|
26
|
+
dimensionWithGroups += that.groupsSeparator;
|
27
|
+
}
|
28
|
+
});
|
29
|
+
|
30
|
+
return this.addSpecification('dimension', dimensionWithGroups);
|
31
|
+
}
|
32
|
+
|
33
|
+
ReportsUrls.prototype.addMetric = function(metric) {
|
34
|
+
return this.addSpecification('metric', metric);
|
35
|
+
}
|
36
|
+
|
37
|
+
ReportsUrls.prototype.addFilter = function(filter) {
|
38
|
+
return this.addSpecification('filter', filter);
|
39
|
+
}
|
40
|
+
|
41
|
+
ReportsUrls.prototype.addSpecification = function(specificationString, specificationValue) {
|
42
|
+
this.url += this.reportSpecificationsSeparator + specificationString + this.reportSpecificationSeparator + encodeURIComponent(specificationValue);
|
43
|
+
return this;
|
44
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require datepicker
|
7
|
+
*= require_tree .
|
8
|
+
*/
|
@@ -0,0 +1,121 @@
|
|
1
|
+
body {
|
2
|
+
padding-top: 20px;
|
3
|
+
padding-bottom: 20px;
|
4
|
+
}
|
5
|
+
|
6
|
+
.top-buffer { margin-top:300px; }
|
7
|
+
|
8
|
+
.truncate-text {
|
9
|
+
overflow: hidden;
|
10
|
+
text-overflow: ellipsis;
|
11
|
+
}
|
12
|
+
|
13
|
+
.navbar {
|
14
|
+
margin-bottom: 20px;
|
15
|
+
}
|
16
|
+
|
17
|
+
#custom-dashboard-builder {
|
18
|
+
width: 100%;
|
19
|
+
}
|
20
|
+
|
21
|
+
#custom-dashboard-builder li.checkbox {
|
22
|
+
margin-left: 10px;
|
23
|
+
}
|
24
|
+
|
25
|
+
.dataTableWrapper {
|
26
|
+
margin-bottom: 50px;
|
27
|
+
margin-left: 10%;
|
28
|
+
margin-right: 10%;
|
29
|
+
}
|
30
|
+
|
31
|
+
.swatch {
|
32
|
+
width: 10px;
|
33
|
+
height: 10px;
|
34
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
35
|
+
display: inline-block;
|
36
|
+
margin-right: 3px;
|
37
|
+
border-radius: 2px;
|
38
|
+
}
|
39
|
+
|
40
|
+
.legend {
|
41
|
+
display: inline-block;
|
42
|
+
vertical-align: top;
|
43
|
+
}
|
44
|
+
|
45
|
+
.charts {
|
46
|
+
display: inline-block;
|
47
|
+
position: relative;
|
48
|
+
background-color: white;
|
49
|
+
}
|
50
|
+
|
51
|
+
text {
|
52
|
+
font: 12px sans-serif;
|
53
|
+
pointer-events: none;
|
54
|
+
}
|
55
|
+
|
56
|
+
text.shadow {
|
57
|
+
stroke: #fff;
|
58
|
+
stroke-width: 3px;
|
59
|
+
stroke-opacity: .8;
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
.overlay {
|
64
|
+
position: fixed;
|
65
|
+
top: 0;
|
66
|
+
left: 0;
|
67
|
+
z-index: 10000;
|
68
|
+
}
|
69
|
+
|
70
|
+
circle {
|
71
|
+
fill-opacity: .8;
|
72
|
+
stroke: #fff;
|
73
|
+
}
|
74
|
+
|
75
|
+
path {
|
76
|
+
stroke: none;
|
77
|
+
fill: none;
|
78
|
+
}
|
79
|
+
.axis {
|
80
|
+
shape-rendering: crispEdges;
|
81
|
+
}
|
82
|
+
.x.axis line {
|
83
|
+
stroke: lightgrey;
|
84
|
+
}
|
85
|
+
.x.axis .minor {
|
86
|
+
stroke-opacity: .5;
|
87
|
+
}
|
88
|
+
.x.axis path {
|
89
|
+
display: none;
|
90
|
+
}
|
91
|
+
|
92
|
+
.y.axis line {
|
93
|
+
fill: none;
|
94
|
+
stroke: lightgrey;
|
95
|
+
}
|
96
|
+
|
97
|
+
.y.axis path {
|
98
|
+
fill: none;
|
99
|
+
stroke: #000;
|
100
|
+
}
|
101
|
+
|
102
|
+
.title {
|
103
|
+
font: 15px sans-serif;
|
104
|
+
font-weight: bold;
|
105
|
+
}
|
106
|
+
|
107
|
+
.bar rect {
|
108
|
+
fill: steelblue;
|
109
|
+
shape-rendering: crispEdges;
|
110
|
+
}
|
111
|
+
|
112
|
+
.bar text {
|
113
|
+
fill: #fff;
|
114
|
+
}
|
115
|
+
|
116
|
+
.legend {
|
117
|
+
padding: 5px;
|
118
|
+
font: 10px sans-serif;
|
119
|
+
background: yellow;
|
120
|
+
box-shadow: 2px 2px 1px #888;
|
121
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Kanaui
|
2
|
+
class DashboardController < Kanaui::EngineController
|
3
|
+
|
4
|
+
#
|
5
|
+
# Load the dashboard by rendering the view and executing the javascript that will call
|
6
|
+
# the reports and available_reports endpoints below.
|
7
|
+
#
|
8
|
+
def index
|
9
|
+
|
10
|
+
user = current_tenant_user
|
11
|
+
options = {
|
12
|
+
:username => user[:username],
|
13
|
+
:password => user[:password],
|
14
|
+
:session_id => user[:session_id],
|
15
|
+
:api_key => user[:api_key],
|
16
|
+
:api_secret => user[:api_secret]
|
17
|
+
}
|
18
|
+
|
19
|
+
raw_reports = Kanaui::DashboardHelper::DashboardApi.available_reports(options)
|
20
|
+
|
21
|
+
@startDate = params['startDate'] || (Date.today << 3).to_s
|
22
|
+
@endDate = params['endDate'] || Date.today.to_s
|
23
|
+
|
24
|
+
@reports = JSON.parse(raw_reports)
|
25
|
+
render
|
26
|
+
end
|
27
|
+
|
28
|
+
# Not used anymore as reports are pulled from index
|
29
|
+
def available_reports
|
30
|
+
user = current_tenant_user
|
31
|
+
options = {
|
32
|
+
:username => user[:username],
|
33
|
+
:password => user[:password],
|
34
|
+
:session_id => user[:session_id],
|
35
|
+
:api_key => user[:api_key],
|
36
|
+
:api_secret => user[:api_secret]
|
37
|
+
}
|
38
|
+
|
39
|
+
available_reports = Kanaui::DashboardHelper::DashboardApi.available_reports(options)
|
40
|
+
render json: available_reports
|
41
|
+
end
|
42
|
+
|
43
|
+
def reports
|
44
|
+
user = current_tenant_user
|
45
|
+
options = {
|
46
|
+
:username => user[:username],
|
47
|
+
:password => user[:password],
|
48
|
+
:session_id => user[:session_id],
|
49
|
+
:api_key => user[:api_key],
|
50
|
+
:api_secret => user[:api_secret]
|
51
|
+
}
|
52
|
+
|
53
|
+
format = params['format'] || 'json'
|
54
|
+
reports = Kanaui::DashboardHelper::DashboardApi.reports(params['startDate'], params['endDate'], params['name'], params['smooth'], format, options)
|
55
|
+
render json: reports
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Kanaui
|
2
|
+
class EngineController < ApplicationController
|
3
|
+
|
4
|
+
layout :get_layout
|
5
|
+
|
6
|
+
def get_layout
|
7
|
+
layout ||= Kanaui.config[:layout]
|
8
|
+
end
|
9
|
+
|
10
|
+
def current_tenant_user()
|
11
|
+
# If the rails application on which that engine is mounted defines such method (Devise), we extract the current user,
|
12
|
+
# if not we default to nil, and serve our static mock configuration
|
13
|
+
user = current_user if respond_to?(:current_user)
|
14
|
+
Kanaui.current_tenant_user.call(session, user)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Kanaui
|
2
|
+
module DashboardHelper
|
3
|
+
|
4
|
+
class DashboardApi < KillBillClient::Model::Resource
|
5
|
+
|
6
|
+
KILLBILL_ANALYTICS_PREFIX = "/plugins/killbill-analytics"
|
7
|
+
|
8
|
+
class << self
|
9
|
+
|
10
|
+
def available_reports(options = {})
|
11
|
+
path = "#{KILLBILL_ANALYTICS_PREFIX}/plugins/killbill-analytics/reports"
|
12
|
+
response = KillBillClient::API.get path, {}, options
|
13
|
+
response.body
|
14
|
+
end
|
15
|
+
|
16
|
+
def reports(start_date, end_date, name, smooth, format, options = {})
|
17
|
+
path = "#{KILLBILL_ANALYTICS_PREFIX}/plugins/killbill-analytics/reports?format=json&startDate=#{start_date}&endDate=#{end_date}&name=#{name}"
|
18
|
+
path = "#{path}&smooth=#{smooth}" if smooth
|
19
|
+
response = KillBillClient::API.get path, {}, options
|
20
|
+
response.body
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<div class="row-fluid">
|
2
|
+
<!-- MENU -->
|
3
|
+
<div class="span2">
|
4
|
+
<h4>Available Reports:</h4>
|
5
|
+
<ul class="nav nav-tabs nav-stacked">
|
6
|
+
<% @reports.each do |r| %>
|
7
|
+
<li><%= link_to r['reportName'], kanaui_engine.dashboard_index_path(:params => {'startDate' => @startDate, 'endDate' => @endDate, 'report1' => r['reportName']}), :class => "truncate-text" %></li>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<!-- DASHBOARD -->
|
13
|
+
<div class="span7">
|
14
|
+
<div class="row-fluid">
|
15
|
+
<div id='loading-spinner'></div>
|
16
|
+
<div id="chartAnchor"></div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<div class="span3">
|
20
|
+
<div class="row-fluid">
|
21
|
+
<form class="form-horizontal">
|
22
|
+
<div class="control-group">
|
23
|
+
<label class="control-label" for="start-date">Start date</label>
|
24
|
+
|
25
|
+
<div class="controls">
|
26
|
+
<input type="text" class="input-small" id="start-date"
|
27
|
+
data-date-format="yyyy-mm-dd">
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<div class="control-group">
|
31
|
+
<label class="control-label" for="end-date">End date</label>
|
32
|
+
|
33
|
+
<div class="controls">
|
34
|
+
<input type="text" class="input-small" id="end-date"
|
35
|
+
data-date-format="yyyy-mm-dd">
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<div class="control-group">
|
39
|
+
<div class="controls">
|
40
|
+
<button type="button" class="btn btn-default btn-sm" id="refresh-graphs">
|
41
|
+
<span class="icon-refresh"></span>
|
42
|
+
</button>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</form>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
</div>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Kanaui</title>
|
5
|
+
<%= stylesheet_link_tag "application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<div class="navbar navbar-inverse">
|
10
|
+
<div class="navbar-inner">
|
11
|
+
<div class="container">
|
12
|
+
<ul class="nav">
|
13
|
+
<li class="active"><a href="#">Menu 1</a></li>
|
14
|
+
<li class="active"><a href="#">Menu 2</a></li>
|
15
|
+
<li class="active"><a href="#">Menu 3</a></li>
|
16
|
+
</ul>
|
17
|
+
<ul class="nav pull-right">
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<div class="container-fluid">
|
23
|
+
<%- # :alert used by devise -%>
|
24
|
+
<% [:error, :alert].each do |key| %>
|
25
|
+
<% if flash[key] %>
|
26
|
+
<div class="row-fluid">
|
27
|
+
<div class="span10 offset2">
|
28
|
+
<div class="alert alert-error"><%= flash[key] %></div>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
<% if flash[:notice] %>
|
34
|
+
<div class="row-fluid">
|
35
|
+
<div class="span10 offset2">
|
36
|
+
<div class="alert alert-info"><%= flash[:notice] %></div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
<% end %>
|
40
|
+
<%= yield %>
|
41
|
+
</div>
|
42
|
+
</body>
|
43
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
en:
|
5
|
+
helpers:
|
6
|
+
actions: "Actions"
|
7
|
+
links:
|
8
|
+
back: "Back"
|
9
|
+
cancel: "Cancel"
|
10
|
+
confirm: "Are you sure?"
|
11
|
+
destroy: "Delete"
|
12
|
+
new: "New"
|
13
|
+
edit: "Edit"
|
14
|
+
titles:
|
15
|
+
edit: "Edit %{model}"
|
16
|
+
save: "Save %{model}"
|
17
|
+
new: "New %{model}"
|
18
|
+
delete: "Delete %{model}"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Kanaui::Engine.routes.draw do
|
2
|
+
|
3
|
+
resources :dashboard, :only => [ :index ]
|
4
|
+
scope "/dashboard" do
|
5
|
+
match "/available_reports" => "dashboard#available_reports", :via => :get, :as => "available_reports"
|
6
|
+
match "/reports" => "dashboard#reports", :via => :get, :as => "reports"
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
end
|
data/lib/kanaui.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "kanaui/engine"
|
2
|
+
|
3
|
+
module Kanaui
|
4
|
+
|
5
|
+
mattr_accessor :current_tenant_user
|
6
|
+
mattr_accessor :kanaui_current_user
|
7
|
+
mattr_accessor :layout
|
8
|
+
|
9
|
+
self.current_tenant_user = lambda { |session, user|
|
10
|
+
{:username => 'admin',
|
11
|
+
:password => 'password',
|
12
|
+
:session_id => nil,
|
13
|
+
:api_key => KillBillClient.api_key,
|
14
|
+
:api_secret => KillBillClient.api_secret}
|
15
|
+
}
|
16
|
+
|
17
|
+
def self.config(&block)
|
18
|
+
{
|
19
|
+
:layout => layout || 'kanaui/layouts/kanaui_application',
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|