- One card per app (grouped by client_id) showing distinct device and category counts; the whole card opens the details modal (with hover and focus highlight) instead of a separate Details button - Details modal: access list styled like the OAuth consent dialog via a shared RsScopeListComponent, plus per-token device, connected date and expiry, each with its own Revoke - "folder" -> "category" in the card, modal, consent dialog and the auth-created notification - Make revoke a real DELETE: it was a GET link that Turbo 8's prefetch-on-hover fired on its own, silently deleting authorizations. Missing or foreign authorizations now return 404 instead of 500. - Move "Launch app" to the app level (GET /services/storage/apps/:client_id/launch); no token id in the URL Part of #254
35 lines
773 B
Ruby
35 lines
773 B
Ruby
# frozen_string_literal: true
|
|
|
|
class RsAuthComponent < ViewComponent::Base
|
|
include OauthHelper
|
|
|
|
def initialize(authorizations:)
|
|
@authorizations = authorizations
|
|
@auth = authorizations.first
|
|
@web_app = @auth.web_app
|
|
end
|
|
|
|
def name
|
|
@web_app&.name.presence || @auth.app_name.presence || @auth.client_id
|
|
end
|
|
|
|
def root_access?
|
|
(@auth.permissions & [":r", ":rw"]).any?
|
|
end
|
|
|
|
def category_summary
|
|
return "All categories and files" if root_access?
|
|
|
|
count = @auth.permissions.size
|
|
"#{count} #{'category'.pluralize(count)}"
|
|
end
|
|
|
|
def device_count
|
|
@authorizations.map { |auth| auth.device_name.presence || "Unknown device" }.uniq.size
|
|
end
|
|
|
|
def device_summary
|
|
"#{device_count} #{'device'.pluralize(device_count)}"
|
|
end
|
|
end
|