foreman_webhooks 1.0.0 → 1.1.0
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/api/v2/webhooks_controller.rb +7 -1
- data/app/controllers/concerns/foreman_webhooks/controller/parameters/webhook.rb +1 -0
- data/app/controllers/webhooks_controller.rb +1 -24
- data/app/services/foreman_webhooks/webhook_service.rb +1 -1
- data/app/views/foreman_webhooks/webhook_templates/remote_execution_-_host_job.erb +0 -1
- data/config/routes.rb +6 -2
- data/lib/foreman_webhooks/engine.rb +2 -2
- data/lib/foreman_webhooks/version.rb +1 -1
- data/package.json +6 -6
- data/webpack/ForemanWebhooks/Routes/ForemanWebhooksRoutes.js +2 -2
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/ForemanFormikField.js +117 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/WebhookFormTabs.css +7 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/WebhookFormTabs.js +163 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/WebhookForm.js +69 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/WebhookFormSelectors.js +58 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/__tests__/WebhookForm.test.js +51 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/__tests__/__snapshots__/WebhookForm.test.js.snap +510 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/constants.js +9 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/index.js +73 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/EmptyWebhooksIndexPage/index.js +63 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookCreateModal.js +69 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookDeleteModal.js +1 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookEditModal.js +107 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookEditModalSelectors.js +22 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookModal.scss +6 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/index.js +1 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/nameToEditFormatter.js +19 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/NameToEditCell.js +35 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/WebhooksTable.js +31 -14
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/WebhooksTableSchema.js +12 -4
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js +13 -4
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/__snapshots__/WebhooksTable.test.js.snap +62 -19
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js +27 -5
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/WebhooksIndexPage.js +61 -32
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.fixtures.js +36 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.test.js +3 -1
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/__snapshots__/WebhooksIndexPage.test.js.snap +18 -60
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/__snapshots__/integration.test.js.snap +43 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/integration.test.js +34 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksPageActions.js +3 -0
- data/webpack/ForemanWebhooks/Routes/Webhooks/constants.js +11 -1
- data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +1 -0
- data/webpack/__mocks__/foremanReact/common/HOC.js +26 -1
- data/webpack/__mocks__/foremanReact/common/urlHelpers.js +7 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +6 -1
- data/webpack/__mocks__/foremanReact/components/Loading/Loading.js +2 -0
- data/webpack/__mocks__/foremanReact/components/Loading/index.js +3 -0
- data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +3 -1
- data/webpack/__mocks__/foremanReact/components/common/forms/ForemanForm.js +9 -0
- data/webpack/__mocks__/foremanReact/components/common/forms/FormField.js +3 -0
- data/webpack/__mocks__/foremanReact/components/common/table.js +21 -0
- data/webpack/__mocks__/foremanReact/history.js +3 -0
- data/webpack/__mocks__/foremanReact/redux/actions/common/forms.js +1 -0
- data/webpack/test_setup.js +15 -0
- metadata +30 -7
- data/app/views/webhooks/_form.html.erb +0 -38
- data/app/views/webhooks/_templates.html.erb +0 -5
- data/app/views/webhooks/edit.html.erb +0 -3
- data/app/views/webhooks/new.html.erb +0 -3
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/EmptyWebhooksTable/index.js +0 -29
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<%= form_for @webhook, url: (@webhook.new_record? ? webhooks_path : webhook_path(id: @webhook)) do |f| %>
|
|
2
|
-
<%= base_errors_for @webhook %>
|
|
3
|
-
<%= text_f f, :name %>
|
|
4
|
-
<%= text_f f, :target_url, help_inline: _('Target URL that should be called by Foreman') %>
|
|
5
|
-
|
|
6
|
-
<%= text_f f, :user, help_block: _('Authentication credentials') %>
|
|
7
|
-
<%= password_f f, :password, keep_value: true %>
|
|
8
|
-
|
|
9
|
-
<%= selectable_f f, :http_method, Webhook::ALLOWED_HTTP_METHODS,
|
|
10
|
-
{ include_blank: false,
|
|
11
|
-
selected: @webhook.http_method },
|
|
12
|
-
{ label: _('HTTP Method'),
|
|
13
|
-
label_help: _(f.object.try(:description)),
|
|
14
|
-
required: true } %>
|
|
15
|
-
<%= text_f f, :http_content_type %>
|
|
16
|
-
|
|
17
|
-
<%= render('templates', f: f) %>
|
|
18
|
-
|
|
19
|
-
<%= selectable_f f, :event, Webhook.available_events.sort.map { |e| e.delete_suffix(Webhook::EVENT_POSTFIX) },
|
|
20
|
-
{ include_blank: false,
|
|
21
|
-
selected: @webhook.event&.delete_suffix(Webhook::EVENT_POSTFIX) },
|
|
22
|
-
{ label: _('Subscribe to'),
|
|
23
|
-
label_help: _(f.object.try(:description)),
|
|
24
|
-
required: true } %>
|
|
25
|
-
|
|
26
|
-
<%= checkbox_f f, :enabled, help_inline: _('If unchecked, the webhook will be inactive') %>
|
|
27
|
-
<%= checkbox_f f, :verify_ssl, help_inline: _("Uncheck this option to disable validation of the receiver's SSL certificate") %>
|
|
28
|
-
<%= textarea_f f, :ssl_ca_certs, label: _('X509 Certification Authorities'),
|
|
29
|
-
size: 'col-md-8', rows: 10,
|
|
30
|
-
placeholder: _("Optional CAs in PEM format concatenated to verify the receiver's SSL certificate.") %>
|
|
31
|
-
<%= checkbox_f f, :proxy_authorization, help_inline: _("Authorize with Foreman client certificate and validate smart-proxy CA from Settings.") %>
|
|
32
|
-
|
|
33
|
-
<%= textarea_f f, :http_headers, label: _('Optional HTTP headers as JSON (ERB allowed)'),
|
|
34
|
-
size: 'col-md-8', rows: 6,
|
|
35
|
-
placeholder: "{\n\"X-Shellhook-Arg-1\": \"value\"\n}" %>
|
|
36
|
-
|
|
37
|
-
<%= submit_or_cancel(f, false, { react_cancel_button: true, cancel_path: '/webhooks' }) %>
|
|
38
|
-
<% end %>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
|
4
|
-
import DefaultEmptyState from 'foremanReact/components/common/EmptyState';
|
|
5
|
-
|
|
6
|
-
const EmptyWebhooksTable = ({ message: { type, text } }) => (
|
|
7
|
-
<DefaultEmptyState
|
|
8
|
-
icon={type === 'error' ? 'error-circle-o' : 'add-circle-o'}
|
|
9
|
-
header={type === 'error' ? __('Error') : __('No Results')}
|
|
10
|
-
description={text}
|
|
11
|
-
documentation={null}
|
|
12
|
-
/>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
EmptyWebhooksTable.propTypes = {
|
|
16
|
-
message: PropTypes.shape({
|
|
17
|
-
type: PropTypes.oneOf(['empty', 'error']),
|
|
18
|
-
text: PropTypes.string,
|
|
19
|
-
}),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
EmptyWebhooksTable.defaultProps = {
|
|
23
|
-
message: PropTypes.shape({
|
|
24
|
-
type: 'empty',
|
|
25
|
-
text: 'No Results',
|
|
26
|
-
}),
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default EmptyWebhooksTable;
|