motor-admin 0.3.17 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/app/channels/motor/application_cable/channel.rb +14 -0
  3. data/app/channels/motor/application_cable/connection.rb +27 -0
  4. data/app/channels/motor/notes_channel.rb +9 -0
  5. data/app/channels/motor/notifications_channel.rb +9 -0
  6. data/app/controllers/concerns/motor/current_user_method.rb +2 -0
  7. data/app/controllers/motor/note_tags_controller.rb +13 -0
  8. data/app/controllers/motor/notes_controller.rb +58 -0
  9. data/app/controllers/motor/notifications_controller.rb +33 -0
  10. data/app/controllers/motor/reminders_controller.rb +38 -0
  11. data/app/controllers/motor/run_queries_controller.rb +1 -1
  12. data/app/controllers/motor/send_alerts_controller.rb +2 -2
  13. data/app/controllers/motor/slack_conversations_controller.rb +11 -0
  14. data/app/controllers/motor/tags_controller.rb +1 -1
  15. data/app/controllers/motor/ui_controller.rb +9 -1
  16. data/app/controllers/motor/users_for_autocomplete_controller.rb +23 -0
  17. data/app/jobs/motor/alert_sending_job.rb +1 -1
  18. data/app/jobs/motor/notify_note_mentions_job.rb +9 -0
  19. data/app/jobs/motor/notify_reminder_job.rb +9 -0
  20. data/app/mailers/motor/alerts_mailer.rb +6 -29
  21. data/app/mailers/motor/application_mailer.rb +27 -1
  22. data/app/mailers/motor/notifications_mailer.rb +33 -0
  23. data/app/models/motor/note.rb +18 -0
  24. data/app/models/motor/note_tag.rb +7 -0
  25. data/app/models/motor/note_tag_tag.rb +8 -0
  26. data/app/models/motor/notification.rb +14 -0
  27. data/app/models/motor/reminder.rb +13 -0
  28. data/app/views/layouts/motor/application.html.erb +4 -1
  29. data/app/views/layouts/motor/mailer.html.erb +72 -0
  30. data/app/views/motor/alerts_mailer/alert_email.html.erb +52 -124
  31. data/app/views/motor/notifications_mailer/notify_mention_email.html.erb +28 -0
  32. data/app/views/motor/notifications_mailer/notify_reminder_email.html.erb +28 -0
  33. data/config/locales/el.yml +25 -0
  34. data/config/locales/en.yml +33 -2
  35. data/config/locales/es.yml +33 -2
  36. data/config/locales/pt.yml +33 -2
  37. data/config/routes.rb +9 -0
  38. data/lib/generators/motor/install_notes_generator.rb +22 -0
  39. data/lib/generators/motor/templates/install.rb +77 -0
  40. data/lib/generators/motor/templates/install_notes.rb +83 -0
  41. data/lib/generators/motor/upgrade_generator.rb +13 -6
  42. data/lib/motor/admin.rb +13 -1
  43. data/lib/motor/alerts/slack_sender.rb +74 -0
  44. data/lib/motor/alerts.rb +42 -0
  45. data/lib/motor/api_query/apply_scope.rb +1 -0
  46. data/lib/motor/build_schema/apply_permissions.rb +8 -0
  47. data/lib/motor/build_schema/defaults.rb +15 -1
  48. data/lib/motor/build_schema/load_from_rails.rb +4 -1
  49. data/lib/motor/build_schema.rb +7 -0
  50. data/lib/motor/configs/build_ui_app_tag.rb +73 -8
  51. data/lib/motor/configs.rb +3 -4
  52. data/lib/motor/notes/notify_mentions.rb +73 -0
  53. data/lib/motor/notes/notify_reminder.rb +49 -0
  54. data/lib/motor/notes/persist.rb +36 -0
  55. data/lib/motor/notes/reminders_scheduler.rb +39 -0
  56. data/lib/motor/notes/tags.rb +34 -0
  57. data/lib/motor/notes.rb +12 -0
  58. data/lib/motor/queries/run_query.rb +66 -3
  59. data/lib/motor/resources/fetch_configured_model.rb +19 -3
  60. data/lib/motor/resources.rb +1 -1
  61. data/lib/motor/slack/client.rb +62 -0
  62. data/lib/motor/slack.rb +16 -0
  63. data/lib/motor/version.rb +1 -1
  64. data/lib/motor.rb +19 -0
  65. data/ui/dist/{main-726aa7f6805676af4d21.css.gz → main-99bab2664944ee03d10f.css.gz} +0 -0
  66. data/ui/dist/main-99bab2664944ee03d10f.js.gz +0 -0
  67. data/ui/dist/manifest.json +5 -5
  68. metadata +36 -4
  69. data/ui/dist/main-726aa7f6805676af4d21.js.gz +0 -0
