foreman_templates 10.0.2 → 10.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_templates/locale/cs_CZ/foreman_templates.js +35 -5
  3. data/app/assets/javascripts/foreman_templates/locale/de/foreman_templates.js +35 -5
  4. data/app/assets/javascripts/foreman_templates/locale/en_GB/foreman_templates.js +34 -4
  5. data/app/assets/javascripts/foreman_templates/locale/es/foreman_templates.js +35 -5
  6. data/app/assets/javascripts/foreman_templates/locale/fr/foreman_templates.js +35 -5
  7. data/app/assets/javascripts/foreman_templates/locale/gl/foreman_templates.js +34 -4
  8. data/app/assets/javascripts/foreman_templates/locale/it/foreman_templates.js +35 -5
  9. data/app/assets/javascripts/foreman_templates/locale/ja/foreman_templates.js +35 -5
  10. data/app/assets/javascripts/foreman_templates/locale/ka/foreman_templates.js +35 -5
  11. data/app/assets/javascripts/foreman_templates/locale/ko/foreman_templates.js +79 -49
  12. data/app/assets/javascripts/foreman_templates/locale/pt_BR/foreman_templates.js +35 -5
  13. data/app/assets/javascripts/foreman_templates/locale/ru/foreman_templates.js +35 -5
  14. data/app/assets/javascripts/foreman_templates/locale/sv_SE/foreman_templates.js +34 -4
  15. data/app/assets/javascripts/foreman_templates/locale/zh_CN/foreman_templates.js +35 -5
  16. data/app/assets/javascripts/foreman_templates/locale/zh_TW/foreman_templates.js +35 -5
  17. data/app/controllers/api/v2/template_controller.rb +4 -1
  18. data/app/controllers/concerns/foreman/controller/parameters/template_params.rb +1 -1
  19. data/app/controllers/ui_template_syncs_controller.rb +21 -1
  20. data/app/services/foreman_templates/action.rb +32 -1
  21. data/app/services/foreman_templates/template_exporter.rb +2 -2
  22. data/app/services/foreman_templates/template_importer.rb +3 -3
  23. data/lib/foreman_templates/engine.rb +6 -0
  24. data/lib/foreman_templates/version.rb +1 -1
  25. data/lib/foreman_templates.rb +4 -0
  26. data/locale/cs_CZ/LC_MESSAGES/foreman_templates.mo +0 -0
  27. data/locale/cs_CZ/foreman_templates.po +38 -6
  28. data/locale/de/LC_MESSAGES/foreman_templates.mo +0 -0
  29. data/locale/de/foreman_templates.po +38 -6
  30. data/locale/en_GB/LC_MESSAGES/foreman_templates.mo +0 -0
  31. data/locale/en_GB/foreman_templates.po +36 -4
  32. data/locale/es/LC_MESSAGES/foreman_templates.mo +0 -0
  33. data/locale/es/foreman_templates.po +38 -6
  34. data/locale/fr/LC_MESSAGES/foreman_templates.mo +0 -0
  35. data/locale/fr/foreman_templates.po +38 -7
  36. data/locale/gl/LC_MESSAGES/foreman_templates.mo +0 -0
  37. data/locale/gl/foreman_templates.po +36 -4
  38. data/locale/it/LC_MESSAGES/foreman_templates.mo +0 -0
  39. data/locale/it/foreman_templates.po +38 -6
  40. data/locale/ja/LC_MESSAGES/foreman_templates.mo +0 -0
  41. data/locale/ja/foreman_templates.po +38 -6
  42. data/locale/ka/LC_MESSAGES/foreman_templates.mo +0 -0
  43. data/locale/ka/foreman_templates.po +38 -6
  44. data/locale/ko/LC_MESSAGES/foreman_templates.mo +0 -0
  45. data/locale/ko/foreman_templates.po +83 -50
  46. data/locale/pt_BR/LC_MESSAGES/foreman_templates.mo +0 -0
  47. data/locale/pt_BR/foreman_templates.po +38 -6
  48. data/locale/ru/LC_MESSAGES/foreman_templates.mo +0 -0
  49. data/locale/ru/foreman_templates.po +38 -6
  50. data/locale/sv_SE/LC_MESSAGES/foreman_templates.mo +0 -0
  51. data/locale/sv_SE/foreman_templates.po +36 -4
  52. data/locale/zh_CN/LC_MESSAGES/foreman_templates.mo +0 -0
  53. data/locale/zh_CN/foreman_templates.po +38 -7
  54. data/locale/zh_TW/LC_MESSAGES/foreman_templates.mo +0 -0
  55. data/locale/zh_TW/foreman_templates.po +38 -6
  56. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormHelpers.js +15 -3
  57. data/webpack/components/NewTemplateSync/components/ProxySettingField.js +44 -0
  58. data/webpack/components/NewTemplateSync/components/ProxySettingFields.js +86 -0
  59. data/webpack/components/NewTemplateSync/components/SyncSettingField.js +5 -12
  60. data/webpack/components/NewTemplateSync/components/SyncSettingFields.js +18 -0
  61. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/SyncSettingField.test.js.snap +3 -3
  62. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/SyncSettingFields.test.js.snap +14 -0
  63. metadata +5 -3
