s3arch 0.0.6.alpha → 0.0.7.alpha

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76cbfbd7db2c11d924729920685cfbd50525fa31e24dda087ab8a2ce4e9c03a4
4
- data.tar.gz: 6256c7ff9391e7b57d40a9ce7f9751a1960142229480fddcf75fd9bd067bd352
3
+ metadata.gz: 64302e564d9997605768c4ded4ae5dbfad42e1b560e965114b28d5aef70f2383
4
+ data.tar.gz: b03157dcd54910490c46f6d31322795fc3ed0cca3ccc828c23b520ceebec756b
5
5
  SHA512:
6
- metadata.gz: 8cc3ec77fbc57dba507db244b0b67d9810506ae113667ded39e588f8b713440f2ec1e20616592901698bec3d774f38d08a47720d8b1af6b30e6439578dcf17cf
7
- data.tar.gz: b3f46f36ab31bc07cca101bad5ee10e1d978b4d090ea6911375dfdc9e3a66b2c3984d180133bffd203f2ac2f571b81bd051da056d287d844efdb769fe46492d0
6
+ metadata.gz: fc4416d80a68b834acb136d6465a7849641127b68180b6b6fe6efdba9bfa3b4f35b78e761b16b331e02352807fe8d7298fe3f0446a8f882885039fa372e3c368
7
+ data.tar.gz: e0042712abb3a5ff25615d9ff828e6c9a310b7493dc72a5dd04f50bf5b0918a052e4ac5c616fc04645fc74287a516c663ba2e52ed862d621ef3d786ece9ca2a3
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,13 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'erb'
3
4
  require 'aws-sdk-dynamodb'
4
5
 
5
6
  class S3archController < BeltController::Base
7
+ VIEWS_PATH = File.expand_path('../../lib/s3arch/dashboard/views', __dir__)
8
+
6
9
  def index
7
- owners = fetch_owners
8
- success_response(owners: owners)
10
+ @owners = fetch_owners
11
+ html = render_erb('index')
12
+ html_response(html)
9
13
  rescue StandardError => e
10
- error_response("Failed to load s3arch dashboard: #{e.message}", 500)
14
+ @error = e.message
15
+ @owners = []
16
+ html = render_erb('index')
17
+ html_response(html, 500)
11
18
  end
12
19
 
13
20
  def rebuild
@@ -51,4 +58,9 @@ class S3archController < BeltController::Base
51
58
  end
52
59
  owners.sort_by { |o| o[:updated_at].to_s }.reverse
53
60
  end
61
+
62
+ def render_erb(template)
63
+ path = File.join(VIEWS_PATH, "#{template}.html.erb")
64
+ ERB.new(File.read(path), trim_mode: '-').result(binding)
65
+ end
54
66
  end
@@ -5,22 +5,28 @@
5
5
  <style>
6
6
  * { box-sizing: border-box; margin: 0; padding: 0; }
