fastentry 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23e7578cd23c2cd0f10faa812cc3fa64313c45740b0d24434f2734384c6ae84b
4
- data.tar.gz: d480666d0220f675be14f935d5c9e96d3a4d28b898e48d57d7182b3940f63ae2
3
+ metadata.gz: 3d7172959be1badc7089c1f1dacb603666d8a66609653aec0a4e8f4ed5a9a869
4
+ data.tar.gz: d47ef8ddc244d16fe5e06099d5c99864bec5403fc018ca3aa0936c9dff01e147
5
5
  SHA512:
6
- metadata.gz: 3ee2d05b69ed1f14677d6b9cd05d717d41e2e35f398cdcfaf3f282520a7acf56085c9a0b33b31bff5107ec1adbe69e46f75a8090fe45b97200e6fa3fa3554c8d
7
- data.tar.gz: a7b57e2489a2f306c7f4cb8ab169cc4b1674a8b894aec6ede24a1908de3360e10010c1258cf30d0243c21fb8232765d6c46ab6cc26f4150642911969c4f1d20b
6
+ metadata.gz: 33fc43236765091c4185883ad7d3f125b89f037da7e1cac6f613cf84c3cc1e31943e93b1cc95f75f4bac92e98f0342b6885e86d8c58ab679b7d36547c9beb2eb
7
+ data.tar.gz: b7b2d1674257804e0360ae7008e61915fe7c8677b87d63d0149b9a2801dd660d2f4758a41a2108d97dcf1b185a0e74e34304064fc8354ec6328f31a966ea20be
@@ -15,5 +15,14 @@ module Fastentry
15
15
 
16
16
  redirect_back(fallback_location: root_path)
17
17
  end
18
+
19
+ def invalidate_multiple
20
+ keys = params[:invalidate_cache_keys] || []
21
+ keys.each do |key|
22
+ Fastentry.cache.delete(key)
23
+ end
24
+
25
+ redirect_back(fallback_location: root_path)
26
+ end
18
27
  end
19
28
  end
@@ -14,53 +14,73 @@
14
14
  </div>
15
15
  <% end %>
16
16
  <br>
17
- <table class="table is-hoverable is-fullwidth">
18
- <thead>
19
- <tr>
20
- <th>Key</th>
21
- <th>Value</th>
22
- <th>Expires at</th>
23
- <th>Actions</th>
24
- </tr>
25
- </thead>
26
- <tbody>
27
- <% @cached.each do |cache| %>
17
+ <%= form_tag(invalidate_multiple_keys_path, method: "delete", id: "checkbox-form") do %>
18
+ <table class="table is-hoverable is-fullwidth">
19
+ <thead>
28
20
  <tr>
29
- <td><%= truncate cache[:cache_key], length: 100 %></td>
30
- <td><%= link_to truncate(cache[:cache_value].to_s, length: 100), cache_path(cache[:cache_key]) %></td>
31
- <td><%= cache[:expiration] %></td>
32
- <td><%= link_to "Invalidate", invalidate_key_path(cache[:cache_key]), method: :delete, data: { confirm: 'Are you sure?' }, class: "button is-danger is-small is-outlined" %></td>
21
+ <th><input type="checkbox" id="select-all-checkboxes"></th>
22
+ <th>Key</th>
23
+ <th>Value</th>
24
+ <th>Expires at</th>
25
+ <th>Actions</th>
33
26
  </tr>
34
- <% end %>
35
- </tbody>
36
- </table>
27
+ </thead>
28
+ <tbody>
29
+ <% @cached.each do |cache| %>
30
+ <tr>
31
+ <td><input type="checkbox" name="invalidate_cache_keys[]" value="<%= cache[:cache_key] %>"></td>
32
+ <td><%= truncate cache[:cache_key], length: 100 %></td>
33
+ <td><%= link_to truncate(cache[:cache_value].to_s, length: 100), cache_path(cache[:cache_key]) %></td>
34
+ <td><%= cache[:expiration] %></td>
35
+ <td><%= link_to "Invalidate", invalidate_key_path(cache[:cache_key]), method: :delete, data: { confirm: 'Are you sure?' }, class: "button is-danger is-small is-outlined" %></td>
36
+ </tr>
37
+ <% end %>
38
+ </tbody>
39
+ </table>
37
40
 
38
- <nav class="pagination is-small is-right" role="navigation" aria-label="pagination">
39
- <a <% if @page - 1 >= 0 %>href="<%= root_path(params.merge(page: @page - 1).permit(:query, :page)) %>"<% else %>disabled<% end %> class="pagination-previous">Previous</a>
40
- <a <% if @page + 1 <= @number_of_pages - 1 %>href="<%= root_path(params.merge(page: @page + 1).permit(:query, :page)) %>"<% else %>disabled<% end %> class="pagination-next">Next</a>
41
+ <nav class="pagination is-small is-right" role="navigation" aria-label="pagination">
42
+ <%= button_tag "Invalidate selected", data: { confirm: 'Are you sure?' }, class: "button is-danger is-small is-outlined" %>
41
43
 
