foreman_puppet 6.1.1 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_puppet/locale/ca/foreman_puppet.js +36 -0
  3. data/app/assets/javascripts/foreman_puppet/locale/cs_CZ/foreman_puppet.js +36 -0
  4. data/app/assets/javascripts/foreman_puppet/locale/de/foreman_puppet.js +36 -0
  5. data/app/assets/javascripts/foreman_puppet/locale/en/foreman_puppet.js +36 -0
  6. data/app/assets/javascripts/foreman_puppet/locale/en_GB/foreman_puppet.js +36 -0
  7. data/app/assets/javascripts/foreman_puppet/locale/es/foreman_puppet.js +36 -0
  8. data/app/assets/javascripts/foreman_puppet/locale/fr/foreman_puppet.js +36 -0
  9. data/app/assets/javascripts/foreman_puppet/locale/gl/foreman_puppet.js +36 -0
  10. data/app/assets/javascripts/foreman_puppet/locale/it/foreman_puppet.js +36 -0
  11. data/app/assets/javascripts/foreman_puppet/locale/ja/foreman_puppet.js +36 -0
  12. data/app/assets/javascripts/foreman_puppet/locale/ka/foreman_puppet.js +36 -0
  13. data/app/assets/javascripts/foreman_puppet/locale/ko/foreman_puppet.js +36 -0
  14. data/app/assets/javascripts/foreman_puppet/locale/nl_NL/foreman_puppet.js +36 -0
  15. data/app/assets/javascripts/foreman_puppet/locale/pl/foreman_puppet.js +36 -0
  16. data/app/assets/javascripts/foreman_puppet/locale/pt_BR/foreman_puppet.js +36 -0
  17. data/app/assets/javascripts/foreman_puppet/locale/ru/foreman_puppet.js +36 -0
  18. data/app/assets/javascripts/foreman_puppet/locale/sv_SE/foreman_puppet.js +36 -0
  19. data/app/assets/javascripts/foreman_puppet/locale/zh_CN/foreman_puppet.js +36 -0
  20. data/app/assets/javascripts/foreman_puppet/locale/zh_TW/foreman_puppet.js +36 -0
  21. data/app/views/foreman_puppet/puppetclasses/index.html.erb +1 -1
  22. data/lib/foreman_puppet/version.rb +1 -1
  23. data/locale/ca/foreman_puppet.po +36 -0
  24. data/locale/cs_CZ/foreman_puppet.po +36 -0
  25. data/locale/de/foreman_puppet.po +36 -0
  26. data/locale/en/foreman_puppet.po +36 -0
  27. data/locale/en_GB/foreman_puppet.po +36 -0
  28. data/locale/es/foreman_puppet.po +36 -0
  29. data/locale/foreman_puppet.pot +63 -2
  30. data/locale/fr/foreman_puppet.po +36 -0
  31. data/locale/gl/foreman_puppet.po +36 -0
  32. data/locale/it/foreman_puppet.po +36 -0
  33. data/locale/ja/foreman_puppet.po +36 -0
  34. data/locale/ka/foreman_puppet.po +36 -0
  35. data/locale/ko/foreman_puppet.po +36 -0
  36. data/locale/nl_NL/foreman_puppet.po +36 -0
  37. data/locale/pl/foreman_puppet.po +36 -0
  38. data/locale/pt_BR/foreman_puppet.po +36 -0
  39. data/locale/ru/foreman_puppet.po +36 -0
  40. data/locale/sv_SE/foreman_puppet.po +36 -0
  41. data/locale/zh_CN/foreman_puppet.po +36 -0
  42. data/locale/zh_TW/foreman_puppet.po +36 -0
  43. data/test/integration/foreman_puppet/smartclass_parameter_js_test.rb +2 -0
  44. data/test/models/foreman_puppet/host_test.rb +2 -2
  45. data/webpack/src/Extends/Host/PuppetTab/Routes.js +1 -1
  46. data/webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/ConfigStatusCard/ConfigStatusCardActions.js +10 -0
  47. data/webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/ConfigStatusCard/ConfigStatusCardConstants.js +1 -0
  48. data/webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/ConfigStatusCard/index.js +186 -0
  49. data/webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/ConfigStatusCard/styles.scss +3 -0
  50. data/webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/index.js +4 -0
  51. data/webpack/src/Extends/Host/PuppetTab/index.js +4 -2
  52. data/webpack/src/Extends/Host/PuppetTab/styles.scss +9 -0
  53. metadata +12 -4
