pager_tree-integrations 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/pager_tree/integrations/alert.rb +3 -1
  3. data/app/models/pager_tree/integrations/app_dynamics/v3.rb +74 -0
  4. data/app/models/pager_tree/integrations/auvik/v3.rb +94 -0
  5. data/app/models/pager_tree/integrations/aws_cloudwatch/v3.rb +108 -0
  6. data/app/models/pager_tree/integrations/azure_monitor/v3.rb +79 -0
  7. data/app/models/pager_tree/integrations/boolean_store_accessor.rb +42 -0
  8. data/app/models/pager_tree/integrations/channel/hangouts/v3.rb +176 -0
  9. data/app/models/pager_tree/integrations/channel/mattermost/v3.rb +6 -0
  10. data/app/models/pager_tree/integrations/channel/microsoft_teams/v3.rb +142 -0
  11. data/app/models/pager_tree/integrations/channel/slack/v3.rb +136 -0
  12. data/app/models/pager_tree/integrations/cronitor/v3.rb +64 -0
  13. data/app/models/pager_tree/integrations/datadog/v3.rb +72 -0
  14. data/app/models/pager_tree/integrations/dead_mans_snitch/v3.rb +76 -0
  15. data/app/models/pager_tree/integrations/elast_alert/v3.rb +63 -0
  16. data/app/models/pager_tree/integrations/form/v3.rb +114 -0
  17. data/app/models/pager_tree/integrations/freshdesk/v3.rb +103 -0
  18. data/app/models/pager_tree/integrations/freshservice/v3.rb +103 -0
  19. data/app/models/pager_tree/integrations/grafana/v3.rb +67 -0
  20. data/app/models/pager_tree/integrations/healthchecks/v3.rb +68 -0
  21. data/app/models/pager_tree/integrations/honeybadger/v3.rb +76 -0
  22. data/app/models/pager_tree/integrations/hyperping/v3.rb +60 -0
  23. data/app/models/pager_tree/integrations/integration.rb +27 -5
  24. data/app/models/pager_tree/integrations/jira_server/v3.rb +61 -0
  25. data/app/models/pager_tree/integrations/jotform/v3.rb +50 -0
  26. data/app/models/pager_tree/integrations/kapacitor/v3.rb +65 -0
  27. data/app/models/pager_tree/integrations/logic_monitor/v3.rb +79 -0
  28. data/app/models/pager_tree/integrations/mattermost/outgoing_webhook/v3.rb +77 -0
  29. data/app/models/pager_tree/integrations/new_relic/v3.rb +67 -0
  30. data/app/models/pager_tree/integrations/outgoing_event.rb +2 -0
  31. data/app/models/pager_tree/integrations/outgoing_webhook/v3.rb +37 -6
  32. data/app/models/pager_tree/integrations/outgoing_webhook_delivery/hook_relay.rb +8 -6
  33. data/app/models/pager_tree/integrations/outgoing_webhook_delivery.rb +1 -1
  34. data/app/models/pager_tree/integrations/pingdom/v3.rb +71 -0
  35. data/app/models/pager_tree/integrations/prometheus/v3.rb +79 -0
  36. data/app/models/pager_tree/integrations/prtg/v3.rb +58 -0
  37. data/app/models/pager_tree/integrations/server_guard24/v3.rb +74 -0
  38. data/app/models/pager_tree/integrations/site24x7/v3.rb +68 -0
  39. data/app/models/pager_tree/integrations/solar_winds/v3.rb +77 -0
  40. data/app/models/pager_tree/integrations/stackdriver/v3.rb +60 -0
  41. data/app/models/pager_tree/integrations/status_cake/v3.rb +65 -0
  42. data/app/models/pager_tree/integrations/twilio/incoming_sms/v3.rb +78 -0
  43. data/app/models/pager_tree/integrations/typeform/v3.rb +43 -0
  44. data/app/models/pager_tree/integrations/uptime/v3.rb +68 -0
  45. data/app/models/pager_tree/integrations/uptime_robot/v3.rb +79 -0
  46. data/app/models/pager_tree/integrations/webhook/v3.rb +112 -0
  47. data/app/models/pager_tree/integrations/zendesk/v3.rb +83 -0
  48. data/app/views/pager_tree/integrations/app_dynamics/v3/_form_options.html.erb +0 -0
  49. data/app/views/pager_tree/integrations/app_dynamics/v3/_show_options.html.erb +0 -0
  50. data/app/views/pager_tree/integrations/auvik/v3/_form_options.html.erb +0 -0
  51. data/app/views/pager_tree/integrations/auvik/v3/_show_options.html.erb +0 -0
  52. data/app/views/pager_tree/integrations/aws_cloudwatch/v3/_form_options.html.erb +0 -0
  53. data/app/views/pager_tree/integrations/aws_cloudwatch/v3/_show_options.html.erb +0 -0
  54. data/app/views/pager_tree/integrations/azure_monitor/v3/_form_options.html.erb +0 -0
  55. data/app/views/pager_tree/integrations/azure_monitor/v3/_show_options.html.erb +0 -0
  56. data/app/views/pager_tree/integrations/channel/hangouts/v3/_form_options.html.erb +34 -0
  57. data/app/views/pager_tree/integrations/channel/hangouts/v3/_show_options.html.erb +40 -0
  58. data/app/views/pager_tree/integrations/channel/mattermost/v3/_form_options.html.erb +1 -0
  59. data/app/views/pager_tree/integrations/channel/mattermost/v3/_show_options.html.erb +1 -0
  60. data/app/views/pager_tree/integrations/channel/microsoft_teams/v3/_form_options.html.erb +34 -0
  61. data/app/views/pager_tree/integrations/channel/microsoft_teams/v3/_show_options.html.erb +40 -0
  62. data/app/views/pager_tree/integrations/channel/slack/v3/_form_options.html.erb +34 -0
  63. data/app/views/pager_tree/integrations/channel/slack/v3/_show_options.html.erb +40 -0
  64. data/app/views/pager_tree/integrations/cronitor/v3/_form_options.html.erb +0 -0
  65. data/app/views/pager_tree/integrations/cronitor/v3/_show_options.html.erb +0 -0
  66. data/app/views/pager_tree/integrations/datadog/v3/_form_options.html.erb +0 -0
  67. data/app/views/pager_tree/integrations/datadog/v3/_show_options.html.erb +0 -0
  68. data/app/views/pager_tree/integrations/dead_mans_snitch/v3/_form_options.html.erb +0 -0
  69. data/app/views/pager_tree/integrations/dead_mans_snitch/v3/_show_options.html.erb +0 -0
  70. data/app/views/pager_tree/integrations/elast_alert/v3/_form_options.html.erb +0 -0
  71. data/app/views/pager_tree/integrations/elast_alert/v3/_show_options.html.erb +0 -0
  72. data/app/views/pager_tree/integrations/form/v3/_form_options.html.erb +64 -0
  73. data/app/views/pager_tree/integrations/form/v3/_show_options.html.erb +122 -0
  74. data/app/views/pager_tree/integrations/freshdesk/v3/_form_options.html.erb +0 -0
  75. data/app/views/pager_tree/integrations/freshdesk/v3/_show_options.html.erb +0 -0
  76. data/app/views/pager_tree/integrations/freshservice/v3/_form_options.html.erb +0 -0
  77. data/app/views/pager_tree/integrations/freshservice/v3/_show_options.html.erb +0 -0
  78. data/app/views/pager_tree/integrations/grafana/v3/_form_options.html.erb +0 -0
  79. data/app/views/pager_tree/integrations/grafana/v3/_show_options.html.erb +0 -0
  80. data/app/views/pager_tree/integrations/healthchecks/v3/_form_options.html.erb +0 -0
  81. data/app/views/pager_tree/integrations/healthchecks/v3/_show_options.html.erb +0 -0
  82. data/app/views/pager_tree/integrations/honeybadger/v3/_form_options.html.erb +7 -0
  83. data/app/views/pager_tree/integrations/honeybadger/v3/_show_options.html.erb +12 -0
  84. data/app/views/pager_tree/integrations/hyperping/v3/_form_options.html.erb +0 -0
  85. data/app/views/pager_tree/integrations/hyperping/v3/_show_options.html.erb +0 -0
  86. data/app/views/pager_tree/integrations/jira_server/v3/_form_options.html.erb +7 -0
  87. data/app/views/pager_tree/integrations/jira_server/v3/_show_options.html.erb +12 -0
  88. data/app/views/pager_tree/integrations/jotform/v3/_form_options.html.erb +0 -0
  89. data/app/views/pager_tree/integrations/jotform/v3/_show_options.html.erb +0 -0
  90. data/app/views/pager_tree/integrations/kapacitor/v3/_form_options.html.erb +0 -0
  91. data/app/views/pager_tree/integrations/kapacitor/v3/_show_options.html.erb +0 -0
  92. data/app/views/pager_tree/integrations/logic_monitor/v3/_form_options.html.erb +0 -0
  93. data/app/views/pager_tree/integrations/logic_monitor/v3/_show_options.html.erb +0 -0
  94. data/app/views/pager_tree/integrations/mattermost/outgoing_webhook/v3/_form_options.html.erb +7 -0
  95. data/app/views/pager_tree/integrations/mattermost/outgoing_webhook/v3/_show_options.html.erb +12 -0
  96. data/app/views/pager_tree/integrations/new_relic/v3/_form_options.html.erb +0 -0
  97. data/app/views/pager_tree/integrations/new_relic/v3/_show_options.html.erb +0 -0
  98. data/app/views/pager_tree/integrations/outgoing_webhook/v3/_form_options.html.erb +12 -4
  99. data/app/views/pager_tree/integrations/outgoing_webhook/v3/_show_options.html.erb +20 -2
  100. data/app/views/pager_tree/integrations/pingdom/v3/_form_options.html.erb +0 -0
  101. data/app/views/pager_tree/integrations/pingdom/v3/_show_options.html.erb +0 -0
  102. data/app/views/pager_tree/integrations/prometheus/v3/_form_options.html.erb +0 -0
  103. data/app/views/pager_tree/integrations/prometheus/v3/_show_options.html.erb +0 -0
  104. data/app/views/pager_tree/integrations/prtg/v3/_form_options.html.erb +0 -0
  105. data/app/views/pager_tree/integrations/prtg/v3/_show_options.html.erb +0 -0
  106. data/app/views/pager_tree/integrations/server_guard24/v3/_form_options.html.erb +7 -0
  107. data/app/views/pager_tree/integrations/server_guard24/v3/_show_options.html.erb +12 -0
  108. data/app/views/pager_tree/integrations/site24x7/v3/_form_options.html.erb +0 -0
  109. data/app/views/pager_tree/integrations/site24x7/v3/_show_options.html.erb +0 -0
  110. data/app/views/pager_tree/integrations/solar_winds/v3/_form_options.html.erb +0 -0
  111. data/app/views/pager_tree/integrations/solar_winds/v3/_show_options.html.erb +0 -0
  112. data/app/views/pager_tree/integrations/stackdriver/v3/_form_options.html.erb +0 -0
  113. data/app/views/pager_tree/integrations/stackdriver/v3/_show_options.html.erb +0 -0
  114. data/app/views/pager_tree/integrations/status_cake/v3/_form_options.html.erb +0 -0
  115. data/app/views/pager_tree/integrations/status_cake/v3/_show_options.html.erb +0 -0
  116. data/app/views/pager_tree/integrations/twilio/incoming_sms/v3/_form_options.html.erb +0 -0
  117. data/app/views/pager_tree/integrations/twilio/incoming_sms/v3/_show_options.html.erb +0 -0
  118. data/app/views/pager_tree/integrations/typeform/v3/_form_options.html.erb +0 -0
  119. data/app/views/pager_tree/integrations/typeform/v3/_show_options.html.erb +0 -0
  120. data/app/views/pager_tree/integrations/uptime/v3/_form_options.html.erb +0 -0
  121. data/app/views/pager_tree/integrations/uptime/v3/_show_options.html.erb +0 -0
  122. data/app/views/pager_tree/integrations/uptime_robot/v3/_form_options.html.erb +0 -0
  123. data/app/views/pager_tree/integrations/uptime_robot/v3/_show_options.html.erb +0 -0
  124. data/app/views/pager_tree/integrations/webhook/v3/_form_options.html.erb +15 -0
  125. data/app/views/pager_tree/integrations/webhook/v3/_show_options.html.erb +26 -0
  126. data/app/views/pager_tree/integrations/zendesk/v3/_form_options.html.erb +0 -0
  127. data/app/views/pager_tree/integrations/zendesk/v3/_show_options.html.erb +0 -0
  128. data/config/locales/en.yml +83 -23
  129. data/lib/generators/integration/integration_generator.rb +2 -1
  130. data/lib/generators/integration/templates/model.rb.tt +16 -6
  131. data/lib/pager_tree/integrations/version.rb +1 -1
  132. metadata +121 -3
