kaui 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/app/assets/stylesheets/kaui/common.less +0 -6
  4. data/app/assets/stylesheets/kaui/datatable.less +14 -0
  5. data/app/assets/stylesheets/kaui/home.less +4 -0
  6. data/app/controllers/kaui/accounts_controller.rb +37 -0
  7. data/app/controllers/kaui/admin_allowed_users_controller.rb +2 -2
  8. data/app/controllers/kaui/admin_controller.rb +27 -0
  9. data/app/controllers/kaui/admin_tenants_controller.rb +8 -2
  10. data/app/controllers/kaui/engine_controller.rb +2 -2
  11. data/app/controllers/kaui/engine_controller_util.rb +1 -1
  12. data/app/controllers/kaui/home_controller.rb +3 -1
  13. data/app/controllers/kaui/invoices_controller.rb +10 -0
  14. data/app/controllers/kaui/payments_controller.rb +31 -7
  15. data/app/controllers/kaui/queues_controller.rb +11 -0
  16. data/app/controllers/kaui/subscriptions_controller.rb +20 -2
  17. data/app/controllers/kaui/tags_controller.rb +11 -0
  18. data/app/controllers/kaui/transactions_controller.rb +27 -4
  19. data/app/helpers/kaui/account_helper.rb +1 -1
  20. data/app/helpers/kaui/application_helper.rb +5 -0
  21. data/app/helpers/kaui/date_helper.rb +5 -1
  22. data/app/helpers/kaui/payment_helper.rb +9 -0
  23. data/app/models/kaui/admin.rb +75 -0
  24. data/app/models/kaui/invoice_payment.rb +26 -9
  25. data/app/models/kaui/payment.rb +2 -0
  26. data/app/models/kaui/payment_method.rb +18 -5
  27. data/app/models/kaui/transaction.rb +8 -0
  28. data/app/models/kaui/user.rb +4 -0
  29. data/app/views/kaui/accounts/_account_info.html.erb +23 -2
  30. data/app/views/kaui/accounts/_billing_info.html.erb +21 -0
  31. data/app/views/kaui/accounts/_form.html.erb +14 -8
  32. data/app/views/kaui/accounts/index.html.erb +5 -2
  33. data/app/views/kaui/admin/index.html.erb +39 -0
  34. data/app/views/kaui/admin/index.js.erb +3 -0
  35. data/app/views/kaui/admin_allowed_users/show.html.erb +2 -2
  36. data/app/views/kaui/admin_tenants/_tenant_details.html.erb +15 -0
  37. data/app/views/kaui/admin_tenants/_useful_links.html.erb +18 -0
  38. data/app/views/kaui/admin_tenants/new_catalog.html.erb +0 -1
  39. data/app/views/kaui/admin_tenants/new_overdue_config.html.erb +0 -1
  40. data/app/views/kaui/admin_tenants/show.html.erb +42 -12
  41. data/app/views/kaui/home/index.html.erb +8 -1
  42. data/app/views/kaui/invoices/_invoice_table.html.erb +1 -1
  43. data/app/views/kaui/invoices/index.html.erb +13 -3
  44. data/app/views/kaui/invoices/show.html.erb +11 -1
  45. data/app/views/kaui/layouts/kaui_account_navbar.html.erb +4 -0
  46. data/app/views/kaui/layouts/kaui_navbar.html.erb +19 -12
  47. data/app/views/kaui/payments/_payment_table.html.erb +60 -50
  48. data/app/views/kaui/payments/index.html.erb +13 -3
  49. data/app/views/kaui/payments/show.html.erb +6 -0
  50. data/app/views/kaui/queues/index.html.erb +124 -0
  51. data/app/views/kaui/subscriptions/_edit_form.html.erb +4 -4
  52. data/app/views/kaui/subscriptions/_form.html.erb +3 -3
  53. data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +25 -22
  54. data/app/views/kaui/subscriptions/edit_bcd.erb +29 -0
  55. data/app/views/kaui/tags/index.html.erb +7 -1
  56. data/app/views/kaui/transactions/_form.html.erb +16 -6
  57. data/config/routes.rb +23 -4
  58. data/kaui.gemspec +1 -1
  59. data/lib/kaui/version.rb +1 -1
  60. data/test/fixtures/catalog-v1.xml +0 -1
  61. metadata +161 -151
