Compare commits
4 Commits
2b8bfaaca8
...
5075fef616
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5075fef616
|
||
|
|
8e090daa9c
|
||
|
|
def87a1621
|
||
|
|
00ec7fa21c
|
25
app/components/rs_auth_component.html.erb
Normal file
25
app/components/rs_auth_component.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<div class="py-4 w-1/2 flex items-center gap-6">
|
||||
<div class="h-16 w-16 flex-none">
|
||||
<%= image_tag s3_image_url(@web_app.icon), class: "h-full w-full" %>
|
||||
</div>
|
||||
<div class="flex-grow">
|
||||
<h4 class="mb-1 text-lg font-bold">
|
||||
<%= @web_app.name %>
|
||||
</h4>
|
||||
<p class="text-sm text-gray-500">
|
||||
<%= @auth.client_id %>
|
||||
</p>
|
||||
</div>
|
||||
<!-- <div> -->
|
||||
<!-- <p class="text-sm text-gray-500"> -->
|
||||
<!-- Approved <%= time_ago_in_words @auth.created_at %> ago -->
|
||||
<!-- </p> -->
|
||||
<!-- </div> -->
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">
|
||||
<%= link_to "#", class: "btn-md btn-outline text-red-700 relative" do %>
|
||||
Revoke access
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
8
app/components/rs_auth_component.rb
Normal file
8
app/components/rs_auth_component.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RsAuthComponent < ViewComponent::Base
|
||||
def initialize(auth:)
|
||||
@auth = auth
|
||||
@web_app = auth.web_app
|
||||
end
|
||||
end
|
||||
@@ -7,6 +7,7 @@ class Services::RemotestorageController < Services::BaseController
|
||||
# unless current_user.services_enabled.include?(:remotestorage)
|
||||
# redirect_to service_remotestorage_info_path
|
||||
# end
|
||||
@rs_auths = current_user.remote_storage_authorizations
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -3,11 +3,7 @@ class AppCatalog::WebApp < ApplicationRecord
|
||||
|
||||
has_many :remote_storage_authorizations
|
||||
|
||||
has_one_attached :icon do |attachable|
|
||||
attachable.variant :medium, resize_to_limit: [128,128]
|
||||
attachable.variant :large, resize_to_limit: [256,256]
|
||||
end
|
||||
|
||||
has_one_attached :icon
|
||||
has_one_attached :apple_touch_icon
|
||||
|
||||
validates :url, presence: true, uniqueness: true
|
||||
|
||||
@@ -64,6 +64,7 @@ class RemoteStorageAuthorization < ApplicationRecord
|
||||
def find_or_create_web_app
|
||||
if looks_like_hosted_origin?
|
||||
web_app = AppCatalog::WebApp.find_or_create_by!(url: self.url)
|
||||
web_app.update_metadata unless web_app.name.present?
|
||||
self.web_app = web_app
|
||||
self.app_name = web_app.name.presence || client_id
|
||||
else
|
||||
|
||||
@@ -63,10 +63,12 @@
|
||||
</section>
|
||||
|
||||
<section class="sm:flex-1 sm:pt-0">
|
||||
<% if @avatar.present? %>
|
||||
<h3>LDAP<h3>
|
||||
<p>
|
||||
<img src="data:image/jpeg;base64,<%= @avatar %>" class="h-48 w-48" />
|
||||
</p>
|
||||
<% end %>
|
||||
<!-- <h3>Actions</h3> -->
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,15 @@
|
||||
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section>
|
||||
<h3>Feature enabled</h3>
|
||||
<h3 class="">Connected Apps</h3>
|
||||
<% if @rs_auths.any? %>
|
||||
<div class="w-full grid grid-columns-1 divide-y">
|
||||
<% @rs_auths.each do |auth| %>
|
||||
<%= render RsAuthComponent.new(auth: auth) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p>No apps connected yet.</p>
|
||||
<% end %>
|
||||
</section>
|
||||
<% end %>
|
||||
|
||||
@@ -100,4 +100,8 @@ Rails.application.routes.draw do
|
||||
end
|
||||
|
||||
root to: 'dashboard#index'
|
||||
|
||||
direct :s3_image do |blob|
|
||||
File.join(ENV['S3_ALIAS_HOST'], blob.key)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user