@@ -1,126 +1,54 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta name="viewport" content="width=device-width">
5
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6
- <title><%= @alert.name %></title>
7
- <style>
8
- @media only screen and (max-width: 620px) {
9
- table[class=body] h1 {
10
- font-size: 28px !important;
11
- margin-bottom: 10px !important;
12
- }
13
- table[class=body] p,
14
- table[class=body] ul,
15
- table[class=body] ol,
16
- table[class=body] td,
17
- table[class=body] span,
18
- table[class=body] a {
19
- font-size: 14px !important;
20
- }
21
- table[class=body] .wrapper,
22
- table[class=body] .article {
23
- padding: 10px !important;
24
- }
25
- table[class=body] .content {
26
- padding: 0 !important;
27
- }
28
- table[class=body] .container {
29
- padding: 0 !important;
30
- width: 100% !important;
31
- }
32
- table[class=body] .main {
33
- border-left-width: 0 !important;
34
- border-radius: 0 !important;
35
- border-right-width: 0 !important;
36
- }
37
- }
38
-
39
- @media all {
40
- .ExternalClass {
41
- width: 100%;
42
- }
43
- .ExternalClass,
44
- .ExternalClass p,
45
- .ExternalClass span,
46
- .ExternalClass font,
47
- .ExternalClass td,
48
- .ExternalClass div {
49
- line-height: 100%;
50
- }
51
- .apple-link a {
52
- color: inherit !important;
53
- font-family: inherit !important;
54
- font-size: inherit !important;
55
- font-weight: inherit !important;
56
- line-height: inherit !important;
57
- text-decoration: none !important;
58
- }
59
- #MessageViewBody a {
60
- color: inherit;
61
- text-decoration: none;
62
- font-size: inherit;
63
- font-family: inherit;
64
- font-weight: inherit;
65
- line-height: inherit;
66
- }
67
- }
68
- </style>
69
- </head>
70
- <body class="" style="background-color: #f9fbfc; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">
71
- <table border="0" cellpadding="0" cellspacing="0" class="body" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background-color: #f9fbfc;">
72
- <tr>
73
- <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">&nbsp;</td>
74
- <td class="container" style="font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; Margin: 0 auto; padding: 10px;">
75
- <div class="content" style="box-sizing: border-box; display: block; Margin: 0 auto;padding: 10px;">
76
- <h1 style="margin: 0"><%= @alert.name.presence || @alert.query.name %></h1>
77
- <% if @query_result.data.length > 1 %>
78
- <p style="margin: 7px 0; float: left">Showing <%= @query_result.data.first(40).size %> of <%= @query_result.data.size %> rows</p>
79
- <% end %>
80
- <a href="<%= Motor::Admin.routes.url_helpers.motor_ui_query_url(@alert.query, { host: 'localhost:3000' }.merge(Rails.application.config.action_mailer.default_url_options || {})) %>" target="blank" style="margin: 7px 0; float: right">Open query </a>
81
- <table class="main" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background: #ffffff; border-radius: 3px;">
82
- <tr>
83
- <td class="wrapper" style="font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px; max-width: 0px; overflow: scroll">
84
- <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: auto;">
85
- <tbody>
86
- <tr>
87
- <td style="font-family: sans-serif; font-size: 14px; overflow: scroll;">
88
- <div style="oveflow: scroll">
89
- <table border="0" cellpadding="0" cellspacing="15" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; white-space: nowrap;">
90
- <tr>
91
- <% @query_result.columns.each do |column| %>
92
- <th><%= column[:name] %></th>
93
- <% end %>
94
- </tr>
95
- <% @query_result.data.first(40).each do |row| %>
96
- <tr>
97
- <% row.each do |col| %>
98
- <td><%= col.respond_to?(:strftime) ? l(col, format: :long) : col.to_s.truncate(100) %></th>
99
- <% end %>
100
- </tr>
1
+ <table border="0" cellpadding="0" cellspacing="0" class="body" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background-color: #f9fbfc;">
2
+ <tr>
3
+ <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">&nbsp;</td>
4
+ <td class="container" style="font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; Margin: 0 auto; padding: 10px;">
5
+ <div class="content" style="box-sizing: border-box; display: block; Margin: 0 auto;padding: 10px;">
6
+ <h1 style="margin: 0"><%= @alert.name.presence || @alert.query.name %></h1>
7
+ <% if @query_result.data.length > 1 %>
8
+ <p style="margin: 7px 0; float: left">Showing <%= @query_result.data.first(40).size %> of <%= @query_result.data.size %> rows</p>
9
+ <% end %>
10
+ <a href="<%= Motor::Admin.routes.url_helpers.motor_ui_query_url(@alert.query, { host: 'localhost:3000' }.merge(Rails.application.config.action_mailer.default_url_options || {})) %>" target="blank" style="margin: 7px 0; float: right">Open query </a>
11
+ <table class="main" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background: #ffffff; border-radius: 3px;">
12
+ <tr>
13
+ <td class="wrapper" style="font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px; max-width: 0px; overflow: scroll">
14
+ <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: auto;">
15
+ <tbody>
16
+ <tr>
17
+ <td style="font-family: sans-serif; font-size: 14px; overflow: scroll;">
18
+ <div style="oveflow: scroll">
19
+ <table border="0" cellpadding="0" cellspacing="15" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; white-space: nowrap;">
20
+ <tr>
21
+ <% @query_result.columns.each do |column| %>
22
+ <th><%= column[:name] %></th>
23
+ <% end %>
24
+ </tr>
25
+ <% @query_result.data.first(40).each do |row| %>
26
+ <tr>
27
+ <% row.each do |col| %>
28
+ <td><%= col.respond_to?(:strftime) ? l(col, format: :long) : col.to_s.truncate(100) %></th>
101
29
  <% end %>