@@ -113,6 +113,9 @@ msgstr "Byt Miljö"
113
113
  msgid "Change Puppet Master"
114
114
  msgstr ""
115
115
 
116
+ msgid "Changed"
117
+ msgstr ""
118
+
116
119
  msgid "Changed environments"
117
120
  msgstr "Ändrade miljöer"
118
121
 
@@ -152,6 +155,9 @@ msgstr ""
152
155
  msgid "Copy to clipboard"
153
156
  msgstr ""
154
157
 
158
+ msgid "Corrective Change"
159
+ msgstr ""
160
+
155
161
  msgid "Couldn't find any ENC data for this host"
156
162
  msgstr ""
157
163
 
@@ -266,12 +272,18 @@ msgstr ""
266
272
  msgid "Facts"
267
273
  msgstr "Fakta"
268
274
 
275
+ msgid "Failed"
276
+ msgstr ""
277
+
269
278
  msgid "Failed to import %{klass} for %{name}: doesn't exists in our database - ignoring"
270
279
  msgstr "Misslyckades med att importera %{klass} på grund av att %{name}: inte existerar i vår databas - ignorerar"
271
280
 
272
281
  msgid "Failed to set %{proxy_type} proxy for %{host}."
273
282
  msgstr ""
274
283
 
284
+ msgid "Failed to start"
285
+ msgstr ""
286
+
275
287
  msgid "Failed to update environments and Puppet classes from the on-disk Puppet installation: %s"
276
288
  msgstr ""
277
289
 
@@ -413,6 +425,9 @@ msgstr ""
413
425
  msgid "Invalid proxy selected!"
414
426
  msgstr ""
415
427
 
428
+ msgid "Last configuration status"
429
+ msgstr ""
430
+
416
431
  msgid "List all Puppet class IDs for host"
417
432
  msgstr ""
418
433
 
@@ -488,12 +503,18 @@ msgstr ""
488
503
  msgid "Name"
489
504
  msgstr "Namn"
490
505
 
506
+ msgid "Never"
507
+ msgstr ""
508
+
491
509
  msgid "New"
492
510
  msgstr "Ny"
493
511
 
494
512
  msgid "No changes to your environments detected"
495
513
  msgstr ""
496
514
 
515
+ msgid "No configuration status available"
516
+ msgstr ""
517
+
497
518
  msgid "No environment selected!"
498
519
  msgstr "Ingen miljö vald!"
499
520
 
@@ -557,6 +578,9 @@ msgstr "Organisationer"
557
578
  msgid "Original value info"
558
579
  msgstr ""
559
580
 
581
+ msgid "Out of sync"
582
+ msgstr ""
583
+
560
584
  msgid "Overridden"
561
585
  msgstr ""
562
586
 
@@ -641,6 +665,9 @@ msgstr "Puppet externa noder YAML-export"
641
665
  msgid "Puppet interval"
642
666
  msgstr ""
643
667
 
668
+ msgid "Puppet metrics"
669
+ msgstr ""
670
+
644
671
  msgid "Puppet parameter"
645
672
  msgstr ""
646
673
 
@@ -677,6 +704,12 @@ msgstr "Rapporter"
677
704
  msgid "Required parameter without value.<br/><b>Please override!</b><br/>"
678
705
  msgstr ""
679
706
 
707
+ msgid "Restarted"
708
+ msgstr ""
709
+
710
+ msgid "Scheduled"
711
+ msgstr ""
712
+
680
713
  msgid "Select environment"
681
714
  msgstr "Välj miljö"
682
715
 
@@ -713,6 +746,9 @@ msgstr ""
713
746
  msgid "Show template combination"
714
747
  msgstr ""
