foreman_webhooks 2.0.1 → 3.0.2

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.
Files changed (20) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/webhooks_controller.rb +8 -2
  3. data/app/views/api/v2/webhooks/show.json.rabl +1 -0
  4. data/lib/foreman_webhooks/engine.rb +1 -1
  5. data/lib/foreman_webhooks/version.rb +1 -1
  6. data/package.json +7 -10
  7. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/WebhooksTable.js +2 -9
  8. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js +0 -4
  9. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/__snapshots__/WebhooksTable.test.js.snap +4 -8
  10. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/WebhooksIndexPage.js +0 -3
  11. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.fixtures.js +1 -1
  12. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.test.js +0 -1
  13. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/__snapshots__/WebhooksIndexPage.test.js.snap +0 -1
  14. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js +0 -8
  15. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksPageActions.js +5 -4
  16. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksPageHelpers.js +1 -1
  17. data/webpack/__mocks__/foremanReact/components/Pagination/index.js +4 -0
  18. data/webpack/test_setup.js +0 -3
  19. metadata +13 -40
  20. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9723dbb6e2ed35504b2a9791fe518a6749619e78bc988a09f57165f561fd9395
4
- data.tar.gz: 0c57ff5b27a2a8123be24ec86c4cfcbee3ae3dea756ce6edf4a332b972044244
3
+ metadata.gz: e166211db618a40dd56da367296ff84e3ea3e43e1d7407cac3840a17eaac22ea
4
+ data.tar.gz: cbfe61067b37c0172bcb02f516d28a582349c0a383b18e6b26406e58069253b5
5
5
  SHA512:
6
- metadata.gz: 2c2194b186bca44b02df0b6170099d9cb0d91b6419023d6fe694648879fde3d6f9a2ad3a7ae699865e2cb566b6feb3893040615851441f5cefdc4c7f3b1dc482
7
- data.tar.gz: f8a2fa2e3674bb3c023762ad1c85f1928751ca9b35697511be77ab7775b97f529f8e3fc77d0cdf692472cd5ee5833866e24b5f9ad2351aeb0dabb8c09a2556b1
6
+ metadata.gz: 537b2c507e961c15383bec14b3bf5e22bb13093a501310e1ba9fee8595ac4ff789d4afd8c4ac4e91832b60502f8daee14104dab87eb9b2771bd4b4ae518ba3dd
7
+ data.tar.gz: 2c224320a96b0a9b55f9942152074e5063d4a5b9e5c84aca5f0d43823ce8fd8ebd91f45a595ccc694d5d09e70859eca3dc9481b4b113716bfc24971021fda39f
@@ -25,8 +25,14 @@ module Api
25
25
  param :target_url, String, required: true
26
26
  param :http_method, Webhook::ALLOWED_HTTP_METHODS
27
27
  param :http_content_type, String
28
- events = Webhook.available_events.sort.map { |e| e.delete_suffix(Webhook::EVENT_POSTFIX) }
29
- param :event, events, required: true
28
+ # If you need to have the list of the events documented, you can run:
29
+ # $ apipie:cache RAILS_ENV=production
30
+ if Rails.env.development?
31
+ param :event, String, required: true
32
+ else
33
+ events = Webhook.available_events.sort.map { |e| e.delete_suffix(Webhook::EVENT_POSTFIX) }
34
+ param :event, events, required: true
35
+ end
30
36
  param :webhook_template_id, :identifier
31
37
  param :enabled, :boolean
32
38
  param :verify_ssl, :boolean
@@ -10,6 +10,7 @@ attributes :target_url,
10
10
  :http_content_type,
11
11
  :enabled,
12
12
  :verify_ssl,
13
+ :proxy_authorization,
13
14
  :http_headers,
14
15
  :ssl_ca_certs,
15
16
  :user
@@ -15,7 +15,7 @@ module ForemanWebhooks
15
15
 
16
16
  initializer 'foreman_webhooks.register_plugin', before: :finisher_hook do |_app|
17
17
  Foreman::Plugin.register :foreman_webhooks do
18
- requires_foreman '>= 2.5'
18
+ requires_foreman '>= 3.2'
19
19
 
20
20
  apipie_documented_controllers ["#{ForemanWebhooks::Engine.root}/app/controllers/api/v2/*.rb"]
21
21
  ApipieDSL.configuration.sections += ['webhooks']
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanWebhooks
4
- VERSION = '2.0.1'
4
+ VERSION = '3.0.2'
5
5
  end
data/package.json CHANGED
@@ -21,25 +21,22 @@
21
21
  "url": "https://projects.theforeman.org/projects/webhooks/issues"
22
22
  },