102
- </table>
103
- </div>
104
- </td>
105
- </tr>
106
- </tbody>
107
- </table>
108
- </td>
109
- </tr>
110
- </table>
111
- <div class="footer" style="clear: both; Margin-top: 10px; text-align: center; width: 100%;">
112
- <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
113
- <tr>
114
- <td class="content-block powered-by" style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;">
115
- Sent from MotorAdmin
116
- </td>
117
- </tr>
30
+ </tr>
31
+ <% end %>
32
+ </table>
33
+ </div>
34
+ </td>
35
+ </tr>
36
+ </tbody>
118
37
  </table>
119
- </div>
120
- </div>
121
- </td>
122
- <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">&nbsp;</td>
123
- </tr>
124
- </table>
125
- </body>
126
- </html>
38
+ </td>
39
+ </tr>
40
+ </table>
41
+ <div class="footer" style="clear: both; Margin-top: 10px; text-align: center; width: 100%;">
42
+ <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
43
+ <tr>
44
+ <td class="content-block powered-by" style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;">
45
+ Sent from <%= Motor.company_name %>
46
+ </td>
47
+ </tr>
48
+ </table>
49
+ </div>
50
+ </div>
51
+ </td>
52
+ <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">&nbsp;</td>
53
+ </tr>
54
+ </table>
@@ -0,0 +1,28 @@
1
+ <table border="0" cellpadding="0" cellspacing="0" class="body" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background-color: #f9fbfc;">
2
+ <tr>
3
+ <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">&nbsp;</td>
4
+ <td class="container" style="font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; Margin: 0 auto; padding: 10px;">
5
+ <div class="content" style="box-sizing: border-box; display: block; Margin: 0 auto;padding: 10px;">
6
+ <h1 style="margin: 0">Mention Notification</h1>
7
+ <a href="<%= Motor::Admin.routes.url_helpers.motor_ui_data_url([Motor::BuildSchema::Utils.slugify(@note.record.class), @note.record[@note.class.primary_key]], { tab: 'notes', host: 'localhost:3000' }.merge(Rails.application.config.action_mailer.default_url_options || {})) %>" target="blank" style="margin: 7px 0; float: right">Go to Mention</a>
8
+ <table class="main" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background: #ffffff; border-radius: 3px;">
9
+ <tr>
10
+ <td class="wrapper" style="font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px; max-width: 0px; overflow: scroll">
11
+ <%= simple_format(@note.body.gsub(URI.regexp, '<a href="\0">\0</a>')) %>
12
+ </td>
13
+ </tr>
14
+ </table>
15
+ <div class="footer" style="clear: both; Margin-top: 10px; text-align: center; width: 100%;">
16
+ <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
17
+ <tr>
18
+ <td class="content-block powered-by" style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;">
19
+ Sent from <%= Motor.company_name %>
20
+ </td>
21
+ </tr>
22
+ </table>
23
+ </div>
24
+ </div>
25
+ </td>
26
+ <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">&nbsp;</td>
27
+ </tr>
28
+ </table>
@@ -0,0 +1,28 @@
1
+ <table border="0" cellpadding="0" cellspacing="0" class="body" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background-color: #f9fbfc;">
2
+ <tr>
3
+ <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">&nbsp;</td>
4
+ <td class="container" style="font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; Margin: 0 auto; padding: 10px;">
5
+ <div class="content" style="box-sizing: border-box; display: block; Margin: 0 auto;padding: 10px;">
6
+ <h1 style="margin: 0">Reminder Notification</h1>
7
+ <a href="<%= Motor::Admin.routes.url_helpers.motor_ui_data_url([Motor::BuildSchema::Utils.slugify(@note.record.class), @note.record[@note.class.primary_key]], { tab: 'notes', host: 'localhost:3000' }.merge(Rails.application.config.action_mailer.default_url_options || {})) %>" target="blank" style="margin: 7px 0; float: right">Go to Reminder</a>
8
+ <table class="main" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background: #ffffff; border-radius: 3px;">
9
+ <tr>
10
+ <td class="wrapper" style="font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px; max-width: 0px; overflow: scroll">
11
+ <%= simple_format(@note.body.gsub(URI.regexp, '<a href="\0">\0</a>')) %>
12
+ </td>
13
+ </tr>
14
+ </table>
15
+ <div class="footer" style="clear: both; Margin-top: 10px; text-align: center; width: 100%;">
16
+ <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
17
+ <tr>
18
+ <td class="content-block powered-by" style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;">
19
+ Sent from <%= Motor.company_name %>
20
+ </td>
21
+ </tr>
22
+ </table>
23
+ </div>
24
+ </div>
25
+ </td>
26
+ <td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">&nbsp;</td>
27
+ </tr>
28
+ </table>
@@ -311,6 +311,31 @@ el:
311
311
  radar_chart: Radar chart