@@ -8,7 +8,7 @@
8
8
  #
9
9
  msgid ""
10
10
  msgstr ""
11
- "Project-Id-Version: foreman_templates 10.0.1\n"
11
+ "Project-Id-Version: foreman_templates 10.0.3\n"
12
12
  "Report-Msgid-Bugs-To: \n"
13
13
  "PO-Revision-Date: 2019-10-14 12:27+0000\n"
14
14
  "Last-Translator: johnny.westerlund <johnny.westerlund@gmail.com>, 2023\n"
@@ -50,6 +50,9 @@ msgstr ""
50
50
  msgid "Commit message"
51
51
  msgstr ""
52
52
 
53
+ msgid "Custom HTTP proxy"
54
+ msgstr ""
55
+
53
56
  msgid "Custom commit message for templates export"
54
57
  msgstr ""
55
58
 
@@ -59,6 +62,9 @@ msgstr ""
59
62
  msgid "Default metadata export mode, refresh re-renders metadata, keep will keep existing metadata, remove exports template without metadata"
60
63
  msgstr ""
61
64
 
65
+ msgid "Directory within Git repo containing the templates."
66
+ msgstr ""
67
+
62
68
  msgid "Dirname"
63
69
  msgstr ""
64
70
 
@@ -74,9 +80,26 @@ msgstr "Filter"
74
80
  msgid "Force import"
75
81
  msgstr ""
76
82
 
83
+ msgid "Global default HTTP proxy"
84
+ msgstr ""
85
+
86
+ msgid "HTTP proxy"
87
+ msgstr ""
88
+
89
+ msgid "HTTP proxy policy"
90
+ msgstr ""
91
+
92
+ msgid ""
93
+ "HTTP proxy policy for template sync. \\\n"
94
+ " Use only when synchronizing templates through the HTTP or the HTTPS protocol. If you choose 'selected', provide the `http_proxy_id` parameter."
95
+ msgstr ""
96
+
77
97
  msgid "How to handle lock for imported templates?"
78
98
  msgstr ""
79
99
 
100
+ msgid "ID of an HTTP proxy to use for template sync. Use this parameter together with `'http_proxy_policy':'selected'`"
101
+ msgstr ""
102
+
80
103
  msgid "Import"
81
104
  msgstr "Importera"
82
105
 
@@ -92,6 +115,9 @@ msgstr ""
92
115
  msgid "Initiate Import"
93
116
  msgstr ""
94
117
 
118
+ msgid "Invalid repo format, must start with one of: "
119
+ msgstr ""
120
+
95
121
  msgid "Keep"
