eyeloupe 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +129 -0
  5. data/Rakefile +8 -0
  6. data/app/assets/builds/eyeloupe.css +1 -0
  7. data/app/assets/config/eyeloupe_manifest.js +3 -0
  8. data/app/assets/images/eyeloupe/logo.png +0 -0
  9. data/app/assets/javascripts/eyeloupe/application.js +5 -0
  10. data/app/assets/javascripts/eyeloupe/controllers/application.js +9 -0
  11. data/app/assets/javascripts/eyeloupe/controllers/eyeloupe/nav_controller.js +13 -0
  12. data/app/assets/javascripts/eyeloupe/controllers/eyeloupe/pause_controller.js +29 -0
  13. data/app/assets/javascripts/eyeloupe/controllers/eyeloupe/refresh_controller.js +53 -0
  14. data/app/assets/javascripts/eyeloupe/controllers/eyeloupe/search_controller.js +11 -0
  15. data/app/assets/javascripts/eyeloupe/controllers/index.js +11 -0
  16. data/app/assets/stylesheets/application.tailwind.css +42 -0
  17. data/app/assets/stylesheets/eyeloupe/application.css +16 -0
  18. data/app/controllers/concerns/eyeloupe/searchable.rb +20 -0
  19. data/app/controllers/eyeloupe/application_controller.rb +17 -0
  20. data/app/controllers/eyeloupe/configs_controller.rb +20 -0
  21. data/app/controllers/eyeloupe/data_controller.rb +15 -0
  22. data/app/controllers/eyeloupe/in_requests_controller.rb +24 -0
  23. data/app/controllers/eyeloupe/out_requests_controller.rb +27 -0
  24. data/app/helpers/eyeloupe/application_helper.rb +5 -0
  25. data/app/jobs/eyeloupe/application_job.rb +4 -0
  26. data/app/mailers/eyeloupe/application_mailer.rb +6 -0
  27. data/app/models/eyeloupe/application_record.rb +5 -0
  28. data/app/models/eyeloupe/in_request.rb +4 -0
  29. data/app/models/eyeloupe/out_request.rb +4 -0
  30. data/app/views/eyeloupe/in_requests/_frame.html.erb +44 -0
  31. data/app/views/eyeloupe/in_requests/index.html.erb +18 -0
  32. data/app/views/eyeloupe/in_requests/show.html.erb +82 -0
  33. data/app/views/eyeloupe/out_requests/_frame.html.erb +46 -0
  34. data/app/views/eyeloupe/out_requests/index.html.erb +18 -0
  35. data/app/views/eyeloupe/out_requests/show.html.erb +69 -0
  36. data/app/views/eyeloupe/shared/_status_code.html.erb +21 -0
  37. data/app/views/eyeloupe/shared/_verb.html.erb +17 -0
  38. data/app/views/layouts/eyeloupe/application.html.erb +203 -0
  39. data/config/importmap.rb +4 -0
  40. data/config/routes.rb +12 -0
  41. data/config/tailwind.config.js +22 -0
  42. data/db/migrate/20230518175305_create_eyeloupe_in_requests.rb +22 -0
  43. data/db/migrate/20230525125352_create_eyeloupe_out_requests.rb +18 -0
  44. data/lib/eyeloupe/configuration.rb +20 -0
  45. data/lib/eyeloupe/engine.rb +21 -0
  46. data/lib/eyeloupe/http.rb +19 -0
  47. data/lib/eyeloupe/processors/in_request.rb +148 -0
  48. data/lib/eyeloupe/processors/out_request.rb +76 -0
  49. data/lib/eyeloupe/request_middleware.rb +72 -0
  50. data/lib/eyeloupe/version.rb +4 -0
  51. data/lib/eyeloupe.rb +21 -0
  52. data/lib/tasks/eyeloupe_tasks.rake +9 -0
  53. metadata +195 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 34e1fd5eb04fa196ab6163e97232eca59d4c3d20d31b1a7761de7bc6e0f0b96c