312
312
  show_on_table: Show on table
313
313
  map: Map
314
+ audits: Έλεγχοι
315
+ nothing_to_show_here_yet: Δεν υπάρχει τίποτα ακόμα εδώ 🤷‍♂️
316
+ internal: Internal/Anonymous
317
+ updated: ενημερωμένο
318
+ created: δημιουργήθηκε
319
+ deleted: διαγράφηκε
320
+ sign_out: Αποσυνδεθείτε
321
+ user_dropdown: Χρήστης dropdown
322
+ add_condition: Προσθήκη συνθήκης
323
+ remove_condition: Αφαίρεση συνθήκης
324
+ unable_to_send_alert: Αδυναμία αποστολής ειδοποίησης
325
+ send_via: Αποστολή μέσω
326
+ variable_name: Όνομα μεταβλητής
327
+ add_variable: Προσθήκη μεταβλητής
328
+ notes: Σημειώσεις
329
+ new_mention_for: "νέα αναφορά για %{resource}"
330
+ user_mentioned_you_with_note: "%{user} σας ανέφερε με:\n%{note}"
331
+ edit_note: Επεξεργασία σημείωσης
332
+ create_reminder: Δημιουργία υπενθύμισης
333
+ new_reminder_for: "Νέα υπενθύμιση για %{resource}"
334
+ reminder_has_been_removed: Η υπενθύμιση έχει αφαιρεθεί
335
+ note_has_been_removed: Η σημείωση έχει αφαιρεθεί
336
+ schedule_at: Χρονοδιάγραμμα στο
337
+ kanban_columns: Kanban columns
338
+ kanban_card_columns: Kanban card columns
314
339
  i:
