foreman_puppet 4.0.0 → 4.0.1

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/foreman_puppet/register.rb +2 -1
  4. data/lib/foreman_puppet/version.rb +1 -1
  5. data/locale/ca/foreman_puppet.edit.po +1221 -0
  6. data/locale/ca/foreman_puppet.po.time_stamp +0 -0
  7. data/locale/cs_CZ/foreman_puppet.edit.po +1208 -0
  8. data/locale/cs_CZ/foreman_puppet.po.time_stamp +0 -0
  9. data/locale/de/foreman_puppet.edit.po +1300 -0
  10. data/locale/de/foreman_puppet.po.time_stamp +0 -0
  11. data/locale/en/foreman_puppet.edit.po +998 -0
  12. data/locale/en/foreman_puppet.po.time_stamp +0 -0
  13. data/locale/en/foreman_puppet.pox +0 -0
  14. data/locale/en_GB/foreman_puppet.edit.po +1197 -0
  15. data/locale/en_GB/foreman_puppet.po.time_stamp +0 -0
  16. data/locale/es/foreman_puppet.edit.po +1275 -0
  17. data/locale/es/foreman_puppet.po.time_stamp +0 -0
  18. data/locale/fr/foreman_puppet.edit.po +1290 -0
  19. data/locale/fr/foreman_puppet.po.time_stamp +0 -0
  20. data/locale/gl/foreman_puppet.edit.po +1203 -0
  21. data/locale/gl/foreman_puppet.po.time_stamp +0 -0
  22. data/locale/it/foreman_puppet.edit.po +1233 -0
  23. data/locale/it/foreman_puppet.po.time_stamp +0 -0
  24. data/locale/ja/foreman_puppet.edit.po +1223 -0
  25. data/locale/ja/foreman_puppet.po.time_stamp +0 -0
  26. data/locale/ko/foreman_puppet.edit.po +1197 -0
  27. data/locale/ko/foreman_puppet.po.time_stamp +0 -0
  28. data/locale/messages.mo +0 -0
  29. data/locale/nl_NL/foreman_puppet.edit.po +1228 -0
  30. data/locale/nl_NL/foreman_puppet.po.time_stamp +0 -0
  31. data/locale/pl/foreman_puppet.edit.po +1238 -0
  32. data/locale/pl/foreman_puppet.po.time_stamp +0 -0
  33. data/locale/pt_BR/foreman_puppet.edit.po +1281 -0
  34. data/locale/pt_BR/foreman_puppet.po.time_stamp +0 -0
  35. data/locale/ru/foreman_puppet.edit.po +1240 -0
  36. data/locale/ru/foreman_puppet.po.time_stamp +0 -0
  37. data/locale/sv_SE/foreman_puppet.edit.po +1205 -0
  38. data/locale/sv_SE/foreman_puppet.po.time_stamp +0 -0
  39. data/locale/zh_CN/foreman_puppet.edit.po +1212 -0
  40. data/locale/zh_CN/foreman_puppet.po.time_stamp +0 -0
  41. data/locale/zh_TW/foreman_puppet.edit.po +1197 -0
  42. data/locale/zh_TW/foreman_puppet.po.time_stamp +0 -0
  43. data/webpack/src/Extends/Host/PuppetTab/Routes.js +6 -1
  44. data/webpack/src/Extends/Host/PuppetTab/SubTabs/ENCPreview/ENCTab.js +61 -0
  45. data/webpack/src/Extends/Host/PuppetTab/SubTabs/ENCPreview/index.js +53 -0
  46. data/webpack/src/Extends/Host/PuppetTab/constants.js +1 -1
  47. metadata +41 -2
File without changes
@@ -4,6 +4,7 @@ import { Route, Switch, Redirect } from 'react-router-dom';
4
4
  import { route } from './helpers';
5
5
  import EmptyPage from './SubTabs/EmptyPage';
6
6
  import Reports from './SubTabs/Reports';
7
+ import ENCPreview from './SubTabs/ENCPreview';
7
8
 