715
748
 
749
+ msgid "Skipped"
750
+ msgstr ""
751
+
716
752
  msgid "Smart Class Parameter"
717
753
  msgstr "Smart Klassparameter"
718
754
 
@@ -117,6 +117,9 @@ msgstr "改变环境"
117
117
  msgid "Change Puppet Master"
118
118
  msgstr "更改 Puppet 主服务器"
119
119
 
120
+ msgid "Changed"
121
+ msgstr ""
122
+
120
123
  msgid "Changed environments"
121
124
  msgstr "修改的环境"
122
125
 
@@ -156,6 +159,9 @@ msgstr "配置管理"
156
159
  msgid "Copy to clipboard"
157
160
  msgstr ""
158
161
 
162
+ msgid "Corrective Change"
163
+ msgstr ""
164
+
159
165
  msgid "Couldn't find any ENC data for this host"
160
166
  msgstr "无法找到此主机的任何 ENC 数据"
161
167
 
@@ -270,12 +276,18 @@ msgstr "错误!"
270
276
  msgid "Facts"
271
277
  msgstr "Facts"
272
278
 
279
+ msgid "Failed"
280
+ msgstr ""
281
+
273
282
  msgid "Failed to import %{klass} for %{name}: doesn't exists in our database - ignoring"
274
283
  msgstr "为 %{name} 导入 %{klass} 失败:不存在于我们的数据库中 -- 忽略"
275
284
 
276
285
  msgid "Failed to set %{proxy_type} proxy for %{host}."
277
286
  msgstr "无法为 %{host} 设置 {proxy_type} 代理服务器。"
278
287
 
288
+ msgid "Failed to start"
289
+ msgstr ""
290
+
279
291
  msgid "Failed to update environments and Puppet classes from the on-disk Puppet installation: %s"
280
292
  msgstr "无法使用磁盘 Puppet 安装更新环境及 Puppet 类别:%s"
281
293
 
@@ -417,6 +429,9 @@ msgstr "从 %s 继承的类"
417
429
  msgid "Invalid proxy selected!"
418
430
  msgstr "所选代理服务器无效!"
419
431
 
432
+ msgid "Last configuration status"
433
+ msgstr ""
434
+
420
435
  msgid "List all Puppet class IDs for host"
421
436
  msgstr "列出主机的所有 Puppet 类 ID"
422
437
 
@@ -492,12 +507,18 @@ msgstr "合并所有匹配的值(仅用于阵列/哈希类型)"
492
507
  msgid "Name"
493
508
  msgstr "名称"
494
509
 
510
+ msgid "Never"
511
+ msgstr ""
512
+
495
513
  msgid "New"
496
514
  msgstr "新"
497
515
 
498
516
  msgid "No changes to your environments detected"
499
517
  msgstr "未探测到您的环境有任何变化"
500
518
 
519
+ msgid "No configuration status available"
520
+ msgstr ""
521
+
501
522
  msgid "No environment selected!"
502
523
  msgstr "没有选择环境!"
503
524
 
@@ -561,6 +582,9 @@ msgstr "机构"
561
582
  msgid "Original value info"
562
583
  msgstr "原始值信息"
563
584
 
585
+ msgid "Out of sync"
586
+ msgstr ""
587
+
564
588
  msgid "Overridden"
565
589
  msgstr "覆盖"
566
590
 
@@ -645,6 +669,9 @@ msgstr "Puppet 外部节点 YAML 转储"
645
669
  msgid "Puppet interval"
646
670
  msgstr "Puppet 间隔"
647
671
 
672
+ msgid "Puppet metrics"
673
+ msgstr ""
674
+
648
675
  msgid "Puppet parameter"
649
676
  msgstr "Puppet 参数"
650
677
 
@@ -681,6 +708,12 @@ msgstr "报表"
681
708
  msgid "Required parameter without value.<br/><b>Please override!</b><br/>"
682
709
  msgstr "需要的参数没有值。<br/><b>请覆盖</b><br/>"
683
710
 
