logs_page_view 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +52 -0
  4. data/Rakefile +29 -0
  5. data/app/assets/config/logs_manifest.js +2 -0
  6. data/app/assets/javascripts/logs/application.js +14 -0
  7. data/app/assets/javascripts/logs/bootstrap.min.js +7 -0
  8. data/app/assets/javascripts/logs/jquery.min.js +2 -0
  9. data/app/assets/stylesheets/logs/application.css +16 -0
  10. data/app/assets/stylesheets/logs/bootstrap.min.css +6 -0
  11. data/app/assets/stylesheets/logs/logs.css +37 -0
  12. data/app/controllers/logs/application_controller.rb +5 -0
  13. data/app/controllers/logs/concerns/logs_loader.rb +23 -0
  14. data/app/controllers/logs/concerns/pagination.rb +33 -0
  15. data/app/controllers/logs/logs_controller.rb +32 -0
  16. data/app/helpers/logs/application_helper.rb +23 -0
  17. data/app/helpers/logs/nav_pagination_helper.rb +21 -0
  18. data/app/services/logs/log_files.rb +8 -0
  19. data/app/services/logs/viewer.rb +9 -0
  20. data/app/views/layouts/logs/application.html.haml +9 -0
  21. data/app/views/logs/logs/index.html.haml +1 -0
  22. data/app/views/logs/logs/show.html.haml +1 -0
  23. data/app/views/logs/logs/tail.html.haml +20 -0
  24. data/app/views/shared/_header.html.haml +8 -0
  25. data/app/views/shared/_layout.html.haml +10 -0
  26. data/app/views/shared/_logs.html.haml +4 -0
  27. data/app/views/shared/_nav_pagination.html.haml +19 -0
  28. data/app/views/shared/_navbar.html.haml +11 -0
  29. data/app/views/shared/_pagination.html.haml +7 -0
  30. data/config/locales/en.yml +10 -0
  31. data/config/locales/fr.yml +10 -0
  32. data/config/routes.rb +9 -0
  33. data/lib/logs/engine.rb +23 -0
  34. data/lib/logs/version.rb +3 -0
  35. data/lib/logs.rb +1 -0
  36. data/lib/tasks/logs_tasks.rake +4 -0
  37. data/vendor/assets/stylesheets/wind.css +531 -0
  38. metadata +192 -0
