oversee 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +53 -14
  3. data/app/components/oversee/{application_component.rb → base.rb} +1 -1
  4. data/app/components/oversee/card.rb +13 -0
  5. data/app/components/oversee/dashboard/filters.rb +54 -0
  6. data/app/components/oversee/dashboard/header.rb +41 -0
  7. data/app/components/oversee/dashboard/index.rb +24 -0
  8. data/app/components/oversee/dashboard/javascript.rb +9 -0
  9. data/app/components/oversee/dashboard/pagination.rb +23 -0
  10. data/app/components/oversee/dashboard/sidebar.rb +53 -0
  11. data/app/components/oversee/dashboard/tailwind.rb +33 -0
  12. data/app/components/oversee/field/display.rb +29 -0
  13. data/app/components/oversee/field/form.rb +49 -0
  14. data/app/components/oversee/field/input/boolean.rb +23 -0
  15. data/app/components/oversee/field/input/datetime.rb +20 -0
  16. data/app/components/oversee/field/input/integer.rb +20 -0
  17. data/app/components/oversee/field/input/string.rb +20 -0
  18. data/app/components/oversee/field/input.rb +26 -0
  19. data/app/components/oversee/field/label.rb +24 -0
  20. data/app/components/oversee/field/value/boolean.rb +50 -0
  21. data/app/components/oversee/field/value/datetime.rb +9 -0
  22. data/app/components/oversee/field/value/enum.rb +9 -0
  23. data/app/components/oversee/field/value/integer.rb +9 -0
  24. data/app/components/oversee/field/value/string.rb +20 -0
  25. data/app/components/oversee/field/value/text.rb +9 -0
  26. data/app/components/oversee/field/value.rb +34 -0
  27. data/app/components/oversee/resources/base.rb +4 -0
  28. data/app/components/oversee/resources/errors.rb +41 -0
  29. data/app/components/oversee/resources/form.rb +49 -0
  30. data/app/components/oversee/resources/index.rb +26 -0
  31. data/app/components/oversee/resources/new.rb +17 -0
  32. data/app/components/oversee/resources/show.rb +126 -0
  33. data/app/components/oversee/resources/table.rb +109 -0
  34. data/app/components/oversee/table/body.rb +13 -0
  35. data/app/components/oversee/table/data.rb +5 -0
  36. data/app/components/oversee/table/head.rb +9 -0
  37. data/app/components/oversee/table/row.rb +9 -0
  38. data/app/components/oversee/table.rb +21 -0
  39. data/app/controllers/oversee/dashboard_controller.rb +4 -0
  40. data/app/controllers/oversee/resources_controller.rb +62 -23
  41. data/app/models/oversee/resource.rb +36 -0
  42. data/app/oversee/filter.rb +39 -0
  43. data/app/oversee/search.rb +34 -0
  44. data/app/views/layouts/oversee/application.html.erb +5 -5
  45. data/config/locales/en.yml +4 -0
  46. data/config/locales/oversee.en.yml +4 -0
  47. data/config/routes.rb +10 -10
  48. data/lib/oversee/configuration.rb +3 -0
  49. data/lib/oversee/version.rb +1 -1
  50. data/lib/oversee.rb +14 -2
  51. metadata +71 -47
  52. data/app/assets/config/oversee_manifest.js +0 -1
  53. data/app/assets/stylesheets/oversee/application.css +0 -15
  54. data/app/components/oversee/card_component.rb +0 -15
  55. data/app/components/oversee/dashboard/sidebar_component.rb +0 -127
  56. data/app/components/oversee/field_component.rb +0 -39
  57. data/app/components/oversee/field_label_component.rb +0 -155
  58. data/app/components/oversee/fields/display_row_component.rb +0 -58
  59. data/app/components/oversee/fields/input/boolean_component.rb +0 -26
  60. data/app/components/oversee/fields/input/datetime_component.rb +0 -27
  61. data/app/components/oversee/fields/input/integer_component.rb +0 -26
  62. data/app/components/oversee/fields/input/string_component.rb +0 -26
  63. data/app/components/oversee/fields/value/boolean_component.rb +0 -44
  64. data/app/components/oversee/fields/value/datetime_component.rb +0 -16
  65. data/app/components/oversee/fields/value/enum_component.rb +0 -16
  66. data/app/components/oversee/fields/value/integer_component.rb +0 -16
  67. data/app/components/oversee/fields/value/string_component.rb +0 -23
  68. data/app/components/oversee/fields/value/text_component.rb +0 -16
  69. data/app/helpers/oversee/application_helper.rb +0 -5
  70. data/app/mailers/oversee/application_mailer.rb +0 -6
  71. data/app/views/oversee/application/_javascript.html.erb +0 -17
  72. data/app/views/oversee/dashboard/show.html.erb +0 -18
  73. data/app/views/oversee/resources/_form.html.erb +0 -10
  74. data/app/views/oversee/resources/_input_field.html.erb +0 -20
  75. data/app/views/oversee/resources/edit.html.erb +0 -30
  76. data/app/views/oversee/resources/index.html.erb +0 -59
  77. data/app/views/oversee/resources/input_field.html.erb +0 -1
  78. data/app/views/oversee/resources/new.html.erb +0 -28
  79. data/app/views/oversee/resources/show.html.erb +0 -51
  80. data/app/views/oversee/resources/update.turbo_stream.erb +0 -3
  81. data/app/views/shared/_sidebar.html.erb +0 -32