4
+ data.tar.gz: 5d472b7ee15e5e699f99bb8f3342296bb32c8be364fa7b6e5f975c21965bed4e
5
+ SHA512:
6
+ metadata.gz: '096bb0cc90cf6a836e13cc7894f46e6ba597046f0c3427e5a0322b32e4cdc7f89338b330ffdcd2538bf77e99f66804bb9e1880d7c2294f8582a1be448ac68297'
7
+ data.tar.gz: e160242a1d2564176498e8ff6319cac337ac8ea5b241cc1a7ab2ab4ea93f1d2b633ccd78a84a069c75357dbc3912e66342cbd7175ac9ddd024395126015729e6
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0
2
+
3
+ - Initial release including incoming and outgoing requests.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2023 Alex
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,129 @@
1
+ [![Contributors][contributors-shield]][contributors-url]
2
+ [![Forks][forks-shield]][forks-url]
3
+ [![Stargazers][stars-shield]][stars-url]
4
+ [![Issues][issues-shield]][issues-url]
5
+ [![MIT License][license-shield]][license-url]
6
+
7
+ <br />
8
+ <div align="center">
9
+ <a href="https://github.com/alxlion/eyeloupe">
10
+ <img src="app/assets/images/eyeloupe/logo.png" width=120 alt="Logo" >
11
+ </a>
12
+
13
+ <h3 align="center">Eyeloupe</h3>
14
+
15
+ <p align="center">
16
+ The elegant Rails debug assistant.
17
+ <br />
18
+ <a href="https://github.com/alxlion/eyeloupe/issues">Report Bug</a>
19
+ ·
20
+ <a href="https://github.com/alxlion/eyeloupe/issues">Request Feature</a>
21
+ </p>
22
+ </div>
23
+
24
+ [![Eyeloupe screenshot][eyeloupe-screen]](https://github.com/alxlion/eyeloupe)
25
+
26
+ Eyeloupe is the elegant Rails debug assistant. It helps you to debug your Rails application by providing a simple and elegant interface to view your incoming and outgoing requests, and a lot more.
27
+
28
+ ## Installation
29
+ Add this line to your application's Gemfile:
30
+
31
+ ```ruby
32
+ gem "eyeloupe"
33
+ ```
34
+
35
+ And then execute:
36
+ ```bash
37
+ $ bundle
38
+ ```
39
+
40
+ Install Eyeloupe migrations into your project:
41
+ ```bash
42
+ $ rails eyeloupe:install:migrations
43
+ ```
44
+
45
+ And run the migrations:
46
+ ```bash
47
+ $ rails db:migrate
48
+ ```
49
+
50
+ ## Configuration
51
+
52
+ This is an example of the configuration you can add to your `initializers/eyeloupe.rb` file:
53
+
54
+ ```ruby
55
+ Eyeloupe.configure do |config|
56
+ config.excluded_paths = %w[assets favicon.ico dance.riv service-worker.js manifest.json]
57
+ config.capture = true
58
+ end
59
+ ```
60
+
61
+ - `excluded_paths` is an array of paths you want to exclude from Eyeloupe capture. Eyeloupe adds these excluded paths to the default ones: ` %w[mini-profiler eyeloupe active_storage]`
62
+ - `capture` is a boolean to enable/disable Eyeloupe capture. By default, it's set to `true`.
63
+
64
+ ## Usage
65
+
66
+ Eyeloupe is exclusively developed for Rails framework.
67
+
68
+ You can use it in your development environment to debug your application but it's not recommended to use it in production.
69
+
70
+ ### Auto-refresh
71
+
72
+ By activating auto-fresh, every _3 seconds_ the page will be refreshed to show you the latest data.
73
+
74
+ ### Delete all data
75
+
76
+ You can delete all the data stored by Eyeloupe by clicking on the trash button.
77
+
78
+
79
+ ## Q/A
80
+
81
+ ### Why the request time is not the same on rack-mini-profiler ?
82
+
83
+ Eyeloupe is not a performance-oriented tool, the request time is the same you can view in the Rails log. If you want more details about your load time, you can use rack-mini-profiler along with Eyeloupe.
84
+
85
+ ### Is this the Laravel Telescope for Rails ?
86
+
87
+ Yes, Eyeloupe is inspired by Laravel Telescope. Lot of people coming from Laravel are missing Telescope or looking for something similar, so Eyeloupe is here to fill this gap.
88
+
89
+ ## Roadmap
90
+
91
+ - [ ] Exceptions - Track all the exceptions thrown by your application
92
+ - [ ] Custom links to the menu - To access all of your debug tool in one place (Sidekiq web, Mailhog, etc.)
93
+
94
+ ## Contributing
95
+ Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
96
+
97
+ If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
98
+ Don't forget to give the project a star! Thanks again!
99
+
100
+ 1. Fork the Project
101
+ 2. Create your Feature Branch (`git checkout -b feature/amazing_feature`)
102
+ 3. Commit your Changes (`git commit -m 'Add some amazing feature'`)
103
+ 4. Push to the Branch (`git push origin feature/amazing_feature`)
104
+ 5. Open a Pull Request
105
+
106
+ ## License
107
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
108
+
109
+ ## Contact
110
+
111
+ [![](https://img.shields.io/badge/@alxlion__-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/alxlion_)
112
+
113
+ Project Link: [https://github.com/alxlion/eyeloupe](https://github.com/alxlion/eyeloupe)
114
+
115
+
116
+
117
+ <!-- MARKDOWN LINKS & IMAGES -->
118
+ <!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
119
+ [contributors-shield]: https://img.shields.io/github/contributors/alxlion/eyeloupe.svg?style=for-the-badge
120
+ [contributors-url]: https://github.com/alxlion/eyeloupe/graphs/contributors
121
+ [forks-shield]: https://img.shields.io/github/forks/alxlion/eyeloupe.svg?style=for-the-badge
122
+ [forks-url]: https://github.com/alxlion/eyeloupe/network/members
123
+ [stars-shield]: https://img.shields.io/github/stars/alxlion/eyeloupe.svg?style=for-the-badge
124
+ [stars-url]: https://github.com/alxlion/eyeloupe/stargazers
125
+ [issues-shield]: https://img.shields.io/github/issues/alxlion/eyeloupe.svg?style=for-the-badge
126
+ [issues-url]: https://github.com/alxlion/eyeloupe/issues
127
+ [license-shield]: https://img.shields.io/github/license/alxlion/eyeloupe.svg?style=for-the-badge
128
+ [license-url]: https://github.com/alxlion/eyeloupe/blob/master/MIT-LICENSE.txt
129
+ [eyeloupe-screen]: /doc/img/screen.png
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ /*! tailwindcss v3.1.3 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-family:Fira Sans,sans-serif,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid #0000;outline-offset:2px}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}select{color-adjust:exact;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact}[multiple]{color-adjust:unset;background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset}[type=checkbox],[type=radio]{color-adjust:exact;--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;-webkit-print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid #0000;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=checkbox]:indeterminate,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:#0000}[type=checkbox]:indeterminate{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:#0000}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px auto -webkit-focus-ring-color}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::-webkit-backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:-webkit-sticky;position:sticky}.inset-0{bottom:0;left:0;right:0;top:0}.left-full{left:100%}.top-0{top:0}.z-50{z-index:50}.z-40{z-index:40}.-m-2\.5{margin:-.625rem}.-m-2{margin:-.5rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.-my-2{margin-bottom:-.5rem;margin-top:-.5rem}.-mx-2{margin-left:-.5rem;margin-right:-.5rem}.mx-auto{margin-left:auto;margin-right:auto}.mt-4{margin-top:1rem}.mt-2{margin-top:.5rem}.mt-8{margin-top:2rem}.mt-6{margin-top:1.5rem}.mt-1{margin-top:.25rem}.mr-16{margin-right:4rem}.ml-2{margin-left:.5rem}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.flow-root{display:flow-root}.hidden{display:none}.h-6{height:1.5rem}.h-16{height:4rem}.h-7{height:1.75rem}.h-12{height:3rem}.h-5{height:1.25rem}.w-full{width:100%}.w-16{width:4rem}.w-6{width:1.5rem}.w-auto{width:auto}.w-5{width:1.25rem}.min-w-full{min-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-y-5{row-gap:1.25rem}.gap-y-7{row-gap:1.75rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.25rem*var(--tw-space-y-reverse));margin-top:calc(.25rem*(1 - var(--tw-space-y-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-300>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(209 213 219/var(--tw-divide-opacity))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity))}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-t{border-top-width:1px}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity))}.bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity))}.bg-yellow-50{--tw-bg-opacity:1;background-color:rgb(254 252 232/var(--tw-bg-opacity))}.bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bg-purple-50{--tw-bg-opacity:1;background-color:rgb(250 245 255/var(--tw-bg-opacity))}.bg-gray-900\/80{background-color:#111827cc}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-1{padding:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-4{padding-bottom:1rem;padding-top:1rem}.px-4{padding-left:1rem;padding-right:1rem}.py-6{padding-bottom:1.5rem;padding-top:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-10{padding-bottom:2.5rem;padding-top:2.5rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.pl-4{padding-left:1rem}.pr-3{padding-right:.75rem}.pl-3{padding-left:.75rem}.pr-4{padding-right:1rem}.pt-5{padding-top:1.25rem}.pb-2{padding-bottom:.5rem}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-sm{font-size:.875rem;line-height:1.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-2xl{font-size:1.5rem;line-height:2rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.tracking-wide{letter-spacing:.025em}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity))}.text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity))}.text-yellow-800{--tw-text-opacity:1;color:rgb(133 77 14/var(--tw-text-opacity))}.text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity))}.text-purple-700{--tw-text-opacity:1;color:rgb(126 34 206/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-inset{--tw-ring-inset:inset}.ring-green-600\/20{--tw-ring-color:#16a34a33}.ring-blue-700\/10{--tw-ring-color:#1d4ed81a}.ring-yellow-600\/20{--tw-ring-color:#ca8a0433}.ring-red-600\/10{--tw-ring-color:#dc26261a}.ring-gray-500\/10{--tw-ring-color:#6b72801a}.ring-gray-500{--tw-ring-opacity:1;--tw-ring-color:rgb(107 114 128/var(--tw-ring-opacity))}.ring-purple-700\/10{--tw-ring-color:#7e22ce1a}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-500{transition-duration:.5s}.pagination{display:inline-flex;position:relative;z-index:0}.pagination>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(-1px*(1 - var(--tw-space-x-reverse)));margin-right:calc(-1px*var(--tw-space-x-reverse))}.pagination{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pagination .prev a{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;border-width:1px;color:rgb(107 114 128/var(--tw-text-opacity));display:inline-flex;font-size:.875rem;font-weight:500;line-height:1.25rem;padding:.5rem;position:relative}.pagination .prev a:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.pagination .next a{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-bottom-right-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-right-radius:.375rem;border-width:1px;color:rgb(107 114 128/var(--tw-text-opacity));display:inline-flex;font-size:.875rem;font-weight:500;line-height:1.25rem;padding:.5rem;position:relative}.pagination .next a:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.pagination .current{--tw-text-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity));border-top-width:2px;color:rgb(239 68 68/var(--tw-text-opacity));padding-left:1rem;padding-right:1rem;padding-top:1rem}.pagination .current,.pagination a{--tw-border-opacity:1;align-items:center;display:inline-flex;font-size:.875rem;font-weight:500;line-height:1.25rem}.pagination a{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(209 213 219/var(--tw-border-opacity));border-width:1px;color:rgb(107 114 128/var(--tw-text-opacity));padding:.5rem 1rem;position:relative}.pagination a:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.pagination .disabled{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(209 213 219/var(--tw-border-opacity));border-width:1px;color:rgb(107 114 128/var(--tw-text-opacity));display:inline-flex;font-size:.875rem;font-weight:500;line-height:1.25rem;opacity:.4;padding:.5rem 1rem;position:relative}.pagination .disabled:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.pagination .gap{background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(209 213 219/var(--tw-border-opacity));color:rgb(55 65 81/var(--tw-text-opacity))}.pagination .active,.pagination .gap{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;align-items:center;border-width:1px;display:inline-flex;font-size:.875rem;font-weight:500;line-height:1.25rem;padding:.5rem 1rem;position:relative}.pagination .active{background-color:rgb(254 242 242/var(--tw-bg-opacity));border-color:rgb(239 68 68/var(--tw-border-opacity));color:rgb(239 68 68/var(--tw-text-opacity));z-index:10}.pagination .next_page,.pagination .previous_page{display:none}.hover\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity))}.hover\:bg-gray-300:hover{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.hover\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.focus\:border-red-500:focus{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.focus\:outline-none:focus{outline:2px solid #0000;outline-offset:2px}.focus\:ring-red-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(239 68 68/var(--tw-ring-opacity))}@media (min-width:640px){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.sm\:mt-0{margin-top:0}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:flex-auto{flex:1 1 auto}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:items-center{align-items:center}.sm\:gap-4{gap:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:px-0{padding-right:0}.sm\:pl-0,.sm\:px-0{padding-left:0}.sm\:pr-0{padding-right:0}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width:1024px){.lg\:fixed{position:fixed}.lg\:inset-y-0{bottom:0;top:0}.lg\:z-50{z-index:50}.lg\:-mx-8{margin-left:-2rem;margin-right:-2rem}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-72{width:18rem}.lg\:flex-col{flex-direction:column}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:pl-72{padding-left:18rem}}
@@ -0,0 +1,3 @@
1
+ //= link_tree ../builds/ .css
2
+ //= link_tree ../images
3
+ //= link_tree ../javascripts .js
Binary file
@@ -0,0 +1,5 @@
1
+ import "@hotwired/turbo-rails"
2
+ import "eyeloupe/controllers"
3
+
4
+ import { Turbo } from "@hotwired/turbo-rails"
5
+ window.Turbo = Turbo
@@ -0,0 +1,9 @@
1
+ import { Application } from "@hotwired/stimulus"
2
+
3
+ const application = Application.start()
4
+
5
+ // Configure Stimulus development experience
6
+ application.debug = false
7
+ window.Stimulus = application
8
+
9
+ export { application }
@@ -0,0 +1,13 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static targets = ["content"]
5
+
6
+ close() {
7
+ this.contentTarget.classList.add("hidden")
8
+ }
9
+
10
+ open() {
11
+ this.contentTarget.classList.remove("hidden")
12
+ }
13
+ }
@@ -0,0 +1,29 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+
5
+ SETTING_NAME = "eyeloupe-pause"
6
+ static targets = ["btn"]
7
+ static values = { enabled: Boolean }
8
+
9
+ connect() {
10
+ this._setActiveClass()
11
+ this._setupRefresh()
12
+ }
13
+
14
+ toggle() {
15
+ localStorage.setItem(this.SETTING_NAME, !this.enabled)
16
+ this._setActiveClass()
17
+ }
18
+
19
+ _setActiveClass() {
20
+ if (this.enabledValue) {
21
+ this.btnTarget.classList.add("bg-red-500", "text-white", "hover:bg-red-600")
22
+ this.btnTarget.classList.remove("bg-gray-200", "text-gray-500", "hover:bg-gray-300")
23
+ } else {
24
+ this.btnTarget.classList.remove("bg-red-500", "text-white", "hover:bg-red-600")
25
+ this.btnTarget.classList.add("bg-gray-200", "text-gray-500", "hover:bg-gray-300")
26
+ }
27
+ }
28
+
29
+ }
@@ -0,0 +1,53 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+
5
+ SETTING_NAME = "eyeloupe-refresh"
6
+ static targets = ["btn", "frame"]
7
+
8
+ connect() {
9
+ this._setActiveClass()
10
+ this._setupRefresh()
11
+ }
12
+
13
+ toggle() {
14
+ localStorage.setItem(this.SETTING_NAME, !this.enabled)
15
+ this._setActiveClass()
16
+ this._setupRefresh()
17
+ }
18
+
19
+ _setupRefresh() {
20
+ if (this.enabled) {
21
+ this._fetch()
22
+ this.interval = setInterval(this._fetch.bind(this), 3000)
23
+ } else {
24
+ if (this.interval) {
25
+ clearTimeout(this.interval)
26
+ }
27
+ }
28
+ }
29
+
30
+ _setActiveClass() {
31
+ if (this.enabled) {
32
+ this.btnTargets.forEach((btn) => {
33
+ btn.classList.add("bg-red-500", "text-white", "hover:bg-red-600")
34
+ btn.classList.remove("bg-gray-200", "text-gray-500", "hover:bg-gray-300")
35
+ })
36
+
37
+ } else {
38
+ this.btnTargets.forEach((btn) => {
39
+ btn.classList.remove("bg-red-500", "text-white", "hover:bg-red-600")
40
+ btn.classList.add("bg-gray-200", "text-gray-500", "hover:bg-gray-300")
41
+ })
42
+ }
43
+ }
44
+
45
+ _fetch() {
46
+ this.frameTarget.reload()
47
+ }
48
+
49
+ get enabled() {
50
+ return localStorage.getItem(this.SETTING_NAME) === "true"
51
+ }
52
+
53
+ }
@@ -0,0 +1,11 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static targets = ["frame"]
5
+
6
+ submit(e) {
7
+ e.preventDefault()
8
+ let q = e.target.elements["q"].value
9
+ this.frameTarget.src = this.frameTarget.src + "&q=" + q
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // Import and register all your controllers from the importmap under controllers/*
2
+
3
+ import { application } from "eyeloupe/controllers/application"
4
+
5
+ // Eager load all controllers defined in the import map under controllers/**/*_controller
6
+ import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
7
+ eagerLoadControllersFrom("eyeloupe/controllers", application)
8
+
9
+ // Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
10
+ // import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
11
+ // lazyLoadControllersFrom("controllers", application)
@@ -0,0 +1,42 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer components {
6
+ }
7
+
8
+ .pagination {
9
+ @apply relative z-0 inline-flex rounded-md shadow-sm -space-x-px;
10
+ }
11
+
12
+ .pagination .prev a {
13
+ @apply relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50;
14
+ }
15
+
16
+ .pagination .next a {
17
+ @apply relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50;
18
+ }
19
+
20
+ .pagination .current {
21
+ @apply border-red-500 text-red-500 border-t-2 pt-4 px-4 inline-flex items-center text-sm font-medium;
22
+ }
23
+
24
+ .pagination a {
25
+ @apply bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium;
26
+ }
27
+
28
+ .pagination .disabled {
29
+ @apply bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium opacity-40;
30
+ }
31
+
32
+ .pagination .gap {
33
+ @apply relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700;
34
+ }
35
+
36
+ .pagination .active {
37
+ @apply z-10 bg-red-50 border-red-500 text-red-500 relative inline-flex items-center px-4 py-2 border text-sm font-medium;
38
+ }
39
+
40
+ .pagination .previous_page, .pagination .next_page {
41
+ @apply hidden;
42
+ }
@@ -0,0 +1,16 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
16
+
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eyeloupe
4
+ module Searchable
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ before_action :set_query, only: [:index]
9
+ end
10
+
11
+ protected
12
+
13
+ def set_query
14
+ model = ("Eyeloupe::" + controller_name.classify).constantize
15
+ @query = params[:q].present? ? model.where('path LIKE ?', "%#{params[:q].strip}%").order(created_at: :desc)
16
+ : model.all.order(created_at: :desc)
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,17 @@
1
+ module Eyeloupe
2
+ class ApplicationController < ActionController::Base
3
+ include Pagy::Backend
4
+
5
+ before_action :set_config
6
+
7
+ def root
8
+ redirect_to in_requests_path
9
+ end
10
+
11
+ protected
12
+
13
+ def set_config
14
+ @eyeloupe_capture = cookies[:eyeloupe_capture].present? ? cookies[:eyeloupe_capture] == "true" : Eyeloupe.configuration.capture
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eyeloupe
4
+ class ConfigsController < ApplicationController
5
+
6
+ before_action :set_config, only: [:update]
7
+
8
+ def update
9
+ Eyeloupe.configuration.capture = @value == "true"
10
+ cookies[:eyeloupe_capture] = @value
11
+ redirect_to root_path, status: 303
12
+ end
13
+
14
+ protected
15
+
16
+ def set_config
17
+ @value = params[:value]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eyeloupe
4
+
5
+ class DataController < ApplicationController
6
+
7
+ # Delete all data in the database
8
+ # DELETE /data
9
+ def destroy
10
+ InRequest.destroy_all
11
+ redirect_to root_path, status: 303
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eyeloupe
4
+ class InRequestsController < ApplicationController
5
+ include Searchable
6
+
7
+ before_action :set_in_request, only: [:show]
8
+
9
+ def index
10
+ @pagy, @requests = pagy(@query, items: 50)
11
+
12
+ render partial: 'frame' if params[:frame].present?
13
+ end
14
+
15
+ def show
16
+ end
17
+
18
+ protected
19
+
20
+ def set_in_request
21
+ @request = InRequest.find(params[:id])
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eyeloupe
4
+ class OutRequestsController < ApplicationController
5
+ include Searchable
6
+
7
+ before_action :set_out_request, only: %i[ show ]
8
+
9
+ # GET /out_requests
10
+ def index
11
+ @pagy, @requests = pagy(@query, items: 50)
12
+
13
+ render partial: 'frame' if params[:frame].present?
14
+ end
15
+
16
+ # GET /out_requests/1
17
+ def show
18
+ end
19
+
20
+ private
21
+ # Use callbacks to share common setup or constraints between actions.
22
+ def set_out_request
23
+ @request = OutRequest.find(params[:id])
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ module Eyeloupe
2
+ module ApplicationHelper
3
+ include Pagy::Frontend
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module Eyeloupe
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Eyeloupe
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Eyeloupe
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module Eyeloupe
2
+ class InRequest < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Eyeloupe
2
+ class OutRequest < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,44 @@
1
+ <%= turbo_frame_tag "frame" do %>
2
+
3
+ <div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
4
+ <div class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
5
+ <table class="min-w-full divide-y divide-gray-300">
6
+ <thead>
7
+ <tr>
8
+ <th scope="col" class="py-3 pl-4 pr-3 text-left text-sm font-medium uppercase tracking-wide text-gray-500 sm:pl-0">Verb</th>
9
+ <th scope="col" class="px-3 py-3 text-left text-sm font-medium uppercase tracking-wide text-gray-500">Path</th>
10
+ <th scope="col" class="px-3 py-3 text-left text-sm font-medium uppercase tracking-wide text-gray-500">Status</th>
11
+ <th scope="col" class="px-3 py-3 text-left text-sm font-medium uppercase tracking-wide text-gray-500">Duration</th>
12
+ <th scope="col" class="px-3 py-3 text-left text-sm font-medium uppercase tracking-wide text-gray-500">Occurred</th>
13
+ <th scope="col" class="relative py-3 pl-3 pr-4 sm:pr-0">
14
+ <span class="sr-only">Details</span>
15
+ </th>
16
+ </tr>
17
+ </thead>
18
+ <tbody class="divide-y divide-gray-200">
19
+ <% @requests.each do |request| %>
20
+ <tr>
21
+ <td class="whitespace-nowrap py-4 pl-4 pr-3 text-base font-medium text-gray-900 sm:pl-0">
22
+ <%= render "eyeloupe/shared/verb", verb: request.verb %>
23
+ </td>
24
+ <td class="whitespace-nowrap px-3 py-4 text-base text-gray-500"><%= request.path.truncate(50) %></td>
25
+ <td class="whitespace-nowrap px-3 py-4 text-base text-gray-500">
26
+ <%= render "eyeloupe/shared/status_code", code: request.status %>
27
+ </td>
28
+ <td class="whitespace-nowrap px-3 py-4 text-base text-gray-500"><%= request.duration %> ms</td>
29
+ <td class="whitespace-nowrap px-3 py-4 text-base text-gray-500"><%= distance_of_time_in_words(request.created_at, DateTime.now) %></td>
30
+ <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-base font-medium sm:pr-0">
31
+ <%= link_to "Details", in_request_path(request), class: "text-gray-600 hover:text-gray-900", data: {"turbo_frame": "_top"} %>
32
+ </td>
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ </div>
38
+ <aside class="mt-4 px-4 py-3 flex items-center justify-center sm:px-6" aria-label="Pagination">
39
+ <div class="flex-1 flex justify-center">
40
+ <%== pagy_nav(@pagy) %>
41
+ </div>
42
+ </aside>
43
+ </div>
44
+ <% end %>