Files
akkounts/app/components/rs_auth_details_modal_component.html.erb
T
raucao a669bf7c9b Add storage dashboard card and per-app details modal
- Rework RsAuthComponent into a card that shows the app, its device, an
  access summary and the permission status
- Group connected apps by app and device, so repeated authorizations for
  the same app and device (e.g. after a browser update) are shown together,
  each with its own revoke action
- Add RsAuthDetailsModalComponent with the full scope list, device,
  connected tokens and permission expiry, plus Launch and Revoke actions
  (built on the existing ModalComponent)
- Add RemoteStorageAuthorization#device_name (parsed from the user agent)
  and #expired?

Part of #254
2026-11-03 11:42:31 +04:00

48 lines
1.6 KiB
ERB

<%= render ModalComponent.new do %>
<div class="flex items-center gap-4">
<div class="h-16 w-16 flex-none">
<%= render AppCatalog::WebAppIconComponent.new(web_app: @web_app) %>
</div>
<div class="min-w-0">
<h4 class="mb-1 text-lg font-bold truncate"><%= name %></h4>
<p class="text-sm text-gray-500 truncate"><%= @auth.client_id %></p>
</div>
</div>
<h5 class="mt-6 mb-1 font-bold">Access</h5>
<% if root_access? %>
<p class="text-sm text-gray-600">All folders and files</p>
<% else %>
<ul class="list-disc list-inside text-sm text-gray-600">
<% @auth.permissions.each do |scope| %>
<li><%= scope_label(scope) %></li>
<% end %>
</ul>
<% end %>
<h5 class="mt-4 mb-1 font-bold">Device</h5>
<p class="text-sm text-gray-600"><%= device_name %></p>
<h5 class="mt-4 mb-2 font-bold">
<%= @authorizations.size > 1 ? "Connected tokens" : "Connected" %>
</h5>
<ul class="space-y-2">
<% @authorizations.each do |auth| %>
<li class="flex items-center justify-between gap-3 text-sm text-gray-600">
<span>
<%= auth.created_at.strftime('%-d %b %Y') %>
&middot;
<%= status_label(auth) %>
</span>
<%= link_to "Revoke access", revoke_services_storage_rs_auth_path(auth),
class: "text-red-700 whitespace-nowrap" %>
</li>
<% end %>
</ul>
<div class="mt-6 flex flex-col sm:flex-row gap-2 sm:justify-end">
<%= link_to "Launch app", launch_app_services_storage_rs_auth_path(@auth),
class: "btn-md btn-blue", target: "_blank", rel: "noopener" %>
</div>
<% end %>