315
340
  locale: el
316
341
  select:
@@ -284,8 +284,6 @@ en:
284
284
  hyphen: Hyphen
285
285
  comma: Comma
286
286
  slash: Slash
287
- sql: SQL
288
- api: API
289
287
  searchable_columns: Searchable columns
290
288
  validate: Validate
291
289
  error_message: Error message
@@ -316,3 +314,36 @@ en:
316
314
  radar_chart: Radar chart
317
315
  show_on_table: Show on table
318
316
  map: Map
317
+ audits: Audits
318
+ nothing_to_show_here_yet: Nothing to show here yet 🤷
319
+ internal: Internal/Anonymous
320
+ updated: updated
321
+ created: created
322
+ deleted: deleted
323
+ sign_out: Sign out
324
+ header: Header
325
+ user_dropdown: User dropdown
326
+ add_condition: Add Condition
327
+ remove_condition: Remove Condition
328
+ unable_to_send_alert: Unable to send alert
329
+ send_via: Send via
330
+ download: Download
331
+ alert: Alert
332
+ downloading: Downloading
333
+ display_id: Display ID
334
+ display_settings: Display settings
335
+ sql: SQL
336
+ api: API
337
+ variable_name: Variable name
338
+ add_variable: Add variable
339
+ notes: Notes
340
+ new_mention_for: "New Mention for %{resource}"
341
+ user_mentioned_you_with_note: "%{user} mentioned you with:\n%{note}"
342
+ edit_note: Edit Note
343
+ create_reminder: Create Reminder
344
+ new_reminder_for: "New Reminder for %{resource}"
345
+ reminder_has_been_removed: Reminder has been removed
346
+ note_has_been_removed: Note has been removed
347
+ schedule_at: Schedule at
348
+ kanban_columns: Kanban columns
349
+ kanban_card_columns: Kanban card columns
@@ -284,8 +284,6 @@ es:
284
284
  hyphen: Guión
285
285
  comma: Coma
286
286
  slash: Slash
287
- sql: SQL
288
- api: API
289
287
  searchable_columns: Columnas de búsqueda
290
288
  validate: Validar
291
289
  error_message: Mensaje de error
@@ -311,6 +309,39 @@ es:
311
309
  radar_chart: Radar chart
312
310
  show_on_table: Show on table
313
311
  map: Map