8
9
  const SecondaryTabRoutes = ({ hostName, hostInfo, status }) => (
9
10
  <Switch>
@@ -21,7 +22,11 @@ const SecondaryTabRoutes = ({ hostName, hostInfo, status }) => (
21
22
  <EmptyPage header="Smart class parameters" />
22
23
  </Route>
23
24
  <Route path={route('yaml')}>
24
- <EmptyPage header="YAML" />
25
+ {hostName ? (
26
+ <ENCPreview hostName={hostName} />
27
+ ) : (
28
+ <EmptyPage header="ENC Preview" />
29
+ )}
25
30
  </Route>
26
31
  <Redirect to={route('reports')} />
27
32
  </Switch>
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import {
4
+ CodeBlock,
5
+ CodeBlockAction,
6
+ CodeBlockCode,
7
+ ClipboardCopyButton,
8
+ } from '@patternfly/react-core';
9
+
10
+ export const ENCTab = ({ encData }) => {
11
+ const [copied, setCopied] = React.useState(false);
12
+
13
+ const code = `${encData}`;
14
+
15
+ const clipboardCopyFunc = (event, text) => {
16
+ const clipboard = event.currentTarget.parentElement;
17
+ const el = document.createElement('textarea');
18
+ el.value = text.toString();
19
+ clipboard.appendChild(el);
20
+ el.select();
21
+ document.execCommand('copy');
22
+ clipboard.removeChild(el);
23
+ };
24
+
25
+ const onClick = (event, text) => {
26
+ clipboardCopyFunc(event, text);
27
+ setCopied(true);
28
+ };
29
+
30
+ const actions = (
31
+ <CodeBlockAction>
32
+ <ClipboardCopyButton
33
+ id="copy-button"
34
+ textId="code-content"
35
+ aria-label="Copy to clipboard"
36
+ onClick={e => onClick(e, code)}
37
+ exitDelay={600}
38
+ maxWidth="110px"
39
+ variant="plain"
40
+ >
41
+ {copied ? 'Successfully copied to clipboard!' : 'Copy to clipboard'}
42
+ </ClipboardCopyButton>
43
+ </CodeBlockAction>
44
+ );
45
+
46
+ return (
47
+ <CodeBlock actions={actions}>
48
+ <CodeBlockCode id="code-content">{code}</CodeBlockCode>
49
+ </CodeBlock>
50
+ );
51
+ };
52
+
53
+ ENCTab.propTypes = {
54
+ encData: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
55
+ };
56
+
57
+ ENCTab.defaultProps = {
58
+ encData: undefined,
59
+ };
60
+
61
+ export default ENCTab;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
3
+ import PropTypes from 'prop-types';
4
+
5
+ import Skeleton from 'react-loading-skeleton';
6
+ import EmptyState from 'foremanReact/components/common/EmptyState/EmptyStatePattern';
7
+ import { STATUS } from 'foremanReact/constants';
8
+ import { EmptyStateIcon } from '@patternfly/react-core';
9
+ import { ExclamationCircleIcon } from '@patternfly/react-icons';
10
+ import { global_danger_color_200 as dangerColor } from '@patternfly/react-tokens';
11
+ import { translate as __ } from 'foremanReact/common/I18n';
12
+ import { ENCTab } from './ENCTab';
13
+
14
+ const ENCPreview = ({ hostName }) => {
15
+ const options = {
16
+ params: { name: hostName, format: 'yml' },
17
+ key: 'PUPPET_ENC_PREVIEW',
18
+ };
19
+ const url = `${window.location.origin.toString()}/foreman_puppet/hosts/${hostName}/externalNodes`;
20
+ const { response, status } = useAPI('get', url, options);
21
+
22
+ if (status === STATUS.PENDING) {
23
+ return <Skeleton count={5} />;
24
+ }
25
+
26
+ if (status === STATUS.ERROR) {
27
+ const icon = (
28
+ <EmptyStateIcon icon={ExclamationCircleIcon} color={dangerColor.value} />
29
+ );
30
+ return (
31
+ <EmptyState
32
+ header={__('Error!')}
33
+ icon={icon}
34
+ description={response?.response?.data?.message}
35
+ />
36
+ );
37
+ }
38
+ if (response !== '' || response !== undefined) {
39
+ return (
40
+ <div className="yaml-tab" padding="16px 24px">
41
+ <ENCTab encData={response} />
42
+ </div>
43
+ );
44
+ }
45
+
46
+ return null;
47
+ };
48
+
49
+ ENCPreview.propTypes = {
50
+ hostName: PropTypes.string.isRequired,
51
+ };
52
+
53
+ export default ENCPreview;
@@ -4,5 +4,5 @@ export const SECONDARY_TABS = [
4
4
  { key: 'reports', title: __('Reports') },
5
5
  { key: 'assigned', title: __('Assigned classes') },
6
6
  { key: 'smart-classes', title: __('Smart class parameters') },
7
- { key: 'yaml', title: __('YAML') },
7
+ { key: 'yaml', title: __('ENC Preview') },
8
8
  ];
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-05-25 00:00:00.000000000 Z
12
+ date: 2022-06-03 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Allow assigning Puppet environments and classes to the Foreman Hosts.
15
15
  email:
@@ -218,44 +218,81 @@ files:
218
218
  - locale/Makefile
219
219
  - locale/action_names.rb
220
220
  - locale/ca/LC_MESSAGES/foreman_puppet.mo
221
+ - locale/ca/foreman_puppet.edit.po
221
222
  - locale/ca/foreman_puppet.po
223
+ - locale/ca/foreman_puppet.po.time_stamp
222
224
  - locale/cs_CZ/LC_MESSAGES/foreman_puppet.mo
225
+ - locale/cs_CZ/foreman_puppet.edit.po
223
226
  - locale/cs_CZ/foreman_puppet.po
227
+ - locale/cs_CZ/foreman_puppet.po.time_stamp
224
228
  - locale/de/LC_MESSAGES/foreman_puppet.mo
229
+ - locale/de/foreman_puppet.edit.po
225
230
  - locale/de/foreman_puppet.po
231
+ - locale/de/foreman_puppet.po.time_stamp
226
232
  - locale/en/LC_MESSAGES/foreman_puppet.mo
227
233
  - locale/en/foreman_puppet.edit.po
228
234
  - locale/en/foreman_puppet.po
235
+ - locale/en/foreman_puppet.po.time_stamp
236
+ - locale/en/foreman_puppet.pox
229
237
  - locale/en_GB/LC_MESSAGES/foreman_puppet.mo
238
+ - locale/en_GB/foreman_puppet.edit.po
230
239
  - locale/en_GB/foreman_puppet.po
240
+ - locale/en_GB/foreman_puppet.po.time_stamp
231
241
  - locale/es/LC_MESSAGES/foreman_puppet.mo
242
+ - locale/es/foreman_puppet.edit.po
232
243
  - locale/es/foreman_puppet.po
244
+ - locale/es/foreman_puppet.po.time_stamp
233
245
  - locale/foreman_puppet.pot
234
246
  - locale/fr/LC_MESSAGES/foreman_puppet.mo
247
+ - locale/fr/foreman_puppet.edit.po
235
248
  - locale/fr/foreman_puppet.po
249
+ - locale/fr/foreman_puppet.po.time_stamp
236
250
  - locale/gemspec.rb
237
251
  - locale/gl/LC_MESSAGES/foreman_puppet.mo
252
+ - locale/gl/foreman_puppet.edit.po
238
253
  - locale/gl/foreman_puppet.po
254
+ - locale/gl/foreman_puppet.po.time_stamp
239
255
  - locale/it/LC_MESSAGES/foreman_puppet.mo
256
+ - locale/it/foreman_puppet.edit.po
240
257
  - locale/it/foreman_puppet.po
258
+ - locale/it/foreman_puppet.po.time_stamp
241
259
  - locale/ja/LC_MESSAGES/foreman_puppet.mo
260
+ - locale/ja/foreman_puppet.edit.po
242
261
  - locale/ja/foreman_puppet.po
262
+ - locale/ja/foreman_puppet.po.time_stamp
243
263
  - locale/ko/LC_MESSAGES/foreman_puppet.mo
264
+ - locale/ko/foreman_puppet.edit.po
244
265
  - locale/ko/foreman_puppet.po
266
+ - locale/ko/foreman_puppet.po.time_stamp
267
+ - locale/messages.mo
245
268
  - locale/nl_NL/LC_MESSAGES/foreman_puppet.mo
269
+ - locale/nl_NL/foreman_puppet.edit.po
246
270
  - locale/nl_NL/foreman_puppet.po
271
+ - locale/nl_NL/foreman_puppet.po.time_stamp
247
272
  - locale/pl/LC_MESSAGES/foreman_puppet.mo
273
+ - locale/pl/foreman_puppet.edit.po
248
274
  - locale/pl/foreman_puppet.po
275
+ - locale/pl/foreman_puppet.po.time_stamp
249
276
  - locale/pt_BR/LC_MESSAGES/foreman_puppet.mo
277
+ - locale/pt_BR/foreman_puppet.edit.po
250
278
  - locale/pt_BR/foreman_puppet.po
279
+ - locale/pt_BR/foreman_puppet.po.time_stamp
251
280
  - locale/ru/LC_MESSAGES/foreman_puppet.mo
281
+ - locale/ru/foreman_puppet.edit.po
252
282
  - locale/ru/foreman_puppet.po
283
+ - locale/ru/foreman_puppet.po.time_stamp
253
284
  - locale/sv_SE/LC_MESSAGES/foreman_puppet.mo
285
+ - locale/sv_SE/foreman_puppet.edit.po
254
286
  - locale/sv_SE/foreman_puppet.po
287
+ - locale/sv_SE/foreman_puppet.po.time_stamp
255
288
  - locale/zh_CN/LC_MESSAGES/foreman_puppet.mo
289
+ - locale/zh_CN/foreman_puppet.edit.po
256
290
  - locale/zh_CN/foreman_puppet.po
291
+ - locale/zh_CN/foreman_puppet.po.time_stamp
257
292
  - locale/zh_TW/LC_MESSAGES/foreman_puppet.mo
293
+ - locale/zh_TW/foreman_puppet.edit.po
258
294
  - locale/zh_TW/foreman_puppet.po
295
+ - locale/zh_TW/foreman_puppet.po.time_stamp
259
296
  - package.json
260
297
  - test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
261
298
  - test/controllers/foreman_puppet/api/v2/environments_controller_test.rb
@@ -338,6 +375,8 @@ files:
338
375
  - webpack/src/Components/Environments/Welcome.js
339
376
  - webpack/src/Extends/Fills/index.js
340
377
  - webpack/src/Extends/Host/PuppetTab/Routes.js
378
+ - webpack/src/Extends/Host/PuppetTab/SubTabs/ENCPreview/ENCTab.js
379
+ - webpack/src/Extends/Host/PuppetTab/SubTabs/ENCPreview/index.js
341
380
  - webpack/src/Extends/Host/PuppetTab/SubTabs/EmptyPage.js
342
381
  - webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/DescriptionCard.js
343
382
  - webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/index.js