42
- <ul class="pagination-list">
43
- <% if @page - 2 >= 0 %>
44
- <li><%= link_to "1", root_path(params.merge(page: 0).permit(:query, :page)), class: "pagination-link" %></li>
45
- <li><span class="pagination-ellipsis">&hellip;</span></li>
46
- <% end %>
44
+ <ul class="pagination-list">
45
+ <a <% if @page - 1 >= 0 %>href="<%= root_path(params.merge(page: @page - 1).permit(:query, :page)) %>"<% else %>disabled<% end %> class="pagination-previous">Previous</a>
46
+ <a <% if @page + 1 <= @number_of_pages - 1 %>href="<%= root_path(params.merge(page: @page + 1).permit(:query, :page)) %>"<% else %>disabled<% end %> class="pagination-next">Next</a>
47
47
 
48
- <% if @page - 1 >= 0 %>
49
- <%= link_to @page, root_path(params.merge(page: @page - 1).permit(:query, :page)), class: "pagination-link" %>
50
- <% end %>
51
- <% if @number_of_pages > 1 %>
52
- <%= link_to @page + 1, root_path(params.merge(page: @page).permit(:query, :page)), class: "pagination-link is-current" %>
53
- <% end %>
54
- <% if @page + 1 <= @number_of_pages - 1 %>
55
- <%= link_to @page + 2, root_path(params.merge(page: @page + 1).permit(:query, :page)), class: "pagination-link" %>
56
- <% end %>
48
+ <% if @page - 2 >= 0 %>
49
+ <li><%= link_to "1", root_path(params.merge(page: 0).permit(:query, :page)), class: "pagination-link" %></li>
50
+ <li><span class="pagination-ellipsis">&hellip;</span></li>
51
+ <% end %>
57
52
 
53
+ <% if @page - 1 >= 0 %>
54
+ <%= link_to @page, root_path(params.merge(page: @page - 1).permit(:query, :page)), class: "pagination-link" %>
55
+ <% end %>
56
+ <% if @number_of_pages > 1 %>
57
+ <%= link_to @page + 1, root_path(params.merge(page: @page).permit(:query, :page)), class: "pagination-link is-current" %>
58
+ <% end %>
59
+ <% if @page + 1 <= @number_of_pages - 1 %>
60
+ <%= link_to @page + 2, root_path(params.merge(page: @page + 1).permit(:query, :page)), class: "pagination-link" %>
61
+ <% end %>
58
62
 
59
- <% if @page + 2 <= @number_of_pages - 1 %>
60
- <li><span class="pagination-ellipsis">&hellip;</span></li>
61
- <li><%= link_to @number_of_pages, root_path(params.merge(page: @number_of_pages - 1).permit(:query, :page)), class: "pagination-link" %></li>
62
- <% end %>
63
- </ul>
64
- </nav>
63
+
64
+ <% if @page + 2 <= @number_of_pages - 1 %>
65
+ <li><span class="pagination-ellipsis">&hellip;</span></li>
66
+ <li><%= link_to @number_of_pages, root_path(params.merge(page: @number_of_pages - 1).permit(:query, :page)), class: "pagination-link" %></li>
67
+ <% end %>
68
+ </ul>
69
+ </nav>
70
+ <% end %>
65
71
  </div>
66
- </section>
72
+ </section>
73
+
74
+ <script>
75
+ window.onload = function(){
76
+ // Select all checkboxes
77
+ var selectControl = document.getElementById("select-all-checkboxes");
78
+ selectControl.onclick = function(){
79
+ checkboxes = document.getElementsByName("invalidate_cache_keys[]");
80
+ var checked = selectControl.checked;
81
+ for (i = 0; i < checkboxes.length; i++){
82
+ checkboxes[i].checked = checked ? 'checked' : '';
83
+ }
84
+ };
85
+ };
86
+ </script>
data/config/routes.rb CHANGED
@@ -5,6 +5,7 @@ Fastentry::Engine.routes.draw do
5
5
 
6
6
  get "cache_item/:key" => "cache#show", as: "cache"
7
7
  delete "invalidate/:key" => "cache#invalidate", as: "invalidate_key"
8
+ delete "invalidate_multiple" => "cache#invalidate_multiple", as: "invalidate_multiple_keys"
8
9
 
9
10
  resources :stats, only: [:index]
10
11
  end
@@ -1,3 +1,3 @@
1
1
  module Fastentry
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastentry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Alves
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails