foreman_templates 7.0.6 → 9.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/template_controller.rb +8 -2
  3. data/app/controllers/concerns/foreman/controller/parameters/template_params.rb +22 -2
  4. data/app/controllers/ui_template_syncs_controller.rb +2 -2
  5. data/app/models/setting/template_sync.rb +12 -2
  6. data/app/services/foreman_templates/export_result.rb +20 -29
  7. data/app/services/foreman_templates/template_exporter.rb +40 -32
  8. data/app/services/foreman_templates/template_importer.rb +20 -4
  9. data/app/views/template_syncs/index.html.erb +20 -19
  10. data/app/views/ui_template_syncs/template_export_result.rabl +4 -4
  11. data/db/migrate/20180627134929_change_lock_setting.rb +5 -0
  12. data/lib/foreman_templates/engine.rb +6 -0
  13. data/lib/foreman_templates/version.rb +1 -1
  14. data/package.json +15 -21
  15. data/webpack/ForemanTemplates.js +17 -13
  16. data/webpack/__mocks__/foremanReact/components/Layout/LayoutSelectors.js +4 -0
  17. data/webpack/__mocks__/foremanReact/components/common/forms/ForemanForm.js +2 -0
  18. data/webpack/components/NewTemplateSync/__fixtures__/templateSyncSettings.fixtures.js +4 -4
  19. data/webpack/components/NewTemplateSync/__tests__/__snapshots__/NewTemplateSync.test.js.snap +2 -2
  20. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncForm.js +89 -53
  21. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormSelectors.js +10 -13
  22. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/NewTemplateSyncFormSelectors.test.js +1 -19
  23. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/__snapshots__/NewTemplateSyncFormSelectors.test.js.snap +7 -36
  24. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/index.js +7 -16
  25. data/webpack/components/NewTemplateSync/components/SyncSettingField.js +5 -11
  26. data/webpack/components/NewTemplateSync/components/SyncSettingFields.js +8 -25
  27. data/webpack/components/NewTemplateSync/components/TextButtonField/index.js +27 -20
  28. data/webpack/components/NewTemplateSync/components/__tests__/SyncSettingField.test.js +2 -1
  29. data/webpack/components/NewTemplateSync/components/__tests__/SyncSettingFields.test.js +1 -0
  30. data/webpack/components/NewTemplateSync/components/__tests__/TextButtonField.test.js +4 -4
  31. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/SyncSettingField.test.js.snap +18 -27
  32. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/SyncSettingFields.test.js.snap +5 -3
  33. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/TextButtonField.test.js.snap +8 -91
  34. data/webpack/components/TemplateSyncResult/__fixtures__/templateSyncResult.fixtures.js +2 -2
  35. data/webpack/components/TemplateSyncResult/__tests__/__snapshots__/TemplateSyncResult.test.js.snap +3 -1
  36. data/webpack/components/TemplateSyncResult/__tests__/__snapshots__/TemplateSyncResultReducer.test.js.snap +3 -1
  37. data/webpack/components/TemplateSyncResult/components/SyncResultList.js +2 -2
  38. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/__snapshots__/helpers.test.js.snap +37 -0
  39. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/helpers.js +21 -11
  40. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/helpers.test.js +21 -0
  41. data/webpack/components/TemplateSyncResult/components/__tests__/__snapshots__/SyncResultList.test.js.snap +8 -6
  42. data/webpack/components/TemplateSyncResult/components/__tests__/__snapshots__/SyncedTemplate.test.js.snap +39 -15
  43. data/webpack/testSetup.js +2 -1
  44. metadata +8 -8
  45. data/webpack/__mocks__/foremanReact/components/common/forms/Form.js +0 -2
  46. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormConstants.js +0 -1
  47. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/NewTemplateSyncForm.test.js +0 -42
  48. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/__snapshots__/NewTemplateSyncForm.test.js.snap +0 -186
data/webpack/testSetup.js CHANGED
@@ -1,4 +1,5 @@
1
- import 'babel-polyfill';
1
+ import 'core-js/shim';
2
+ import 'regenerator-runtime/runtime';
2
3
 
3
4
  import { configure } from 'enzyme';
4
5
  import Adapter from 'enzyme-adapter-react-16';
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.6
4
+ version: 9.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Sutcliffe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-14 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy
@@ -88,6 +88,7 @@ files:
88
88
  - app/views/ui_template_syncs/template_import_result.json.rabl
89
89
  - app/views/ui_template_syncs/template_import_results.json.rabl
90
90
  - config/routes.rb
91
+ - db/migrate/20180627134929_change_lock_setting.rb
91
92
  - lib/foreman_templates.rb
92
93
  - lib/foreman_templates/engine.rb
93
94
  - lib/foreman_templates/version.rb
@@ -96,9 +97,10 @@ files:
96
97
  - webpack/ForemanTemplates.js
97
98
  - webpack/Routes.js
98
99
  - webpack/__mocks__/foremanReact/common/helpers.js
100
+ - webpack/__mocks__/foremanReact/components/Layout/LayoutSelectors.js
99
101
  - webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js
100
102
  - webpack/__mocks__/foremanReact/components/common/forms/CommonForm.js
101
- - webpack/__mocks__/foremanReact/components/common/forms/Form.js
103
+ - webpack/__mocks__/foremanReact/components/common/forms/ForemanForm.js
102
104
  - webpack/__mocks__/foremanReact/components/common/forms/TextField.js
103
105
  - webpack/__mocks__/foremanReact/redux/actions/common/forms.js
104
106
  - webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
@@ -118,11 +120,8 @@ files:
118
120
  - webpack/components/NewTemplateSync/__tests__/__snapshots__/NewTemplateSyncSelectors.test.js.snap
119
121
  - webpack/components/NewTemplateSync/components/ButtonTooltip.js
120
122
  - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncForm.js
121
- - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormConstants.js
122
123
  - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormSelectors.js
123
- - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/NewTemplateSyncForm.test.js
124
124
  - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/NewTemplateSyncFormSelectors.test.js
125
- - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/__snapshots__/NewTemplateSyncForm.test.js.snap
126
125
  - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/__snapshots__/NewTemplateSyncFormSelectors.test.js.snap
127
126
  - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/index.js
128
127
  - webpack/components/NewTemplateSync/components/SyncSettingField.js
@@ -166,7 +165,9 @@ files:
166
165
  - webpack/components/TemplateSyncResult/components/SyncedTemplate/InfoItem.js
167
166
  - webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
168
167
  - webpack/components/TemplateSyncResult/components/SyncedTemplate/StringInfoItem.js
168
+ - webpack/components/TemplateSyncResult/components/SyncedTemplate/__snapshots__/helpers.test.js.snap
169
169
  - webpack/components/TemplateSyncResult/components/SyncedTemplate/helpers.js
170
+ - webpack/components/TemplateSyncResult/components/SyncedTemplate/helpers.test.js
170
171
  - webpack/components/TemplateSyncResult/components/SyncedTemplate/index.js
171
172
  - webpack/components/TemplateSyncResult/components/__tests__/SyncResultList.test.js
172
173
  - webpack/components/TemplateSyncResult/components/__tests__/SyncedTemplate.test.js
@@ -197,8 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
198
  - !ruby/object:Gem::Version
198
199
  version: '0'
199
200
  requirements: []
