pager_tree-integrations 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/pager_tree/integrations/live_call_routing/twilio/v3_controller.rb +20 -0
- data/app/jobs/pager_tree/integrations/live_call_routing/twilio/v3/max_wait_time_job.rb +13 -0
- data/app/models/pager_tree/integrations/additional_datum.rb +2 -2
- data/app/models/pager_tree/integrations/alert.rb +2 -2
- data/app/models/pager_tree/integrations/aws_cloudwatch/v3.rb +15 -5
- data/app/models/pager_tree/integrations/boolean_store_accessor.rb +2 -2
- data/app/models/pager_tree/integrations/channel/hangouts/v3.rb +23 -2
- data/app/models/pager_tree/integrations/channel/mattermost/v3.rb +4 -0
- data/app/models/pager_tree/integrations/channel/microsoft_teams/v3.rb +74 -29
- data/app/models/pager_tree/integrations/channel/microsoft_teams/v4.rb +261 -0
- data/app/models/pager_tree/integrations/channel/slack/v3.rb +30 -3
- data/app/models/pager_tree/integrations/cloudflare/v3.rb +75 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3.rb +206 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/datadog.json +12 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/datadog.yaml +30 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/generic_rules_definition.json +9 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/generic_rules_example.yaml +27 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/grafana.json +25 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/grafana.yaml +33 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/new_relic.json +40 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/new_relic.yaml +32 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/pingdom.json +30 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/pingdom.yaml +23 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/sns_cloudwatch.json +12 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/sns_cloudwatch.yaml +48 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/sns_health_event.json +21 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/sns_health_event.yaml +43 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/sns_lambda_monitor.json +31 -0
- data/app/models/pager_tree/integrations/custom_webhook/v3_examples/sns_lambda_monitor.yaml +24 -0
- data/app/models/pager_tree/integrations/datadog/v3.rb +10 -3
- data/app/models/pager_tree/integrations/dynatrace/v3.rb +67 -0
- data/app/models/pager_tree/integrations/echoes_hq/v3.rb +138 -0
- data/app/models/pager_tree/integrations/elast_alert/v3.rb +24 -0
- data/app/models/pager_tree/integrations/email/v3.rb +272 -22
- data/app/models/pager_tree/integrations/email/v3_examples/example.yml +24 -0
- data/app/models/pager_tree/integrations/form/v3.rb +15 -3
- data/app/models/pager_tree/integrations/freshdesk/v3.rb +7 -5
- data/app/models/pager_tree/integrations/freshservice/v3.rb +7 -5
- data/app/models/pager_tree/integrations/grafana/v3.rb +2 -2
- data/app/models/pager_tree/integrations/hetrix_tools/v3.rb +160 -0
- data/app/models/pager_tree/integrations/honeybadger/v3.rb +1 -1
- data/app/models/pager_tree/integrations/hydrozen/v3.rb +6 -0
- data/app/models/pager_tree/integrations/integration.rb +52 -9
- data/app/models/pager_tree/integrations/jira_server/v3.rb +12 -2
- data/app/models/pager_tree/integrations/kapacitor/v3.rb +1 -1
- data/app/models/pager_tree/integrations/live_call_routing/twilio/v3.rb +257 -22
- data/app/models/pager_tree/integrations/logic_monitor/v3.rb +193 -3
- data/app/models/pager_tree/integrations/mattermost/outgoing_webhook/v3.rb +1 -1
- data/app/models/pager_tree/integrations/meta/workplace/v3.rb +230 -0
- data/app/models/pager_tree/integrations/new_relic/v3.rb +9 -5
- data/app/models/pager_tree/integrations/outgoing_event.rb +8 -0
- data/app/models/pager_tree/integrations/outgoing_webhook/v3.rb +108 -13
- data/app/models/pager_tree/integrations/outgoing_webhook_delivery/hook_relay.rb +43 -33
- data/app/models/pager_tree/integrations/outgoing_webhook_delivery.rb +6 -5
- data/app/models/pager_tree/integrations/prtg/v3.rb +2 -1
- data/app/models/pager_tree/integrations/pulsetic/v3.rb +70 -0
- data/app/models/pager_tree/integrations/scom/pagertree.ps1 +153 -0
- data/app/models/pager_tree/integrations/scom/v3.rb +58 -0
- data/app/models/pager_tree/integrations/sentry/v3.rb +477 -0
- data/app/models/pager_tree/integrations/server_guard24/v3.rb +1 -1
- data/app/models/pager_tree/integrations/sixty_six_uptime/v3.rb +118 -0
- data/app/models/pager_tree/integrations/slack/webhook/v3.rb +1 -1
- data/app/models/pager_tree/integrations/solar_winds/v3.rb +66 -2
- data/app/models/pager_tree/integrations/status_gator/v3.rb +69 -0
- data/app/models/pager_tree/integrations/uptime_kuma/v3.rb +76 -0
- data/app/models/pager_tree/integrations/uptime_robot/v3.rb +6 -0
- data/app/models/pager_tree/integrations/webhook/v3.rb +25 -7
- data/app/models/pager_tree/integrations/zabbix/v3.rb +95 -0
- data/app/models/pager_tree/integrations/zendesk/v3.rb +2 -0
- data/app/views/pager_tree/integrations/channel/hangouts/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/channel/hangouts/v3/_show_options.html.erb +10 -0
- data/app/views/pager_tree/integrations/channel/microsoft_teams/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/channel/microsoft_teams/v3/_show_options.html.erb +14 -0
- data/app/views/pager_tree/integrations/channel/microsoft_teams/v4/_form_options.html.erb +41 -0
- data/app/views/pager_tree/integrations/channel/microsoft_teams/v4/_show_options.html.erb +54 -0
- data/app/views/pager_tree/integrations/channel/slack/v3/_form_options.html.erb +6 -3
- data/app/views/pager_tree/integrations/channel/slack/v3/_show_options.html.erb +1 -1
- data/app/views/pager_tree/integrations/cloudflare/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/cloudflare/v3/_show_options.html.erb +12 -0
- data/app/views/pager_tree/integrations/custom_webhook/v3/_form_options.html.erb +8 -0
- data/app/views/pager_tree/integrations/custom_webhook/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/datadog/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/datadog/v3/_show_options.html.erb +12 -0
- data/app/views/pager_tree/integrations/dynatrace/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/dynatrace/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/echoes_hq/v3/_form_options.html.erb +10 -0
- data/app/views/pager_tree/integrations/echoes_hq/v3/_show_options.html.erb +12 -0
- data/app/views/pager_tree/integrations/email/v3/_form_options.html.erb +41 -11
- data/app/views/pager_tree/integrations/email/v3/_show_options.html.erb +18 -0
- data/app/views/pager_tree/integrations/form/v3/_form_options.html.erb +1 -5
- data/app/views/pager_tree/integrations/hetrix_tools/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/hetrix_tools/v3/_show_options.html.erb +12 -0
- data/app/views/pager_tree/integrations/hydrozen/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/hydrozen/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/live_call_routing/twilio/v3/_form_options.html.erb +44 -31
- data/app/views/pager_tree/integrations/live_call_routing/twilio/v3/_show_options.html.erb +93 -8
- data/app/views/pager_tree/integrations/logic_monitor/v3/_form_options.html.erb +31 -0
- data/app/views/pager_tree/integrations/logic_monitor/v3/_show_options.html.erb +60 -0
- data/app/views/pager_tree/integrations/meta/workplace/v3/_form_options.html.erb +44 -0
- data/app/views/pager_tree/integrations/meta/workplace/v3/_show_options.html.erb +68 -0
- data/app/views/pager_tree/integrations/outgoing_webhook/v3/_form_options.html.erb +17 -3
- data/app/views/pager_tree/integrations/outgoing_webhook/v3/_show_options.html.erb +20 -0
- data/app/views/pager_tree/integrations/pulsetic/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/pulsetic/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/scom/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/scom/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/sentry/v3/_form_options.html.erb +9 -0
- data/app/views/pager_tree/integrations/sentry/v3/_show_options.html.erb +15 -0
- data/app/views/pager_tree/integrations/sixty_six_uptime/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/sixty_six_uptime/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/solar_winds/v3/_form_options.html.erb +40 -0
- data/app/views/pager_tree/integrations/solar_winds/v3/_show_options.html.erb +66 -0
- data/app/views/pager_tree/integrations/status_gator/v3/_form_options.html.erb +13 -0
- data/app/views/pager_tree/integrations/status_gator/v3/_show_options.html.erb +24 -0
- data/app/views/pager_tree/integrations/uptime_kuma/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/uptime_kuma/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/webhook/v3/_form_options.html.erb +8 -0
- data/app/views/pager_tree/integrations/webhook/v3/_show_options.html.erb +15 -0
- data/app/views/pager_tree/integrations/zabbix/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/zabbix/v3/_show_options.html.erb +12 -0
- data/config/locales/en.yml +158 -10
- data/config/routes.rb +1 -0
- data/lib/pager_tree/integrations/format_converters/yaml_json_converter.rb +67 -0
- data/lib/pager_tree/integrations/version.rb +1 -1
- data/lib/pager_tree/integrations.rb +11 -3
- metadata +84 -8
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= form.hidden_field :option_code, class: "form-control" %>
|
|
2
|
+
|
|
3
|
+
<div class="grid grid-cols-1 gap-4">
|
|
4
|
+
<div class="form-group group">
|
|
5
|
+
<%= form.label :option_client_secret %>
|
|
6
|
+
<%= form.text_field :option_client_secret, class: "form-control" %>
|
|
7
|
+
<p class="form-hint"><%== t(".option_client_secret_hint_html") %></p>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
<% if integration.option_client_secret.present? %>
|
|
3
|
+
<div class="sm:col-span-2">
|
|
4
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
5
|
+
<%= t("activerecord.attributes.pager_tree/integrations/sentry/v3.option_client_secret") %>
|
|
6
|
+
</dt>
|
|
7
|
+
<dd class="mt-1 text-sm text-gray-900">
|
|
8
|
+
<div class="flex items-center gap-2">
|
|
9
|
+
<p class="text-sm truncate">
|
|
10
|
+
<%= mask integration.option_client_secret %>
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
13
|
+
</dd>
|
|
14
|
+
</div>
|
|
15
|
+
<% end %>
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<div x-data="{option_alert_acknowledged: <%= form.object.option_alert_acknowledged %> }">
|
|
2
|
+
<div class="grid grid-cols-1 gap-4">
|
|
3
|
+
<div class="form-group group">
|
|
4
|
+
<%= form.check_box "option_alert_acknowledged", class: "form-checkbox", "x-model": "option_alert_acknowledged" %>
|
|
5
|
+
<%= form.label "option_alert_acknowledged", class: "inline-block" %>
|
|
6
|
+
<p class="form-hint md:inline-block"><%== t(".option_alert_acknowledged_hint_html") %></p>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div x-show="option_alert_acknowledged">
|
|
11
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
12
|
+
<div class="form-group group">
|
|
13
|
+
<%= form.label :option_server_url %>
|
|
14
|
+
<%= form.text_field :option_server_url, class: "form-control" %>
|
|
15
|
+
<p class="form-hint"><%== t(".option_server_url_hint_html") %></p>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="form-group group">
|
|
19
|
+
<%= form.label :option_server_username %>
|
|
20
|
+
<%= form.text_field :option_server_username, class: "form-control" %>
|
|
21
|
+
<p class="form-hint"><%== t(".option_server_username_hint_html") %></p>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="form-group group" data-controller="password-visibility">
|
|
25
|
+
<%= form.label :option_server_password %>
|
|
26
|
+
<%= form.password_field :option_server_password, value: form.object.option_server_password, class: "form-control", data: { password_visibility_target: "input"} %>
|
|
27
|
+
<div class="flex justify-between">
|
|
28
|
+
<p class="form-hint"><%== t(".option_server_password_hint_html") %></p>
|
|
29
|
+
<%= render partial: "shared/password_visibility_button" %>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="form-group group">
|
|
34
|
+
<%= form.label :option_proxy_url %>
|
|
35
|
+
<%= form.text_field :option_proxy_url, class: "form-control" %>
|
|
36
|
+
<p class="form-hint"><%== t(".option_proxy_url_hint_html") %></p>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<div class="sm:col-span-1">
|
|
2
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
3
|
+
<%= t("activerecord.attributes.pager_tree/integrations/solar_winds/v3.option_alert_acknowledged") %>
|
|
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
|
+
<%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_alert_acknowledged } %>
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
11
|
+
</dd>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<% if integration.option_alert_acknowledged %>
|
|
15
|
+
<div class="sm:col-span-2">
|
|
16
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
17
|
+
<%= t("activerecord.attributes.pager_tree/integrations/solar_winds/v3.option_server_url") %>
|
|
18
|
+
</dt>
|
|
19
|
+
<dd class="mt-1 text-sm text-gray-900">
|
|
20
|
+
<div class="flex items-center gap-2">
|
|
21
|
+
<p class="text-sm truncate">
|
|
22
|
+
<%= integration.option_server_url %>
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
</dd>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div class="sm:col-span-1">
|
|
29
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
30
|
+
<%= t("activerecord.attributes.pager_tree/integrations/solar_winds/v3.option_server_username") %>
|
|
31
|
+
</dt>
|
|
32
|
+
<dd class="mt-1 text-sm text-gray-900">
|
|
33
|
+
<div class="flex items-center gap-2">
|
|
34
|
+
<p class="text-sm truncate">
|
|
35
|
+
<%= mask integration.option_server_username %>
|
|
36
|
+
</p>
|
|
37
|
+
</div>
|
|
38
|
+
</dd>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="sm:col-span-1">
|
|
42
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
43
|
+
<%= t("activerecord.attributes.pager_tree/integrations/solar_winds/v3.option_server_password") %>
|
|
44
|
+
</dt>
|
|
45
|
+
<dd class="mt-1 text-sm text-gray-900">
|
|
46
|
+
<div class="flex items-center gap-2">
|
|
47
|
+
<p class="text-sm truncate">
|
|
48
|
+
<%= mask integration.option_server_password %>
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
</dd>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="sm:col-span-2">
|
|
55
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
56
|
+
<%= t("activerecord.attributes.pager_tree/integrations/solar_winds/v3.option_proxy_url") %>
|
|
57
|
+
</dt>
|
|
58
|
+
<dd class="mt-1 text-sm text-gray-900">
|
|
59
|
+
<div class="flex items-center gap-2">
|
|
60
|
+
<p class="text-sm truncate">
|
|
61
|
+
<%= integration.option_proxy_url %>
|
|
62
|
+
</p>
|
|
63
|
+
</div>
|
|
64
|
+
</dd>
|
|
65
|
+
</div>
|
|
66
|
+
<% end %>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
2
|
+
<div class="form-group group">
|
|
3
|
+
<%= form.check_box :option_create_on_warn, class: "form-checkbox1" %>
|
|
4
|
+
<%= form.label :option_create_on_warn, class: "inline-block" %>
|
|
5
|
+
<p class="form-hint md:inline-block"><%== t(".option_create_on_warn_hint_html") %></p>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="form-group group">
|
|
9
|
+
<%= form.check_box :option_create_on_maintenance, class: "form-checkbox1" %>
|
|
10
|
+
<%= form.label :option_create_on_maintenance, class: "inline-block" %>
|
|
11
|
+
<p class="form-hint md:inline-block"><%== t(".option_create_on_maintenance_hint_html") %></p>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div class="sm:col-span-1">
|
|
2
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
3
|
+
<%= t("activerecord.attributes.pager_tree/integrations/status_gator/v3.option_create_on_warn") %>
|
|
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
|
+
<%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_create_on_warn } %>
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
11
|
+
</dd>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div class="sm:col-span-1">
|
|
15
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
16
|
+
<%= t("activerecord.attributes.pager_tree/integrations/status_gator/v3.option_create_on_maintenance") %>
|
|
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
|
+
<%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_create_on_maintenance } %>
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
24
|
+
</dd>
|
|
File without changes
|
|
File without changes
|
|
@@ -12,4 +12,12 @@
|
|
|
12
12
|
<%= form.label :option_capture_additional_data, class: "inline-block" %>
|
|
13
13
|
<p class="form-hint md:inline-block"><%== t(".option_capture_additional_data_hint_html") %></p>
|
|
14
14
|
</div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class="grid grid-cols-1 gap-4">
|
|
18
|
+
<div class="form-group group">
|
|
19
|
+
<%= form.label :option_wrapper_key %>
|
|
20
|
+
<%= form.text_field :option_wrapper_key, class: "form-control" %>
|
|
21
|
+
<p class="form-hint"><%== t(".option_wrapper_key_hint_html") %></p>
|
|
22
|
+
</div>
|
|
15
23
|
</div>
|
|
@@ -24,3 +24,18 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
</dd>
|
|
26
26
|
</div>
|
|
27
|
+
|
|
28
|
+
<% if integration.option_wrapper_key.present? %>
|
|
29
|
+
<div class="sm:col-span-2">
|
|
30
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
31
|
+
<%= t("activerecord.attributes.pager_tree/integrations/webhook/v3.option_wrapper_key") %>
|
|
32
|
+
</dt>
|
|
33
|
+
<dd class="mt-1 text-sm text-gray-900">
|
|
34
|
+
<div class="flex items-center gap-2">
|
|
35
|
+
<p class="text-sm truncate">
|
|
36
|
+
<%= integration.option_wrapper_key %>
|
|
37
|
+
</p>
|
|
38
|
+
</div>
|
|
39
|
+
</dd>
|
|
40
|
+
</div>
|
|
41
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<div class="grid grid-cols-1 gap-4">
|
|
2
|
+
<div class="form-group group">
|
|
3
|
+
<%= form.check_box :option_map_urgency, class: "form-checkbox" %>
|
|
4
|
+
<%= form.label :option_map_urgency, class: "inline-block" %>
|
|
5
|
+
<p class="form-hint md:inline-block"><%== t(".option_map_urgency_hint_html") %></p>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<div class="sm:col-span-2">
|
|
2
|
+
<dt class="text-sm font-medium text-gray-500">
|
|
3
|
+
<%= t("activerecord.attributes.pager_tree/integrations/zabbix/v3.option_map_urgency") %>
|
|
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
|
+
<%= render partial: "shared/components/badge_enabled", locals: { enabled: integration.option_map_urgency } %>
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
11
|
+
</dd>
|
|
12
|
+
</div>
|
data/config/locales/en.yml
CHANGED
|
@@ -5,9 +5,10 @@ en:
|
|
|
5
5
|
default: "default"
|
|
6
6
|
none: "none"
|
|
7
7
|
option_outgoing_rules: "Outgoing Rules"
|
|
8
|
-
option_outgoing_rules_hint_html: Outgoing Rules <a href='https://pagertree.com/
|
|
8
|
+
option_outgoing_rules_hint_html: Outgoing Rules <a href='https://pagertree.com/docs/integration-guides/outgoing-webhook#outgoing-rules' target='_blank'>(see docs)</a> for details.
|
|
9
9
|
option_incoming_webhook_url_hint_html: "URL to POST to"
|
|
10
10
|
option_alert_created_hint_html: "Send when the alert is created (before its routed)"
|
|
11
|
+
option_alert_assigned_hint_html: "Send when the alert is assigned to a team."
|
|
11
12
|
option_alert_open_hint_html: "Send when the alert is marked open (it has been routed)"
|
|
12
13
|
option_alert_acknowledged_hint_html: "Send when a user has acknowledged the alert"
|
|
13
14
|
option_alert_rejected_hint_html: "Send when a user has rejected the alert"
|
|
@@ -15,13 +16,50 @@ en:
|
|
|
15
16
|
option_alert_resolved_hint_html: "Send when the alert is marked resolved"
|
|
16
17
|
option_alert_dropped_hint_html: "Send when the alert is dropped"
|
|
17
18
|
option_alert_handoff_hint_html: "Send when the alert has been handed off"
|
|
18
|
-
|
|
19
|
+
option_compact_message_hint_html: "Show only alert title, status, and assigned user in the message box"
|
|
20
|
+
option_comment_created_hint_html: "Send when a comment is created"
|
|
21
|
+
option_comment_updated_hint_html: "Send when a comment is updated"
|
|
22
|
+
option_comment_destroyed_hint_html: "Send when a comment is deleted"
|
|
23
|
+
option_event_reminder_going_on_call_hint_html: "Send when a user is going on call"
|
|
24
|
+
option_event_reminder_going_off_call_hint_html: "Send when a user is going off call"
|
|
25
|
+
option_template_hint_html: "A handlebars template describing the body that should be posted. See <a href='https://pagertree.com/docs/integration-guides/outgoing-webhook#custom-format' target='_blank'>docs</a> for details."
|
|
19
26
|
option_send_linked_hint_html: "Send linked data (source, source_log, user, team)"
|
|
27
|
+
channel:
|
|
28
|
+
hangouts:
|
|
29
|
+
v3:
|
|
30
|
+
form_options:
|
|
31
|
+
option_thread_same_alert_hint_html: "Send all messages for the same alert to the same thread"
|
|
32
|
+
microsoft_teams:
|
|
33
|
+
v3:
|
|
34
|
+
form_options:
|
|
35
|
+
option_time_zone_hint_html: "The time zone to use when formatting dates and times"
|
|
36
|
+
v4:
|
|
37
|
+
form_options:
|
|
38
|
+
option_time_zone_hint_html: "The time zone to use when formatting dates and times"
|
|
39
|
+
cloudflare:
|
|
40
|
+
v3:
|
|
41
|
+
form_options:
|
|
42
|
+
option_webhook_secret_hint_html: "Cloudflare Webhook Secret"
|
|
43
|
+
custom_webhook:
|
|
44
|
+
v3:
|
|
45
|
+
form_options:
|
|
46
|
+
option_custom_definition_hint_html: "YAML definition for the custom webhook. <a href='https://pagertree.com/docs/integration-guides/custom-webhook' target='_blank'>See docs 🔗.</a>"
|
|
47
|
+
datadog:
|
|
48
|
+
v3:
|
|
49
|
+
form_options:
|
|
50
|
+
option_support_retriggered_event_hint_html: "Create a new alert when the 'Re-Triggered' event is sent by Datadog"
|
|
51
|
+
echoes_hq:
|
|
52
|
+
v3:
|
|
53
|
+
form_options:
|
|
54
|
+
option_api_key_hint_html: "EchoesHQ <a href='https://docs.echoeshq.com/api-authentication#ZB9nc' target='_blank'>API Key</a>"
|
|
20
55
|
email:
|
|
21
56
|
v3:
|
|
22
57
|
form_options:
|
|
23
58
|
option_allow_spam_hint_html: "Allow emails marked as SPAM to create alerts"
|
|
24
59
|
option_dedup_threads_hint_html: "Ignore emails from same thread (ex: Prevents new alerts for replys on emails (aka: RE:RE:RE...))"
|
|
60
|
+
option_sanitize_level_hint_html: "Email HTML Sanitization level. relaxed_2 can remove style tags from Microsoft Outlook. See <a href='https://github.com/rgrove/sanitize#configuration' target='_blank'>santize gem documentation</a> for details."
|
|
61
|
+
option_custom_definition_enabled_hint_html: "Enable custom email parsing rules defined in the YAML definition"
|
|
62
|
+
option_custom_definition_hint_html: "YAML definition for custom email parsing rules. <a href='https://pagertree.com/docs/integration-guides/email#custom-parsing-rules' target='_blank'>See docs 🔗.</a>"
|
|
25
63
|
form:
|
|
26
64
|
v3:
|
|
27
65
|
form_options:
|
|
@@ -35,6 +73,10 @@ en:
|
|
|
35
73
|
option_form_phone_required_hint_html: "Should the phone field be required to submit?"
|
|
36
74
|
option_form_description_required_hint_html: "Should the description field be required to submit?"
|
|
37
75
|
option_form_urgency_required_hint_html: "Should the urgency field be required to submit?"
|
|
76
|
+
hetrix_tools:
|
|
77
|
+
v3:
|
|
78
|
+
form_options:
|
|
79
|
+
option_authentication_token_hint_html: "Authentication Token to be used to authenticate requests from Hetrix Tools servers (optional, <a href=\"https://docs.hetrixtools.com/webhook-authentication-token/\" target=\"_blank\">see docs</a>)"
|
|
38
80
|
honeybadger:
|
|
39
81
|
v3:
|
|
40
82
|
form_options:
|
|
@@ -50,31 +92,59 @@ en:
|
|
|
50
92
|
option_account_sid_hint_html: "Twilio Account SID"
|
|
51
93
|
option_api_key_hint_html: "Twilio API Key"
|
|
52
94
|
option_api_secret_hint_html: "Twilio API Secret"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
95
|
+
option_api_region_hint_html: "Twilio API Region (must match API key/secret and number configuration regions)"
|
|
96
|
+
option_welcome_media_hint_html: "A <a href='https://www.twilio.com/docs/voice/twiml/play#supported-audio-file-types' target='_blank'>.mp3</a> recording that will be played first to caller (ex: \"Hello, you have reached the Devop's on-call support line.\")"
|
|
97
|
+
option_please_wait_media_hint_html: "A <a href='https://www.twilio.com/docs/voice/twiml/play#supported-audio-file-types' target='_blank'>.mp3</a> recording to be played before wait music music (default: <a href='https://app.pagertree.com/audios/please-wait.mp3' target='_blank'>Please wait while you are being connected</a>)"
|
|
98
|
+
option_music_media_hint_html: "A <a href='https://www.twilio.com/docs/voice/twiml/play#supported-audio-file-types' target='_blank'>.mp3</a> recording or wait music to be played while the caller waits for someone to acknowledge the alert (default: <a href='http://com.twilio.sounds.music.s3.amazonaws.com/oldDog_-_endless_goodbye_%28instr.%29.mp3' target='_blank'>Endless Goodbye</a>)"
|
|
99
|
+
option_connect_now_media_hint_html: "A <a href='https://www.twilio.com/docs/voice/twiml/play#supported-audio-file-types' target='_blank'>.mp3</a> recording played before connecting the caller to the acknowledger (default: <a href='https://app.pagertree.com/audios/you-are-now-being-connected.mp3' target='_blank'>You are now being connected</a>)"
|
|
100
|
+
option_no_answer_media_hint_html: "A <a href='https://www.twilio.com/docs/voice/twiml/play#supported-audio-file-types' target='_blank'>.mp3</a> recording to be played when no one answers"
|
|
101
|
+
option_no_answer_thank_you_media_hint_html: "A <a href='https://www.twilio.com/docs/voice/twiml/play#supported-audio-file-types' target='_blank'>.mp3</a> recording played after the caller leaves a voicemail"
|
|
102
|
+
option_no_answer_no_record_media_hint_html: "An optional <a href='https://www.twilio.com/docs/voice/twiml/play#supported-audio-file-types' target='_blank'>.mp3</a> recording to be played when no one answers if you select to not record voicemails (default: \"No one is available to answer this call. Goodbye.\")"
|
|
59
103
|
option_force_input_hint_html: "Force the caller to select a team (even if the integration only has one team)"
|
|
60
104
|
option_record_hint_html: "Record a voicemail when no one acknowledges the call"
|
|
105
|
+
option_send_straight_to_voicemail_hint_html: "Send the caller straight to voicemail without ringing any team members (only applies if 'Record a voicemail' is enabled). The alert will be routed after the caller leaves a voicemail."
|
|
61
106
|
option_record_emails_list_hint_html: "List of email addresses to notify when a voicemail has been recorded"
|
|
107
|
+
option_banned_phones_list_hint_html: "List of phone numbers that are banned from calling the integration"
|
|
108
|
+
option_max_wait_time_hint_html: "The maximum amount of time (in seconds) that the caller will wait before transferring the call to the voicemail. If set to nil, it will wait indefinitely."
|
|
109
|
+
option_skip_resolve_on_hangup_hint_html: "By default, if a caller hangs up before being connected to an acknowledger, the alert will be automatically resolved. Enabling this option will prevent the alert from being automatically resolved when a caller hangs up."
|
|
62
110
|
v3_mailer:
|
|
63
111
|
call_recording:
|
|
64
112
|
subject: "🎧 Alert #%{tiny_id} - New voicemail from %{from}"
|
|
65
113
|
body: "Alert #%{tiny_id} - New voicemail from %{from}"
|
|
114
|
+
logic_monitor:
|
|
115
|
+
v3:
|
|
116
|
+
form_options:
|
|
117
|
+
option_access_id_hint_html: "Logic Monitor Access <b>ID</b>"
|
|
118
|
+
option_access_key_hint_html: "Logic Monitor Access <b>Key</b>"
|
|
119
|
+
option_bearer_token_hint_html: "Logic Monitor <b>Bearer Token</b>"
|
|
120
|
+
option_logic_monitor_account_name_hint_html: "Your Logic Monitor account name. (ex: https://<b>account_name</b>.logicmonitor.com)"
|
|
121
|
+
option_alert_acknowledged_hint_html: "Acknowledge the alert in Logic Monitor when the alert is acknowledged in PagerTree. (PagerTree => Logic Monitor)"
|
|
66
122
|
mattermost:
|
|
67
123
|
outgoing_webhook:
|
|
68
124
|
v3:
|
|
69
125
|
form_options:
|
|
70
126
|
option_token_hint_html: "The token can be used to authenticate requests from Mattermost servers (optional)"
|
|
127
|
+
meta:
|
|
128
|
+
workplace:
|
|
129
|
+
v3:
|
|
130
|
+
form_options:
|
|
131
|
+
option_group_id_hint_html: "Workplace Group ID (find this in the URL when viewing the group in Workplace)"
|
|
132
|
+
option_access_token_hint_html: "Workplace Integration Access Token (generate this on the integration settings page in Workplace)"
|
|
133
|
+
option_app_secret_hint_html: "Workplace Integration App Secret"
|
|
134
|
+
option_incoming_enabled_hint_html: "Enable incoming requests (Workplace to PagerTree)"
|
|
135
|
+
option_outgoing_enabled_hint_html: "Enable outgoing requests (PagerTree to Workplace)"
|
|
71
136
|
outgoing_webhook:
|
|
72
137
|
v3:
|
|
73
138
|
form_options:
|
|
74
139
|
option_webhook_url_hint_html: "URL to POST to"
|
|
75
140
|
option_username_hint_html: "Basic auth username (optional)"
|
|
76
141
|
option_password_hint_html: "Basic auth password (optional)"
|
|
77
|
-
|
|
142
|
+
option_proxy_url_hint_html: "Proxy URL to pass through (optional). (Format: http://username:password@proxy.example.com:3128)"
|
|
143
|
+
option_template_hint_html: "A handlebars template describing the body that should be posted. See <a href='https://pagertree.com/docs/integration-guides/outgoing-webhook#custom-format' target='_blank'>docs</a> for details."
|
|
144
|
+
sentry:
|
|
145
|
+
v3:
|
|
146
|
+
form_options:
|
|
147
|
+
option_client_secret_hint_html: "Optional: The client secret can be used to authenticate requests from Sentry servers (only needed when 'internal integration' is being used)"
|
|
78
148
|
server_guard24:
|
|
79
149
|
v3:
|
|
80
150
|
form_options:
|
|
@@ -84,11 +154,29 @@ en:
|
|
|
84
154
|
v3:
|
|
85
155
|
form_options:
|
|
86
156
|
option_token_hint_html: "The token can be used to authenticate requests from Slack servers (optional)"
|
|
157
|
+
solar_winds:
|
|
158
|
+
v3:
|
|
159
|
+
form_options:
|
|
160
|
+
option_alert_acknowledged_hint_html: "Acknowledge the alert in SolarWinds when the alert is acknowledged in PagerTree. (PagerTree => SolarWinds)"
|
|
161
|
+
option_server_url_hint_html: "SolarWinds Server URL (ex: https://sw.example.com:17774)"
|
|
162
|
+
option_server_username_hint_html: "SolarWinds Server Username (needs to be account that has Alert access)"
|
|
163
|
+
option_server_password_hint_html: "SolarWinds Server Password"
|
|
164
|
+
option_proxy_url_hint_html: "Proxy URL to pass through (optional). (Format: http://username:password@proxy.example.com:3128)"
|
|
165
|
+
status_gator:
|
|
166
|
+
v3:
|
|
167
|
+
form_options:
|
|
168
|
+
option_create_on_warn_hint_html: "Create an alert when the status is WARN"
|
|
169
|
+
option_create_on_maintenance_hint_html: "Create an alert when the status is MAINTENANCE"
|
|
87
170
|
webhook:
|
|
88
171
|
v3:
|
|
89
172
|
form_options:
|
|
90
173
|
option_token_hint_html: "The PagerTree-Token header can be used to authenticate requests (optional)"
|
|
91
|
-
option_capture_additional_data_hint_html: "Capture additional data from the webhook (optional)"
|
|
174
|
+
option_capture_additional_data_hint_html: "Capture additional data from the webhook (optional)"
|
|
175
|
+
option_wrapper_key_hint_html: "If the incoming webhook payload is wrapped in an outer key, specify that key here (optional). For example, if the payload is <code>{ \"data\": { ...actual payload... } }</code>, set this to <code>data</code>. JMESPath syntax is supported for nested keys (ex: <code>data.attributes</code>). If the JMESPath expression is invalid or the specified path is not found in the payload, the original payload will be processed."
|
|
176
|
+
zabbix:
|
|
177
|
+
v3:
|
|
178
|
+
form_options:
|
|
179
|
+
option_map_urgency_hint_html: "Map Zabbix event severity to PagerTree urgency"
|
|
92
180
|
# SCAFFOLD_INTEGRATION
|
|
93
181
|
|
|
94
182
|
|
|
@@ -99,6 +187,7 @@ en:
|
|
|
99
187
|
option_description_template_enabled: "Description Template"
|
|
100
188
|
option_incoming_webhook_url: "URL"
|
|
101
189
|
option_alert_created: "alert.created"
|
|
190
|
+
option_alert_assigned: "alert.assigned"
|
|
102
191
|
option_alert_open: "alert.open"
|
|
103
192
|
option_alert_acknowledged: "alert.acknowledged"
|
|
104
193
|
option_alert_rejected: "alert.rejected"
|
|
@@ -106,12 +195,33 @@ en:
|
|
|
106
195
|
option_alert_resolved: "alert.resolved"
|
|
107
196
|
option_alert_dropped: "alert.dropped"
|
|
108
197
|
option_alert_handoff: "alert.handoff"
|
|
198
|
+
option_comment_created: "comment.created"
|
|
199
|
+
option_comment_updated: "comment.updated"
|
|
200
|
+
option_comment_destroyed: "comment.destroyed"
|
|
201
|
+
option_event_reminder_going_on_call: "event_reminder.going_on_call"
|
|
202
|
+
option_event_reminder_going_off_call: "event_reminder.going_off_call"
|
|
109
203
|
option_outgoing_rules: "Outgoing Rules"
|
|
204
|
+
option_compact_message: "Compact Message?"
|
|
110
205
|
"pager_tree/integrations/apex_ping/v3":
|
|
111
206
|
option_api_key: "API Key"
|
|
207
|
+
"pager_tree/integrations/channel/hangouts/v3":
|
|
208
|
+
option_thread_same_alert: "Thread Same Alert"
|
|
209
|
+
"pager_tree/integrations/channel/microsoft_teams/v3":
|
|
210
|
+
option_time_zone: "Display Time Zone"
|
|
211
|
+
"pager_tree/integrations/custom_webhook/v3":
|
|
212
|
+
option_custom_definition: "YAML Definition"
|
|
213
|
+
"pager_tree/integrations/cloudflare/v3":
|
|
214
|
+
option_webhook_secret: "Webhook Secret"
|
|
215
|
+
"pager_tree/integrations/datadog/v3":
|
|
216
|
+
option_support_retriggered_event: "Retriggered Event"
|
|
217
|
+
"pager_tree/integrations/echoes_hq/v3":
|
|
218
|
+
option_api_key: "Echoes HQ API Key"
|
|
112
219
|
"pager_tree/integrations/email/v3":
|
|
113
220
|
option_allow_spam: "Allow Spam"
|
|
114
221
|
option_dedup_threads: "Dedup Threads"
|
|
222
|
+
option_sanitize_level: "Sanitize Level"
|
|
223
|
+
option_custom_definition_enabled: "Enable Custom Definition"
|
|
224
|
+
option_custom_definition: "YAML Custom Definition"
|
|
115
225
|
"pager_tree/integrations/form/v3":
|
|
116
226
|
option_form_title: "Form Title"
|
|
117
227
|
option_form_header: "Form Header"
|
|
@@ -123,36 +233,74 @@ en:
|
|
|
123
233
|
option_form_phone_required: "Phone Required?"
|
|
124
234
|
option_form_description_required: "Description Required?"
|
|
125
235
|
option_form_urgency_required: "Urgency Required?"
|
|
236
|
+
"pager_tree/integrations/hetrix_tools/v3":
|
|
237
|
+
option_authentication_token: "Authentication Token"
|
|
126
238
|
"pager_tree/integrations/honeybadger/v3":
|
|
127
239
|
option_token: "Honeybadger Token"
|
|
128
240
|
"pager_tree/integrations/jira_server/v3":
|
|
129
241
|
option_issue_updated: "Trigger on issue.updated event"
|
|
130
242
|
"pager_tree/integrations/mattermost/outgoing_webhook/v3":
|
|
131
243
|
option_token: "Mattermost Token"
|
|
244
|
+
"pager_tree/integrations/meta/workplace/v3":
|
|
245
|
+
option_group_id: "Workplace Group ID"
|
|
246
|
+
option_access_token: "Workplace Integration Access Token"
|
|
247
|
+
option_app_secret: "Workplace Integration App Secret"
|
|
248
|
+
option_incoming_enabled: "Incoming Requests Enabled"
|
|
249
|
+
option_outgoing_enabled: "Outgoing Requests Enabled"
|
|
132
250
|
"pager_tree/integrations/outgoing_webhook/v3":
|
|
133
251
|
option_webhook_url: "URL"
|
|
134
252
|
option_username: "Username"
|
|
135
253
|
option_password: "Password"
|
|
254
|
+
option_proxy_url: "Proxy URL"
|
|
255
|
+
option_proxy_port: "Proxy Port"
|
|
256
|
+
option_proxy_username: "Proxy Username"
|
|
257
|
+
option_proxy_password: "Proxy Password"
|
|
136
258
|
option_template: "JSON Template"
|
|
137
259
|
option_send_linked: "Send Linked"
|
|
138
260
|
"pager_tree/integrations/live_call_routing/twilio/v3":
|
|
139
261
|
option_account_sid: "Twilio Account SID"
|
|
140
262
|
option_api_key: "Twilio API Key"
|
|
141
263
|
option_api_secret: "Twilio API Secret"
|
|
264
|
+
option_api_region: "Twilio API Region"
|
|
142
265
|
option_welcome_media: "Welcome Recording"
|
|
143
266
|
option_please_wait_media: "Before Wait Music Recording"
|
|
144
267
|
option_music_media: "Wait Music Recording"
|
|
145
268
|
option_connect_now_media: "Before Connect Recording"
|
|
146
269
|
option_no_answer_media: "Voicemail Greeting Recording"
|
|
147
270
|
option_no_answer_thank_you_media: "After Voicemail Recording"
|
|
271
|
+
option_no_answer_no_record_media: "No Answer (No Voicemail) Recording"
|
|
148
272
|
option_force_input: "Force Caller Input"
|
|
149
273
|
option_record: "Voicemail"
|
|
274
|
+
option_send_straight_to_voicemail: "Send Straight to Voicemail"
|
|
150
275
|
option_record_emails_list: "Voicemail Emails"
|
|
276
|
+
option_banned_phones_list: "Banned Phones"
|
|
277
|
+
option_max_wait_time: "Max Wait Time (seconds)"
|
|
278
|
+
option_skip_resolve_on_hangup: "Skip Resolve on Hangup"
|
|
279
|
+
"pager_tree/integrations/logic_monitor/v3":
|
|
280
|
+
option_access_id: "Logic Monitor Access ID"
|
|
281
|
+
option_access_key: "Logic Monitor Access Key"
|
|
282
|
+
option_bearer_token: "Logic Monitor Bearer Token"
|
|
283
|
+
option_logic_monitor_account_name: "Logic Monitor Account Name"
|
|
284
|
+
option_alert_acknowledged: "Acknowledge in Logic Monitor"
|
|
285
|
+
"pager_tree/integrations/sentry/v3":
|
|
286
|
+
option_client_secret: "Sentry Client Secret"
|
|
151
287
|
"pager_tree/integrations/slack/webhook/v3":
|
|
152
288
|
option_token: "Slack Token"
|
|
153
289
|
"pager_tree/integrations/server_guard24/v3":
|
|
154
290
|
option_resolve_warn: "Resolve on Warning"
|
|
291
|
+
"pager_tree/integrations/solar_winds/v3":
|
|
292
|
+
option_alert_acknowledged: "Acknowledge in SolarWinds?"
|
|
293
|
+
option_server_url: "SolarWinds URL"
|
|
294
|
+
option_server_username: "SolarWinds Username"
|
|
295
|
+
option_server_password: "SolarWinds Password"
|
|
296
|
+
option_proxy_url: "Proxy URL"
|
|
297
|
+
"pager_tree/integrations/status_gator/v3":
|
|
298
|
+
option_create_on_warn: "WARN create?"
|
|
299
|
+
option_create_on_maintenance: "MAINTENANCE create?"
|
|
155
300
|
"pager_tree/integrations/webhook/v3":
|
|
156
301
|
option_token: "PagerTree Token"
|
|
157
302
|
option_capture_additional_data: "Capture Additional Data"
|
|
303
|
+
option_wrapper_key: "Wrapper Key"
|
|
304
|
+
"pager_tree/integrations/zabbix/v3":
|
|
305
|
+
option_map_urgency: "Map Urgency"
|
|
158
306
|
# SCAFFOLD_ACTIVE_RECORD
|
data/config/routes.rb
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# lib/pager_tree/integrations/format_converters/yaml_json_converter.rb
|
|
2
|
+
require "yaml"
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module PagerTree
|
|
6
|
+
module Integrations
|
|
7
|
+
module FormatConverters
|
|
8
|
+
class YamlJsonConverter
|
|
9
|
+
class InvalidFormatError < StandardError; end
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
def convert_to_json(str, pretty: true)
|
|
13
|
+
format = detect_format(str)
|
|
14
|
+
|
|
15
|
+
case format
|
|
16
|
+
when :json
|
|
17
|
+
data = JSON.parse(str)
|
|
18
|
+
pretty ? JSON.pretty_generate(data) : data.to_json
|
|
19
|
+
when :yaml
|
|
20
|
+
data = YAML.safe_load(str)
|
|
21
|
+
pretty ? JSON.pretty_generate(data) : data.to_json
|
|
22
|
+
else
|
|
23
|
+
raise InvalidFormatError, "Input is neither valid JSON nor YAML"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def convert_to_yaml(str)
|
|
28
|
+
format = detect_format(str)
|
|
29
|
+
|
|
30
|
+
case format
|
|
31
|
+
when :json
|
|
32
|
+
data = JSON.parse(str)
|
|
33
|
+
data.to_yaml
|
|
34
|
+
when :yaml
|
|
35
|
+
data = YAML.safe_load(str)
|
|
36
|
+
data.to_yaml
|
|
37
|
+
else
|
|
38
|
+
raise InvalidFormatError, "Input is neither valid JSON nor YAML"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def detect_format(str)
|
|
43
|
+
return :json if json?(str)
|
|
44
|
+
return :yaml if yaml?(str)
|
|
45
|
+
:unknown
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def json?(str)
|
|
51
|
+
JSON.parse(str)
|
|
52
|
+
true
|
|
53
|
+
rescue JSON::ParserError
|
|
54
|
+
false
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def yaml?(str)
|
|
58
|
+
YAML.safe_load(str)
|
|
59
|
+
true
|
|
60
|
+
rescue Psych::SyntaxError
|
|
61
|
+
false
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|