foreman_webhooks 2.0.3 → 3.0.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/views/api/v2/webhooks/show.json.rabl +0 -5
- data/lib/foreman_webhooks/engine.rb +1 -1
- data/lib/foreman_webhooks/version.rb +1 -1
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/ForemanFormikField.js +1 -36
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/WebhookFormTabs.js +0 -8
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/WebhookForm.js +0 -11
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/__tests__/__snapshots__/WebhookForm.test.js.snap +0 -2
- data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/index.js +1 -16
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookCreateModal.js +2 -4
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookEditModal.js +17 -38
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js +0 -4
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/__snapshots__/WebhooksTable.test.js.snap +0 -4
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/WebhooksIndexPage.js +0 -3
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.test.js +0 -1
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/__snapshots__/WebhooksIndexPage.test.js.snap +0 -1
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js +0 -8
- data/webpack/test_setup.js +0 -3
- metadata +9 -9
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9acc94d42d1da3f77bd90c0383a6f22ed44ece4fd1dbdadff575a56983dcbd22
         | 
| 4 | 
            +
              data.tar.gz: 5b4dfd3d9b5f224182fdd6ab3d320df4ed8fbb2fc1030f5abf823c1e01cf8343
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 824471769ea8d3cf27a8fc14bf8d1780a456cedb3013630636416a89fa0b2405b96b3d8674a290e66b0163636467a0773d23f574a70ec64222ba9a4d43f67dff
         | 
| 7 | 
            +
              data.tar.gz: 25c3cc1fc29b99de2eb08ec6e7bdb9b36024d6c2c323e797611c569429822557a103fc4ac9ad839cee01c1ce6c40ff7a5f9ae4294b08195acd2cc1f370d60e7d
         | 
| @@ -10,15 +10,10 @@ attributes :target_url, | |
| 10 10 | 
             
                       :http_content_type,
         | 
| 11 11 | 
             
                       :enabled,
         | 
| 12 12 | 
             
                       :verify_ssl,
         | 
| 13 | 
            -
                       :proxy_authorization,
         | 
| 14 13 | 
             
                       :http_headers,
         | 
| 15 14 | 
             
                       :ssl_ca_certs,
         | 
| 16 15 | 
             
                       :user
         | 
| 17 16 |  | 
| 18 | 
            -
            node :password_set do |webhook|
         | 
| 19 | 
            -
              webhook.password.present?
         | 
| 20 | 
            -
            end
         | 
| 21 | 
            -
             | 
| 22 17 | 
             
            child :webhook_template do
         | 
| 23 18 | 
             
              extends 'api/v2/webhook_templates/base'
         | 
| 24 19 | 
             
            end
         | 
| @@ -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 '>=  | 
| 18 | 
            +
                    requires_foreman '>= 3.0'
         | 
| 19 19 |  | 
| 20 20 | 
             
                    apipie_documented_controllers ["#{ForemanWebhooks::Engine.root}/app/controllers/api/v2/*.rb"]
         | 