96
122
  msgstr ""
97
123
 
@@ -128,6 +154,9 @@ msgstr ""
128
154
  msgid "New"
129
155
  msgstr "Ny"
130
156
 
157
+ msgid "No HTTP proxy"
158
+ msgstr ""
159
+
131
160
  msgid "Override the default repo from settings."
132
161
  msgstr ""
133
162
 
@@ -155,6 +184,12 @@ msgstr ""
155
184
  msgid "Repo"
156
185
  msgstr ""
157
186
 
187
+ msgid "Select an HTTP proxy to use for template sync. You can add HTTP proxies on the Infrastructure > HTTP proxies page."
188
+ msgstr ""
189
+
190
+ msgid "Should an HTTP proxy be used for template sync? If you select Custom HTTP proxy, you will be prompted to select one."
191
+ msgstr ""
192
+
158
193
  msgid "Should importing overwrite locked templates?"
159
194
  msgstr ""
160
195
 
@@ -173,9 +208,6 @@ msgstr ""
173
208
  msgid "Template Sync"
174
209
  msgstr ""
175
210
 
176
- msgid "The directory within Git repo containing the templates"
177
- msgstr ""
178
-
179
211
  msgid "The directory within the Git repo containing the templates"
180
212
  msgstr ""
181
213
 
@@ -6,16 +6,15 @@
6
6
  # Translators:
7
7
  # Martin Liu <liuzh66@gmail.com>, 2019
8
8
  # Bryan Kearney <bryan.kearney@gmail.com>, 2023
9
- # Amit Upadhye <aupadhye@redhat.com>, 2023
10
9
  # Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2024
10
+ # Amit Upadhye <aupadhye@redhat.com>, 2024
11
11
  #
12
12
  msgid ""
13
13
  msgstr ""
14
- "Project-Id-Version: foreman_templates 10.0.1\n"
14
+ "Project-Id-Version: foreman_templates 10.0.3\n"
15
15
  "Report-Msgid-Bugs-To: \n"
16
16
  "PO-Revision-Date: 2019-10-14 12:27+0000\n"
17
- "Last-Translator: Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarde"
18
- "n.nl>, 2024\n"
17
+ "Last-Translator: Amit Upadhye <aupadhye@redhat.com>, 2024\n"
19
18
  "Language-Team: Chinese (China) (https://app.transifex.com/foreman/teams/114/zh"
20
19
  "_CN/)\n"
21
20
  "MIME-Version: 1.0\n"
@@ -54,6 +53,9 @@ msgstr "为 Rake 任务导入模板选择详细程度"
54
53
  msgid "Commit message"
55
54
  msgstr "提交消息"
56
55
 
56
+ msgid "Custom HTTP proxy"
57
+ msgstr ""
58
+
57
59
  msgid "Custom commit message for templates export"
58
60
  msgstr "模板导出的自定义提交消息"
59
61
 
@@ -63,6 +65,9 @@ msgstr "Git 仓库中的默认分支"
63
65
  msgid "Default metadata export mode, refresh re-renders metadata, keep will keep existing metadata, remove exports template without metadata"
64
66
  msgstr "默认元数据导出模式,刷新后重新渲染元数据,保留将保留现有元数据,删除不包含元数据的导出模板"
65
67
 
68
+ msgid "Directory within Git repo containing the templates."
69
+ msgstr ""
70
+
66
71
  msgid "Dirname"
67
72
  msgstr "Dirname"
68
73
 
@@ -78,9 +83,26 @@ msgstr "过滤器"
78
83
  msgid "Force import"
79
84
  msgstr "强制导入"
80
85
 
86
+ msgid "Global default HTTP proxy"
87
+ msgstr ""
88
+
89
+ msgid "HTTP proxy"
90
+ msgstr "HTTP 代理"
91
+
92
+ msgid "HTTP proxy policy"
93
+ msgstr ""
94
+
95
+ msgid ""
96
+ "HTTP proxy policy for template sync. \\\n"
97
+ " Use only when synchronizing templates through the HTTP or the HTTPS protocol. If you choose 'selected', provide the `http_proxy_id` parameter."
98
+ msgstr ""
99
+
81
100
  msgid "How to handle lock for imported templates?"
82
101
  msgstr "如何处理导入的模板锁定?"
83
102
 
103
+ msgid "ID of an HTTP proxy to use for template sync. Use this parameter together with `'http_proxy_policy':'selected'`"
104
+ msgstr ""
105
+
84
106
  msgid "Import"
85
107
  msgstr "导入"
86
108
 
@@ -96,6 +118,9 @@ msgstr "启动导出"
96
118
  msgid "Initiate Import"
97
119
  msgstr "启动导入"
98
120
 
121
+ msgid "Invalid repo format, must start with one of: "
122
+ msgstr ""
123
+
99
124
  msgid "Keep"
100
125
  msgstr "保持"
101
126
 
@@ -132,6 +157,9 @@ msgstr "决不"
132
157
  msgid "New"
133
158
  msgstr "新"
134
159
 
160
+ msgid "No HTTP proxy"
161
+ msgstr ""
162
+
135
163
  msgid "Override the default repo from settings."
136
164
  msgstr "覆盖设置中的默认仓库。"
137
165
 
@@ -159,6 +187,12 @@ msgstr "移除"
159
187
  msgid "Repo"
160
188
  msgstr "仓库"
161
189
 
190
+ msgid "Select an HTTP proxy to use for template sync. You can add HTTP proxies on the Infrastructure > HTTP proxies page."
191
+ msgstr ""
192
+
193
+ msgid "Should an HTTP proxy be used for template sync? If you select Custom HTTP proxy, you will be prompted to select one."
194
+ msgstr ""
195
+
162
196
  msgid "Should importing overwrite locked templates?"
163
197
  msgstr "是否应该导入覆盖锁定的模板?"
164
198
 
@@ -177,9 +211,6 @@ msgstr "要导入/导出的目标路径。可以使用不同的协议,如 /tmp
177
211
  msgid "Template Sync"
178
212
  msgstr "模板同步"
179
213
 
180
- msgid "The directory within Git repo containing the templates"
181
- msgstr "Git 仓库中包含模板的目录"
182
-
183
214
  msgid "The directory within the Git repo containing the templates"
184
215
  msgstr "Git 仓库中包含模板的目录"
185
216
 
@@ -5,14 +5,14 @@
5
5
  #
6
6
  # Translators:
7
7
  # 0868a4d1af5275b3f70b0a6dac4c99a4, 2019
8
- # Bryan Kearney <bryan.kearney@gmail.com>, 2023
8
+ # Bryan Kearney <bryan.kearney@gmail.com>, 2024
9
9
  #
10
10
  msgid ""
11
11
  msgstr ""
12
- "Project-Id-Version: foreman_templates 10.0.1\n"
12
+ "Project-Id-Version: foreman_templates 10.0.3\n"
13
13
  "Report-Msgid-Bugs-To: \n"
14
14
  "PO-Revision-Date: 2019-10-14 12:27+0000\n"
15
- "Last-Translator: Bryan Kearney <bryan.kearney@gmail.com>, 2023\n"
15
+ "Last-Translator: Bryan Kearney <bryan.kearney@gmail.com>, 2024\n"
16
16
  "Language-Team: Chinese (Taiwan) (https://app.transifex.com/foreman/teams/114/z"
17
17
  "h_TW/)\n"
18
18
  "MIME-Version: 1.0\n"
@@ -51,6 +51,9 @@ msgstr ""
51
51
  msgid "Commit message"
52
52
  msgstr ""
53
53
 
54
+ msgid "Custom HTTP proxy"
55
+ msgstr ""
56
+
54
57
  msgid "Custom commit message for templates export"
55
58
  msgstr ""
56
59
 