23
23
  "peerDependencies": {
24
- "@theforeman/vendor": ">= 8.4.1"
24
+ "@theforeman/vendor": "^8.15.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@babel/core": "^7.7.0",
28
- "@theforeman/builder": "^8.4.1",
29
- "@theforeman/stories": "^8.4.1",
30
- "@theforeman/test": "^8.4.1",
31
- "@theforeman/vendor-dev": "^8.4.1",
32
- "@theforeman/eslint-plugin-foreman": "^8.4.1",
28
+ "@theforeman/builder": "^8.15.0",
29
+ "@theforeman/stories": "^8.15.0",
30
+ "@theforeman/test": "^8.15.0",
31
+ "@theforeman/vendor-dev": "^8.15.0",
32
+ "@theforeman/eslint-plugin-foreman": "^8.15.0",
33
33
  "babel-eslint": "^10.0.0",
34
34
  "eslint": "^6.8.0",
35
35
  "eslint-plugin-spellcheck": "^0.0.17",
36
+ "jed": "^1.1.1",
36
37
  "prettier": "^1.13.5",
37
38
  "stylelint": "^9.3.0",
38
39
  "stylelint-config-standard": "^18.0.0",
39
40
  "surge": "^0.20.3"
40
- },
41
- "dependencies": {
42
- "jed": "^1.1.1",
43
- "react-intl": "^2.8.0"
44
41
  }
45
42
  }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
4
  import { Table } from 'foremanReact/components/common/table';
5
- import Pagination from 'foremanReact/components/Pagination/PaginationWrapper';
5
+ import Pagination from 'foremanReact/components/Pagination';
6
6
  import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks';
7
7
 
8
8
  import WebhookDeleteModal from '../WebhookDeleteModal';
@@ -57,15 +57,8 @@ const WebhooksTable = ({
57
57
  )}
58
58
  rows={results}
59
59
  id="webhooks-table"
60
- style={{ marginBottom: -6 }}
61
- />
62
- <Pagination
63
- viewType="list"
64
- itemCount={itemCount}
65
- pagination={pagination}
66
- onChange={fetchAndPush}
67
- dropdownButtonId="webhooks-page-pagination-dropdown"
68
60
  />
61
+ <Pagination itemCount={itemCount} onChange={fetchAndPush} />
69
62
  </React.Fragment>
70
63
  );
71
64
  };
@@ -29,14 +29,12 @@ const fixtures = {
29
29
  isLoading: true,
30
30
  hasData: false,
31
31
  hasError: false,
32
- toasts: [],
33
32
  }),
34
33
  'should render with no data': propsFactory({
35
34
  ...props,
36
35
  isLoading: false,
37
36
  hasData: false,
38
37
  hasError: false,
39
- toasts: [],
40
38
  }),
41
39
  'should render with error': propsFactory({
42
40
  isLoading: false,
@@ -47,14 +45,12 @@ const fixtures = {
47
45
  text: 'this is error',
48
46
  },
49
47
  ...props,
50
- toasts: [],
51
48
  }),
52
49
  'should render with webhooks': propsFactory({
53
50
  ...props,
54
51
  isLoading: false,
55
52
  hasError: false,
56
53
  hasData: true,
57
- toasts: [],
58
54
  results: webhooks,
59
55
  itemCount: webhooks.length,
60
56
  }),
@@ -17,7 +17,7 @@ exports[`WebhooksTable rendering should render when loading 1`] = `
17
17
  "perPage": 20,
18
18
  }
19
19
  }
20
- perPage={42}
20
+ per_page={42}
21
21
  reloadWithSearch={[MockFunction]}
22
22
  results={Array []}
23
23
  search="name=foo"
@@ -29,7 +29,6 @@ exports[`WebhooksTable rendering should render when loading 1`] = `
29
29
  }
30
30
  toDelete={Object {}}
31
31
  toEdit={0}
32
- toasts={Array []}
33
32
  />
34
33
  `;
35
34
 
@@ -56,7 +55,7 @@ exports[`WebhooksTable rendering should render with error 1`] = `
56
55
  "perPage": 20,
57
56
  }
58
57
  }
59
- perPage={42}
58
+ per_page={42}
60
59
  reloadWithSearch={[MockFunction]}
61
60
  results={Array []}
62
61
  search="name=foo"
@@ -68,7 +67,6 @@ exports[`WebhooksTable rendering should render with error 1`] = `
68
67
  }
69
68
  toDelete={Object {}}
70
69
  toEdit={0}
71
- toasts={Array []}
72
70
  />
73
71
  `;
74
72
 