@@ -0,0 +1,10 @@
1
+ en:
2
+ logs:
3
+ log_file: 'Log file: '
4
+ lines: 'Lines: '
5
+ pages: 'Pages: '
6
+ last: 'last »'
7
+ first: '« first'
8
+ all_pages: 'All pages: '
9
+ download: 'Download'
10
+ auto_refresh: 'Auto refresh every 10s'
@@ -0,0 +1,10 @@
1
+ fr:
2
+ logs:
3
+ log_file: 'Fichier journal: '
4
+ lines: 'Lignes: '
5
+ pages: 'Pages: '
6
+ last: 'dernier »'
7
+ first: '« premier'
8
+ all_pages: 'Toutes les pages: '
9
+ download: 'Télécharger'
10
+ auto_refresh: 'Actualisation automatique toutes les 10s'
data/config/routes.rb ADDED
@@ -0,0 +1,9 @@
1
+ Logs::Engine.routes.draw do
2
+ root 'logs#index'
3
+
4
+ get '/download', to: 'logs#download'
5
+ get '/tail', to: 'logs#tail'
6
+ get ':name', to: 'logs#show'
7
+
8
+ resources :logs, only: %i[index show]
9
+ end
@@ -0,0 +1,23 @@
1
+ module Logs
2
+ class Engine < ::Rails::Engine
3
+ %w[haml-rails rake].each { |f| require f }
4
+
5
+ isolate_namespace Logs
6
+
7
+ config.to_prepare do
8
+ folders = ['app/services/logs/*', 'app/*/logs/concerns/*']
9
+ folders.each do |folder|
10
+ Dir.glob(Engine.root + folder).each do |c|
11
+ require_dependency(c)
12
+ end
13
+ end
14
+ end
15
+
16
+ config.generators do |g|
17
+ g.test_framework :rspec
18
+ g.stylesheets false
19
+ g.javascripts false
20
+ g.template_engine :haml
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module Logs
2
+ VERSION = '1.0.0'
3
+ end
data/lib/logs.rb ADDED
@@ -0,0 +1 @@
1
+ require 'logs/engine'
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :logs do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,531 @@
1
+ /**
2
+ * Wing v1.0.0-beta
3
+ * Copyright 2016-2017 Kabir Shah
4
+ * Released under the MIT License
5
+ * http://usewing.ml
6
+ */
7
+
8
+ /*=============================
9
+ Base Styles
10
+ =============================*/
11
+ * {
12
+ box-sizing: border-box;
13
+ }
14
+ html,
15
+ body {
16
+ margin: 0;
17
+ padding: 0;
18
+ }
19
+ body {
20
+ line-height: 1.6;
21
+ color: #111;
22
+ font-size: 1rem;
23
+ font-weight: 400;
24
+ font-family: -apple-system, BlinkMacSystemFont, Avenir, "Avenir Next", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
25
+ }
26
+ /*=============================
27
+ Grid
28
+ =============================*/
29
+ .container {
30
+ width: 80%;
31
+ max-width: 960px;
32
+ margin: 0 auto;
33
+ }
34
+ .row {
35
+ display: flex;
36
+ flex-flow: row wrap;
37
+ justify-content: space-between;
38
+ width: 100%;
39
+ margin-bottom: 10px;
40
+ }
41
+ .row:last-child {
42
+ margin-bottom: 0;
43
+ }
44
+ .row .col {
45
+ flex: 1 1 0px;
46
+ }
47
+ .row .col,
48
+ .row [class^="col-"],
49
+ .row [class*=" col-"] {
50
+ padding-right: 10px;
51
+ }
52
+ .row .col:last-child,
53
+ .row [class^="col-"]:last-child,
54
+ .row [class*=" col-"]:last-child {
55
+ padding-right: 0;
56
+ }
57
+ .row .col-1 {
58
+ width: 8.333333333333332%;
59
+ }
60
+ .row .col-2 {
61
+ width: 16.666666666666664%;
62
+ }
63
+ .row .col-3 {
64
+ width: 25%;
65
+ }
66
+ .row .col-4 {
67
+ width: 33.33333333333333%;
68
+ }
69
+ .row .col-5 {
70
+ width: 41.66666666666667%;
71
+ }
72
+ .row .col-6 {
73
+ width: 50%;
74
+ }
75
+ .row .col-7 {
76
+ width: 58.333333333333336%;
77
+ }
78
+ .row .col-8 {
79
+ width: 66.66666666666666%;
80
+ }
81
+ .row .col-9 {
82
+ width: 75%;
83
+ }
84
+ .row .col-10 {
85
+ width: 83.33333333333334%;
86
+ }
87
+ .row .col-11 {
88
+ width: 91.66666666666666%;
89
+ }
90
+ .row .col-12 {
91
+ width: 100%;
92
+ }
93
+ @media screen and (max-width: 768px) {
94
+ .row .col,
95
+ .row [class^='col-'],
96
+ .row [class*=" col-"] {
97
+ flex: 0 0 100%;
98
+ margin-bottom: 10px;
99
+ padding: 0;
100
+ }
101
+ .row .col:last-child,
102
+ .row [class^='col-']:last-child,
103
+ .row [class*=" col-"]:last-child {
104
+ margin-bottom: 0;
105
+ }
106
+ }
107
+ /*=============================
108
+ Typography
109
+ =============================*/
110
+ h1,
111
+ h2,
112
+ h3,
113
+ h4,
114
+ h5,
115
+ h6,
116
+ p {
117
+ margin-top: 0;
118
+ margin-bottom: 10px;
119
+ font-family: -apple-system, BlinkMacSystemFont, Avenir, "Avenir Next", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
120
+ }
121
+ h1,
122
+ h2,
123
+ h3,
124
+ h4,
125
+ h5,
126
+ h6 {
127
+ font-weight: 500;
128
+ }
129
+ h1 {
130
+ font-size: 2.986rem;
131
+ line-height: 1.2;
132
+ }
133
+ h2 {
134
+ font-size: 2.488rem;
135
+ line-height: 1.25;
136
+ }
137
+ h3 {
138
+ font-size: 2.074rem;
139
+ line-height: 1.3;
140
+ }
141
+ h4 {
142
+ font-size: 1.728rem;
143
+ line-height: 1.35;
144
+ }
145
+ h5 {
146
+ font-size: 1.44rem;
147
+ line-height: 1.5;
148
+ }
149
+ h6 {
150
+ font-size: 1.2rem;
151
+ line-height: 1.6;
152
+ }
153
+ p {
154
+ font-size: 1rem;
155
+ }
156
+ @media (max-width: 768px) {
157
+ h1 {
158
+ font-size: 2.027rem;
159
+ }
160
+ h2 {
161
+ font-size: 1.802rem;
162
+ }
163
+ h3 {
164
+ font-size: 1.602rem;
165
+ }
166
+ h4 {
167
+ font-size: 1.424rem;
168
+ }
169
+ h5 {
170
+ font-size: 1.266rem;
171
+ }
172
+ h6 {
173
+ font-size: 1.125rem;
174
+ }
175
+ }
176
+ /*=============================
177
+ Form
178
+ =============================*/
179
+ input[type=text],
180
+ input[type=password],
181
+ input[type=email],
182
+ input[type=search],
183
+ input[type=number],
184
+ input[type=file],
185
+ input[type=tel],
186
+ input[type=url],
187
+ select,
188
+ textarea {
189
+ height: 45px;
190
+ width: 100%;
191
+ margin-bottom: 10px;
192
+ padding: 10px;
193
+ font-size: 1rem;
194
+ background: #f5f5f5;
195
+ border: 1px solid #a7a7a7;
196
+ border-radius: 2px;
197
+ transition: all 0.2s ease;
198
+ }
199
+ input[type=text]:hover,
200
+ input[type=password]:hover,
201
+ input[type=email]:hover,
202
+ input[type=search]:hover,
203
+ input[type=number]:hover,
204
+ input[type=file]:hover,
205
+ input[type=tel]:hover,
206
+ input[type=url]:hover,
207
+ select:hover,
208
+ textarea:hover {
209
+ border-color: #111;
210
+ }
211
+ input[type=text]:focus,
212
+ input[type=password]:focus,
213
+ input[type=email]:focus,
214
+ input[type=search]:focus,
215
+ input[type=number]:focus,
216
+ input[type=file]:focus,
217
+ input[type=tel]:focus,
218
+ input[type=url]:focus,
219
+ select:focus,
220
+ textarea:focus {
221
+ outline: none;
222
+ border-color: #0062ff;
223
+ }
224
+ textarea {
225
+ min-height: 70px;
226
+ }
227
+ /*=============================
228
+ Button
229
+ =============================*/
230
+ button,
231
+ .button,
232
+ [type=submit] {
233
+ height: 45px;
234
+ margin-bottom: 10px;
235
+ padding: 10px 30px;
236
+ outline: none;
237
+ text-decoration: none;
238
+ color: #f5f5f5;
239
+ font-size: 1rem;
240
+ background: #111;
241
+ border: 1px solid #111;
242
+ border-radius: 2px;
243
+ transition: all 0.2s ease;
244
+ }
245
+ button:hover,
246
+ .button:hover,
247
+ [type=submit]:hover,
248
+ button:focus,
249
+ .button:focus,
250
+ [type=submit]:focus {
251
+ opacity: 0.9;
252
+ }
253
+ button:active,
254
+ .button:active,
255
+ [type=submit]:active {
256
+ opacity: 0.7;
257
+ }
258
+ button[disabled],
259
+ .button[disabled],
260
+ [type=submit][disabled] {
261
+ opacity: 0.8;
262
+ cursor: not-allowed;
263
+ }
264
+ button.outline,
265
+ .button.outline,
266
+ [type=submit].outline {
267
+ color: #111;
268
+ background: none;
269
+ }
270
+ button.outline:hover,
271
+ .button.outline:hover,
272
+ [type=submit].outline:hover,
273
+ button.outline:focus,
274
+ .button.outline:focus,
275
+ [type=submit].outline:focus {
276
+ color: #f5f5f5;
277
+ background: #111;
278
+ }
279
+ /*=============================
280
+ Link
281
+ =============================*/
282
+ a {
283
+ color: #0062ff;
284
+ transition: all 0.2s ease;
285
+ }
286
+ a:hover {
287
+ cursor: pointer;
288
+ color: #111;
289
+ }
290
+ /*=============================
291
+ List
292
+ =============================*/
293
+ ul,
294
+ ol {
295
+ margin-top: 0;
296
+ margin-bottom: 10px;
297
+ padding-left: 0;
298
+ list-style-position: inside;
299
+ }
300
+ ul li,
301
+ ol li {
302
+ margin-bottom: 10px;
303
+ }
304
+ ul li:last-child,
305
+ ol li:last-child {
306
+ margin-bottom: 0;
307
+ }
308
+ ul ul,
309
+ ol ul,
310
+ ul ol,
311
+ ol ol {
312
+ margin-left: 10px;
313
+ }
314
+ /*=============================
315
+ Image
316
+ =============================*/
317
+ img {
318
+ margin-top: 0;
319
+ margin-bottom: 10px;
320
+ }
321
+ /*=============================
322
+ Box
323
+ =============================*/
324
+ .box {
325
+ margin-bottom: 10px;
326
+ padding-top: 10px;
327
+ padding-right: 10px;
328
+ padding-left: 10px;
329
+ border: 1px solid #a7a7a7;
330
+ border-radius: 2px;
331
+ }
332
+ /*=============================
333
+ Navigation
334
+ =============================*/
335
+ .nav {
336
+ position: relative;
337
+ display: flex;
338
+ flex-wrap: wrap;
339
+ align-items: center;
340
+ justify-content: space-between;
341
+ padding-top: 10px;
342
+ padding-bottom: 10px;
343
+ }
344
+ .nav .nav-item {
345
+ margin-right: 10px;
346
+ }
347
+ .nav .nav-item:last-child {
348
+ margin-right: 0;
349
+ }
350
+ /*=============================
351
+ Card
352
+ =============================*/
353
+ .card {
354
+ display: flex;
355
+ flex-direction: column;
356
+ margin-bottom: 10px;
357
+ border: 1px solid #a7a7a7;
358
+ border-radius: 2px;
359
+ }
360
+ .card .card-content {
361
+ margin: 0;
362
+ padding: 10px;
363
+ }
364
+ .card .card-image {
365
+ display: block;
366
+ height: auto;
367
+ width: 100%;
368
+ }
369
+ /*=============================
370
+ Code
371
+ =============================*/
372
+ pre {
373
+ margin-top: 0;
374
+ margin-bottom: 10px;
375
+ }
376
+ pre code {
377
+ display: block;
378
+ padding: 10px 10px;
379
+ white-space: pre-wrap;
380
+ word-wrap: break-word;
381
+ }
382
+ code {
383
+ padding: 2px;
384
+ white-space: nowrap;
385
+ background: #e7e7e7;
386
+ border: 1px solid #d7d7d7;
387
+ border-radius: 2px;
388
+ font-family: "Consolas", "Monaco", "Menlo", monospace;
389
+ }
390
+ /*=============================
391
+ Divider
392
+ =============================*/
393
+ hr {
394
+ border-width: 0.5px;
395
+ border-color: #a7a7a7;
396
+ }
397
+ /*=============================
398
+ Utilities
399
+ =============================*/
400
+ .position-relative {
401
+ position: relative;
402
+ }
403
+ .position-absolute {
404
+ position: absolute;
405
+ }
406
+ .position-fixed {
407
+ position: fixed;
408
+ }
409
+ .text-left {
410
+ text-align: left;
411
+ }
412
+ .text-center {
413
+ text-align: center;
414
+ }
415
+ .text-right {
416
+ text-align: right;
417
+ }
418
+ .size-full-height {
419
+ min-height: 100vh;
420
+ }
421
+ .size-full-width {
422
+ width: 100%;
423
+ }
424
+ .size-full {
425
+ width: 100%;
426
+ min-height: 100vh;
427
+ }
428
+ .hidden {
429
+ display: none;
430
+ }
431
+ .flex {
432
+ display: flex;
433
+ }
434
+ .justify-start {
435
+ justify-content: flex-start;
436
+ }
437
+ .justify-center {
438
+ justify-content: center;
439
+ }
440
+ .justify-end {
441
+ justify-content: flex-end;
442
+ }
443
+ .align-start {
444
+ align-items: flex-start;
445
+ }
446
+ .align-center {
447
+ align-items: center;
448
+ }
449
+ .align-end {
450
+ align-items: flex-end;
451
+ }
452
+ .direction-vertical {
453
+ flex-direction: column;
454
+ }
455
+ .direction-horizontal {
456
+ flex-direction: row;
457
+ }
458
+ .center {
459
+ flex-direction: column;
460
+ justify-content: center;
461
+ align-items: center;
462
+ }
463
+ .border-black {
464
+ border: 1px solid #111;
465
+ }
466
+ .border-gray {
467
+ border: 1px solid #a7a7a7;
468
+ }
469
+ .border-white {
470
+ border: 1px solid #f5f5f5;
471
+ }
472
+ .border-blue {
473
+ border: 1px solid #0062ff;
474
+ }
475
+ .border-red {
476
+ border: 1px solid #ff1500;
477
+ }
478
+ .border-yellow {
479
+ border: 1px solid #ffbf00;
480
+ }
481
+ .border-green {
482
+ border: 1px solid #00b30f;
483
+ }
484
+ .border-rounded {
485
+ border-radius: 2px;
486
+ }
487
+ .border-circle {
488
+ border-radius: 2px;
489
+ }
490
+ .color-black {
491
+ color: #111;
492
+ }
493
+ .color-gray {
494
+ color: #a7a7a7;
495
+ }
496
+ .color-white {
497
+ color: #f5f5f5;
498
+ }
499
+ .color-blue {
500
+ color: #0062ff;
501
+ }
502
+ .color-red {
503
+ color: #ff1500;
504
+ }
505
+ .color-yellow {
506
+ color: #ffbf00;
507
+ }
508
+ .color-green {
509
+ color: #00b30f;
510
+ }
511
+ .background-black {
512
+ background-color: #111;
513
+ }
514
+ .background-gray {
515
+ background-color: #a7a7a7;
516
+ }
517
+ .background-white {
518
+ background-color: #f5f5f5;
519
+ }
520
+ .background-blue {
521
+ background-color: #0062ff;
522
+ }
523
+ .background-red {
524
+ background-color: #ff1500;
525
+ }
526
+ .background-yellow {
527
+ background-color: #ffbf00;
528
+ }
529
+ .background-green {
530
+ background-color: #00b30f;
531
+ }