@@ -60,6 +63,9 @@ msgstr ""
60
63
  msgid "Default metadata export mode, refresh re-renders metadata, keep will keep existing metadata, remove exports template without metadata"
61
64
  msgstr ""
62
65
 
66
+ msgid "Directory within Git repo containing the templates."
67
+ msgstr ""
68
+
63
69
  msgid "Dirname"
64
70
  msgstr ""
65
71
 
@@ -75,9 +81,26 @@ msgstr "篩選器"
75
81
  msgid "Force import"
76
82
  msgstr ""
77
83
 
84
+ msgid "Global default HTTP proxy"
85
+ msgstr ""
86
+
87
+ msgid "HTTP proxy"
88
+ msgstr "HTTP 代理"
89
+
90
+ msgid "HTTP proxy policy"
91
+ msgstr ""
92
+
93
+ msgid ""
94
+ "HTTP proxy policy for template sync. \\\n"
95
+ " Use only when synchronizing templates through the HTTP or the HTTPS protocol. If you choose 'selected', provide the `http_proxy_id` parameter."
96
+ msgstr ""
97
+
78
98
  msgid "How to handle lock for imported templates?"
79
99
  msgstr ""
80
100
 
101
+ msgid "ID of an HTTP proxy to use for template sync. Use this parameter together with `'http_proxy_policy':'selected'`"
102
+ msgstr ""
103
+
81
104
  msgid "Import"
82
105
  msgstr "匯入"
83
106
 
@@ -93,6 +116,9 @@ msgstr ""
93
116
  msgid "Initiate Import"
94
117
  msgstr ""
95
118
 
119
+ msgid "Invalid repo format, must start with one of: "
120
+ msgstr ""
121
+
96
122
  msgid "Keep"
97
123
  msgstr ""
98
124
 
@@ -129,6 +155,9 @@ msgstr "永不"
129
155
  msgid "New"
130
156
  msgstr "新增"
131
157
 
158
+ msgid "No HTTP proxy"
159
+ msgstr ""
160
+
132
161
  msgid "Override the default repo from settings."
133
162
  msgstr ""
134
163
 
@@ -156,6 +185,12 @@ msgstr "移除"
156
185
  msgid "Repo"
157
186
  msgstr "軟體庫"
158
187
 
188
+ msgid "Select an HTTP proxy to use for template sync. You can add HTTP proxies on the Infrastructure > HTTP proxies page."
189
+ msgstr ""
190
+
191
+ msgid "Should an HTTP proxy be used for template sync? If you select Custom HTTP proxy, you will be prompted to select one."
192
+ msgstr ""
193
+
159
194
  msgid "Should importing overwrite locked templates?"
160
195
  msgstr ""
161
196
 
@@ -174,9 +209,6 @@ msgstr ""
174
209
  msgid "Template Sync"
175
210
  msgstr ""
176
211
 
177
- msgid "The directory within Git repo containing the templates"
178
- msgstr ""
179
-
180
212
  msgid "The directory within the Git repo containing the templates"
181
213
  msgstr ""
182
214
 
@@ -1,4 +1,6 @@
1
1
  import * as Yup from 'yup';
2
+ import React from 'react';
3
+ import { translate as __ } from 'foremanReact/common/I18n';
2
4
 
3
5
  export const redirectToResult = history => () =>
4
6
  history.push({ pathname: '/template_syncs/result' });
@@ -24,9 +26,9 @@ export const syncFormSchema = (syncType, settingsObj, validationData) => {
24
26
  repo: Yup.string()
25
27
  .test(
26
28
  'repo-format',
27
- `Invalid repo format, must start with one of: ${validationData.repo.join(
28
- ', '
29
- )}`,
29
+ `${__(
30
+ 'Invalid repo format, must start with one of: '
31
+ )}${validationData.repo.join(', ')}`,
30
32
  repoFormat(validationData.repo)
31
33
  )
32
34
  .required("can't be blank"),
@@ -41,3 +43,13 @@ export const syncFormSchema = (syncType, settingsObj, validationData) => {
41
43
  [syncType]: Yup.object().shape(schema),
42
44
  });