| 21 21 | 
             
                    ApipieDSL.configuration.sections += ['webhooks']
         | 
    
        data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/ForemanFormikField.js
    CHANGED
    
    | @@ -21,8 +21,6 @@ const ForemanFormikField = ({ | |
| 21 21 | 
             
              placeholder,
         | 
| 22 22 | 
             
              options,
         | 
| 23 23 | 
             
              isLoading,
         | 
| 24 | 
            -
              disabled,
         | 
| 25 | 
            -
              setDisabled,
         | 
| 26 24 | 
             
            }) => (
         | 
| 27 25 | 
             
              <FormikField name={name}>
         | 
| 28 26 | 
             
                {({
         | 
| @@ -34,15 +32,6 @@ const ForemanFormikField = ({ | |
| 34 32 |  | 
| 35 33 | 
             
                    return filter(initialOptions, o => o.value === fieldValue);
         | 
| 36 34 | 
             
                  };
         | 
| 37 | 
            -
                  const passwordInput = (
         | 
| 38 | 
            -
                    <input
         | 
| 39 | 
            -
                      {...field}
         | 
| 40 | 
            -
                      placeholder={disabled ? '********' : ''}
         | 
| 41 | 
            -
                      type={type}
         | 
| 42 | 
            -
                      disabled={disabled}
         | 
| 43 | 
            -
                      className="form-control"
         | 
| 44 | 
            -
                    />
         | 
| 45 | 
            -
                  );
         | 
| 46 35 | 
             
                  let content = null;
         | 
| 47 36 | 
             
                  switch (type) {
         | 
| 48 37 | 
             
                    case 'textarea':
         | 
| @@ -67,30 +56,10 @@ const ForemanFormikField = ({ | |
| 67 56 | 
             
                          onChange={selected =>
         | 
| 68 57 | 
             
                            setFieldValue(field.name, selected[0]?.value)
         | 
| 69 58 | 
             
                          }
         | 
| 59 | 
            +
                          // onBlur={e => setFieldTouched(field.name, true)}
         | 
| 70 60 | 
             
                        />
         | 
| 71 61 | 
             
                      );
         | 
| 72 62 | 
             
                      break;
         | 
| 73 | 
            -
                    case 'password':
         | 
| 74 | 
            -
                      content = setDisabled ? (
         | 
| 75 | 
            -
                        <div className="input-group">
         | 
| 76 | 
            -
                          {passwordInput}
         | 
| 77 | 
            -
                          <span className="input-group-btn">
         | 
| 78 | 
            -
                            <button
         | 
| 79 | 
            -
                              className="btn btn-default"
         | 
| 80 | 
            -
                              onClick={e => {
         | 
| 81 | 
            -
                                e.preventDefault();
         | 
| 82 | 
            -
                                setDisabled(!disabled);
         | 
| 83 | 
            -
                              }}
         | 
| 84 | 
            -
                              title={__('Change the password')}
         | 
| 85 | 
            -
                            >
         | 
| 86 | 
            -
                              <span className="pficon pficon-edit" />
         | 
| 87 | 
            -
                            </button>
         | 
| 88 | 
            -
                          </span>
         | 
| 89 | 
            -
                        </div>
         | 
| 90 | 
            -
                      ) : (
         | 
| 91 | 
            -
                        passwordInput
         | 
| 92 | 
            -
                      );
         | 
| 93 | 
            -
                      break;
         | 
| 94 63 | 
             
                    default:
         | 
| 95 64 | 
             
                      content = (
         | 
| 96 65 | 
             
                        <input
         | 
| @@ -132,8 +101,6 @@ ForemanFormikField.propTypes = { | |
| 132 101 | 
             
              placeholder: PropTypes.string,
         | 
| 133 102 | 
             
              options: PropTypes.array,
         | 
| 134 103 | 
             
              isLoading: PropTypes.bool,
         | 
| 135 | 
            -
              disabled: PropTypes.bool,
         | 
| 136 | 
            -
              setDisabled: PropTypes.func,
         | 
| 137 104 | 
             
            };
         | 
| 138 105 |  | 
| 139 106 | 
             
            ForemanFormikField.defaultProps = {
         | 
| @@ -145,8 +112,6 @@ ForemanFormikField.defaultProps = { | |
| 145 112 | 
             
              placeholder: '',
         | 
| 146 113 | 
             
              options: null,
         | 
| 147 114 | 
             
              isLoading: false,
         | 
| 148 | 
            -
              disabled: false,
         | 
| 149 | 
            -
              setDisabled: undefined,
         | 
| 150 115 | 
             
            };
         | 
| 151 116 |  | 
| 152 117 | 
             
            export default ForemanFormikField;
         | 
    
        data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/WebhookFormTabs.js
    CHANGED
    
    | @@ -18,8 +18,6 @@ const WebhookFormTabs = ({ | |
| 18 18 | 
             
              availableEvents,
         | 
| 19 19 | 
             
              isTemplatesLoading,
         | 
| 20 20 | 
             
              isEventsLoading,
         | 
| 21 | 
            -
              isPasswordDisabled,
         | 
| 22 | 
            -
              setIsPasswordDisabled,
         | 
| 23 21 | 
             
            }) => (
         | 
| 24 22 | 
             
              <Tabs activeKey={activeTab} onSelect={handleTabClick} isFilled>
         | 
| 25 23 | 
             
                <Tab
         | 
| @@ -92,8 +90,6 @@ const WebhookFormTabs = ({ | |
| 92 90 | 
             
                      type="password"
         | 
| 93 91 | 
             
                      label={__('Password')}
         | 
| 94 92 | 
             
                      labelHelp={__('Authentication credentials')}
         | 
| 95 | 
            -
                      disabled={isPasswordDisabled}
         | 
| 96 | 
            -
                      setDisabled={setIsPasswordDisabled}
         | 
| 97 93 | 
             
                    />
         | 
| 98 94 | 
             
                    <ForemanFormikField
         | 
| 99 95 | 
             
                      name="verify_ssl"
         | 
| @@ -157,15 +153,11 @@ WebhookFormTabs.propTypes = { | |
| 157 153 | 
             
              availableEvents: PropTypes.array.isRequired,
         | 
| 158 154 | 
             
              isTemplatesLoading: PropTypes.bool.isRequired,
         | 
| 159 155 | 
             
              isEventsLoading: PropTypes.bool.isRequired,
         | 
| 160 | 
            -
              isPasswordDisabled: PropTypes.bool,
         | 
| 161 | 
            -
              setIsPasswordDisabled: PropTypes.func,
         | 
| 162 156 | 
             
            };
         | 
| 163 157 |  | 
| 164 158 | 
             
            WebhookFormTabs.defaultProps = {
         | 
| 165 159 | 
             
              disabled: false,
         | 
| 166 160 | 
             
              formProps: {},
         | 
| 167 | 
            -
              isPasswordDisabled: false,
         | 
| 168 | 
            -
              setIsPasswordDisabled: undefined,
         | 
| 169 161 | 
             
            };
         | 
| 170 162 |  | 
| 171 163 | 
             
            export default WebhookFormTabs;
         | 
| @@ -25,8 +25,6 @@ const WebhookForm = ({ | |
| 25 25 | 
             
              availableEvents,
         | 
| 26 26 | 
             
              isTemplatesLoading,
         | 
| 27 27 | 
             
              isEventsLoading,
         | 
| 28 | 
            -
              isPasswordDisabled,
         | 
| 29 | 
            -
              setIsPasswordDisabled,
         | 
| 30 28 | 
             
            }) => {
         | 
| 31 29 | 
             
              const webhookTemplates = templates.map(t => ({ value: t.id, label: t.name }));
         | 
| 32 30 |  | 
| @@ -53,8 +51,6 @@ const WebhookForm = ({ | |
| 53 51 | 
             
                    availableEvents={availableEvents}
         | 
| 54 52 | 
             
                    isEventsLoading={isEventsLoading}
         | 
| 55 53 | 
             
                    isTemplatesLoading={isTemplatesLoading}
         | 
| 56 | 
            -
                    isPasswordDisabled={isPasswordDisabled}
         | 
| 57 | 
            -
                    setIsPasswordDisabled={setIsPasswordDisabled}
         | 
| 58 54 | 
             
                  />
         | 
| 59 55 | 
             
                </ForemanForm>
         | 
| 60 56 | 
             
              );
         | 
| @@ -68,13 +64,6 @@ WebhookForm.propTypes = { | |
| 68 64 | 
             
              availableEvents: PropTypes.array.isRequired,
         | 
| 69 65 | 
             
              isEventsLoading: PropTypes.bool.isRequired,
         | 
| 70 66 | 
             
              isTemplatesLoading: PropTypes.bool.isRequired,
         | 
| 71 | 
            -
              isPasswordDisabled: PropTypes.bool,
         | 
| 72 | 
            -
              setIsPasswordDisabled: PropTypes.func,
         | 
| 73 | 
            -
            };
         | 
| 74 | 
            -
             | 
| 75 | 
            -
            WebhookForm.defaultProps = {
         | 
| 76 | 
            -
              isPasswordDisabled: false,
         | 
| 77 | 
            -
              setIsPasswordDisabled: undefined,
         | 
| 78 67 | 
             
            };
         | 
| 79 68 |  | 
| 80 69 | 
             
            export default WebhookForm;
         | 
| @@ -241,7 +241,6 @@ exports[`WebhookForm rendering should render for edit page 1`] = ` | |
| 241 241 | 
             
                  ]
         | 
| 242 242 | 
             
                }
         | 
| 243 243 | 
             
                isEventsLoading={false}
         | 
| 244 | 
            -
                isPasswordDisabled={false}
         | 
| 245 244 | 
             
                isTemplatesLoading={false}
         | 
| 246 245 | 
             
                webhookTemplates={
         | 
| 247 246 | 
             
                  Array [
         | 
| @@ -493,7 +492,6 @@ exports[`WebhookForm rendering should render for new page 1`] = ` | |
| 493 492 | 
             
                  ]
         | 
| 494 493 | 
             
                }
         | 
| 495 494 | 
             
                isEventsLoading={false}
         | 
| 496 | 
            -
                isPasswordDisabled={false}
         | 
| 497 495 | 
             
                isTemplatesLoading={false}
         | 
| 498 496 | 
             
                webhookTemplates={
         | 
| 499 497 | 
             
                  Array [
         | 
| @@ -24,13 +24,7 @@ import { | |
| 24 24 |  | 
| 25 25 | 
             
            const params = { page: 1, search: 'snippet = false', per_page: 'all' };
         | 
| 26 26 |  | 
| 27 | 
            -
            const ConnectedWebhookForm = ({
         | 
| 28 | 
            -
              onCancel,
         | 
| 29 | 
            -
              handleSubmit,
         | 
| 30 | 
            -
              initialValues,
         | 
| 31 | 
            -
              isPasswordDisabled,
         | 
| 32 | 
            -
              setIsPasswordDisabled,
         | 
| 33 | 
            -
            }) => {
         | 
| 27 | 
            +
            const ConnectedWebhookForm = ({ onCancel, handleSubmit, initialValues }) => {
         | 
| 34 28 | 
             
              const dispatch = useDispatch();
         | 
| 35 29 |  | 
| 36 30 | 
             
              const templates = useSelector(selectWebhookTemplates);
         | 
| @@ -66,8 +60,6 @@ const ConnectedWebhookForm = ({ | |
| 66 60 | 
             
                  initialValues={initialValues}
         | 
| 67 61 | 
             
                  isTemplatesLoading={isTemplatesLoading}
         | 
| 68 62 | 
             
                  isEventsLoading={isEventsLoading}
         | 
| 69 | 
            -
                  isPasswordDisabled={isPasswordDisabled}
         | 
| 70 | 
            -
                  setIsPasswordDisabled={setIsPasswordDisabled}
         | 
| 71 63 | 
             
                />
         | 
| 72 64 | 
             
              );
         | 
| 73 65 | 
             
            };
         | 
| @@ -76,13 +68,6 @@ ConnectedWebhookForm.propTypes = { | |
| 76 68 | 
             
              onCancel: PropTypes.func.isRequired,
         | 
| 77 69 | 
             
              handleSubmit: PropTypes.func.isRequired,
         | 
| 78 70 | 
             
              initialValues: PropTypes.object.isRequired,
         | 
| 79 | 
            -
              isPasswordDisabled: PropTypes.bool,
         | 
| 80 | 
            -
              setIsPasswordDisabled: PropTypes.func,
         | 
| 81 | 
            -
            };
         | 
| 82 | 
            -
             | 
| 83 | 
            -
            ConnectedWebhookForm.defaultProps = {
         | 
| 84 | 
            -
              isPasswordDisabled: false,
         | 
| 85 | 
            -
              setIsPasswordDisabled: undefined,
         | 
| 86 71 | 
             
            };
         | 
| 87 72 |  | 
| 88 73 | 
             
            export default ConnectedWebhookForm;
         | 
    
        data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookCreateModal.js
    CHANGED
    
    | @@ -1,6 +1,5 @@ | |
| 1 1 | 
             
            import React from 'react';
         | 
| 2 2 | 
             
            import PropTypes from 'prop-types';
         | 
| 3 | 
            -
            import { Modal } from 'patternfly-react';
         | 
| 4 3 | 
             
            import { useDispatch } from 'react-redux';
         | 
| 5 4 |  | 
| 6 5 | 
             
            import { translate as __ } from 'foremanReact/common/I18n';
         | 
| @@ -48,12 +47,11 @@ const WebhookCreateModal = ({ onSuccess, onCancel }) => { | |
| 48 47 | 
             
              return (
         | 
| 49 48 | 
             
                <ForemanModal
         | 
| 50 49 | 
             
                  id={WEBHOOK_CREATE_MODAL_ID}
         | 
| 50 | 
            +
                  title={__('Create Webhook')}
         | 
| 51 51 | 
             
                  backdrop="static"
         | 
| 52 52 | 
             
                  className="webhooks-modal"
         | 
| 53 53 | 
             
                >
         | 
| 54 | 
            -
                  < | 
| 55 | 
            -
                    <Modal.Title>{__('Create Webhook')}</Modal.Title>
         | 
| 56 | 
            -
                  </Modal.Header>
         | 
| 54 | 
            +
                  <ForemanModal.Header />
         | 
| 57 55 | 
             
                  <ConnectedWebhookForm
         | 
| 58 56 | 
             
                    handleSubmit={handleSubmit}
         | 
| 59 57 | 
             
                    initialValues={initialWebhookValues}
         | 
    
        data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookEditModal.js
    CHANGED
    
    | @@ -1,5 +1,4 @@ | |
| 1 | 
            -
            import React, { useEffect | 
| 2 | 
            -
            import { Modal } from 'patternfly-react';
         | 
| 1 | 
            +
            import React, { useEffect } from 'react';
         | 
| 3 2 | 
             
            import { useSelector, useDispatch } from 'react-redux';
         | 
| 4 3 | 
             
            import PropTypes from 'prop-types';
         | 
| 5 4 |  | 
| @@ -30,11 +29,22 @@ import './WebhookModal.scss'; | |
| 30 29 | 
             
            const WebhookEditModal = ({ toEdit, onSuccess, onCancel }) => {
         | 
| 31 30 | 
             
              const dispatch = useDispatch();
         | 
| 32 31 |  | 
| 33 | 
            -
              const [isPasswordDisabled, setIsPasswordDisabled] = useState(false);
         | 
| 34 32 | 
             
              const id = toEdit;
         | 
| 35 33 |  | 
| 34 | 
            +
              const handleSubmit = (values, actions) =>
         | 
| 35 | 
            +
                dispatch(
         | 
| 36 | 
            +
                  submitForm({
         | 
| 37 | 
            +
                    url: foremanUrl(`/api${WEBHOOKS_PATH}/${id}`),
         | 
| 38 | 
            +
                    values: { ...values, controller: 'webhooks' },
         | 
| 39 | 
            +
                    item: 'Webhook',
         | 
| 40 | 
            +
                    message: __('Webhook was successfully updated.'),
         | 
| 41 | 
            +
                    method: 'put',
         | 
| 42 | 
            +
                    successCallback: onSuccess,
         | 
| 43 | 
            +
                    actions,
         | 
| 44 | 
            +
                  })
         | 
| 45 | 
            +
                );
         | 
| 46 | 
            +
             | 
| 36 47 | 
             
              const isLoading = useSelector(selectIsLoading);
         | 
| 37 | 
            -
              const isPasswordSet = useSelector(selectWebhookValues).passwordSet;
         | 
| 38 48 | 
             
              const initialWebhookValues = {
         | 
| 39 49 | 
             
                id: useSelector(selectWebhookValues).id,
         | 
| 40 50 | 
             
                name: useSelector(selectWebhookValues).name,
         | 
| @@ -52,27 +62,6 @@ const WebhookEditModal = ({ toEdit, onSuccess, onCancel }) => { | |
| 52 62 | 
             
                proxy_authorization: useSelector(selectWebhookValues).proxyAuthorization,
         | 
| 53 63 | 
             
              };
         | 
| 54 64 |  | 
| 55 | 
            -
              useEffect(() => {
         | 
| 56 | 
            -
                setIsPasswordDisabled(isPasswordSet);
         | 
| 57 | 
            -
              }, [isPasswordSet]);
         | 
| 58 | 
            -
             | 
| 59 | 
            -
              const handleSubmit = (values, actions) => {
         | 
| 60 | 
            -
                if (isPasswordDisabled) {
         | 
| 61 | 
            -
                  delete values.password;
         | 
| 62 | 
            -
                }
         | 
| 63 | 
            -
                dispatch(
         | 
| 64 | 
            -
                  submitForm({
         | 
| 65 | 
            -
                    url: foremanUrl(`/api${WEBHOOKS_PATH}/${id}`),
         | 
| 66 | 
            -
                    values: { ...values, controller: 'webhooks' },
         | 
| 67 | 
            -
                    item: 'Webhook',
         | 
| 68 | 
            -
                    message: __('Webhook was successfully updated.'),
         | 
| 69 | 
            -
                    method: 'put',
         | 
| 70 | 
            -
                    successCallback: onSuccess,
         | 
| 71 | 
            -
                    actions,
         | 
| 72 | 
            -
                  })
         | 
| 73 | 
            -
                );
         | 
| 74 | 
            -
              };
         | 
| 75 | 
            -
             | 
| 76 65 | 
             
              useEffect(() => {
         | 
| 77 66 | 
             
                if (id) {
         | 
| 78 67 | 
             
                  dispatch(
         | 
| @@ -84,31 +73,21 @@ const WebhookEditModal = ({ toEdit, onSuccess, onCancel }) => { | |
| 84 73 | 
             
                }
         | 
| 85 74 | 
             
              }, [id, dispatch]);
         | 
| 86 75 |  | 
| 87 | 
            -
              const onEditCancel = () => {
         | 
| 88 | 
            -
                if (isPasswordSet) setIsPasswordDisabled(true);
         | 
| 89 | 
            -
                onCancel();
         | 
| 90 | 
            -
              };
         | 
| 91 | 
            -
             | 
| 92 76 | 
             
              return (
         | 
| 93 77 | 
             
                <ForemanModal
         | 
| 94 78 | 
             
                  id={WEBHOOK_EDIT_MODAL_ID}
         | 
| 79 | 
            +
                  title={`${__('Edit')} ${initialWebhookValues.name}`}
         | 
| 95 80 | 
             
                  backdrop="static"
         | 
| 96 81 | 
             
                  className="webhooks-modal"
         | 
| 97 82 | 
             
                >
         | 
| 98 | 
            -
                  < | 
| 99 | 
            -
                    <Modal.Title>
         | 
| 100 | 
            -
                      {`${__('Edit')} ${initialWebhookValues.name}`}
         | 
| 101 | 
            -
                    </Modal.Title>
         | 
| 102 | 
            -
                  </Modal.Header>
         | 
| 83 | 
            +
                  <ForemanModal.Header />
         | 
| 103 84 | 
             
                  {isLoading ? (
         | 
| 104 85 | 
             
                    <Loading />
         | 
| 105 86 | 
             
                  ) : (
         | 
| 106 87 | 
             
                    <ConnectedWebhookForm
         | 
| 107 88 | 
             
                      handleSubmit={handleSubmit}
         | 
| 108 89 | 
             
                      initialValues={initialWebhookValues}
         | 
| 109 | 
            -
                      onCancel={ | 
| 110 | 
            -
                      isPasswordDisabled={isPasswordDisabled}
         | 
| 111 | 
            -
                      setIsPasswordDisabled={setIsPasswordDisabled}
         | 
| 90 | 
            +
                      onCancel={onCancel}
         | 
| 112 91 | 
             
                    />
         | 
| 113 92 | 
             
                  )}
         | 
| 114 93 | 
             
                </ForemanModal>
         | 
| @@ -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 | 
             
              }),
         | 
| @@ -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 |  | 
| @@ -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 |  | 
| @@ -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 |  | 
| @@ -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 |  | 
| @@ -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);
         | 
    
        data/webpack/test_setup.js
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: foreman_webhooks
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 3.0.0
         | 
| 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:  | 
| 11 | 
            +
            date: 2021-09-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rdoc
         | 
| @@ -186,7 +186,7 @@ homepage: https://github.com/theforeman/foreman_webhooks | |
| 186 186 | 
             
            licenses:
         | 
| 187 187 | 
             
            - GPL-3.0
         | 
| 188 188 | 
             
            metadata: {}
         | 
| 189 | 
            -
            post_install_message: | 
| 189 | 
            +
            post_install_message:
         | 
| 190 190 | 
             
            rdoc_options: []
         | 
| 191 191 | 
             
            require_paths:
         | 
| 192 192 | 
             
            - lib
         | 
| @@ -201,8 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 201 201 | 
             
                - !ruby/object:Gem::Version
         | 
| 202 202 | 
             
                  version: '0'
         | 
| 203 203 | 
             
            requirements: []
         | 
| 204 | 
            -
            rubygems_version: 3.1. | 
| 205 | 
            -
            signing_key: | 
| 204 | 
            +
            rubygems_version: 3.1.4
         | 
| 205 | 
            +
            signing_key:
         | 
| 206 206 | 
             
            specification_version: 4
         | 
| 207 207 | 
             
            summary: Configure webhooks for Foreman.
         | 
| 208 208 | 
             
            test_files:
         | 
| @@ -213,14 +213,14 @@ test_files: | |
| 213 213 | 
             
            - test/factories/webhook_template.rb
         | 
| 214 214 | 
             
            - test/jobs/foreman_webhooks/deliver_webhook_job_test.rb
         | 
| 215 215 | 
             
            - test/models/webhook_test.rb
         | 
| 216 | 
            -
            - test/test_plugin_helper.rb
         | 
| 217 216 | 
             
            - test/unit/foreman_webhooks/webhook_service_test.rb
         | 
| 218 | 
            -
            -  | 
| 217 | 
            +
            - test/test_plugin_helper.rb
         | 
| 219 218 | 
             
            - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/__tests__/enabledCellFormatter.test.js
         | 
| 220 219 | 
             
            - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/__tests__/EnabledCell.test.js
         | 
| 221 220 | 
             
            - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js
         | 
| 222 | 
            -
            - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/integration.test.js
         | 
| 223 221 | 
             
            - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.fixtures.js
         | 
| 222 | 
            +
            - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/integration.test.js
         | 
| 224 223 | 
             
            - webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.test.js
         | 
| 225 224 | 
             
            - webpack/ForemanWebhooks/Routes/Webhooks/__tests__/WebhooksPageHelpers.test.js
         | 
| 226 225 | 
             
            - webpack/ForemanWebhooks/Routes/Webhooks/__tests__/WebhooksPageSelectors.test.js
         | 
| 226 | 
            +
            - webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/__tests__/WebhookForm.test.js
         |