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 +4 -4
- data/app/controllers/fastentry/cache_controller.rb +9 -0
- data/app/views/fastentry/dashboard/index.html.erb +62 -42
- data/config/routes.rb +1 -0
- data/lib/fastentry/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d7172959be1badc7089c1f1dacb603666d8a66609653aec0a4e8f4ed5a9a869
|
4
|
+
data.tar.gz: d47ef8ddc244d16fe5e06099d5c99864bec5403fc018ca3aa0936c9dff01e147
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
18
|
-
<
|
19
|
-
<
|
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
|
-
<
|
30
|
-
<
|
31
|
-
<
|
32
|
-
<
|
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
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
39
|
-
|
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
|
-
|
43
|
-
|
44
|
-
<
|
45
|
-
<li><span class="pagination-ellipsis">…</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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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">…</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
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
63
|
+
|
64
|
+
<% if @page + 2 <= @number_of_pages - 1 %>
|
65
|
+
<li><span class="pagination-ellipsis">…</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
|
data/lib/fastentry/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|