312
+ audits: Audits
313
+ nothing_to_show_here_yet: Nothing to show here yet 🤷
314
+ internal: Internal/Anonymous
315
+ updated: updated
316
+ created: created
317
+ deleted: deleted
318
+ sign_out: Sign out
319
+ header: Header
320
+ user_dropdown: User dropdown
321
+ add_condition: Add Condition
322
+ remove_condition: Remove Condition
323
+ unable_to_send_alert: Unable to send alert
324
+ send_via: Send via
325
+ download: Descargar
326
+ alert: Alerta
327
+ downloading: Descargando
328
+ display_id: Visualizar ID
329
+ display_settings: Configuración de la pantalla
330
+ sql: SQL
331
+ api: API
332
+ variable_name: Nombre de la variable
333
+ add_variable: Añadir variable
334
+ notes: Notes
335
+ new_mention_for: "New Mention for %{resource}"
336
+ user_mentioned_you_with_note: "%{user} mentioned you with:\n%{note}"
337
+ edit_note: Edit Note
338
+ create_reminder: Create Reminder
339
+ new_reminder_for: "New Reminder for %{resource}"
340
+ reminder_has_been_removed: Reminder has been removed
341
+ note_has_been_removed: Note has been removed
342
+ schedule_at: Schedule at
343
+ kanban_columns: Kanban columns
344
+ kanban_card_columns: Kanban card columns
314
345
  i:
315
346
  locale: es
316
347
  select:
@@ -280,8 +280,6 @@ pt:
280
280
  hyphen: Hífen
281
281
  comma: Vírgula
282
282
  slash: Slash
283
- sql: SQL
284
- api: API
285
283
  searchable_columns: Colunas pesquisáveis
286
284
  validate: Validar
287
285
  error_message: Mensagem de erro
@@ -307,6 +305,39 @@ pt:
307
305
  radar_chart: Radar chart
308
306
  show_on_table: Show on table
309
307
  map: Map
308
+ audits: Audits
309
+ nothing_to_show_here_yet: Nothing to show here yet 🤷
310
+ internal: Internal/Anonymous
311
+ updated: updated
312
+ created: created
313
+ deleted: deleted
314
+ sign_out: Sign out
315
+ header: Header
316
+ user_dropdown: User dropdown
317
+ add_condition: Add Condition
318
+ remove_condition: Remove Condition
319
+ unable_to_send_alert: Unable to send alert
320
+ send_via: Send via
321
+ download: Descarregar
322
+ alert: Alerta
323
+ downloading: Descarregamento
324
+ display_id: Mostrar ID
325
+ display_settings: Definições de visualização
326
+ sql: SQL
327
+ api: API
328
+ variable_name: Nome da variável
329
+ add_variable: Adicionar variável
330
+ notes: Notes
331
+ new_mention_for: "New Mention for %{resource}"
332
+ user_mentioned_you_with_note: "%{user} mentioned you with:\n%{note}"
333
+ edit_note: Edit Note
334
+ create_reminder: Create Reminder
335
+ new_reminder_for: "New Reminder for %{resource}"
336
+ reminder_has_been_removed: Reminder has been removed
337
+ note_has_been_removed: Note has been removed
338
+ schedule_at: Schedule at
339
+ kanban_columns: Kanban columns
340
+ kanban_card_columns: Kanban card columns
310
341
  i:
311
342
  locale: pt
312
343
  select:
data/config/routes.rb CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Motor::Admin.routes.draw do
4
4
  namespace :motor, path: '' do
5
+ mount ActionCable.server => '/cable', as: :cabel if defined?(ActionCable)
6
+
5
7
  scope 'api', as: :api do
6
8
  resources :run_queries, only: %i[show create]
7
9
  resources :send_alerts, only: %i[create]
@@ -18,11 +20,17 @@ Motor::Admin.routes.draw do
18
20
  resource :run_graphql_request, only: %i[create]
19
21
  resources :api_configs, only: %i[index create destroy]
20
22
  resources :forms, only: %i[index show create update destroy]
23
+ resources :notes, only: %i[index show create update destroy]
24
+ resources :note_tags, only: %i[index]
25
+ resources :users_for_autocomplete, only: %i[index]
26
+ resources :notifications, only: %i[index update]
27
+ resources :reminders, only: %i[create destroy]
21
28
  resources :alerts, only: %i[index show create update destroy]
22
29
  resources :icons, only: %i[index]
23
30
  resources :active_storage_attachments, only: %i[create], path: 'data/active_storage__attachments'
24
31
  resources :audits, only: %i[index]