@@ -0,0 +1,18 @@
1
+ <div class="col-md-6">
2
+
3
+ <div class="column-block">
4
+
5
+ <h1>Useful links</h1>
6
+
7
+ <ul>
8
+ <li><%= link_to 'Parked accounts', kaui_engine.tags_path(:q => '__PARK__') %></li>
9
+ <li><%= link_to 'AUTO_INVOICING_OFF accounts', kaui_engine.tags_path(:q => 'AUTO_INVOICING_OFF') %></li>
10
+ <li><%= link_to 'AUTO_PAY_OFF accounts', kaui_engine.tags_path(:q => 'AUTO_PAY_OFF') %></li>
11
+ <li><%= link_to 'PENDING payments', kaui_engine.payments_path(:q => 'PENDING') %></li>
12
+ <li><%= link_to 'UNKNOWN payments', kaui_engine.payments_path(:q => 'UNKNOWN') %></li>
13
+ <li><%= link_to 'Queues', kaui_engine.queues_path %></li>
14
+ </ul>
15
+
16
+ </div>
17
+
18
+ </div>
@@ -95,7 +95,6 @@
95
95
  <% end %>
96
96
  </div>
97
97
 
98
-
99
98
  <%= javascript_tag do %>
100
99
 
101
100
  function known_products() {
@@ -79,7 +79,6 @@
79
79
  <% end %>
80
80
  </div>
81
81
 
82
-
83
82
  <%= javascript_tag do %>
84
83
 
85
84
 
@@ -1,16 +1,10 @@
1
- <div class="column-block">
1
+ <%= render :partial => 'tenant_details' %>
2
2
 
3
- <h1>Tenant details</h1>
4
-
5
- <b>Name:</b> <%= @tenant.name %>
6
- <br/>
7
- <b>Tenant ID:</b> <%= @tenant.kb_tenant_id %>
8
- <br/>
9
- <b>API Key:</b> <%= @tenant.api_key %>
10
-
11
- </div>
3
+ <%= render :partial => 'useful_links' %>
12
4
 
13
5
  <% unless @allowed_users.empty? %>
6
+ <div class="col-md-12">
7
+
14
8
  <div class="search">
15
9
 
16
10
  <div class="column-block">
@@ -30,7 +24,7 @@
30
24
  <td><%= link_to u.kb_username, admin_allowed_user_path(u.id) %></td>
31
25
  <td><%= u.description %></td>
32
26
  <td>
33
- <% if Kaui.root_username == current_user.kb_username %>
27
+ <% if current_user.root? %>
34
28
  <button type="button" class="btn btn-default btn-sm" id="<%= "allowed-user-remove-#{u.id}" %>">
35
29
  <span class="fa fa-times"></span>
36
30
  </button>
@@ -45,6 +39,8 @@
45
39
 
46
40
  </div>
47
41
 
42
+ </div>
43
+
48
44
  <%= javascript_tag do %>
49
45
  $(document).ready(function() {
50
46
  $('#allowed-users-for-tenant-table').dataTable({
@@ -62,7 +58,7 @@
62
58
  <% end %>
63
59
 
64
60
  <div class="container">
65
- <ul class="nav nav-tabs">
61
+ <ul class="nav nav-tabs" id="tenant_tabs" active_tab="<%= @active_tab %>">
66
62
  <li class="nav active"><a href="#CatalogShow" data-toggle="tab">Catalog Show</a></li>
67
63
  <li class="nav"><a href="#OverdueShow" data-toggle="tab">Overdue Show</a></li>
68
64
  <li class="nav"><a href="#InvoiceTemplate" data-toggle="tab">Invoice Template</a></li>
@@ -83,6 +79,30 @@
83
79
  </div>
84
80
 
85
81
  <%= javascript_tag do %>
82
+
83
+
84
+ function updateBrowserHistory(target) {
85
+ // Check if we are already on the right tab
86
+ res = $.grep(location.href.split('?'), function(el) {
87
+ if (el.startsWith("active_tab")) {
88
+ return true;
89
+ }
90
+ });
91
+ if (res.length > 0) {
92
+ if (res[0].split('=')[1] == target) {
93
+ return;
94
+ }
95
+ }
96
+
97
+ // If not update the browser history
98
+ var base_url = location.href.split('?')[0]
99
+ var newUrl = base_url + "?active_tab=" + target
100
+
101
+ var stateObj = { tenantTab: target };
102
+ history.pushState(stateObj, "New tab ", newUrl);
103
+ }
104
+
105
+
86
106
  $(document).ready(function() {
87
107
  $('[id^=allowed-user-remove-]').click(function() {
88
108
  var allowedUser = $(this);
@@ -93,5 +113,15 @@
93
113
  error: function(request, textStatus, errorThrown) { console.log("AJAX FAILED!!!! request.status " + request.status + ", textStatus = " + textStatus); return false; }
94
114
  });
95
115
  });
116
+
117
+ $('#tenant_tabs li').on('shown.bs.tab', function (e) {
118
+ var target = $(e.target).attr("href");
119
+ updateBrowserHistory(target.split('#')[1])
120
+ });
121
+
122
+
123
+ if ($('#tenant_tabs').attr('active_tab') != "") {
124
+ $('#tenant_tabs a[href="#' + $('#tenant_tabs').attr('active_tab') + '"]').tab('show');
125
+ }
96
126
  });
97
127
  <% end %>
@@ -8,6 +8,13 @@
8
8
  <% end %>
9
9
 
10
10
  </div>
11
+ <div class="col-md-6 col-md-offset-3 legend">
12
+ <p class="text-center">
13
+ <%= link_to 'Latest accounts', kaui_engine.accounts_path %> /
14
+ <%= link_to 'Latest invoices', kaui_engine.invoices_path %> /
15
+ <%= link_to 'Latest payments', kaui_engine.payments_path %>
16
+ </p>
17
+ </div>
11
18
  </div>
12
- <span class="duck_help">You can search accounts by ID, external key, name, company or email address.</span>
19
+ <span class="duck_help">Accounts are searched by default. Or try the <b>invoice:</b> and <b>payment:</b> and <b>transaction:</b> operators</span>
13
20
  </div>
@@ -1,6 +1,6 @@
1
1
  <div class="info-wrapper">
2
2
 
3
- <% if can?(:credit, Kaui::Account) || can?(:charge, Kaui::Account) || (@invoice.balance > 0 && can?(:trigger, Kaui::Payment)) %>
3
+ <% if !dry_run && (can?(:credit, Kaui::Account) || can?(:charge, Kaui::Account) || (@invoice.balance > 0 && can?(:trigger, Kaui::Payment))) %>
4
4
  <div class="tag-bar">
5
5
  <!--<div class="tag-select">-->
6
6
  <!--<span><i class="fa fa-tag"></i><i class="fa fa-caret-down"></i></span>-->
@@ -27,9 +27,19 @@
27
27
  <%= javascript_tag do %>
28
28
  $(document).ready(function() {
29
29
  $('#invoices-table').dataTable({
30
- "dom": "t",
31
- "paging": false,
32
- "order": [[ 0, "desc" ]],
30
+ <% if @search_query.blank? %>
31
+ "dom": "<'row'r>t<'row'<'col-md-6'i><'col-md-6'p>>",
32
+ "pagingType": "full_numbers",
33
+ "pageLength": <%= @limit %>,
34
+ "displayStart": <%= @offset %>,
35
+ <% else %>
36
+ // No paging for per-account listings
37
+ "dom": "t",
38
+ "paging": false,
39
+ <% end %>
40
+ <% unless @ordering.blank? %>
41
+ "order": [[ 0, "<%= @ordering %>" ]],
42
+ <% end %>
33
43
  "processing": true,
34
44
  "serverSide": true,
35
45
  "search": {"search": "<%= @search_query %>"},
@@ -4,6 +4,16 @@
4
4
 
5
5
  <h1>Invoice <%= @invoice.invoice_number %></h1>
6
6
 
7
+ <% dry_run = @invoice.invoice_number.blank? %>
8
+ <% if dry_run %>
9
+ <div class="alert alert-warning">
10
+ This is a dry-run invoice.
11
+ <% if can? :trigger, Kaui::Invoice %>
12
+ To persist it, <%= link_to 'trigger an invoice run', kaui_engine.trigger_invoice_path(:account_id => @invoice.account_id, :target_date => @invoice.target_date), :method => :post %>.
13
+ <% end %>
14
+ </div>
15
+ <% end %>
16
+
7
17
  <div class="row">
8
18
  <div class="col-md-3">
9
19
  <table class="transparent subtitle">
@@ -19,7 +29,7 @@
19
29
  </div>
20
30
  </div>
21
31
 
22
- <%= render :partial => 'invoice_table' %>
32
+ <%= render :partial => 'kaui/invoices/invoice_table', :locals => {:dry_run => dry_run} %>
23
33
 
24
34
  </div>
25
35
 
@@ -8,6 +8,10 @@
8
8
  <%= link_to 'Invoices', kaui_engine.account_invoices_path(params[:account_id]), :class => (params[:controller].ends_with?('invoices') ? 'current' : 'non-current') %>
9
9
  <%= link_to 'Payments', kaui_engine.account_payments_path(params[:account_id]), :class => (params[:controller].ends_with?('payments') ? 'current' : 'non-current') %>
10
10
  <%= link_to 'Timeline', kaui_engine.account_timeline_path(params[:account_id]), :class => (params[:controller].ends_with?('timelines') ? 'current' : 'non-current') %>
11
+
12
+ <% if current_user.root? %>
13
+ <%= link_to 'Queues', kaui_engine.account_queues_path(params[:account_id]), :class => (params[:controller].ends_with?('queues') ? 'current' : 'non-current') %>
14
+ <% end %>
11
15
  </div>
12
16
 
13
17
  </div>
@@ -24,26 +24,33 @@
24
24
 
25
25
  <div id="main-menu" class="col-xs-6">
26
26
 
27
- <% if user_signed_in? && tenant_selected? -%>
27
+ <% if user_signed_in? -%>
28
28
  <div class="tag-bar tag-bar-no-border">
29
29
 
30
- <div class="tag-select" onclick="void(0)">
31
- <span><i class="fa fa-tags"></i><i class="fa fa-caret-down"></i></span>
30
+ <% if tenant_selected? -%>
31
+ <div class="tag-select" onclick="void(0)">
32
+ <span><i class="fa fa-tags"></i><i class="fa fa-caret-down"></i></span>
32
33
 
33
- <div class="tag-select-box">
34
- <%= link_to 'Tags', kaui_engine.tags_path %>
35
- <%= link_to 'Tag definitions', kaui_engine.tag_definitions_path %>
36
- <%= link_to 'Custom Fields', kaui_engine.custom_fields_path %>
37
- </div>
38
- </div>
34
+ <div class="tag-select-box">
35
+ <%= link_to 'Tags', kaui_engine.tags_path %>
36
+ <%= link_to 'Tag definitions', kaui_engine.tag_definitions_path %>
37
+ <%= link_to 'Custom Fields', kaui_engine.custom_fields_path %>
38
+ </div>
39
+ </div>
40
+ <% end %>
39
41
 
40
- <% if can? :view, Kaui::AdminTenant %>
42
+ <% if current_user.root? || can?(:view, Kaui::AdminTenant) %>
41
43
  <div class="tag-select" onclick="void(0)">
42
44
  <span><i class="fa fa-cogs"></i><i class="fa fa-caret-down"></i></span>
43
45
 
44
46
  <div class="tag-select-box">
45
- <%= link_to 'Users', kaui_engine.admin_allowed_users_path %>
46
- <%= link_to 'Tenants', kaui_engine.admin_tenants_path %>
47
+ <% if can? :view, Kaui::AdminTenant %>
48
+ <%= link_to 'Users', kaui_engine.admin_allowed_users_path %>
49
+ <%= link_to 'Tenants', kaui_engine.admin_tenants_path %>
50
+ <% end %>
51
+ <% if current_user.root? %>
52
+ <%= link_to 'Admin', kaui_engine.admin_path %>
53
+ <% end %>
47
54
  </div>
48
55
  </div>
49
56
  <% end %>
@@ -1,4 +1,4 @@
1
- <div class="info-wrapper">
1
+ <div class="info-wrapper" >
2
2
 
3
3
  <% if payment.capturable? || payment.voidable? || (payment.refundable? && (can?(:refund, Kaui::Payment) || can?(:chargeback, Kaui::Payment))) %>
4
4
  <div class="tag-bar">
@@ -64,56 +64,66 @@
64
64
  </div>
65
65
  <% end %>
66
66
 
67
- <table id="payment_<%= payment.payment_id %>" class="table table-condensed mobile-data">
68
- <thead>
69
- <tr>
70
- <th>Date</th>
71
- <th>Type</th>
72
- <th>Amount</th>
73
- <th>First id</th>
74
- <th>Second id</th>
75
- <th>Gateway code</th>
76
- <th>Gateway message</th>
77
- <th>Status</th>
78
- </tr>
79
- </thead>
80
- <tbody>
81
- <% (payment.transactions || []).each do |transaction| %>
82
- <tr>
83
- <td><%= format_date(transaction.effective_date, account.time_zone).html_safe %></td>
84
- <td><%= transaction.transaction_type %></td>
85
- <td>
86
- <% if transaction.amount.present? %>
87
- <%= humanized_money_with_symbol Kaui::Transaction.amount_to_money(transaction) %>
88
- (<%= transaction.currency %>)
89
- <% end %>
90
- </td>
91
- <td><%= transaction.first_payment_reference_id %></td>
92
- <td><%= transaction.second_payment_reference_id %></td>
93
- <td><%= transaction.gateway_error_code %></td>
94
- <td><%= transaction.gateway_error_msg %></td>
95
- <td>
96
- <ul style="list-style: none">
97
- <li>
98
- <span <% if transaction.status != 'SUCCESS' %>class='alert-danger'<% else %>class='alert-success' <% end %>>
99
- <%= transaction.status %>
100
- </span>
101
- </li>
102
- <% if transaction.next_retry_date %>
103
- <li>
104
- Scheduled retry:
105
- <%= format_date(transaction.next_retry_date) %>
106
- <% if can? :trigger, Kaui::Payment %>
107
- <%= link_to '<i class="fa fa-times"></i>'.html_safe, kaui_engine.payment_cancel_scheduled_payment_path(payment.payment_id, :account_id => payment.account_id, :transaction_external_key => transaction.transaction_external_key), :method => :delete %>
108
- <% end %>
109
- </li>
67
+ <div style="overflow-x: auto;">
68
+ <table id="payment_<%= payment.payment_id %>" class="table table-condensed mobile-data">
69
+ <thead>
70
+ <tr>
71
+ <th>Date</th>
72
+ <th>Type</th>
73
+ <th>Amount</th>
74
+ <th>First id</th>
75
+ <th>Second id</th>
76
+ <th>Gateway code</th>
77
+ <th>Gateway message</th>
78
+ <th>Status</th>
79
+ </tr>
80
+ </thead>
81
+ <tbody>
82
+ <% (payment.transactions || []).each do |transaction| %>
83
+ <tr>
84
+ <td><%= format_date(transaction.effective_date, account.time_zone).html_safe %></td>
85
+ <td><%= transaction.transaction_type %></td>
86
+ <td>
87
+ <% if transaction.amount.present? %>
88
+ <%= humanized_money_with_symbol Kaui::Transaction.amount_to_money(transaction) %>
89
+ (<%= transaction.currency %>)
110
90
  <% end %>
111
- </ul>
112
- </td>
113
- </tr>
114
- <% end %>
115
- </tbody>
116
- </table>
91
+ </td>
92
+ <td><%= transaction.first_payment_reference_id %></td>
93
+ <td><%= transaction.second_payment_reference_id %></td>
94
+ <td><%= transaction.gateway_error_code %></td>
95
+ <td><%= transaction.gateway_error_msg %></td>
96
+ <td>
97
+ <ul style="list-style: none; padding-left: 0">
98
+ <li>
99
+ <span <% if transaction.status != 'SUCCESS' %>class='alert-danger'<% else %>class='alert-success' <% end %>><%= transaction.status %></span>
100
+ <% if current_user.root? %>
101
+ <%= link_to '&nbsp;<i class="fa fa-eraser"></i>'.html_safe, kaui_engine.new_account_transaction_path(payment.account_id,
102
+ :payment_id => payment.payment_id,
103
+ :transaction_id => transaction.transaction_id) %>
104
+ <% end %>
105
+ </li>
106
+ <% if transaction.next_retry_date %>
107
+ <li>
108
+ Scheduled retry:
109
+ <%= transaction.next_retry_date %>
110
+ <% if can? :trigger, Kaui::Payment %>
111
+ <%= link_to '<i class="fa fa-times"></i>'.html_safe, kaui_engine.payment_cancel_scheduled_payment_path(payment.payment_id, :account_id => payment.account_id, :transaction_external_key => transaction.transaction_external_key), :method => :delete %>
112
+ <% end %>
113
+ </li>
114
+ <% end %>
115
+ <% (transaction.properties || []).sort_by { |p| p.key }.each do |property| %>
116
+ <% next if property.value.blank? %>
117
+ <li><%= property.key %>
118
+ : <%= is_json?(property.value) ? "<pre>#{JSON.pretty_generate(JSON.parse(property.value))}</pre>".html_safe : property.value %></li>
119
+ <% end %>
120
+ </ul>
121
+ </td>
122
+ </tr>
123
+ <% end %>
124
+ </tbody>
125
+ </table>
126
+ </div>
117
127
 
118
128
  </div>
119
129
 
@@ -27,9 +27,19 @@
27
27
  <%= javascript_tag do %>
28
28
  $(document).ready(function() {
29
29
  $('#payments-table').dataTable({
30
- "dom": "t",
31
- "paging": false,
32
- "order": [[ 0, "desc" ]],
30
+ <% if @search_query.blank? %>
31
+ "dom": "<'row'r>t<'row'<'col-md-6'i><'col-md-6'p>>",
32
+ "pagingType": "full_numbers",
33
+ "pageLength": <%= @limit %>,
34
+ "displayStart": <%= @offset %>,
35
+ <% else %>
36
+ // No paging for per-account listings
37
+ "dom": "t",
38
+ "paging": false,
39
+ <% end %>
40
+ <% unless @ordering.blank? %>
41
+ "order": [[ 0, "<%= @ordering %>" ]],
42
+ <% end %>
33
43
  "processing": true,
34
44
  "serverSide": true,
35
45
  "search": {"search": "<%= @search_query %>"},
@@ -12,6 +12,12 @@
12
12
  <th>Invoice ID</th>
13
13
  <td><%= link_to @payment.target_invoice_id, account_invoice_path(@account.account_id, @payment.target_invoice_id) %></td>
14
14
  </tr>
15
+ <% if @payment.payment_external_key != @payment.payment_id %>
16
+ <tr>
17
+ <th>External key</th>
18
+ <td><%= @payment.payment_external_key %></td>
19
+ </tr>
20
+ <% end %>
15
21
  </table>
16
22
  </div>
17
23
  </div>
@@ -0,0 +1,124 @@
1
+ <p class="text-center">
2
+ <%= link_to 'Current or future entries', kaui_engine.queues_path(params.merge(:with_history => false)) %> /
3
+ <%= link_to 'Historical entries (last week)', kaui_engine.queues_path(params.merge(:with_history => true, :min_date => @now - 1.week)) %> /
4
+ <%= link_to 'Historical entries (last month)', kaui_engine.queues_path(params.merge(:with_history => true, :min_date => @now - 1.month)) %> /
5
+ <%= link_to 'All historical entries', kaui_engine.queues_path(params.merge(:with_history => true, :min_date => '1970-01-01')) %>
6
+ </p>
7
+
8
+ <div class="search">
9
+
10
+ <% unless (@queues_entries['busEvents'] || []).empty? %>
11
+ <div class="column-block">
12
+
13
+ <h1>Bus events</h1>
14
+
15
+ <div style="overflow-x: auto;">
16
+ <table id="bus-table" class="table table-condensed mobile-data table-small-padding">
17
+ <thead>
18
+ <tr>
19
+ <th>Created date</th>
20
+ <th>Class name</th>
21
+ <th>Event</th>
22
+ <th>User token</th>
23
+ <% if @account_id.blank? %>
24
+ <th>Account record id</th>
25
+ <% end %>
26
+ </tr>
27
+ </thead>
28
+ <tbody>
29
+ <% @queues_entries['busEvents'].each do |bus_event| %>
30
+ <% if bus_event['createdDate'].to_datetime < @now %>
31
+ <tr class="disabled">
32
+ <% else %>
33
+ <tr>
34
+ <% end %>
35
+ <td><%= truncate_millis(bus_event['createdDate']) %></td>
36
+ <td><%= truncate_class_name(bus_event['className']) %></td>
37
+ <td><%= "<pre>#{JSON.pretty_generate(bus_event['event'])}</pre>".html_safe %></td>
38
+ <td><%= truncate_uuid(bus_event['userToken']) %></td>
39
+ <% if @account_id.blank? %>
40
+ <td><%= bus_event['searchKey1'] %></td>
41
+ <% end %>
42
+ </tr>
43
+ <% end %>
44
+ </tbody>
45
+ </table>
46
+ </div>
47
+
48
+ </div>
49
+ <% end %>
50
+ <% unless (@queues_entries['notifications'] || []).empty? %>
51
+ <div class="column-block">
52
+
53
+ <h1>Notifications</h1>
54
+
55
+ <div style="overflow-x: auto;">
56
+ <table id="notifications-table" class="table table-condensed mobile-data table-small-padding">
57
+ <thead>
58
+ <tr>
59
+ <th>Effective date</th>
60
+ <th>Queue name</th>
61
+ <th>Event</th>
62
+ <th>User token</th>
63
+ <% if @account_id.blank? %>
64
+ <th>Account record id</th>
65
+ <% end %>
66
+ </tr>
67
+ </thead>
68
+ <tbody>
69
+ <% @queues_entries['notifications'].each do |notification| %>
70
+ <% if notification['effectiveDate'].to_datetime < @now %>
71
+ <tr class="disabled">
72
+ <% else %>
73
+ <tr>
74
+ <% end %>
75
+ <td><%= truncate_millis(notification['effectiveDate']) %></td>
76
+ <td>
77
+ <%= notification['queueName'] %>
78
+ </td>
79
+ <td><%= "<pre>#{JSON.pretty_generate(notification['event'])}</pre>".html_safe %></td>
80
+ <td><%= truncate_uuid(notification['userToken']) %></td>
81
+ <% if @account_id.blank? %>
82
+ <td><%= notification['searchKey1'] %></td>
83
+ <% end %>
84
+ </tr>
85
+ <% end %>
86
+ </tbody>
87
+ </table>
88
+ </div>
89
+
90
+ </div>
91
+ <% end %>
92
+
93
+ </div>
94
+
95
+ <% nb_bus_entries = (@queues_entries['busEvents'] || []).size %>
96
+ <% nb_notifications_entries = (@queues_entries['notifications'] || []).size %>
97
+ <%= javascript_tag do %>
98
+ $(document).ready(function() {
99
+ $('#bus-table').dataTable({
100
+ <% if nb_bus_entries <= 50 %>
101
+ "dom": "<'row'<'col-md-6'><'col-md-6'f>r>t",
102
+ "paging": "false",
103
+ <% else %>
104
+ "dom": "<'row'<'col-md-6'><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
105
+ "pagingType": "full_numbers",
106
+ "displayStart": <%= [0, nb_bus_entries - 50].max %>,
107
+ <% end %>
108
+ "pageLength": 50,
109
+ "order": []
110
+ });
111
+ $('#notifications-table').dataTable({
112
+ <% if nb_notifications_entries <= 50 %>
113
+ "dom": "<'row'<'col-md-6'><'col-md-6'f>r>t",
114
+ "paging": "false",
115
+ <% else %>
116
+ "dom": "<'row'<'col-md-6'><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
117
+ "pagingType": "full_numbers",
118
+ "displayStart": 0,
119
+ <% end %>
120
+ "pageLength": 50,
121
+ "order": []
122
+ });
123
+ });
124
+ <% end %>