711
+ msgid "Restarted"
712
+ msgstr ""
713
+
714
+ msgid "Scheduled"
715
+ msgstr ""
716
+
684
717
  msgid "Select environment"
685
718
  msgstr "选择环境"
686
719
 
@@ -717,6 +750,9 @@ msgstr "显示具体智能类别参数的替代值"
717
750
  msgid "Show template combination"
718
751
  msgstr "显示模板组合"
719
752
 
753
+ msgid "Skipped"
754
+ msgstr ""
755
+
720
756
  msgid "Smart Class Parameter"
721
757
  msgstr "智能代理参数"
722
758
 
@@ -112,6 +112,9 @@ msgstr "更改環境"
112
112
  msgid "Change Puppet Master"
113
113
  msgstr "改變 Puppet Master"
114
114
 
115
+ msgid "Changed"
116
+ msgstr ""
117
+
115
118
  msgid "Changed environments"
116
119
  msgstr "已更改的環境"
117
120
 
@@ -151,6 +154,9 @@ msgstr ""
151
154
  msgid "Copy to clipboard"
152
155
  msgstr ""
153
156
 
157
+ msgid "Corrective Change"
158
+ msgstr ""
159
+
154
160
  msgid "Couldn't find any ENC data for this host"
155
161
  msgstr ""
156
162
 
@@ -265,12 +271,18 @@ msgstr ""
265
271
  msgid "Facts"
266
272
  msgstr "詳情"
267
273
 
274
+ msgid "Failed"
275
+ msgstr ""
276
+
268
277
  msgid "Failed to import %{klass} for %{name}: doesn't exists in our database - ignoring"
269
278
  msgstr "為 %{name} 匯入 %{klass} 失敗:不存在我們的資料庫中 - 將被忽略"
270
279
 
271
280
  msgid "Failed to set %{proxy_type} proxy for %{host}."
272
281
  msgstr "設定 %{proxy_type} 代理給 %{host} 時失敗。"
273
282
 
283
+ msgid "Failed to start"
284
+ msgstr ""
285
+
274
286
  msgid "Failed to update environments and Puppet classes from the on-disk Puppet installation: %s"
275
287
  msgstr ""
276
288
 
@@ -412,6 +424,9 @@ msgstr ""
412
424
  msgid "Invalid proxy selected!"
413
425
  msgstr "選擇了不正確的代理!"
414
426
 
427
+ msgid "Last configuration status"
428
+ msgstr ""
429
+
415
430
  msgid "List all Puppet class IDs for host"
416
431
  msgstr "列出主機的所有 Puppet 類別 ID"
417
432
 
@@ -487,12 +502,18 @@ msgstr "合併所有相符的值(只有陣列 / 雜湊類型)"
487
502
  msgid "Name"
488
503
  msgstr "名稱"
489
504
 
505
+ msgid "Never"
506
+ msgstr ""
507
+
490
508
  msgid "New"
491
509
  msgstr "新增"
492
510
 
493
511
  msgid "No changes to your environments detected"
494
512
  msgstr "未偵測到您的環境遭到變更"
495
513
 
514
+ msgid "No configuration status available"
515
+ msgstr ""
516
+
496
517
  msgid "No environment selected!"
497
518
  msgstr "未選擇環境!"
498
519
 
@@ -556,6 +577,9 @@ msgstr "組織"
556
577
  msgid "Original value info"
557
578
  msgstr "原始值資訊"
558
579
 
580
+ msgid "Out of sync"
581
+ msgstr ""
582
+
559
583
  msgid "Overridden"
560
584
  msgstr ""
561
585
 
@@ -640,6 +664,9 @@ msgstr "Puppet 外部節點 YAML 傾印"
640
664
  msgid "Puppet interval"
641
665
  msgstr "Puppet 間隔"
642
666
 
667
+ msgid "Puppet metrics"
668
+ msgstr ""
669
+
643
670
  msgid "Puppet parameter"
644
671
  msgstr "Puppet 參數"
645
672
 
@@ -676,6 +703,12 @@ msgstr "報告"
676
703
  msgid "Required parameter without value.<br/><b>Please override!</b><br/>"