7
7
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f5f5f5; color: #333; padding: 2rem; }
8
- h1 { margin-bottom: 1.5rem; }
8
+ h1 { margin-bottom: 1.5rem; font-size: 1.5rem; }
9
9
  .error { background: #fee; border: 1px solid #fcc; padding: 0.75rem; border-radius: 4px; margin-bottom: 1rem; color: #c00; }
10
+ .success { background: #efe; border: 1px solid #cfc; padding: 0.75rem; border-radius: 4px; margin-bottom: 1rem; color: #060; display: none; }
10
11
  table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
11
12
  th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid #eee; }
12
- th { background: #fafafa; font-weight: 600; }
13
- form.inline { display: inline; }
14
- button { background: #2563eb; color: #fff; border: none; padding: 0.4rem 0.8rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
15
- button:hover { background: #1d4ed8; }
16
- .rebuild-all { margin-bottom: 1rem; }
17
- .rebuild-all button { background: #dc2626; }
18
- .rebuild-all button:hover { background: #b91c1c; }
13
+ th { background: #fafafa; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: #555; }
14
+ tr:last-child td { border-bottom: none; }
15
+ tr:hover td { background: #f9fafb; }
16
+ .btn { border: none; padding: 0.4rem 0.8rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: background 0.15s; }
17
+ .btn-rebuild { background: #2563eb; color: #fff; }
18
+ .btn-rebuild:hover { background: #1d4ed8; }
19
+ .btn-rebuild:disabled { background: #93c5fd; cursor: not-allowed; }
20
+ .owner-id { font-family: "SF Mono", SFMono-Regular, Consolas, monospace; font-size: 0.8rem; }
19
21
  .empty { padding: 2rem; text-align: center; color: #666; }
22
+ .meta { font-size: 0.85rem; color: #666; margin-bottom: 1rem; }
20
23
  </style>
21
24
  </head>
22
25
  <body>
23
26
  <h1>S3arch Dashboard</h1>
27
+ <p class="meta"><%= @owners.size %> indexed owner<%= @owners.size == 1 ? '' : 's' %></p>
28
+
29
+ <div id="flash" class="success"></div>
24
30
 
25
31
  <%- if @error -%>
26
32
  <div class="error"><strong>Error:</strong> <%= @error %></div>
@@ -40,15 +46,12 @@
40
46
  <tbody>
41
47
  <%- @owners.each do |owner| -%>
42
48
  <tr>
43
- <td><%= owner[:owner_id] %></td>
49
+ <td class="owner-id"><%= owner[:owner_id] %></td>
44
50
  <td><%= owner[:version] %></td>
45
51
  <td><%= owner[:record_count] || '—' %></td>
46
52
  <td><%= owner[:updated_at] || '—' %></td>
47
53
  <td>
48
- <form class="inline" method="post" action="<%= @env['SCRIPT_NAME'] %>/rebuild">
49
- <input type="hidden" name="owner_id" value="<%= owner[:owner_id] %>">
50
- <button type="submit">Rebuild</button>
51
- </form>
54
+ <button class="btn btn-rebuild" onclick="rebuild('<%= owner[:owner_id] %>', this)">Recreate SQLite</button>
52
55
  </td>
53
56
  </tr>
54
57
  <%- end -%>
@@ -57,5 +60,43 @@
57
60
  <%- else -%>
58
61
  <div class="empty">No indexed owners found.</div>
59
62
  <%- end -%>
63
+
64
+ <script>
65
+ function rebuild(ownerId, btn) {
66
+ btn.disabled = true;
67
+ btn.textContent = 'Rebuilding…';
68
+ var headers = { 'Content-Type': 'application/json' };
69
+ var authMeta = document.querySelector('meta[name="authorization"]');
70
+ if (authMeta) headers['Authorization'] = authMeta.content;
71
+ var baseMeta = document.querySelector('meta[name="api-base"]');
72
+ var base = baseMeta ? baseMeta.content : window.location.pathname.replace(/\/$/, '');
73
+
74
+ fetch(base + '/rebuild', {
75
+ method: 'POST',
76
+ headers: headers,
77
+ body: JSON.stringify({ owner_id: ownerId })
78
+ }).then(function(r) { return r.json(); }).then(function(data) {
79
+ btn.textContent = 'Recreate SQLite';
80
+ btn.disabled = false;
81
+ var flash = document.getElementById('flash');
82
+ if (data.status === 'ok') {
83
+ flash.className = 'success';
84
+ flash.textContent = 'Rebuild triggered for ' + ownerId;
85
+ flash.style.display = 'block';
86
+ } else {
87
+ flash.className = 'error';
88
+ flash.textContent = data.error || 'Rebuild failed';
89
+ flash.style.display = 'block';
90
+ }
91
+ }).catch(function(e) {
92
+ btn.textContent = 'Recreate SQLite';
93
+ btn.disabled = false;
94
+ var flash = document.getElementById('flash');
95
+ flash.className = 'error';
96
+ flash.textContent = 'Request failed: ' + e.message;
97
+ flash.style.display = 'block';
98
+ });
99
+ }
100
+ </script>
60
101
  </body>
61
102
  </html>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module S3arch
4
- VERSION = '0.0.6.alpha'
4
+ VERSION = '0.0.7.alpha'
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3arch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.alpha
4
+ version: 0.0.7.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Dalton
metadata.gz.sig CHANGED
Binary file