25
32
  resource :session, only: %i[show destroy]
33
+ resources :slack_conversations, only: %i[index]
26
34
  resources :resources, path: '/data/:resource',
27
35
  only: %i[index show update create destroy],
28
36
  controller: 'data',
@@ -45,6 +53,7 @@ Motor::Admin.routes.draw do
45
53
  get '/data(/*path)', to: 'ui#index', as: :data
46
54
 
47
55
  with_options controller: 'ui' do
56
+ resources :notifications, only: %i[index]
48
57
  resources :reports, only: %i[index show]
49
58
  resources :queries, only: %i[index show new]
50
59
  resources :dashboards, only: %i[index show new]
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators'
4
+ require 'rails/generators/migration'
5
+ require 'active_record'
6
+ require 'rails/generators/active_record'
7
+ require 'generators/motor/migration'
8
+
9
+ module Motor
10
+ module Generators
11
+ class InstallProNotesGenerator < Rails::Generators::Base
12
+ include Rails::Generators::Migration
13
+ extend Motor::Generators::Migration
14
+
15
+ source_root File.expand_path('templates', __dir__)
16
+
17
+ def copy_migration
18
+ migration_template 'install_pro_notes.rb', 'db/migrate/install_motor_admin_pro_notes.rb'
19
+ end
20
+ end
21
+ end
22
+ end
@@ -155,6 +155,78 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi
155
155
  where: 'deleted_at IS NULL'
156
156
  end
157
157
 
158
+ create_table :motor_notes do |t|
159
+ t.column :body, :text
160
+ t.column :author_id, :bigint
161
+ t.column :author_type, :string
162
+ t.column :record_id, :string, null: false
163
+ t.column :record_type, :string, null: false
164
+ t.column :deleted_at, :datetime
165
+
166
+ t.timestamps
167
+
168
+ t.index %i[author_id author_type],
169
+ name: 'motor_notes_author_id_author_type_index'
170
+ end
171
+
172
+ create_table :motor_note_tags do |t|
173
+ t.column :name, :string, null: false
174
+
175
+ t.timestamps
176
+
177
+ t.index 'name',
178
+ name: 'motor_note_tags_name_unique_index',
179
+ unique: true
180
+ end
181
+
182
+ create_table :motor_note_tag_tags do |t|
183
+ t.references :tag, null: false, foreign_key: { to_table: :motor_note_tags }, index: true
184
+ t.references :note, null: false, foreign_key: { to_table: :motor_notes }, index: false
185
+
186
+ t.index %i[note_id tag_id],
187
+ name: 'motor_note_tags_note_id_tag_id_index',
188
+ unique: true
189
+ end
190
+
191
+ create_table :motor_reminders do |t|
192
+ t.column :author_id, :bigint, null: false
193
+ t.column :author_type, :string, null: false
194
+ t.column :recipient_id, :bigint, null: false
195
+ t.column :recipient_type, :string, null: false
196
+ t.column :record_id, :string
197
+ t.column :record_type, :string
198
+ t.column :scheduled_at, :datetime, null: false, index: true
199
+
200
+ t.timestamps
201
+
202
+ t.index %i[author_id author_type],
203
+ name: 'motor_reminders_author_id_author_type_index'
204
+
205
+ t.index %i[recipient_id recipient_type],
206
+ name: 'motor_reminders_recipient_id_recipient_type_index'
207
+
208
+ t.index %i[record_id record_type],
209
+ name: 'motor_reminders_record_id_record_type_index'
210
+ end
211
+
212
+ create_table :motor_notifications do |t|
213
+ t.column :title, :string, null: false
214
+ t.column :description, :text
215
+ t.column :recipient_id, :bigint, null: false
216
+ t.column :recipient_type, :string, null: false
217
+ t.column :record_id, :string
218
+ t.column :record_type, :string
219
+ t.column :status, :string, null: false
220
+
221
+ t.timestamps
222
+
223
+ t.index %i[recipient_id recipient_type],
224
+ name: 'motor_notifications_recipient_id_recipient_type_index'
225
+
226
+ t.index %i[record_id record_type],
227
+ name: 'motor_notifications_record_id_record_type_index'
228
+ end
229
+
158
230
  add_index :motor_audits, %i[auditable_type auditable_id version], name: 'motor_auditable_index'