677
704
  msgstr "必要的參數未提供值。<br/><b>請覆寫!</b> <br/>"
678
705
 
706
+ msgid "Restarted"
707
+ msgstr ""
708
+
709
+ msgid "Scheduled"
710
+ msgstr ""
711
+
679
712
  msgid "Select environment"
680
713
  msgstr "選擇環境"
681
714
 
@@ -712,6 +745,9 @@ msgstr "顯示特定智慧類別參數的置換值"
712
745
  msgid "Show template combination"
713
746
  msgstr "顯示範本組合"
714
747
 
748
+ msgid "Skipped"
749
+ msgstr ""
750
+
715
751
  msgid "Smart Class Parameter"
716
752
  msgstr "智慧類別參數"
717
753
 
@@ -74,6 +74,8 @@ module ForemanPuppet
74
74
  within(:xpath, '//table') do
75
75
  click_link 'ssl'
76
76
  end
77
+ # see: https://projects.theforeman.org/issues/37251
78
+ page.driver.browser.file_detector = nil if page.driver.browser.respond_to?(:file_detector=)
77
79
  fill_in 'puppetclass_lookup_key_description', with: 'test'
78
80
  fill_in 'puppetclass_lookup_key_default_value', with: 'false'
79
81
  assert_submit_button(puppetclass_lookup_keys_path)
@@ -172,7 +172,7 @@ module ForemanPuppet
172
172
  host.expects(:template_kinds).returns(template_kinds)
173
173
  template_kinds.each do |kind|
174
174
  ::ProvisioningTemplate.expects(:find_template)
175
- .with(kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: host.puppet.environment.id)
175
+ .with({ kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: host.puppet.environment.id })
176
176
  .returns(stub(name: "default #{kind.name}"))
177
177
  end
178
178
  assert_equal template_kinds.map { |k| "default #{k.name}" }, host.available_template_kinds.map(&:name)
@@ -183,7 +183,7 @@ module ForemanPuppet
183
183
  host.expects(:template_kinds).returns(template_kinds)
184
184
  template_kinds.each do |kind|
185
185
  ::ProvisioningTemplate.expects(:find_template)
186
- .with(kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: nil)
186
+ .with({ kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: nil })
187
187
  .returns(stub(name: "default #{kind.name}"))
188
188
  end
189
189
  assert_equal template_kinds.map { |k| "default #{k.name}" }, host.available_template_kinds.map(&:name)
@@ -6,7 +6,7 @@ import Reports from './SubTabs/Reports';
6
6
  import ENCPreview from './SubTabs/ENCPreview';
7
7
 
