oversee 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +53 -14
- data/app/components/oversee/{application_component.rb → base.rb} +1 -1
- data/app/components/oversee/card.rb +13 -0
- data/app/components/oversee/dashboard/filters.rb +54 -0
- data/app/components/oversee/dashboard/header.rb +41 -0
- data/app/components/oversee/dashboard/index.rb +24 -0
- data/app/components/oversee/dashboard/javascript.rb +9 -0
- data/app/components/oversee/dashboard/pagination.rb +23 -0
- data/app/components/oversee/dashboard/sidebar.rb +53 -0
- data/app/components/oversee/dashboard/tailwind.rb +33 -0
- data/app/components/oversee/field/display.rb +29 -0
- data/app/components/oversee/field/form.rb +49 -0
- data/app/components/oversee/field/input/boolean.rb +23 -0
- data/app/components/oversee/field/input/datetime.rb +20 -0
- data/app/components/oversee/field/input/integer.rb +20 -0
- data/app/components/oversee/field/input/string.rb +20 -0
- data/app/components/oversee/field/input.rb +26 -0
- data/app/components/oversee/field/label.rb +24 -0
- data/app/components/oversee/field/value/boolean.rb +50 -0
- data/app/components/oversee/field/value/datetime.rb +9 -0
- data/app/components/oversee/field/value/enum.rb +9 -0
- data/app/components/oversee/field/value/integer.rb +9 -0
- data/app/components/oversee/field/value/string.rb +20 -0
- data/app/components/oversee/field/value/text.rb +9 -0
- data/app/components/oversee/field/value.rb +34 -0
- data/app/components/oversee/resources/base.rb +4 -0
- data/app/components/oversee/resources/errors.rb +41 -0
- data/app/components/oversee/resources/form.rb +49 -0
- data/app/components/oversee/resources/index.rb +26 -0
- data/app/components/oversee/resources/new.rb +17 -0
- data/app/components/oversee/resources/show.rb +126 -0
- data/app/components/oversee/resources/table.rb +109 -0
- data/app/components/oversee/table/body.rb +13 -0
- data/app/components/oversee/table/data.rb +5 -0
- data/app/components/oversee/table/head.rb +9 -0
- data/app/components/oversee/table/row.rb +9 -0
- data/app/components/oversee/table.rb +21 -0
- data/app/controllers/oversee/dashboard_controller.rb +4 -0
- data/app/controllers/oversee/resources_controller.rb +62 -23
- data/app/models/oversee/resource.rb +36 -0
- data/app/oversee/filter.rb +39 -0
- data/app/oversee/search.rb +34 -0
- data/app/views/layouts/oversee/application.html.erb +5 -5
- data/config/locales/en.yml +4 -0
- data/config/locales/oversee.en.yml +4 -0
- data/config/routes.rb +10 -10
- data/lib/oversee/configuration.rb +3 -0
- data/lib/oversee/version.rb +1 -1
- data/lib/oversee.rb +14 -2
- metadata +71 -47
- data/app/assets/config/oversee_manifest.js +0 -1
- data/app/assets/stylesheets/oversee/application.css +0 -15
- data/app/components/oversee/card_component.rb +0 -15
- data/app/components/oversee/dashboard/sidebar_component.rb +0 -127
- data/app/components/oversee/field_component.rb +0 -39
- data/app/components/oversee/field_label_component.rb +0 -155
- data/app/components/oversee/fields/display_row_component.rb +0 -58
- data/app/components/oversee/fields/input/boolean_component.rb +0 -26
- data/app/components/oversee/fields/input/datetime_component.rb +0 -27
- data/app/components/oversee/fields/input/integer_component.rb +0 -26
- data/app/components/oversee/fields/input/string_component.rb +0 -26
- data/app/components/oversee/fields/value/boolean_component.rb +0 -44
- data/app/components/oversee/fields/value/datetime_component.rb +0 -16
- data/app/components/oversee/fields/value/enum_component.rb +0 -16
- data/app/components/oversee/fields/value/integer_component.rb +0 -16
- data/app/components/oversee/fields/value/string_component.rb +0 -23
- data/app/components/oversee/fields/value/text_component.rb +0 -16
- data/app/helpers/oversee/application_helper.rb +0 -5
- data/app/mailers/oversee/application_mailer.rb +0 -6
- data/app/views/oversee/application/_javascript.html.erb +0 -17
- data/app/views/oversee/dashboard/show.html.erb +0 -18
- data/app/views/oversee/resources/_form.html.erb +0 -10
- data/app/views/oversee/resources/_input_field.html.erb +0 -20
- data/app/views/oversee/resources/edit.html.erb +0 -30
- data/app/views/oversee/resources/index.html.erb +0 -59
- data/app/views/oversee/resources/input_field.html.erb +0 -1
- data/app/views/oversee/resources/new.html.erb +0 -28
- data/app/views/oversee/resources/show.html.erb +0 -51
- data/app/views/oversee/resources/update.turbo_stream.erb +0 -3
- data/app/views/shared/_sidebar.html.erb +0 -32
@@ -1,155 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
class FieldLabelComponent < Phlex::HTML
|
3
|
-
def initialize(datatype: :string, key: nil)
|
4
|
-
@datatype = datatype
|
5
|
-
@key = key
|
6
|
-
end
|
7
|
-
|
8
|
-
def view_template
|
9
|
-
div(class:"inline-flex items-center space-x-2") do
|
10
|
-
div(class: "h-5 w-5 bg-gray-100 inline-flex items-center justify-center rounded") do
|
11
|
-
respond_to?("#{@datatype}_icon", true) ? send("#{@datatype}_icon") : data_icon
|
12
|
-
end
|
13
|
-
p(class: "uppercase text-xs text-gray-500 font-medium") { @key.to_s.humanize }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def string_icon
|
20
|
-
svg(
|
21
|
-
xmlns: "http://www.w3.org/2000/svg",
|
22
|
-
class: "h-2.5 w-2.5",
|
23
|
-
viewbox: "0 0 24 24",
|
24
|
-
stroke_width: "2",
|
25
|
-
stroke: "currentColor",
|
26
|
-
fill: "none",
|
27
|
-
stroke_linecap: "round",
|
28
|
-
stroke_linejoin: "round"
|
29
|
-
) do |s|
|
30
|
-
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
31
|
-
s.path(d: "M6 4l12 0")
|
32
|
-
s.path(d: "M12 4l0 16")
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def integer_icon
|
37
|
-
svg(
|
38
|
-
xmlns: "http://www.w3.org/2000/svg",
|
39
|
-
class: "h-2.5 w-2.5",
|
40
|
-
viewbox: "0 0 24 24",
|
41
|
-
stroke_width: "2",
|
42
|
-
stroke: "currentColor",
|
43
|
-
fill: "none",
|
44
|
-
stroke_linecap: "round",
|
45
|
-
stroke_linejoin: "round"
|
46
|
-
) do |s|
|
47
|
-
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
48
|
-
s.path(d: "M4 17v-10l7 10v-10")
|
49
|
-
s.path(d: "M15 17h5")
|
50
|
-
s.path(d: "M17.5 10m-2.5 0a2.5 3 0 1 0 5 0a2.5 3 0 1 0 -5 0")
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def text_icon
|
55
|
-
svg(
|
56
|
-
xmlns: "http://www.w3.org/2000/svg",
|
57
|
-
class: "h-2.5 w-2.5",
|
58
|
-
viewbox: "0 0 24 24",
|
59
|
-
stroke_width: "2",
|
60
|
-
stroke: "currentColor",
|
61
|
-
fill: "none",
|
62
|
-
stroke_linecap: "round",
|
63
|
-
stroke_linejoin: "round"
|
64
|
-
) do |s|
|
65
|
-
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
66
|
-
s.path(d: "M6 4l12 0")
|
67
|
-
s.path(d: "M12 4l0 16")
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def boolean_icon
|
72
|
-
svg(
|
73
|
-
xmlns: "http://www.w3.org/2000/svg",
|
74
|
-
class: "h-2.5 w-2.5",
|
75
|
-
viewbox: "0 0 24 24",
|
76
|
-
stroke_width: "2",
|
77
|
-
stroke: "currentColor",
|
78
|
-
fill: "none",
|
79
|
-
stroke_linecap: "round",
|
80
|
-
stroke_linejoin: "round"
|
81
|
-
) do |s|
|
82
|
-
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
83
|
-
s.path(d: "M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0")
|
84
|
-
s.path(
|
85
|
-
d:
|
86
|
-
"M2 6m0 6a6 6 0 0 1 6 -6h8a6 6 0 0 1 6 6v0a6 6 0 0 1 -6 6h-8a6 6 0 0 1 -6 -6z"
|
87
|
-
)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def enum_icon
|
92
|
-
svg(
|
93
|
-
xmlns: "http://www.w3.org/2000/svg",
|
94
|
-
class: "h-2.5 w-2.5",
|
95
|
-
viewbox: "0 0 24 24",
|
96
|
-
stroke_width: "2",
|
97
|
-
stroke: "currentColor",
|
98
|
-
fill: "none",
|
99
|
-
stroke_linecap: "round",
|
100
|
-
stroke_linejoin: "round"
|
101
|
-
) do |s|
|
102
|
-
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
103
|
-
s.path(
|
104
|
-
d:
|
105
|
-
"M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"
|
106
|
-
)
|
107
|
-
s.path(d: "M9 11l3 3l3 -3")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def datetime_icon
|
112
|
-
svg(
|
113
|
-
xmlns: "http://www.w3.org/2000/svg",
|
114
|
-
class: "h-2.5 w-2.5",
|
115
|
-
viewbox: "0 0 24 24",
|
116
|
-
stroke_width: "2",
|
117
|
-
stroke: "currentColor",
|
118
|
-
fill: "none",
|
119
|
-
stroke_linecap: "round",
|
120
|
-
stroke_linejoin: "round"
|
121
|
-
) do |s|
|
122
|
-
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
123
|
-
s.path(
|
124
|
-
d:
|
125
|
-
"M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z"
|
126
|
-
)
|
127
|
-
s.path(d: "M16 3v4")
|
128
|
-
s.path(d: "M8 3v4")
|
129
|
-
s.path(d: "M4 11h16")
|
130
|
-
s.path(d: "M11 15h1")
|
131
|
-
s.path(d: "M12 15v3")
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def data_icon
|
136
|
-
svg(
|
137
|
-
xmlns: "http://www.w3.org/2000/svg",
|
138
|
-
viewbox: "0 0 24 24",
|
139
|
-
fill: "none",
|
140
|
-
stroke: "currentColor",
|
141
|
-
stroke_width: "2",
|
142
|
-
stroke_linecap: "round",
|
143
|
-
stroke_linejoin: "round",
|
144
|
-
class: "h-2.5 w-2.5",
|
145
|
-
) do |s|
|
146
|
-
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
147
|
-
s.path(d: "M15 12h.01")
|
148
|
-
s.path(d: "M12 12h.01")
|
149
|
-
s.path(d: "M9 12h.01")
|
150
|
-
s.path(d: "M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2")
|
151
|
-
s.path(d: "M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2")
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
class Oversee::Fields::DisplayRowComponent < Phlex::HTML
|
2
|
-
include Phlex::Rails::Helpers::DOMID
|
3
|
-
include Phlex::Rails::Helpers::Routes
|
4
|
-
|
5
|
-
def initialize(key:, resource:, datatype:, value:)
|
6
|
-
@datatype = datatype
|
7
|
-
@resource = resource
|
8
|
-
@key = key
|
9
|
-
@value = value
|
10
|
-
end
|
11
|
-
|
12
|
-
def view_template
|
13
|
-
div(
|
14
|
-
id: dom_id(@resource, @key),
|
15
|
-
class:
|
16
|
-
"py-4 px-8 hover:bg-gray-50 group flex items-center justify-between"
|
17
|
-
) do
|
18
|
-
div do
|
19
|
-
render Oversee::FieldLabelComponent.new(key: @key, datatype: @datatype)
|
20
|
-
div(class: "mt-2 bg-gray-100 rounded px-4 py-2 min-w-64") do
|
21
|
-
render Oversee::FieldComponent.new(kind: :value, datatype: @datatype, value: @resource.send(@key))
|
22
|
-
end
|
23
|
-
end
|
24
|
-
div do
|
25
|
-
a(
|
26
|
-
href:
|
27
|
-
(
|
28
|
-
input_field_path(
|
29
|
-
@resource.id,
|
30
|
-
resource: @resource.class,
|
31
|
-
key: @key
|
32
|
-
)
|
33
|
-
),
|
34
|
-
data_turbo_stream: "true",
|
35
|
-
class:
|
36
|
-
"opacity-0 group-hover:opacity-100 transition h-8 w-8 rounded-md bg-white border inline-flex justify-center items-center text-gray-400 hover:text-gray-800"
|
37
|
-
) do
|
38
|
-
svg(
|
39
|
-
xmlns: "http://www.w3.org/2000/svg",
|
40
|
-
viewbox: "0 0 16 16",
|
41
|
-
fill: "currentColor",
|
42
|
-
data_slot: "icon",
|
43
|
-
class: "w-4 h-4"
|
44
|
-
) do |s|
|
45
|
-
s.path(
|
46
|
-
d:
|
47
|
-
"M13.488 2.513a1.75 1.75 0 0 0-2.475 0L6.75 6.774a2.75 2.75 0 0 0-.596.892l-.848 2.047a.75.75 0 0 0 .98.98l2.047-.848a2.75 2.75 0 0 0 .892-.596l4.261-4.262a1.75 1.75 0 0 0 0-2.474Z"
|
48
|
-
)
|
49
|
-
s.path(
|
50
|
-
d:
|
51
|
-
"M4.75 3.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h6.5c.69 0 1.25-.56 1.25-1.25V9A.75.75 0 0 1 14 9v2.25A2.75 2.75 0 0 1 11.25 14h-6.5A2.75 2.75 0 0 1 2 11.25v-6.5A2.75 2.75 0 0 1 4.75 2H7a.75.75 0 0 1 0 1.5H4.75Z"
|
52
|
-
)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
module Fields
|
3
|
-
module Input
|
4
|
-
class BooleanComponent < Phlex::HTML
|
5
|
-
def initialize(key:, value:)
|
6
|
-
@key = key
|
7
|
-
@value = value
|
8
|
-
end
|
9
|
-
|
10
|
-
def view_template
|
11
|
-
input type: "text", id: field_id, name: field_name, value: @value, class: "border rounded-md px-4 py-2 text-sm"
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def field_id
|
17
|
-
"resource_#{@key.to_s}"
|
18
|
-
end
|
19
|
-
|
20
|
-
def field_name
|
21
|
-
"resource[#{@key.to_s}]"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
|
2
|
-
module Oversee
|
3
|
-
module Fields
|
4
|
-
module Input
|
5
|
-
class DatetimeComponent < Phlex::HTML
|
6
|
-
def initialize(key:, value:)
|
7
|
-
@key = key
|
8
|
-
@value = value
|
9
|
-
end
|
10
|
-
|
11
|
-
def view_template
|
12
|
-
input type: "datetime-local", id: field_id, name: field_name, value: @value.strftime("%Y-%m-%dT%T"), class: "border rounded-md px-4 py-2 text-sm"
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def field_id
|
18
|
-
"resource_#{@key.to_s}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def field_name
|
22
|
-
"resource[#{@key.to_s}]"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
module Fields
|
3
|
-
module Input
|
4
|
-
class IntegerComponent < Phlex::HTML
|
5
|
-
def initialize(key:, value:)
|
6
|
-
@key = key
|
7
|
-
@value = value
|
8
|
-
end
|
9
|
-
|
10
|
-
def view_template
|
11
|
-
input type: "number", id: field_id, name: field_name, value: @value, class: "border rounded-md px-4 py-2 text-sm"
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def field_id
|
17
|
-
"resource_#{@key.to_s}"
|
18
|
-
end
|
19
|
-
|
20
|
-
def field_name
|
21
|
-
"resource[#{@key.to_s}]"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
module Fields
|
3
|
-
module Input
|
4
|
-
class StringComponent < Phlex::HTML
|
5
|
-
def initialize(key:, value:)
|
6
|
-
@key = key
|
7
|
-
@value = value
|
8
|
-
end
|
9
|
-
|
10
|
-
def view_template
|
11
|
-
input type: "text", id: field_id, name: field_name, value: @value, class: "border rounded-md px-4 py-2 text-sm w-full"
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def field_id
|
17
|
-
"resource_#{@key.to_s}"
|
18
|
-
end
|
19
|
-
|
20
|
-
def field_name
|
21
|
-
"resource[#{@key.to_s}]"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
module Fields
|
3
|
-
module Value
|
4
|
-
class BooleanComponent < Phlex::HTML
|
5
|
-
def initialize(key: nil, value: nil, kind: :value)
|
6
|
-
@value = value
|
7
|
-
end
|
8
|
-
|
9
|
-
def view_template
|
10
|
-
return p(class: "text-gray-500 text-xs"){ "—" } if @value.blank?
|
11
|
-
if @value
|
12
|
-
svg(
|
13
|
-
xmlns: "http://www.w3.org/2000/svg",
|
14
|
-
viewbox: "0 0 16 16",
|
15
|
-
fill: "currentColor",
|
16
|
-
data_slot: "icon",
|
17
|
-
class: "w-4 h-4 text-emerald-500"
|
18
|
-
) do |s|
|
19
|
-
s.path(
|
20
|
-
fill_rule: "evenodd",
|
21
|
-
d:
|
22
|
-
"M12.416 3.376a.75.75 0 0 1 .208 1.04l-5 7.5a.75.75 0 0 1-1.154.114l-3-3a.75.75 0 0 1 1.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 0 1 1.04-.207Z",
|
23
|
-
clip_rule: "evenodd"
|
24
|
-
)
|
25
|
-
end
|
26
|
-
else
|
27
|
-
svg(
|
28
|
-
xmlns: "http://www.w3.org/2000/svg",
|
29
|
-
viewbox: "0 0 16 16",
|
30
|
-
fill: "currentColor",
|
31
|
-
data_slot: "icon",
|
32
|
-
class: "w-4 h-4 text-red-400"
|
33
|
-
) do |s|
|
34
|
-
s.path(
|
35
|
-
d:
|
36
|
-
"M5.28 4.22a.75.75 0 0 0-1.06 1.06L6.94 8l-2.72 2.72a.75.75 0 1 0 1.06 1.06L8 9.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L9.06 8l2.72-2.72a.75.75 0 0 0-1.06-1.06L8 6.94 5.28 4.22Z"
|
37
|
-
)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
module Fields
|
3
|
-
module Value
|
4
|
-
class DatetimeComponent < Phlex::HTML
|
5
|
-
def initialize(key: nil, value: nil, kind: :value)
|
6
|
-
@value = value
|
7
|
-
end
|
8
|
-
|
9
|
-
def view_template
|
10
|
-
return p(class: "text-gray-500 text-xs"){ "—" } if @value.blank?
|
11
|
-
p { @value&.to_fs(:short) || "N/A" }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
module Fields
|
3
|
-
module Value
|
4
|
-
class EnumComponent < Phlex::HTML
|
5
|
-
def initialize(key: nil, value: nil, kind: :value)
|
6
|
-
@value = value
|
7
|
-
end
|
8
|
-
|
9
|
-
def view_template
|
10
|
-
return p(class: "text-gray-500 text-xs"){ "—" } if @value.blank?
|
11
|
-
p { @value.to_s }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
module Fields
|
3
|
-
module Value
|
4
|
-
class IntegerComponent < Phlex::HTML
|
5
|
-
def initialize(key: nil, value: nil, kind: :value)
|
6
|
-
@value = value
|
7
|
-
end
|
8
|
-
|
9
|
-
def view_template
|
10
|
-
return p(class: "text-gray-500 text-xs"){ "—" } if @value.blank?
|
11
|
-
p { @value }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
module Fields
|
3
|
-
module Value
|
4
|
-
class StringComponent < Phlex::HTML
|
5
|
-
def initialize(key: nil, value: nil, kind: :value)
|
6
|
-
@key = key
|
7
|
-
@value = value
|
8
|
-
@kind = kind
|
9
|
-
end
|
10
|
-
|
11
|
-
def view_template
|
12
|
-
return p(class: "text-gray-500 text-xs"){ "—" } if @value.blank?
|
13
|
-
|
14
|
-
if @key&.downcase&.include?("password") || @key&.downcase&.include?("token")
|
15
|
-
p { "[REDACTED]" }
|
16
|
-
else
|
17
|
-
p(class: "truncate") { @value }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Oversee
|
2
|
-
module Fields
|
3
|
-
module Value
|
4
|
-
class TextComponent < Phlex::HTML
|
5
|
-
def initialize(datatype: :string, key: nil, value: nil, kind: :value)
|
6
|
-
@value = value
|
7
|
-
end
|
8
|
-
|
9
|
-
def view_template
|
10
|
-
return p(class: "text-gray-500 text-xs"){ "—" } if @value.blank?
|
11
|
-
p(class: "truncate") { @value }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<script src="https://cdn.tailwindcss.com"></script>
|
2
|
-
|
3
|
-
<script type="importmap" data-turbo-track="reload">
|
4
|
-
{
|
5
|
-
"imports": {
|
6
|
-
"@hotwired/stimulus": "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js",
|
7
|
-
"@hotwired/turbo": "https://unpkg.com/@hotwired/turbo",
|
8
|
-
"@hotwired/turbo-rails": "https://unpkg.com/@hotwired/turbo-rails"
|
9
|
-
}
|
10
|
-
}
|
11
|
-
</script>
|
12
|
-
|
13
|
-
<script async src="https://unpkg.com/es-module-shims/dist/es-module-shims.js"></script>
|
14
|
-
|
15
|
-
<script type="module">
|
16
|
-
import * as Turbo from "@hotwired/turbo-rails"
|
17
|
-
</script>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<div class="p-8">
|
2
|
-
<div class="flex items-center justify-between">
|
3
|
-
<div>
|
4
|
-
<p class="text-xs uppercase font-medium text-gray-400">Dashboard</p>
|
5
|
-
<h1 class="text-xl">Welcome</h1>
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<% if Oversee.card_class_names.present? %>
|
11
|
-
<div class="p-8">
|
12
|
-
<div class="grid grid-cols-4 gap-4">
|
13
|
-
<% Oversee.card_class_names.each do |card_name| %>
|
14
|
-
<%= render Oversee::CardComponent.new(card_name: card_name) %>
|
15
|
-
<% end %>
|
16
|
-
</div>
|
17
|
-
</div>
|
18
|
-
<% end %>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%= form_with model: @resource, scope: :resource, url: resource_path do |form| %>
|
2
|
-
<% @resource_class.columns_hash.each do |key, metadata| %>
|
3
|
-
<div class="mb-4">
|
4
|
-
<%= form.label key, class: "uppercase text-xs" %>
|
5
|
-
<%= form.text_field key, class: "block border" %>
|
6
|
-
</div>
|
7
|
-
<% end %>
|
8
|
-
<%= hidden_field_tag :resource_class, @resource_class %>
|
9
|
-
<%= form.submit %>
|
10
|
-
<% end %>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<div id="<%= dom_id(@resource, key) %>" class="py-4 px-8 hover:bg-gray-50 group flex items-center justify-between">
|
2
|
-
<div class="hidden space-y-2 animate-pulse">
|
3
|
-
<div class="h-4 w-10 bg-gray-100 rounded-md"></div>
|
4
|
-
<div class="h-8 w-32 bg-gray-100 rounded-md"></div>
|
5
|
-
</div>
|
6
|
-
<div>
|
7
|
-
<%= render Oversee::FieldLabelComponent.new(key: key, datatype: datatype) %>
|
8
|
-
<div class="mt-2">
|
9
|
-
<%= form_with url: resource_path(@resource.id, resource_class: @resource_class), scope: :resource, model: @resource do |f| %>
|
10
|
-
<%= f.hidden_field :oversee_key, value: key %>
|
11
|
-
<%= f.hidden_field :oversee_datatype, value: datatype %>
|
12
|
-
|
13
|
-
<% input_datatype = [:string, :integer, :datetime].include?(datatype) ? datatype : :string %>
|
14
|
-
<%= render Oversee::FieldComponent.new(kind: :input, datatype: input_datatype.to_sym, key: key, value: value)%>
|
15
|
-
|
16
|
-
<%= f.submit "Save", class: "bg-blue-500 px-4 py-2 rounded-md text-white text-sm hover:bg-blue-600 hover:cursor-pointer" %>
|
17
|
-
<% end %>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
</div>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
<div class="p-8">
|
2
|
-
<div class="flex items-center justify-between">
|
3
|
-
<div>
|
4
|
-
<p class="text-xs uppercase font-medium text-gray-400">Resource</p>
|
5
|
-
<h1 class="text-xl"><%= params[:resource] %></h1>
|
6
|
-
</div>
|
7
|
-
<%= link_to 'Edit', edit_resource_path(@resource, resource: params[:resource]), class: "inline-flex items-center justify-center py-2 px-6 rounded bg-blue-500 text-white text-sm font-medium" %>
|
8
|
-
</div>
|
9
|
-
</div>
|
10
|
-
<div class="p-8">
|
11
|
-
<%= render "form" %>
|
12
|
-
</div>
|
13
|
-
<div class="p-8">
|
14
|
-
<div class="bg-white px-8 border shadow-sm rounded">
|
15
|
-
<div class="divide-y divide-gray-100 -mx-8">
|
16
|
-
<% @resource.attributes.each do |attribute, value| %>
|
17
|
-
<div class="py-4 px-8">
|
18
|
-
<p class="text-xs font-medium text-gray-500 uppercase"><%= attribute.humanize %></p>
|
19
|
-
<p class="mt-1 text-lg"><%= render Oversee::FieldComponent.new(datatype: :string, value: value) %></p>
|
20
|
-
</div>
|
21
|
-
<% end %>
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
|
26
|
-
<div class="p-8">
|
27
|
-
<pre>
|
28
|
-
<%= debug @resource.attributes %>
|
29
|
-
</pre>
|
30
|
-
</div>
|
@@ -1,59 +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">Index</p>
|
5
|
-
<h1 class="text-2xl"><%= params[:resource] %></h1>
|
6
|
-
</div>
|
7
|
-
<%= link_to 'Add new', new_resource_path(params[:resource]), class: "inline-flex items-center justify-center py-2 px-6 rounded bg-blue-500 text-white text-sm font-medium" %>
|
8
|
-
</div>
|
9
|
-
</div>
|
10
|
-
<div class="">
|
11
|
-
<div class="bg-white border-t overflow-x-hidden">
|
12
|
-
<div class="-mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
13
|
-
<div class="inline-block min-w-full align-middle sm:px-6 lg:px-8">
|
14
|
-
<table class="min-w-full divide-y divide-gray-300">
|
15
|
-
<thead>
|
16
|
-
<tr class="divide-x divide-gray-200">
|
17
|
-
<th class="hidden"><input type="checkbox" name="" id="" class="mx-4"></th>
|
18
|
-
<th scope="col" class="px-4 py-3.5 text-left text-xs font-semibold text-gray-900 uppercase"></th>
|
19
|
-
<% @resource_class.columns_hash.each do |key, metadata| %>
|
20
|
-
<th scope="col" class="px-4 py-3.5 text-left text-xs font-semibold text-gray-900 uppercase whitespace-nowrap hover:bg-gray-50 transition">
|
21
|
-
<a href="<%= resources_path(resource: params[:resource], sort_attribute: key, sort_direction: params[:sort_direction] == "asc" ? :desc : :asc) %>" class="hover:underline">
|
22
|
-
<%= render Oversee::FieldLabelComponent.new(key: key, datatype: metadata.sql_type_metadata.type) %>
|
23
|
-
</a>
|
24
|
-
</th>
|
25
|
-
<% end %>
|
26
|
-
</tr>
|
27
|
-
</thead>
|
28
|
-
<tbody class="divide-y divide-gray-100 bg-white">
|
29
|
-
<% @resources.each do |resource| %>
|
30
|
-
<tr class="divide-x divide-gray-100">
|
31
|
-
<td class="hidden">
|
32
|
-
<input type="checkbox" name="" id="" class="mx-4">
|
33
|
-
</td>
|
34
|
-
<td>
|
35
|
-
<div class="flex space-x-2 mx-4">
|
36
|
-
<a href="<%= resource_path(resource.id, resource: params[:resource]) %>" data-turbo-stream="true">
|
37
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" data-slot="icon" class="w-4 h-4 text-gray-500 hover:text-blue-500">
|
38
|
-
<path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" />
|
39
|
-
<path fill-rule="evenodd" d="M1.38 8.28a.87.87 0 0 1 0-.566 7.003 7.003 0 0 1 13.238.006.87.87 0 0 1 0 .566A7.003 7.003 0 0 1 1.379 8.28ZM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" clip-rule="evenodd" />
|
40
|
-
</svg>
|
41
|
-
</a>
|
42
|
-
</div>
|
43
|
-
</td>
|
44
|
-
<% @resource_class.columns_hash.each do |key, metadata| %>
|
45
|
-
<td class="whitespace-nowrap p-4 text-sm text-gray-500">
|
46
|
-
<div class="max-w-96">
|
47
|
-
<%= render Oversee::FieldComponent.new(datatype: metadata.sql_type_metadata.type, value: resource.send(key), key: key) %>
|
48
|
-
</div>
|
49
|
-
</td>
|
50
|
-
<% end %>
|
51
|
-
</tr>
|
52
|
-
<% end %>
|
53
|
-
</tbody>
|
54
|
-
</table>
|
55
|
-
</div>
|
56
|
-
</div>
|
57
|
-
</div>
|
58
|
-
<%= raw(pagy_nav(@pagy)) if @pagy.pages > 1 %>
|
59
|
-
</div>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render partial: "oversee/resources/input_field" %>
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<div class="p-8">
|
2
|
-
<div class="flex items-center justify-between">
|
3
|
-
<div>
|
4
|
-
<p class="text-xs uppercase font-medium text-gray-400">New</p>
|
5
|
-
<h1 class="text-xl"><%= params[:resource] %></h1>
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<div class="pb-8 px-8">
|
11
|
-
<%= form_with model: @resource, scope: :resource, url: create_resource_path(resource_class: @resource.class), scope: :resource do |f| %>
|
12
|
-
<div class="border-y -mx-8 py-8">
|
13
|
-
<% @resource_class.columns_hash.each do |key, metadata| %>
|
14
|
-
<% next if [@resource_class.primary_key, "created_at", "updated_at"].include?(key) %>
|
15
|
-
<div class="px-8 py-2">
|
16
|
-
<%= render Oversee::FieldLabelComponent.new(key: key, datatype: metadata.sql_type_metadata.type) %>
|
17
|
-
<div class="mt-2 w-2/3">
|
18
|
-
<%= render Oversee::FieldComponent.new(kind: :input, datatype: metadata.sql_type_metadata.type, key: key)%>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
<%#= render Oversee::Fields::DisplayRowComponent.new(key: key, resource: @resource, datatype: metadata.sql_type_metadata.type, value: @resource.send(key)) %>
|
22
|
-
<% end %>
|
23
|
-
</div>
|
24
|
-
<div class="flex justify-end mt-8">
|
25
|
-
<%= f.submit "Save", class: "bg-blue-500 px-4 py-2 rounded-md text-white text-sm hover:bg-blue-600 hover:cursor-pointer" %>
|
26
|
-
</div>
|
27
|
-
<% end %>
|
28
|
-
</div>
|