43
45
  };
46
+
47
+ export const tooltipContent = setting => (
48
+ <div
49
+ dangerouslySetInnerHTML={{
50
+ __html: __(setting.description),
51
+ }}
52
+ />
53
+ );
54
+
55
+ export const label = setting => `${__(setting.fullName)}`;
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { get } from 'lodash';
4
+
5
+ import { FieldLevelHelp } from 'patternfly-react';
6
+ import RenderField from './TextButtonField/RenderField';
7
+ import ButtonTooltip from './ButtonTooltip';
8
+
9
+ import {
10
+ tooltipContent,
11
+ label,
12
+ } from './NewTemplateSyncForm/NewTemplateSyncFormHelpers';
13
+
14
+ const ProxySettingField = ({ setting, resetField, field, form, fieldName }) => (
15
+ <RenderField
16
+ label={label(setting)}
17
+ fieldSelector={_ => 'select'}
18
+ tooltipHelp={<FieldLevelHelp content={tooltipContent(setting)} />}
19
+ buttonAttrs={{
20
+ buttonText: <ButtonTooltip tooltipId={fieldName} />,
21
+ buttonAction: () =>
22
+ resetField(fieldName, setting.value)(form.setFieldValue),
23
+ }}
24
+ blank={{}}
25
+ item={setting}
26
+ disabled={false}
27
+ fieldRequired
28
+ meta={{
29
+ touched: get(form.touched, fieldName),
30
+ error: get(form.errors, fieldName),
31
+ }}
32
+ input={field}
33
+ />
34
+ );
35
+
36
+ ProxySettingField.propTypes = {
37
+ setting: PropTypes.object.isRequired,
38
+ resetField: PropTypes.func.isRequired,
39
+ field: PropTypes.object.isRequired,
40
+ form: PropTypes.object.isRequired,
41
+ fieldName: PropTypes.string.isRequired,
42
+ };
43
+
44
+ export default ProxySettingField;
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Field as FormikField } from 'formik';
4
+
5
+ import ProxySettingField from './ProxySettingField';
6
+
7
+ const ProxySettingsFields = ({
8
+ proxyPolicySetting,
9
+ proxyIdSetting,
10
+ syncType,
11
+ resetField,
12
+ formProps: { isSubmitting },
13
+ }) => {
14
+ if (Object.keys(proxyPolicySetting).length === 0) {
15
+ return <></>;
16
+ }
17
+ const proxyPolicyFieldName = `${syncType}.http_proxy_policy`;
18
+ const proxyIdFieldName = `${syncType}.http_proxy_id`;
19
+
20
+ // removes the custom proxy option if no proxy is available
21
+ if (proxyIdSetting.value === '') {
22
+ proxyPolicySetting = proxyPolicySetting.set(
23
+ 'selection',
24
+ proxyPolicySetting.selection.slice(0, 2)
25
+ );
26
+ }
27
+
28
+ return (
29
+ <React.Fragment>
30
+ <FormikField
31
+ name={proxyPolicyFieldName}
32
+ render={({ field, form }) => {
33
+ if (form.values[syncType]?.repo?.match(/^https?:\/\//))
34
+ return (
35
+ <ProxySettingField
36
+ setting={proxyPolicySetting}
37
+ resetField={resetField}
38
+ field={field}
39
+ form={form}
40
+ fieldName={proxyPolicyFieldName}
41
+ />
42
+ );
43
+ return <></>;
44
+ }}
45
+ />
46
+ <FormikField
47
+ name={proxyIdFieldName}
48
+ render={({ field, form }) => {
49
+ if (
50
+ proxyIdSetting.value !== '' &&
51
+ // Changing name to camel case here would unnecessarily complicate the code
52
+ // eslint-disable-next-line camelcase
53
+ form.values[syncType]?.http_proxy_policy === 'selected'
54
+ ) {
55
+ return (
56
+ <ProxySettingField
57
+ setting={proxyIdSetting}
58
+ resetField={resetField}
59
+ field={field}
60
+ form={form}
61
+ fieldName={proxyIdFieldName}
62
+ />
63
+ );
64
+ }
65
+ return <></>;
66
+ }}
67
+ />
68
+ </React.Fragment>
69
+ );
70
+ };
71
+
72
+ ProxySettingsFields.propTypes = {
73
+ proxyPolicySetting: PropTypes.object,
74
+ proxyIdSetting: PropTypes.object,
75
+ syncType: PropTypes.string.isRequired,
76
+ resetField: PropTypes.func.isRequired,
77
+ formProps: PropTypes.object,
78
+ };
79
+
80
+ ProxySettingsFields.defaultProps = {
81
+ formProps: {},
82
+ proxyPolicySetting: {},
83
+ proxyIdSetting: {},
84
+ };
85
+
86
+ export default ProxySettingsFields;
@@ -1,14 +1,15 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { FieldLevelHelp } from 'patternfly-react';
4
- import { translate as __ } from 'foremanReact/common/I18n';
5
4
 
5
+ import {
6
+ tooltipContent,
7
+ label,
8
+ } from './NewTemplateSyncForm/NewTemplateSyncFormHelpers';
6
9
  import TextButtonField from './TextButtonField';
7
10
  import ButtonTooltip from './ButtonTooltip';
8
11
 
9
12
  const SyncSettingField = ({ setting, resetField, disabled, syncType }) => {
10
- const label = settingObj => `${__(settingObj.fullName)} `;
11
-
12
13
  const fieldSelector = settingObj => {
13
14
  if (settingObj.settingsType === 'boolean') {
14
15
  return 'checkbox';
@@ -21,14 +22,6 @@ const SyncSettingField = ({ setting, resetField, disabled, syncType }) => {
21
22
  return 'text';
22
23
  };
23
24
 
24
- const tooltipContent = (
25
- <div
26
- dangerouslySetInnerHTML={{
27
- __html: __(setting.description),
28
- }}
29
- />
30
- );
31
-
32
25
  return (
33
26
  <TextButtonField
34
27
  name={`${syncType}.${setting.name}`}
@@ -40,7 +33,7 @@ const SyncSettingField = ({ setting, resetField, disabled, syncType }) => {
40
33
  fieldSelector={fieldSelector}
41
34
  disabled={disabled}
42
35
  fieldRequired={setting.required}
43
- tooltipHelp={<FieldLevelHelp content={tooltipContent} />}
36
+ tooltipHelp={<FieldLevelHelp content={tooltipContent(setting)} />}
44
37
  >
45
38
  {setting.value}
46
39
  </TextButtonField>
@@ -3,6 +3,7 @@ import { upperFirst } from 'lodash';
3
3
  import PropTypes from 'prop-types';
4
4
 
5
5
  import SyncSettingField from './SyncSettingField';
6
+ import ProxySettingsFields from './ProxySettingFields';
6
7
 
7
8
  const SyncSettingsFields = ({
8
9
  importSettings,
@@ -38,10 +39,21 @@ const SyncSettingsFields = ({
38
39
  );
39
40
 
40
41
  const settingsAry = syncType === 'import' ? importSettings : exportSettings;
42
+ const proxyPolicySetting = settingsAry.find(
43
+ setting => setting.id === 'template_sync_http_proxy_policy'
44
+ );
45
+ const proxyIdSetting = settingsAry.find(
46
+ setting => setting.id === 'template_sync_http_proxy_id'
47
+ );
41
48
 
42
49
  return (
43
50
  <React.Fragment>
44
51
  {settingsAry
52
+ .filter(
53
+ setting =>
54
+ setting.id !== 'template_sync_http_proxy_policy' &&
55
+ setting.id !== 'template_sync_http_proxy_id'
56
+ )
45
57
  .map(addRequiredToSetting)
46
58
  .map(setting => modifyDescription(setting, syncType))
47
59
  .map(setting => specializeDescription(setting, syncType))
@@ -54,6 +66,12 @@ const SyncSettingsFields = ({
54
66
  resetField={resetField}
55
67
  />
56
68
  ))}
69
+ <ProxySettingsFields
70
+ proxyPolicySetting={proxyPolicySetting}
71
+ proxyIdSetting={proxyIdSetting}
72
+ syncType={syncType}
73
+ resetField={resetField}
74
+ />
57
75
  </React.Fragment>
58
76
  );
59
77
  };
@@ -23,7 +23,7 @@ exports[`SyncSettingField should render boolean setting as checkbox 1`] = `
23
23
  "value": false,
24
24
  }
25
25
  }
26
- label="undefined "
26
+ label="undefined"
27
27
  name="import.force"
28
28
  tooltipHelp={
29
29
  <FieldLevelHelp
@@ -67,7 +67,7 @@ exports[`SyncSettingField should render setting with input field 1`] = `
67
67
  "value": "",
68
68
  }
69
69
  }
70
- label="undefined "
70
+ label="undefined"
71
71
  name="import.filter"
72
72
  tooltipHelp={
73
73
  <FieldLevelHelp
@@ -125,7 +125,7 @@ exports[`SyncSettingField should render setting with select choices 1`] = `
125
125
  "value": "new",
126
126
  }
127
127
  }
128
- label="undefined "
128
+ label="undefined"
129
129
  name="import.associate"
130
130
  tooltipHelp={
131
131
  <FieldLevelHelp
@@ -48,6 +48,13 @@ exports[`SyncSettingFields should show export settings 1`] = `
48
48
  }
49
49
  syncType="export"
50
50
  />
51
+ <ProxySettingsFields
52
+ formProps={Object {}}
53
+ proxyIdSetting={Object {}}
54
+ proxyPolicySetting={Object {}}
55
+ resetField={[Function]}
56
+ syncType="export"
57
+ />
51
58
  </Fragment>
52
59
  `;
53
60
 
@@ -97,5 +104,12 @@ exports[`SyncSettingFields should show import settings 1`] = `
97
104
  }
98
105
  syncType="import"
99
106
  />
107
+ <ProxySettingsFields
108
+ formProps={Object {}}
109
+ proxyIdSetting={Object {}}
110
+ proxyPolicySetting={Object {}}
111
+ resetField={[Function]}
112
+ syncType="import"
113
+ />
100
114
  </Fragment>
101
115
  `;
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: 10.0.2
4
+ version: 10.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Sutcliffe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-08 00:00:00.000000000 Z
11
+ date: 2025-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy
@@ -200,6 +200,8 @@ files:
200
200
  - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/NewTemplateSyncFormSelectors.test.js
201
201
  - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/__snapshots__/NewTemplateSyncFormSelectors.test.js.snap
202
202
  - webpack/components/NewTemplateSync/components/NewTemplateSyncForm/index.js
203
+ - webpack/components/NewTemplateSync/components/ProxySettingField.js
204
+ - webpack/components/NewTemplateSync/components/ProxySettingFields.js
203
205
  - webpack/components/NewTemplateSync/components/SyncSettingField.js
204
206
  - webpack/components/NewTemplateSync/components/SyncSettingFields.js
205
207
  - webpack/components/NewTemplateSync/components/SyncTypeRadios.js
@@ -274,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
276
  - !ruby/object:Gem::Version
275
277
  version: '0'
276
278
  requirements: []
277
- rubygems_version: 3.2.33
279
+ rubygems_version: 3.3.27
278
280
  signing_key:
279
281
  specification_version: 4
280
282
  summary: Template-syncing engine for Foreman