@@ -0,0 +1,112 @@
1
+ module PagerTree::Integrations
2
+ class Webhook::V3 < Integration
3
+ OPTIONS = [
4
+ {key: :token, type: :string, default: nil},
5
+ {key: :capture_additional_data, type: :boolean, default: false}
6
+ ]
7
+ store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
8
+
9
+ after_initialize do
10
+ self.option_token ||= nil
11
+ self.option_capture_additional_data ||= false
12
+ end
13
+
14
+ def adapter_should_block_incoming?(request)
15
+ self.option_token.present? && (request.headers["pagertree-token"] != self.option_token)
16
+ end
17
+
18
+ def adapter_supports_incoming?
19
+ true
20
+ end
21
+
22
+ def adapter_supports_outgoing?
23
+ false
24
+ end
25
+
26
+ def adapter_incoming_can_defer?
27
+ true
28
+ end
29
+
30
+ def adapter_thirdparty_id
31
+ adapter_incoming_request_params.dig("Id") || adapter_incoming_request_params.dig("id")
32
+ end
33
+
34
+ def adapter_action
35
+ case adapter_incoming_request_params.dig("event_type").to_s.downcase.strip
36
+ when "create"
37
+ :create
38
+ # when "acknowledge"
39
+ # :acknowledge
40
+ when "resolve"
41
+ :resolve
42
+ else
43
+ :other
44
+ end
45
+ end
46
+
47
+ def adapter_process_create
48
+ Alert.new(
49
+ title: _title,
50
+ description: _description,
51
+ urgency: _urgency,
52
+ thirdparty_id: adapter_thirdparty_id,
53
+ dedup_keys: [adapter_thirdparty_id],
54
+ incident: _incident,
55
+ incident_severity: _incident_severity,
56
+ incident_message: _incident_message,
57
+ tags: _tags,
58
+ meta: _meta,
59
+ additional_data: _additional_datums
60
+ )
61
+ end
62
+
63
+ private
64
+
65
+ def _title
66
+ adapter_incoming_request_params.dig("Title") || adapter_incoming_request_params.dig("title")
67
+ end
68
+
69
+ def _description
70
+ adapter_incoming_request_params.dig("Description") || adapter_incoming_request_params.dig("description")
71
+ end
72
+
73
+ def _tags
74
+ tags = adapter_incoming_request_params.dig("Tags") || adapter_incoming_request_params.dig("tags")
75
+ Array(tags).compact_blank.map(&:to_s).uniq
76
+ end
77
+
78
+ def _urgency
79
+ urgency = adapter_incoming_request_params.dig("Urgency") || adapter_incoming_request_params.dig("urgency")
80
+ urgency&.to_s&.downcase&.strip
81
+ end
82
+
83
+ def _incident
84
+ !!adapter_incoming_request_params.dig("Meta", "incident")
85
+ end
86
+
87
+ def _incident_message
88
+ adapter_incoming_request_params.dig("Meta", "incident_message")
89
+ end
90
+
91
+ def _incident_severity
92
+ adapter_incoming_request_params.dig("Meta", "incident_severity")&.to_s&.upcase&.strip
93
+ end
94
+
95
+ def _meta
96
+ meta = adapter_incoming_request_params.dig("Meta")
97
+ meta.is_a?(Hash) ? meta.except("incident", "incident_message", "incident_severity") : {}
98
+ end
99
+
100
+ def _additional_datums
101
+ if self.option_capture_additional_data == true
102
+ adapter_incoming_request_params.except(
103
+ "Id", "Title", "Description", "Urgency", "Tags", "Meta", "id", "title", "description", "urgency", "tags", "meta", "event_type", "pagertree_integration_id"
104
+ ).map do |key, value|
105
+ AdditionalDatum.new(format: "text", label: key, value: value.to_s)
106
+ end
107
+ else
108
+ []
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,83 @@
1
+ module PagerTree::Integrations
2
+ class Zendesk::V3 < Integration
3
+ OPTIONS = []
4
+ store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
5
+
6
+ after_initialize do
7
+ end
8
+
9
+ def adapter_supports_incoming?
10
+ true
11
+ end
12
+
13
+ def adapter_supports_outgoing?
14
+ false
15
+ end
16
+
17
+ def adapter_incoming_can_defer?
18
+ true
19
+ end
20
+
21
+ def adapter_thirdparty_id
22
+ adapter_incoming_request_params.dig("id")
23
+ end
24
+
25
+ def adapter_action
26
+ case adapter_incoming_request_params.dig("event_type")
27
+ when "create"
28
+ :create
29
+ when "acknowledge"
30
+ :acknowledge
31
+ when "resolve"
32
+ :resolve
33
+ else
34
+ :other
35
+ end
36
+ end
37
+
38
+ def adapter_process_create
39
+ Alert.new(
40
+ title: _title,
41
+ description: _description,
42
+ urgency: _urgency,
43
+ thirdparty_id: adapter_thirdparty_id,
44
+ dedup_keys: [adapter_thirdparty_id],
45
+ additional_data: _additional_datums
46
+ )
47
+ end
48
+
49
+ private
50
+
51
+ def _title
52
+ adapter_incoming_request_params.dig("title")
53
+ end
54
+
55
+ def _description
56
+ # this comes in as text format, so wrap it in a pre tag so it shows nicely in the web app
57
+ "<pre>#{adapter_incoming_request_params.dig("description")}</pre>"
58
+ end
59
+
60
+ def _additional_datums
61
+ [
62
+ AdditionalDatum.new(format: "link", label: "Zendesk Link", value: adapter_incoming_request_params.dig("link")),
63
+ AdditionalDatum.new(format: "text", label: "Priority", value: adapter_incoming_request_params.dig("priority")),
64
+ AdditionalDatum.new(format: "text", label: "Ticket Type", value: adapter_incoming_request_params.dig("ticket_type")),
65
+ AdditionalDatum.new(format: "text", label: "Via", value: adapter_incoming_request_params.dig("via")),
66
+ AdditionalDatum.new(format: "text", label: "Assignee Name", value: adapter_incoming_request_params.dig("assignee_name"))
67
+ ]
68
+ end
69
+
70
+ def _urgency
71
+ case adapter_incoming_request_params.dig("priority").to_s.downcase
72
+ when "urgent"
73
+ "critical"
74
+ when "high"
75
+ "high"
76
+ when "normal"
77
+ "medium"
78
+ when "low"
79
+ "low"
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,34 @@
1
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
2
+ <div class="form-group md:col-span-3">
3
+ <%= form.label :option_incoming_webhook_url %>
4
+ <%= form.text_field :option_incoming_webhook_url, class: "form-control" %>
5
+ <p class="form-hint"><%== t("pager_tree.integrations.common.option_incoming_webhook_url_hint_html") %></p>
6
+ </div>
7
+
8
+ <%
9
+ opts = [
10
+ :alert_open,
11
+ :alert_acknowledged,
12
+ :alert_resolved,
13
+ :alert_dropped,
14
+ ]
15
+ %>
16
+ <% opts.each do |opt| %>
17
+ <div class="form-group">
18
+ <%= form.check_box "option_#{opt.to_s}".to_sym, class: "form-checkbox mr-1" %>
19
+ <%= form.label "option_#{opt.to_s}".to_sym, class: "inline-block" %>
20
+ <p class="form-hint"><%== t("pager_tree.integrations.common.option_#{opt.to_s}_hint_html") %></p>
21
+ </div>
22
+ <% end %>
23
+
24
+ </div>
25
+
26
+
27
+ <div class="grid grid-cols-1 gap-4">
28
+ <%= tag.div class: "form-group", data: {controller: "code-editor", code_editor_language_value: "yaml", code_editor_read_only_value: false } do %>
29
+ <%= form.label :option_outgoing_rules, t("pager_tree.integrations.common.option_outgoing_rules") %>
30
+ <%= form.hidden_field :option_outgoing_rules, class: "form-control", data: {code_editor_target: "form"} %>
31
+ <%= tag.div class: "h-96", data: {code_editor_target: "editor"} do %><%= form.object.option_outgoing_rules %><% end %>
32
+ <p class="form-hint"><%== t("pager_tree.integrations.common.option_outgoing_rules_hint_html") %></p>
33
+ <% end %>
34
+ </div>
@@ -0,0 +1,40 @@
1
+ <div class="sm:col-span-2">
2
+ <dt class="text-sm font-medium text-gray-500">
3
+ <%= t("activerecord.attributes.pager_tree/integrations/integration.option_incoming_webhook_url") %>
4
+ </dt>
5
+ <dd class="mt-1 text-sm text-gray-900">
6
+ <div class="flex items-center gap-2">
7
+ <p class="text-sm truncate">
8
+ <%= integration.option_incoming_webhook_url %>
9
+ </p>
10
+ </div>
11
+ </dd>
12
+ </div>
13
+
14
+ <%
15
+ opts = [
16
+ :alert_open,
17
+ :alert_acknowledged,
18
+ :alert_resolved,
19
+ :alert_dropped,
20
+ ]
21
+ %>
22
+ <% opts.each do |opt| %>
23
+ <div class="sm:col-span-1">
24
+ <dt class="text-sm font-medium text-gray-500">
25
+ <%= t("activerecord.attributes.pager_tree/integrations/integration.option_#{opt.to_s}") %>
26
+ </dt>
27
+ <dd class="mt-1 text-sm text-gray-900">
28
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.send("option_#{opt.to_s}") } %>
29
+ </dd>
30
+ </div>
31
+ <% end %>
32
+
33
+ <div class="sm:col-span-1">
34
+ <dt class="text-sm font-medium text-gray-500">
35
+ <%= t("pager_tree.integrations.common.option_outgoing_rules") %>
36
+ </dt>
37
+ <dd class="mt-1 text-sm text-gray-900">
38
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_outgoing_rules.present? } %>
39
+ </dd>
40
+ </div>
@@ -0,0 +1 @@
1
+ <%= render partial: "pager_tree/integrations/channel/slack/v3/form_options", locals: local_assigns %>
@@ -0,0 +1 @@
1
+ <%= render partial: "pager_tree/integrations/channel/slack/v3/show_options", locals: local_assigns %>
@@ -0,0 +1,34 @@
1
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
2
+ <div class="form-group md:col-span-3">
3
+ <%= form.label :option_incoming_webhook_url %>
4
+ <%= form.text_field :option_incoming_webhook_url, class: "form-control" %>
5
+ <p class="form-hint"><%== t("pager_tree.integrations.common.option_incoming_webhook_url_hint_html") %></p>
6
+ </div>
7
+
8
+ <%
9
+ opts = [
10
+ :alert_open,
11
+ :alert_acknowledged,
12
+ :alert_resolved,
13
+ :alert_dropped,
14
+ ]
15
+ %>
16
+ <% opts.each do |opt| %>
17
+ <div class="form-group">
18
+ <%= form.check_box "option_#{opt.to_s}".to_sym, class: "form-checkbox mr-1" %>
19
+ <%= form.label "option_#{opt.to_s}".to_sym, class: "inline-block" %>
20
+ <p class="form-hint"><%== t("pager_tree.integrations.common.option_#{opt.to_s}_hint_html") %></p>
21
+ </div>
22
+ <% end %>
23
+
24
+ </div>
25
+
26
+
27
+ <div class="grid grid-cols-1 gap-4">
28
+ <%= tag.div class: "form-group", data: {controller: "code-editor", code_editor_language_value: "yaml", code_editor_read_only_value: false } do %>
29
+ <%= form.label :option_outgoing_rules, t("pager_tree.integrations.common.option_outgoing_rules") %>
30
+ <%= form.hidden_field :option_outgoing_rules, class: "form-control", data: {code_editor_target: "form"} %>
31
+ <%= tag.div class: "h-96", data: {code_editor_target: "editor"} do %><%= form.object.option_outgoing_rules %><% end %>
32
+ <p class="form-hint"><%== t("pager_tree.integrations.common.option_outgoing_rules_hint_html") %></p>
33
+ <% end %>
34
+ </div>
@@ -0,0 +1,40 @@
1
+ <div class="sm:col-span-2">
2
+ <dt class="text-sm font-medium text-gray-500">
3
+ <%= t("activerecord.attributes.pager_tree/integrations/integration.option_incoming_webhook_url") %>
4
+ </dt>
5
+ <dd class="mt-1 text-sm text-gray-900">
6
+ <div class="flex items-center gap-2">
7
+ <p class="text-sm truncate">
8
+ <%= integration.option_incoming_webhook_url %>
9
+ </p>
10
+ </div>
11
+ </dd>
12
+ </div>
13
+
14
+ <%
15
+ opts = [
16
+ :alert_open,
17
+ :alert_acknowledged,
18
+ :alert_resolved,
19
+ :alert_dropped,
20
+ ]
21
+ %>
22
+ <% opts.each do |opt| %>
23
+ <div class="sm:col-span-1">
24
+ <dt class="text-sm font-medium text-gray-500">
25
+ <%= t("activerecord.attributes.pager_tree/integrations/integration.option_#{opt.to_s}") %>
26
+ </dt>
27
+ <dd class="mt-1 text-sm text-gray-900">
28
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.send("option_#{opt.to_s}") } %>
29
+ </dd>
30
+ </div>
31
+ <% end %>
32
+
33
+ <div class="sm:col-span-1">
34
+ <dt class="text-sm font-medium text-gray-500">
35
+ <%= t("pager_tree.integrations.common.option_outgoing_rules") %>
36
+ </dt>
37
+ <dd class="mt-1 text-sm text-gray-900">
38
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_outgoing_rules.present? } %>
39
+ </dd>
40
+ </div>
@@ -0,0 +1,34 @@
1
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
2
+ <div class="form-group md:col-span-3">
3
+ <%= form.label :option_incoming_webhook_url %>
4
+ <%= form.text_field :option_incoming_webhook_url, class: "form-control" %>
5
+ <p class="form-hint"><%== t("pager_tree.integrations.common.option_incoming_webhook_url_hint_html") %></p>
6
+ </div>
7
+
8
+ <%
9
+ opts = [
10
+ :alert_open,
11
+ :alert_acknowledged,
12
+ :alert_resolved,
13
+ :alert_dropped,
14
+ ]
15
+ %>
16
+ <% opts.each do |opt| %>
17
+ <div class="form-group">
18
+ <%= form.check_box "option_#{opt.to_s}".to_sym, class: "form-checkbox mr-1" %>
19
+ <%= form.label "option_#{opt.to_s}".to_sym, class: "inline-block" %>
20
+ <p class="form-hint"><%== t("pager_tree.integrations.common.option_#{opt.to_s}_hint_html") %></p>
21
+ </div>
22
+ <% end %>
23
+
24
+ </div>
25
+
26
+
27
+ <div class="grid grid-cols-1 gap-4">
28
+ <%= tag.div class: "form-group", data: {controller: "code-editor", code_editor_language_value: "yaml", code_editor_read_only_value: false } do %>
29
+ <%= form.label :option_outgoing_rules, t("pager_tree.integrations.common.option_outgoing_rules") %>
30
+ <%= form.hidden_field :option_outgoing_rules, class: "form-control", data: {code_editor_target: "form"} %>
31
+ <%= tag.div class: "h-96", data: {code_editor_target: "editor"} do %><%= form.object.option_outgoing_rules %><% end %>
32
+ <p class="form-hint"><%== t("pager_tree.integrations.common.option_outgoing_rules_hint_html") %></p>
33
+ <% end %>
34
+ </div>
@@ -0,0 +1,40 @@
1
+ <div class="sm:col-span-2">
2
+ <dt class="text-sm font-medium text-gray-500">
3
+ <%= t("activerecord.attributes.pager_tree/integrations/integration.option_incoming_webhook_url") %>
4
+ </dt>
5
+ <dd class="mt-1 text-sm text-gray-900">
6
+ <div class="flex items-center gap-2">
7
+ <p class="text-sm truncate">
8
+ <%= integration.option_incoming_webhook_url %>
9
+ </p>
10
+ </div>
11
+ </dd>
12
+ </div>
13
+
14
+ <%
15
+ opts = [
16
+ :alert_open,
17
+ :alert_acknowledged,
18
+ :alert_resolved,
19
+ :alert_dropped,
20
+ ]
21
+ %>
22
+ <% opts.each do |opt| %>
23
+ <div class="sm:col-span-1">
24
+ <dt class="text-sm font-medium text-gray-500">
25
+ <%= t("activerecord.attributes.pager_tree/integrations/integration.option_#{opt.to_s}") %>
26
+ </dt>
27
+ <dd class="mt-1 text-sm text-gray-900">
28
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.send("option_#{opt.to_s}") } %>
29
+ </dd>
30
+ </div>
31
+ <% end %>
32
+
33
+ <div class="sm:col-span-1">
34
+ <dt class="text-sm font-medium text-gray-500">
35
+ <%= t("pager_tree.integrations.common.option_outgoing_rules") %>
36
+ </dt>
37
+ <dd class="mt-1 text-sm text-gray-900">
38
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_outgoing_rules.present? } %>
39
+ </dd>
40
+ </div>
@@ -0,0 +1,64 @@
1
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
2
+ <div class="form-group md:col-span-2">
3
+ <%= form.label :option_form_title %>
4
+ <%= form.text_field :option_form_title, class: "form-control" %>
5
+ <p class="form-hint"><%== t(".option_form_title_hint_html") %></p>
6
+ </div>
7
+
8
+ <div class="form-group md:col-span-2">
9
+ <%= form.label :option_form_header %>
10
+ <%= form.text_field :option_form_header, class: "form-control" %>
11
+ <p class="form-hint"><%== t(".option_form_header_hint_html") %></p>
12
+ </div>
13
+
14
+ <div class="form-group md:col-span-2">
15
+ <%= form.label :option_form_instructions %>
16
+ <%= form.text_area :option_form_instructions, class: "form-control" %>
17
+ <p class="form-hint"><%== t(".option_form_instructions_hint_html") %></p>
18
+ </div>
19
+
20
+ <div class="form-group">
21
+ <%= form.label :option_form_footer_text %>
22
+ <%= form.text_field :option_form_footer_text, class: "form-control" %>
23
+ <p class="form-hint"><%== t(".option_form_footer_text_hint_html") %></p>
24
+ </div>
25
+
26
+ <div class="form-group">
27
+ <%= form.label :option_form_footer_link %>
28
+ <%= form.text_field :option_form_footer_link, class: "form-control" %>
29
+ <p class="form-hint"><%== t(".option_form_footer_link_hint_html") %></p>
30
+ </div>
31
+
32
+ <div class="form-group">
33
+ <%= form.label :option_form_logo %>
34
+ <%= form.file_field :option_form_logo, accept: "image/*", class: "file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-gray-50 file:text-gray-700 hover:file:bg-gray-100" %>
35
+ <p class="form-hint"><%== t(".option_form_logo_hint_html") %></p>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="grid grid-cols-4 gap-4">
40
+
41
+ <div class="form-group">
42
+ <%= form.check_box :option_form_email_required, class: "form-checkbox mr-1" %>
43
+ <%= form.label :option_form_email_required, class: "inline-block" %>
44
+ <p class="form-hint"><%== t(".option_form_email_required_hint_html") %></p>
45
+ </div>
46
+
47
+ <div class="form-group">
48
+ <%= form.check_box :option_form_phone_required, class: "form-checkbox mr-1" %>
49
+ <%= form.label :option_form_phone_required, class: "inline-block" %>
50
+ <p class="form-hint"><%== t(".option_form_phone_required_hint_html") %></p>
51
+ </div>
52
+
53
+ <div class="form-group">
54
+ <%= form.check_box :option_form_description_required, class: "form-checkbox mr-1" %>
55
+ <%= form.label :option_form_description_required, class: "inline-block" %>
56
+ <p class="form-hint"><%== t(".option_form_description_required_hint_html") %></p>
57
+ </div>
58
+
59
+ <div class="form-group">
60
+ <%= form.check_box :option_form_urgency_required, class: "form-checkbox mr-1" %>
61
+ <%= form.label :option_form_urgency_required, class: "inline-block" %>
62
+ <p class="form-hint"><%== t(".option_form_urgency_required_hint_html") %></p>
63
+ </div>
64
+ </div>
@@ -0,0 +1,122 @@
1
+ <div class="sm:col-span-2">
2
+ <dt class="text-sm font-medium text-gray-500">
3
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_title") %>
4
+ </dt>
5
+ <dd class="mt-1 text-sm text-gray-900">
6
+ <div class="flex items-center gap-2">
7
+ <p class="text-sm truncate">
8
+ <%= integration.option_form_title %>
9
+ </p>
10
+ </div>
11
+ </dd>
12
+ </div>
13
+
14
+ <div class="sm:col-span-2">
15
+ <dt class="text-sm font-medium text-gray-500">
16
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_header") %>
17
+ </dt>
18
+ <dd class="mt-1 text-sm text-gray-900">
19
+ <div class="flex items-center gap-2">
20
+ <p class="text-sm truncate">
21
+ <%= integration.option_form_header %>
22
+ </p>
23
+ </div>
24
+ </dd>
25
+ </div>
26
+
27
+ <div class="sm:col-span-2">
28
+ <dt class="text-sm font-medium text-gray-500">
29
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_instructions") %>
30
+ </dt>
31
+ <dd class="mt-1 text-sm text-gray-900">
32
+ <div class="flex items-center gap-2">
33
+ <p class="text-sm truncate">
34
+ <%= integration.option_form_instructions %>
35
+ </p>
36
+ </div>
37
+ </dd>
38
+ </div>
39
+
40
+ <div class="sm:col-span-2">
41
+ <dt class="text-sm font-medium text-gray-500">
42
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_footer_text") %>
43
+ </dt>
44
+ <dd class="mt-1 text-sm text-gray-900">
45
+ <div class="flex items-center gap-2">
46
+ <p class="text-sm truncate">
47
+ <%= integration.option_form_footer_text %>
48
+ </p>
49
+ </div>
50
+ </dd>
51
+ </div>
52
+
53
+ <div class="sm:col-span-2">
54
+ <dt class="text-sm font-medium text-gray-500">
55
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_footer_link") %>
56
+ </dt>
57
+ <dd class="mt-1 text-sm text-gray-900">
58
+ <div class="flex items-center gap-2">
59
+ <p class="text-sm truncate">
60
+ <%= integration.option_form_footer_link %>
61
+ </p>
62
+ </div>
63
+ </dd>
64
+ </div>
65
+
66
+ <div class="sm:col-span-2">
67
+ <dt class="text-sm font-medium text-gray-500">
68
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_logo") %>
69
+ </dt>
70
+ <dd class="mt-1 text-sm text-gray-900">
71
+ <div class="flex items-center gap-2">
72
+ <p class="text-sm truncate">
73
+ <% if integration.option_form_logo.present? %>
74
+ <%= link_to integration.option_form_logo.blob.filename, integration.option_form_logo, target: "_blank" %>
75
+ <% else %>
76
+ -
77
+ <% end %>
78
+ </p>
79
+ <%= link_to t("delete"), main_app.integration_attachment_path(integration, integration.option_form_logo.id), method: :delete, class: "btn btn-small btn-danger outline", data: { confirm: t("are_you_sure") } if integration.option_form_logo.present? %>
80
+ </div>
81
+ </dd>
82
+ </div>
83
+
84
+ <div class="sm:col-span-1">
85
+ <dt class="text-sm font-medium text-gray-500">
86
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_email_required") %>
87
+ </dt>
88
+ <dd class="mt-1 text-sm text-gray-900">
89
+ <div class="flex items-center gap-2">
90
+ <p class="text-sm truncate">
91
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_form_email_required } %>
92
+ </p>
93
+ </div>
94
+ </dd>
95
+ </div>
96
+
97
+ <div class="sm:col-span-1">
98
+ <dt class="text-sm font-medium text-gray-500">
99
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_phone_required") %>
100
+ </dt>
101
+ <dd class="mt-1 text-sm text-gray-900">
102
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_form_phone_required } %>
103
+ </dd>
104
+ </div>
105
+
106
+ <div class="sm:col-span-1">
107
+ <dt class="text-sm font-medium text-gray-500">
108
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_description_required") %>
109
+ </dt>
110
+ <dd class="mt-1 text-sm text-gray-900">
111
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_form_description_required } %>
112
+ </dd>
113
+ </div>
114
+
115
+ <div class="sm:col-span-1">
116
+ <dt class="text-sm font-medium text-gray-500">
117
+ <%= t("activerecord.attributes.pager_tree/integrations/form/v3.option_form_urgency_required") %>
118
+ </dt>
119
+ <dd class="mt-1 text-sm text-gray-900">
120
+ <%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_form_urgency_required } %>
121
+ </dd>
122
+ </div>