200
- rubyforge_project:
201
- rubygems_version: 2.7.6.2
201
+ rubygems_version: 3.1.2
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: Template-syncing engine for Foreman
@@ -1,2 +0,0 @@
1
- const Form = () => jest.fn();
2
- export default Form;
@@ -1 +0,0 @@
1
- export const NEW_TEMPLATE_SYNC_FORM_NAME = 'newTemplateSync';
@@ -1,42 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
-
3
- import NewTemplateSyncForm from '../NewTemplateSyncForm';
4
-
5
- import {
6
- importSettings,
7
- exportSettings,
8
- } from '../../../__fixtures__/templateSyncSettings.fixtures';
9
-
10
- const noop = () => {};
11
-
12
- const commonFixture = {
13
- importUrl: '/import',
14
- exportUrl: '/export',
15
- validationData: {},
16
- userPermissions: {
17
- import: true,
18
- export: true,
19
- },
20
- handleSubmit: noop,
21
- valid: true,
22
- importSettings,
23
- exportSettings,
24
- };
25
-
26
- const fixtures = {
27
- 'should render when for import settings': {
28
- loadingSettings: false,
29
- ...commonFixture,
30
- },
31
- 'should render for export settings': {
32
- loadingSettings: true,
33
- ...commonFixture,
34
- userPermissions: {
35
- import: false,
36
- export: true,
37
- },
38
- },
39
- };
40
-
41
- describe('NewTemplateSyncForm', () =>
42
- testComponentSnapshotsWithFixtures(NewTemplateSyncForm, fixtures));
@@ -1,186 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`NewTemplateSyncForm should render for export settings 1`] = `
4
- <Form
5
- disabled={false}
6
- errorTitle="Warning! "
7
- onCancel={[Function]}
8
- submitting={false}
9
- >
10
- <SyncTypeRadios
11
- controlLabel="Action type"
12
- disabled={false}
13
- name="syncType"
14
- radios={
15
- Array [
16
- Object {
17
- "checked": true,
18
- "label": "Export",
19
- "onChange": [Function],
20
- "permission": "export",
21
- "value": "export",
22
- },
23
- ]
24
- }
25
- />
26
- <SyncSettingsFields
27
- disabled={false}
28
- exportSettings={
29
- Array [
30
- Object {
31
- "description": "Import or export names matching this regex (case-insensitive; snippets are not filtered)",
32
- "id": 47,
33
- "name": "filter",
34
- "settingsType": "string",
35
- "value": "",
36
- },
37
- Object {
38
- "description": "Negate the filter for import/export",
39
- "id": 48,
40
- "name": "negate",
41
- "settingsType": "bool",
42
- "value": false,
43
- },
44
- Object {
45
- "description": "Target path to import and export. Different protocols can be used, for example /tmp/dir, git://example.com, https://example.com, ssh://example.com. When exporting to /tmp, note that production deployments may be configured to use private tmp.",
46
- "id": 49,
47
- "name": "repo",
48
- "settingsType": "string",
49
- "value": "https://github.com/theforeman/community-templates.git",
50
- },
51
- ]
52
- }
53
- importSettings={
54
- Array [
55
- Object {
56
- "description": "Associate templates to OS, organization and location",
57
- "id": 45,
58
- "name": "associate",
59
- "selection": Array [
60
- Object {
61
- "label": "New",
62
- "value": "new",
63
- },
64
- Object {
65
- "label": "Never",
66
- "value": "never",
67
- },
68
- Object {
69
- "label": "Always",
70
- "value": "always",
71
- },
72
- ],
73
- "settingsType": "string",
74
- "value": "new",
75
- },
76
- Object {
77
- "description": "Should importing overwrite locked templates?",
78
- "id": 46,
79
- "name": "force",
80
- "settingsType": "bool",
81
- "value": false,
82
- },
83
- ]
84
- }
85
- resetField={[Function]}
86
- syncType="export"
87
- validationData={Object {}}
88
- />
89
- </Form>
90
- `;
91
-
92
- exports[`NewTemplateSyncForm should render when for import settings 1`] = `
93
- <Form
94
- disabled={false}
95
- errorTitle="Warning! "
96
- onCancel={[Function]}
97
- submitting={false}
98
- >
99
- <SyncTypeRadios
100
- controlLabel="Action type"
101
- disabled={false}
102
- name="syncType"
103
- radios={
104
- Array [
105
- Object {
106
- "checked": true,
107
- "label": "Import",
108
- "onChange": [Function],
109
- "permission": "import",
110
- "value": "import",
111
- },
112
- Object {
113
- "checked": false,
114
- "label": "Export",
115
- "onChange": [Function],
116
- "permission": "export",
117
- "value": "export",
118
- },
119
- ]
120
- }
121
- />
122
- <SyncSettingsFields
123
- disabled={false}
124
- exportSettings={
125
- Array [
126
- Object {
127
- "description": "Import or export names matching this regex (case-insensitive; snippets are not filtered)",
128
- "id": 47,
129
- "name": "filter",
130
- "settingsType": "string",
131
- "value": "",
132
- },
133
- Object {
134
- "description": "Negate the filter for import/export",
135
- "id": 48,
136
- "name": "negate",
137
- "settingsType": "bool",
138
- "value": false,
139
- },
140
- Object {
141
- "description": "Target path to import and export. Different protocols can be used, for example /tmp/dir, git://example.com, https://example.com, ssh://example.com. When exporting to /tmp, note that production deployments may be configured to use private tmp.",
142
- "id": 49,
143
- "name": "repo",
144
- "settingsType": "string",
145
- "value": "https://github.com/theforeman/community-templates.git",
146
- },
147
- ]
148
- }
149
- importSettings={
150
- Array [
151
- Object {
152
- "description": "Associate templates to OS, organization and location",
153
- "id": 45,
154
- "name": "associate",
155
- "selection": Array [
156
- Object {
157
- "label": "New",
158
- "value": "new",
159
- },
160
- Object {
161
- "label": "Never",
162
- "value": "never",
163
- },
164
- Object {
165
- "label": "Always",
166
- "value": "always",
167
- },
168
- ],
169
- "settingsType": "string",
170
- "value": "new",
171
- },
172
- Object {
173
- "description": "Should importing overwrite locked templates?",
174
- "id": 46,
175
- "name": "force",
176
- "settingsType": "bool",
177
- "value": false,
178
- },
179
- ]
180
- }
181
- resetField={[Function]}
182
- syncType="import"
183
- validationData={Object {}}
184
- />
185
- </Form>
186
- `;