@@ -89,7 +87,7 @@ exports[`WebhooksTable rendering should render with no data 1`] = `
89
87
  "perPage": 20,
90
88
  }
91
89
  }
92
- perPage={42}
90
+ per_page={42}
93
91
  reloadWithSearch={[MockFunction]}
94
92
  results={Array []}
95
93
  search="name=foo"
@@ -101,7 +99,6 @@ exports[`WebhooksTable rendering should render with no data 1`] = `
101
99
  }
102
100
  toDelete={Object {}}
103
101
  toEdit={0}
104
- toasts={Array []}
105
102
  />
106
103
  `;
107
104
 
@@ -122,7 +119,7 @@ exports[`WebhooksTable rendering should render with webhooks 1`] = `
122
119
  "perPage": 20,
123
120
  }
124
121
  }
125
- perPage={42}
122
+ per_page={42}
126
123
  reloadWithSearch={[MockFunction]}
127
124
  results={
128
125
  Array [
@@ -153,6 +150,5 @@ exports[`WebhooksTable rendering should render with webhooks 1`] = `
153
150
  }
154
151
  toDelete={Object {}}
155
152
  toEdit={0}
156
- toasts={Array []}
157
153
  />
158
154
  `;
@@ -26,7 +26,6 @@ const WebhooksIndexPage = ({
26
26
  itemCount,
27
27
  message,
28
28
  canCreate,
29
- toasts,
30
29
  reloadWithSearch,
31
30
  }) => {
32
31
  const [toDelete, setToDelete] = useState({});
@@ -62,7 +61,6 @@ const WebhooksIndexPage = ({
62
61
  isLoading={isLoading && hasData}
63
62
  onSearch={reloadWithSearch}
64
63
  onBookmarkClick={reloadWithSearch}
65
- toastNotifications={toasts}
66
64
  toolbarButtons={canCreate && createBtn}
67
65
  >
68
66
  <WebhooksTable
@@ -98,7 +96,6 @@ WebhooksIndexPage.propTypes = {
98
96
  itemCount: PropTypes.number.isRequired,
99
97
  message: PropTypes.object,
100
98
  canCreate: PropTypes.bool.isRequired,
101
- toasts: PropTypes.array.isRequired,
102
99
  reloadWithSearch: PropTypes.func.isRequired,
103
100
  };
104
101
 
@@ -17,7 +17,7 @@ export const querySort = {
17
17
 
18
18
  const pageParams = {
19
19
  page: 5,
20
- perPage: 42,
20
+ per_page: 42,
21
21
  };
22
22
 
23
23
  const stateParams = {
@@ -13,7 +13,6 @@ const fixtures = {
13
13
  canCreate: true,
14
14
  sort: {},
15
15
  webhooks: [],
16
- toasts: [],
17
16
  },
18
17
  };
19
18
 
@@ -20,7 +20,6 @@ exports[`WebhooksIndexPage redering render with minimal props 1`] = `
20
20
  reloadWithSearch={[MockFunction]}
21
21
  search=""
22
22
  sort={Object {}}
23
- toasts={Array []}
24
23
  webhooks={Array []}
25
24
  />
26
25
  `;
@@ -1,9 +1,7 @@
1
- import React from 'react';
2
1
  import { connect } from 'react-redux';
3
2
  import { compose, bindActionCreators } from 'redux';
4
3
 
5
4
  import { callOnMount, callOnPopState } from 'foremanReact/common/HOC';
6
- import { useForemanContext } from 'foremanReact/Root/Context/ForemanContext';
7
5
 
8
6
  import WebhooksIndexPage from './WebhooksIndexPage';
9
7
  import * as actions from '../WebhooksPageActions';
@@ -38,14 +36,8 @@ const mapStateToProps = state => ({
38
36
 
39
37
  const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
40
38
 
41
- const callWithToastsContext = Component => props => {
42
- const { toasts } = useForemanContext();
43
- return <Component {...props} toasts={toasts} />;
44
- };
45
-
46
39
  export default compose(
47
40
  connect(mapStateToProps, mapDispatchToProps),
48
- callWithToastsContext,
49
41
  callOnMount(({ initializeWebhooks }) => initializeWebhooks()),
50
42
  callOnPopState(({ fetchWebhooks }) => fetchWebhooks())
51
43
  )(WebhooksIndexPage);
@@ -11,7 +11,7 @@ import {
11
11
 
12
12
  export const initializeWebhooks = () => dispatch => {
13
13
  const params = getParams();
14
- dispatch(fetchWebhooks(params));
14
+ dispatch(fetchWebhooks({ per_page: params.perPage, ...params }));
15
15
  if (!history.action === 'POP') {
16
16
  history.replace({
17
17
  pathname: WEBHOOKS_PATH,
@@ -21,7 +21,8 @@ export const initializeWebhooks = () => dispatch => {
21
21
  };
22
22
 
23
23
  export const fetchWebhooks = (
24
- { page, perPage, searchQuery, sort },
24
+ /* eslint-disable-next-line camelcase */
25
+ { page, per_page, searchQuery, sort },
25
26
  url = WEBHOOKS_API_PATH
26
27
  ) => async dispatch => {
27
28
  const sortString =
@@ -33,7 +34,7 @@ export const fetchWebhooks = (
33
34
  url,
34
35
  params: {
35
36
  page,
36
- per_page: perPage,
37
+ per_page,
37
38
  search: searchQuery,
38
39
  order: sortString,
39
40
  },
@@ -46,7 +47,7 @@ export const fetchAndPush = (params = {}) => (dispatch, getState) => {
46
47
  dispatch(fetchWebhooks(query));
47
48
  history.push({
48
49
  pathname: WEBHOOKS_PATH,
49
- search: stringifyParams(query),
50
+ search: stringifyParams({ perPage: query.per_page, ...query }),
50
51
  });
51
52
  };
52
53
 
@@ -12,7 +12,7 @@ export const buildQuery = (query, state) => {
12
12
 
13
13
  return {
14
14
  page: query.page || selectPage(state),
15
- perPage: query.perPage || selectPerPage(state),
15
+ per_page: query.per_page || selectPerPage(state),
16
16
  searchQuery:
17
17
  query.searchQuery === undefined ? selectSearch(state) : query.searchQuery,
18
18
  ...(querySort && { sort: querySort }),
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+
3
+ const Pagination = () => <></>;
4
+ export default Pagination;
@@ -1,6 +1,3 @@
1
- jest.mock('foremanReact/Root/Context/ForemanContext', () => ({
2
- useForemanContext: () => ({ toasts: [] }),
3
- }));
4
1
  jest.mock('foremanReact/history', () => ({
5
2
  history: {
6
3
  action: 'PUSH',
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_webhooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Goebel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-03 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rdoc
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rubocop
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 0.71.0
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: 0.71.0
11
+ date: 2022-06-01 00:00:00.000000000 Z
12
+ dependencies: []
41
13
  description: Plugin for Foreman that allows to configure Webhooks.
42
14
  email:
43
15
  - mail@timogoebel.name
@@ -167,7 +139,7 @@ files:
167
139
  - webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js
168
140
  - webpack/__mocks__/foremanReact/components/Loading/Loading.js
169
141
  - webpack/__mocks__/foremanReact/components/Loading/index.js
170
- - webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js
142
+ - webpack/__mocks__/foremanReact/components/Pagination/index.js
171
143
  - webpack/__mocks__/foremanReact/components/common/EmptyState.js
172
144
  - webpack/__mocks__/foremanReact/components/common/forms/ForemanForm.js
173
145
  - webpack/__mocks__/foremanReact/components/common/forms/FormField.js
@@ -185,8 +157,9 @@ files:
185
157
  homepage: https://github.com/theforeman/foreman_webhooks
186
158
  licenses:
187
159
  - GPL-3.0
188
- metadata: {}
189
- post_install_message:
160
+ metadata:
161
+ is_foreman_plugin: 'true'
162
+ post_install_message:
190
163
  rdoc_options: []
191
164
  require_paths:
192
165
  - lib
@@ -201,8 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
174
  - !ruby/object:Gem::Version
202
175
  version: '0'
203
176
  requirements: []
204
- rubygems_version: 3.1.4
205
- signing_key:
177
+ rubygems_version: 3.1.2
178
+ signing_key:
206
179
  specification_version: 4
207
180
  summary: Configure webhooks for Foreman.
208
181
  test_files:
@@ -213,14 +186,14 @@ test_files:
213
186
  - test/factories/webhook_template.rb
214
187
  - test/jobs/foreman_webhooks/deliver_webhook_job_test.rb
215
188
  - test/models/webhook_test.rb
216
- - test/unit/foreman_webhooks/webhook_service_test.rb
217
189
  - test/test_plugin_helper.rb
190
+ - test/unit/foreman_webhooks/webhook_service_test.rb
191
+ - webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/__tests__/WebhookForm.test.js
218
192
  - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/__tests__/enabledCellFormatter.test.js
219
193
  - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/__tests__/EnabledCell.test.js
220
194
  - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js
221
- - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.fixtures.js
222
195
  - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/integration.test.js
196
+ - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.fixtures.js
223
197
  - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.test.js
224
198
  - webpack/ForemanWebhooks/Routes/Webhooks/__tests__/WebhooksPageHelpers.test.js
225
199
  - webpack/ForemanWebhooks/Routes/Webhooks/__tests__/WebhooksPageSelectors.test.js
226
- - webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/__tests__/WebhookForm.test.js
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
-
3
- const PaginationWrapper = () => <></>;
4
- export default PaginationWrapper;