@@ -1,51 +0,0 @@
1
- <div class="p-8">
2
- <div class="flex items-center justify-between">
3
- <div>
4
- <p class="text-xs font-medium text-gray-500">Resource</p>
5
- <h1 class="text-xl"><%= params[:resource] %></h1>
6
- <div class="mt-2 inline-flex py-1 px-3 rounded-full text-xs bg-white border"># <%= @resource.to_param %></div>
7
- </div>
8
- <%= button_to resource_path(resource: params[:resource]), method: :delete, data: { turbo_confirm: "Are you sure?" }, class: "py-2 px-6 inline-flex border rounded text-red-500 shadow-sm hover:bg-gray-50 text-sm font-medium" do %>
9
- Delete
10
- <% end %>
11
- </div>
12
- </div>
13
-
14
- <div class="pb-8">
15
- <div class="px-8">
16
- <h3 class="text-xl mb-8">Attributes</h3>
17
- <div class="border-y divide-y -mx-8">
18
- <% @resource_class.columns_hash.each do |key, metadata| %>
19
- <%= render Oversee::Fields::DisplayRowComponent.new(key: key, resource: @resource, datatype: metadata.sql_type_metadata.type, value: @resource.send(key)) %>
20
- <% end %>
21
- </div>
22
- </div>
23
- </div>
24
-
25
- <div class="pb-8">
26
- <div class="px-8">
27
- <h3 class="text-xl mb-8">Associations</h3>
28
- <div class="border-y divide-y -mx-8">
29
- <% @resource_associations.each do |association| %>
30
- <% associated_resources = @resource.send(association.name.to_sym) %>
31
- <% next if associated_resources.blank? %>
32
- <% associated_resources = [associated_resources] unless associated_resources.respond_to?(:each) %>
33
-
34
- <div class="px-8 py-6">
35
- <div class="inline-flex items-center gap-2 mb-4">
36
- <div class="inline-flex items-center justify-center h-6 w-6 bg-gray-50">
37
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M6.5 17.5l5.5 -4.5l5.5 4.5" /><path d="M12 7l0 6" /></svg>
38
- </div>
39
- <%= association.name.to_s.titleize %>
40
- </div>
41
-
42
- <div class="flex gap-2 flex-wrap">
43
- <% associated_resources.each do |ar| %>
44
- <a href="<%= resource_path(ar.id, resource: ar.class) %>" class="inline-flex text-xs border border-transparent rounded-full bg-gray-100 hover:bg-gray-200 px-3 py-1.5"><%= ar.class %> - <%= ar.to_param %></a>
45
- <% end %>
46
- </div>
47
- </div>
48
- <% end %>
49
- </div>
50
- </div>
51
- </div>
@@ -1,3 +0,0 @@
1
- <%= turbo_stream.replace(dom_id(@resource, @key)) do %>
2
- <%= render Oversee::Fields::DisplayRowComponent.new(key: @key, resource: @resource, datatype: @datatype, value: @resource.send(@key)) %>
3
- <% end %>
@@ -1,32 +0,0 @@
1
- <div class="bg-gray-50 h-full relative p-4">
2
- <div class="overflow-y-scroll mb-4">
3
- <ul class="mb-4">
4
- <li class="flex">
5
- <a href="<%= root_path %>" class="group flex items-center space-x-1.5 rounded-md hover:bg-gray-100 p-2">
6
- <svg xmlns="http://www.w3.org/2000/svg" class="group-hover:text-gray-500 text-gray-400 w-4 h-4 transition-colors duration-75" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 4m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v1a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z" /><path d="M4 13m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z" /><path d="M14 4m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z" /></svg>
7
- <p class="text-sm text-gray-800 group-hover:text-gray-900">Dashboard</p>
8
- </a>
9
- </li>
10
- <li class="flex">
11
- <a href="<%= main_app.root_path %>" class="group flex items-center space-x-1.5 rounded-md hover:bg-gray-100 p-2">
12
- <svg xmlns="http://www.w3.org/2000/svg" class="group-hover:text-gray-500 text-gray-400 w-4 h-4 transition-colors duration-75" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2" /><path d="M9 12h12l-3 -3" /><path d="M18 15l3 -3" /></svg>
13
- <p class="text-sm text-gray-800 group-hover:text-gray-900">Return to app</p>
14
- </a>
15
- </li>
16
- </ul>
17
- <p class="font-medium mb-2 text-xs text-gray-500">Resources</p>
18
- <ul>
19
- <% ApplicationRecord.descendants.map(&:to_s).sort.each do |resource_name| %>
20
- <li class="flex">
21
- <a href="<%= resources_path(resource: resource_name) %>" class="group flex items-center space-x-1.5 rounded-md hover:bg-gray-100 p-2">
22
- <svg xmlns="http://www.w3.org/2000/svg" class="group-hover:text-gray-500 text-gray-400 w-4 h-4 transition-colors duration-75" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2" /></svg>
23
- <p class="text-sm text-gray-800 group-hover:text-gray-900"><%= resource_name %></p>
24
- </a>
25
- </li>
26
- <% end %>
27
- </ul>
28
- </div>
29
- <div class="absolute bottom-0 w-full text-xs flex items-center justify-center py-3 bg-gray-50 -mx-4">
30
- <p>Powered by <a href="https://github.com/primevise/oversee" class="text-blue-500 hover:underline" target="_blank">Oversee</a></p>
31
- </div>
32
- </div>