8
8
  const SecondaryTabRoutes = ({ hostName, hostInfo, status }) => (
9
- <Switch>
9
+ <Switch ouiaId="foreman-puppet-switch">
10
10
  <Route path={route('reports')}>
11
11
  <Reports hostName={hostName} hostInfo={hostInfo} status={status} />
12
12
  </Route>
@@ -0,0 +1,10 @@
1
+ import { API_OPERATIONS, get } from 'foremanReact/redux/API';
2
+ import { FOREMAN_PUPPET_LAST_REPORT_KEY } from './ConfigStatusCardConstants';
3
+
4
+ export const getReportByIdAction = reportId =>
5
+ get({
6
+ type: API_OPERATIONS.GET,
7
+ key: FOREMAN_PUPPET_LAST_REPORT_KEY,
8
+ url: `/api/config_reports/${reportId}`,
9
+ });
10
+ export default getReportByIdAction;
@@ -0,0 +1 @@
1
+ export const FOREMAN_PUPPET_LAST_REPORT_KEY = 'FOREMAN_PUPPET_LAST_REPORT';
@@ -0,0 +1,186 @@
1
+ import PropTypes from 'prop-types';
2
+ import React, { useCallback, useEffect } from 'react';
3
+ import {
4
+ Divider,
5
+ Flex,
6
+ FlexItem,
7
+ Button,
8
+ DescriptionList,
9
+ DescriptionListTerm,
10
+ DescriptionListGroup,
11
+ DescriptionListDescription,
12
+ } from '@patternfly/react-core';
13
+ import {
14
+ TableComposable,
15
+ TableText,
16
+ Tr,
17
+ Tbody,
18
+ Td,
19
+ } from '@patternfly/react-table';
20
+ import { useSelector, useDispatch } from 'react-redux';
21
+ import { selectAPIResponse } from 'foremanReact/redux/API/APISelectors';
22
+ import CardTemplate from 'foremanReact/components/HostDetails/Templates/CardItem/CardTemplate';
23
+ import RelativeDateTime from 'foremanReact/components/common/dates/RelativeDateTime';
24
+ import SkeletonLoader from 'foremanReact/components/common/SkeletonLoader';
25
+ import DefaultLoaderEmptyState from 'foremanReact/components/HostDetails/DetailsCard/DefaultLoaderEmptyState';
26
+ import { statusFormatter } from 'foremanReact/components/HostDetails/Tabs/ReportsTab/helpers';
27
+ import { translate as __ } from 'foremanReact/common/I18n';
28
+
29
+ import { getReportByIdAction } from './ConfigStatusCardActions';
30
+ import { FOREMAN_PUPPET_LAST_REPORT_KEY } from './ConfigStatusCardConstants';
31
+ import './styles.scss';
32
+
33
+ const cardHeaderDivider = () => (
34
+ <Divider
35
+ orientation={{
36
+ default: 'vertical',
37
+ }}
38
+ inset={{ default: 'insetMd' }}
39
+ />
40
+ );
41
+
42
+ const generateCardHeader = (allReports = [], reportsCount) =>
43
+ reportsCount > 0 ? (
44
+ <>
45
+ {__('Last configuration status')}
46
+ <Flex>
47
+ <FlexItem>
48
+ <Button
49
+ ouiaId="foreman-puppet-last-report-button"
50
+ variant="link"
51
+ component="a"
52
+ isInline
53
+ isDisabled={!allReports.length}
54
+ href={`/config_reports/${allReports[0].id}`}
55
+ >
56
+ <RelativeDateTime
57
+ date={allReports[0].reported_at}
58
+ defaultValue={__('Never')}
59
+ />
60
+ </Button>
61
+ </FlexItem>
62
+ <FlexItem>{statusFormatter('failed', allReports[0])}</FlexItem>
63
+ {cardHeaderDivider()}
64
+ <FlexItem>{statusFormatter('failed_restarts', allReports[0])}</FlexItem>
65
+ {cardHeaderDivider()}
66
+ <FlexItem>{statusFormatter('restarted', allReports[0])}</FlexItem>
67
+ {cardHeaderDivider()}
68
+ <FlexItem>{statusFormatter('applied', allReports[0])}</FlexItem>
69
+ {cardHeaderDivider()}
70
+ <FlexItem>{statusFormatter('skipped', allReports[0])}</FlexItem>
71
+ {cardHeaderDivider()}
72
+ <FlexItem>{statusFormatter('pending', allReports[0])}</FlexItem>
73
+ </Flex>
74
+ </>
75
+ ) : (
76
+ <> {__('No configuration status available')} </>
77
+ );
78
+
79
+ const createPuppetMetricsTableElement = (name, value = '--') => (
80
+ <>
81
+ <Td modifier="truncate" key={`metrics-name-${name}`}>
82
+ <TableText
83
+ className={name === 'Total' ? 'last-config-puppet-metrics-total' : ''}
84
+ >
85
+ {name}
86
+ </TableText>
87
+ </Td>
88
+ <Td modifier="truncate" key={`metrics-name-${value}`}>
89
+ <TableText
90
+ className={name === 'Total' ? 'last-config-puppet-metrics-total' : ''}
91
+ >
92
+ {value}
93
+ </TableText>
94
+ </Td>
95
+ </>
96
+ );
97
+
98
+ const createPuppetMetricsTable = (metrics = undefined) => (
99
+ <TableComposable
100
+ aria-label="foreman puppet metrics table"
101
+ variant="compact"
102
+ borders="compactBorderless"
103
+ ouiaId="foreman-puppet-metrics-table"
104
+ key="foreman-puppet-metrics-table"
105
+ >
106
+ <Tbody>
107
+ <Tr>
108
+ {createPuppetMetricsTableElement(__('Failed'), metrics.failed)}
109
+ {createPuppetMetricsTableElement(__('Changed'), metrics.changed)}
110
+ {createPuppetMetricsTableElement(__('Scheduled'), metrics.scheduled)}
111
+ </Tr>
112
+ <Tr>
113
+ {createPuppetMetricsTableElement(
114
+ __('Failed to start'),
115
+ metrics.failed_to_start
116
+ )}
117
+ {createPuppetMetricsTableElement(__('Restarted'), metrics.restarted)}
118
+ {createPuppetMetricsTableElement(
119
+ __('Corrective Change'),
120
+ metrics.corrective_change
121
+ )}
122
+ </Tr>
123
+ <Tr>
124
+ {createPuppetMetricsTableElement(__('Skipped'), metrics.skipped)}
125
+ {createPuppetMetricsTableElement(
126
+ __('Out of sync'),
127
+ metrics.out_of_sync
128
+ )}
129
+ {createPuppetMetricsTableElement(__('Total'), metrics.total)}
130
+ </Tr>
131
+ </Tbody>
132
+ </TableComposable>
133
+ );
134
+
135
+ const ConfigStatusCard = ({ hostName, parentStatus }) => {
136
+ const dispatch = useDispatch();
137
+ // get already fetched results from reports tab
138
+ const API_KEY = `get-reports-${hostName}`;
139
+ const { reports, itemCount } = useSelector(state =>
140
+ selectAPIResponse(state, API_KEY)
141
+ );
142
+
143
+ // we need to fetch the last Puppet report to get all Puppet metrics
144
+ const getLastReport = useCallback(() => {
145
+ if (hostName && reports?.length)
146
+ dispatch(getReportByIdAction(reports[0].id));
147
+ }, [hostName, reports, dispatch]);
148
+
149
+ useEffect(() => {
150
+ getLastReport();
151
+ }, [hostName, reports]);
152
+
153
+ const { metrics } = useSelector(state =>
154
+ selectAPIResponse(state, FOREMAN_PUPPET_LAST_REPORT_KEY)
155
+ );
156
+
157
+ return (
158
+ <CardTemplate header={generateCardHeader(reports, itemCount)} expandable>
159
+ <DescriptionList isCompact>
160
+ <DescriptionListGroup>
161
+ <DescriptionListTerm>{__('Puppet metrics')}</DescriptionListTerm>
162
+ <DescriptionListDescription>
163
+ <SkeletonLoader
164
+ status={parentStatus}
165
+ emptyState={<DefaultLoaderEmptyState />}
166
+ >
167
+ {metrics && createPuppetMetricsTable(metrics.resources)}
168
+ </SkeletonLoader>
169
+ </DescriptionListDescription>
170
+ </DescriptionListGroup>
171
+ </DescriptionList>
172
+ </CardTemplate>
173
+ );
174
+ };
175
+
176
+ ConfigStatusCard.propTypes = {
177
+ hostName: PropTypes.string,
178
+ parentStatus: PropTypes.string,
179
+ };
180
+
181
+ ConfigStatusCard.defaultProps = {
182
+ hostName: undefined,
183
+ parentStatus: undefined,
184
+ };
185
+
186
+ export default ConfigStatusCard;
@@ -0,0 +1,3 @@
1
+ .last-config-puppet-metrics-total {
2
+ font-weight: bold;
3
+ }
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { Grid, GridItem } from '@patternfly/react-core';
4
4
  import ReportsTab from 'foremanReact/components/HostDetails/Tabs/ReportsTab';
5
5
  import DescriptionCard from './components/DescriptionCard';
6
+ import ConfigStatusCard from './components/ConfigStatusCard';
6
7
  import './styles.scss';
7
8
 
8
9
  const Reports = ({
@@ -18,6 +19,9 @@ const Reports = ({
18
19
  }) => (
19
20
  <div className="report-tab">
20
21
  <Grid hasGutter>
22
+ <GridItem span={8}>
23
+ <ConfigStatusCard hostName={hostName} parentStatus={status} />
24
+ </GridItem>
21
25
  <GridItem span={4}>
22
26
  <DescriptionCard
23
27
  proxyName={proxyName}
@@ -8,13 +8,15 @@ import SecondaryTabRoutes from './Routes';
8
8
  import { activeTab } from './helpers';
9
9
  import { SECONDARY_TABS } from './constants';
10
10
 
11
+ import './styles.scss';
12
+
11
13
  const PuppetTab = ({ response, status, location: { pathname } }) => {
12
14
  const hashHistory = useHistory();
13
15
  return (
14
16
  <>
15
17
  <Tabs
16
- ouiaId="puppet-tabs"
17
- className="margin-0-24"
18
+ ouiaId="foreman-puppet-host-details-tab"
19
+ className="foreman-puppet-host-details-tab"
18
20
  onSelect={(evt, subTab) => hashHistory.push(subTab)}
19
21
  isSecondary
20
22
  activeKey={activeTab(pathname)}
@@ -0,0 +1,9 @@
1
+
2
+ .pf-c-tabs.pf-m-secondary.foreman-puppet-host-details-tab {
3
+ overflow: visible;
4
+ }
5
+
6
+ .foreman-puppet-host-details-tab {
7
+ margin: 0 24px
8
+ }
9
+
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: 6.1.1
4
+ version: 6.3.0
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: 2023-12-01 00:00:00.000000000 Z
12
+ date: 2024-03-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Allow assigning Puppet environments and classes to the Foreman Hosts.
15
15
  email:
@@ -401,12 +401,17 @@ files:
401
401
  - webpack/src/Extends/Host/PuppetTab/SubTabs/ENCPreview/ENCTab.js
402
402
  - webpack/src/Extends/Host/PuppetTab/SubTabs/ENCPreview/index.js
403
403
  - webpack/src/Extends/Host/PuppetTab/SubTabs/EmptyPage.js
404
+ - webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/ConfigStatusCard/ConfigStatusCardActions.js
405
+ - webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/ConfigStatusCard/ConfigStatusCardConstants.js
406
+ - webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/ConfigStatusCard/index.js
407
+ - webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/ConfigStatusCard/styles.scss
404
408
  - webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/DescriptionCard.js
405
409
  - webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/index.js
406
410
  - webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/styles.scss
407
411
  - webpack/src/Extends/Host/PuppetTab/constants.js
408
412
  - webpack/src/Extends/Host/PuppetTab/helpers.js
409
413
  - webpack/src/Extends/Host/PuppetTab/index.js
414
+ - webpack/src/Extends/Host/PuppetTab/styles.scss
410
415
  - webpack/src/ForemanPuppet.js
411
416
  - webpack/src/Router/__snapshots__/routes.test.js.snap
412
417
  - webpack/src/Router/index.js
@@ -429,7 +434,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
429
434
  requirements:
430
435
  - - ">="
431
436
  - !ruby/object:Gem::Version
432
- version: '0'
437
+ version: '2.7'
438
+ - - "<"
439
+ - !ruby/object:Gem::Version
440
+ version: '4'
433
441
  required_rubygems_version: !ruby/object:Gem::Requirement
434
442
  requirements:
435
443
  - - ">="
@@ -481,8 +489,8 @@ test_files:
481
489
  - test/integration/foreman_puppet/environment_js_test.rb
482
490
  - test/integration/foreman_puppet/hostgroup_js_test.rb
483
491
  - test/integration/foreman_puppet/puppetclass_js_test.rb
484
- - test/integration/foreman_puppet/smartclass_parameter_js_test.rb
485
492
  - test/integration/foreman_puppet/host_js_test.rb
493
+ - test/integration/foreman_puppet/smartclass_parameter_js_test.rb
486
494
  - test/models/foreman_puppet/config_group_class_test.rb
487
495
  - test/models/foreman_puppet/config_group_test.rb
488
496
  - test/models/foreman_puppet/environment_test.rb