159
231
  add_index :motor_audits, %i[associated_type associated_id], name: 'motor_auditable_associated_index'
160
232
  add_index :motor_audits, %i[user_id user_type], name: 'motor_auditable_user_index'
@@ -187,5 +259,10 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi
187
259
  drop_table :motor_queries
188
260
  drop_table :motor_dashboards
189
261
  drop_table :motor_api_configs
262
+ drop_table :motor_note_tag_tags
263
+ drop_table :motor_note_tags
264
+ drop_table :motor_notes
265
+ drop_table :motor_notifications
266
+ drop_table :motor_reminders
190
267
  end
191
268
  end
@@ -0,0 +1,83 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
+ def self.up
3
+ create_table :motor_notes do |t|
4
+ t.column :body, :text
5
+ t.column :author_id, :bigint
6
+ t.column :author_type, :string
7
+ t.column :record_id, :string, null: false
8
+ t.column :record_type, :string, null: false
9
+ t.column :deleted_at, :datetime
10
+
11
+ t.timestamps
12
+
13
+ t.index %i[author_id author_type],
14
+ name: 'motor_notes_author_id_author_type_index'
15
+ end
16
+
17
+ create_table :motor_note_tags do |t|
18
+ t.column :name, :string, null: false
19
+
20
+ t.timestamps
21
+
22
+ t.index 'name',
23
+ name: 'motor_note_tags_name_unique_index',
24
+ unique: true
25
+ end
26
+
27
+ create_table :motor_note_tag_tags do |t|
28
+ t.references :tag, null: false, foreign_key: { to_table: :motor_note_tags }, index: true
29
+ t.references :note, null: false, foreign_key: { to_table: :motor_notes }, index: false
30
+
31
+ t.index %i[note_id tag_id],
32
+ name: 'motor_note_tags_note_id_tag_id_index',
33
+ unique: true
34
+ end
35
+
36
+ create_table :motor_reminders do |t|
37
+ t.column :author_id, :bigint, null: false
38
+ t.column :author_type, :string, null: false
39
+ t.column :recipient_id, :bigint, null: false
40
+ t.column :recipient_type, :string, null: false
41
+ t.column :record_id, :string
42
+ t.column :record_type, :string
43
+ t.column :scheduled_at, :datetime, null: false, index: true
44
+
45
+ t.timestamps
46
+
47
+ t.index %i[author_id author_type],
48
+ name: 'motor_reminders_author_id_author_type_index'
49
+
50
+ t.index %i[recipient_id recipient_type],
51
+ name: 'motor_reminders_recipient_id_recipient_type_index'
52
+
53
+ t.index %i[record_id record_type],
54
+ name: 'motor_reminders_record_id_record_type_index'
55
+ end
56
+
57
+ create_table :motor_notifications do |t|
58
+ t.column :title, :string, null: false
59
+ t.column :description, :text
60
+ t.column :recipient_id, :bigint, null: false
61
+ t.column :recipient_type, :string, null: false
62
+ t.column :record_id, :string
63
+ t.column :record_type, :string
64
+ t.column :status, :string, null: false
65
+
66
+ t.timestamps
67
+
68
+ t.index %i[recipient_id recipient_type],
69
+ name: 'motor_notifications_recipient_id_recipient_type_index'
70
+
71
+ t.index %i[record_id record_type],
72
+ name: 'motor_notifications_record_id_record_type_index'
73
+ end
74
+ end
75
+
76
+ def self.down
77
+ drop_table :motor_note_tag_tags
78
+ drop_table :motor_note_tags
79
+ drop_table :motor_notes
80
+ drop_table :motor_notifications
81
+ drop_table :motor_reminders
82
+ end
83
+ end