foreman_openscap 9.0.4 → 10.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_openscap/locale/cs_CZ/foreman_openscap.js +115 -127
- data/app/assets/javascripts/foreman_openscap/locale/de/foreman_openscap.js +12 -24
- data/app/assets/javascripts/foreman_openscap/locale/en/foreman_openscap.js +1 -13
- data/app/assets/javascripts/foreman_openscap/locale/en_GB/foreman_openscap.js +3 -15
- data/app/assets/javascripts/foreman_openscap/locale/es/foreman_openscap.js +12 -24
- data/app/assets/javascripts/foreman_openscap/locale/fr/foreman_openscap.js +83 -95
- data/app/assets/javascripts/foreman_openscap/locale/gl/foreman_openscap.js +4 -16
- data/app/assets/javascripts/foreman_openscap/locale/it/foreman_openscap.js +10 -22
- data/app/assets/javascripts/foreman_openscap/locale/ja/foreman_openscap.js +68 -80
- data/app/assets/javascripts/foreman_openscap/locale/ka/foreman_openscap.js +28 -40
- data/app/assets/javascripts/foreman_openscap/locale/ko/foreman_openscap.js +12 -24
- data/app/assets/javascripts/foreman_openscap/locale/pt_BR/foreman_openscap.js +9 -21
- data/app/assets/javascripts/foreman_openscap/locale/ru/foreman_openscap.js +8 -20
- data/app/assets/javascripts/foreman_openscap/locale/sv_SE/foreman_openscap.js +6 -18
- data/app/assets/javascripts/foreman_openscap/locale/zh_CN/foreman_openscap.js +67 -79
- data/app/assets/javascripts/foreman_openscap/locale/zh_TW/foreman_openscap.js +9 -21
- data/app/helpers/foreman_openscap_helper.rb +2 -18
- data/db/migrate/20201217161511_add_url_to_oval_content.rb +1 -1
- data/lib/foreman_openscap/engine.rb +148 -155
- data/lib/foreman_openscap/version.rb +1 -1
- data/locale/Makefile +12 -2
- data/locale/cs_CZ/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/cs_CZ/foreman_openscap.edit.po +1442 -0
- data/locale/cs_CZ/foreman_openscap.po +120 -130
- data/locale/cs_CZ/foreman_openscap.po.time_stamp +0 -0
- data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/de/foreman_openscap.edit.po +1454 -0
- data/locale/de/foreman_openscap.po +13 -25
- data/locale/de/foreman_openscap.po.time_stamp +0 -0
- data/locale/en/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/en/foreman_openscap.edit.po +1439 -0
- data/locale/en/foreman_openscap.po +1 -13
- data/locale/en/foreman_openscap.po.time_stamp +0 -0
- data/locale/en_GB/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/en_GB/foreman_openscap.edit.po +1440 -0
- data/locale/en_GB/foreman_openscap.po +3 -15
- data/locale/en_GB/foreman_openscap.po.time_stamp +0 -0
- data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/es/foreman_openscap.edit.po +1449 -0
- data/locale/es/foreman_openscap.po +12 -24
- data/locale/es/foreman_openscap.po.time_stamp +0 -0
- data/locale/foreman_openscap.pot +47 -61
- data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/fr/foreman_openscap.edit.po +1455 -0
- data/locale/fr/foreman_openscap.po +83 -95
- data/locale/fr/foreman_openscap.po.time_stamp +0 -0
- data/locale/gl/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/gl/foreman_openscap.edit.po +1440 -0
- data/locale/gl/foreman_openscap.po +4 -16
- data/locale/gl/foreman_openscap.po.time_stamp +0 -0
- data/locale/it/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/it/foreman_openscap.edit.po +1442 -0
- data/locale/it/foreman_openscap.po +10 -22
- data/locale/it/foreman_openscap.po.time_stamp +0 -0
- data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ja/foreman_openscap.edit.po +1450 -0
- data/locale/ja/foreman_openscap.po +68 -80
- data/locale/ja/foreman_openscap.po.time_stamp +0 -0
- data/locale/ka/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ka/foreman_openscap.edit.po +1444 -0
- data/locale/ka/foreman_openscap.po +28 -40
- data/locale/ka/foreman_openscap.po.time_stamp +0 -0
- data/locale/ko/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ko/foreman_openscap.edit.po +1440 -0
- data/locale/ko/foreman_openscap.po +12 -24
- data/locale/ko/foreman_openscap.po.time_stamp +0 -0
- data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/pt_BR/foreman_openscap.edit.po +1454 -0
- data/locale/pt_BR/foreman_openscap.po +9 -21
- data/locale/pt_BR/foreman_openscap.po.time_stamp +0 -0
- data/locale/ru/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ru/foreman_openscap.edit.po +1444 -0
- data/locale/ru/foreman_openscap.po +8 -20
- data/locale/ru/foreman_openscap.po.time_stamp +0 -0
- data/locale/sv_SE/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/sv_SE/foreman_openscap.edit.po +1440 -0
- data/locale/sv_SE/foreman_openscap.po +6 -18
- data/locale/sv_SE/foreman_openscap.po.time_stamp +0 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/zh_CN/foreman_openscap.edit.po +1449 -0
- data/locale/zh_CN/foreman_openscap.po +67 -79
- data/locale/zh_CN/foreman_openscap.po.time_stamp +0 -0
- data/locale/zh_TW/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/zh_TW/foreman_openscap.edit.po +1441 -0
- data/locale/zh_TW/foreman_openscap.po +9 -21
- data/locale/zh_TW/foreman_openscap.po.time_stamp +0 -0
- data/test/unit/message_cleaner_test.rb +1 -0
- metadata +35 -7
- data/locale/action_names.rb +0 -2
- data/webpack/components/EditableInput.js +0 -166
- data/webpack/components/EditableInput.scss +0 -3
- data/webpack/helpers/formFieldsHelper.js +0 -114
@@ -6,11 +6,11 @@
|
|
6
6
|
# FIRST AUTHOR <EMAIL@ADDRESS>, 2016
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version:
|
9
|
+
"Project-Id-Version: foreman_openscap 10.0.1\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
11
|
"PO-Revision-Date: 2016-04-14 07:48+0000\n"
|
12
12
|
"Last-Translator: FIRST AUTHOR <EMAIL@ADDRESS>, 2016\n"
|
13
|
-
"Language-Team: Chinese (Taiwan) (http://
|
13
|
+
"Language-Team: Chinese (Taiwan) (http://app.transifex.com/foreman/foreman/lang"
|
14
14
|
"uage/zh_TW/)\n"
|
15
15
|
"MIME-Version: 1.0\n"
|
16
16
|
"Content-Type: text/plain; charset=UTF-8\n"
|
@@ -135,7 +135,7 @@ msgid "Choose weekday"
|
|
135
135
|
msgstr "選擇星期幾"
|
136
136
|
|
137
137
|
msgid "Close"
|
138
|
-
msgstr ""
|
138
|
+
msgstr "關閉"
|
139
139
|
|
140
140
|
msgid "Compliance"
|
141
141
|
msgstr "合規"
|
@@ -192,7 +192,7 @@ msgid "Create a Tailoring file"
|
|
192
192
|
msgstr ""
|
193
193
|
|
194
194
|
msgid "Created at"
|
195
|
-
msgstr ""
|
195
|
+
msgstr "建立於"
|
196
196
|
|
197
197
|
msgid "Dashboard"
|
198
198
|
msgstr "控制面板"
|
@@ -461,7 +461,7 @@ msgid "Locations"
|
|
461
461
|
msgstr "位置"
|
462
462
|
|
463
463
|
msgid "Manual"
|
464
|
-
msgstr ""
|
464
|
+
msgstr "手動式"
|
465
465
|
|
466
466
|
msgid "Message"
|
467
467
|
msgstr "訊息"
|
@@ -556,9 +556,6 @@ msgstr "無"
|
|
556
556
|
msgid "None found"
|
557
557
|
msgstr "未找到"
|
558
558
|
|
559
|
-
msgid "None provided"
|
560
|
-
msgstr ""
|
561
|
-
|
562
559
|
msgid "None!"
|
563
560
|
msgstr "無!"
|
564
561
|
|
@@ -619,7 +616,7 @@ msgid "Passed|P"
|
|
619
616
|
msgstr "Passed|P"
|
620
617
|
|
621
618
|
msgid "Permission denied"
|
622
|
-
msgstr ""
|
619
|
+
msgstr "使用權限被拒"
|
623
620
|
|
624
621
|
msgid "Please Confirm"
|
625
622
|
msgstr "請確認"
|
@@ -763,7 +760,7 @@ msgid "Rule Results"
|
|
763
760
|
msgstr ""
|
764
761
|
|
765
762
|
msgid "Run"
|
766
|
-
msgstr ""
|
763
|
+
msgstr "執行"
|
767
764
|
|
768
765
|
msgid "Run OpenSCAP remediation with Ansible"
|
769
766
|
msgstr ""
|
@@ -850,7 +847,7 @@ msgid "Smart Class Parameters"
|
|
850
847
|
msgstr ""
|
851
848
|
|
852
849
|
msgid "Snippet"
|
853
|
-
msgstr ""
|
850
|
+
msgstr "程式碼片段"
|
854
851
|
|
855
852
|
msgid "Something went wrong while selecting compliance reports - %s"
|
856
853
|
msgstr "選擇合規報告時發生了錯誤 - %s"
|
@@ -914,12 +911,6 @@ msgstr ""
|
|
914
911
|
msgid "The following %{key_name} were missing for %{item_name}: %{key_names}. Make sure they are imported before proceeding."
|
915
912
|
msgstr ""
|
916
913
|
|
917
|
-
msgid "The following Smart Proxies need to be updated to unlock the feature: %s. "
|
918
|
-
msgstr ""
|
919
|
-
|
920
|
-
msgid "The following proxies could not be reached: %s. Please make sure they are available so Foreman can check their versions."
|
921
|
-
msgstr ""
|
922
|
-
|
923
914
|
msgid "The identifier of the host"
|
924
915
|
msgstr ""
|
925
916
|
|
@@ -938,9 +929,6 @@ msgstr ""
|
|
938
929
|
msgid "There's no available report for this host"
|
939
930
|
msgstr ""
|
940
931
|
|
941
|
-
msgid "This feature is temporarily disabled. "
|
942
|
-
msgstr ""
|
943
|
-
|
944
932
|
msgid "This leaves the setup of the foreman_scap_client solely on the user. The policy still needs to be defined in order to link incoming ARF reports."
|
945
933
|
msgstr ""
|
946
934
|
|
@@ -948,7 +936,7 @@ msgid "This profile will be used to override the one from scap content"
|
|
948
936
|
msgstr ""
|
949
937
|
|
950
938
|
msgid "Title"
|
951
|
-
msgstr ""
|
939
|
+
msgstr "標題"
|
952
940
|
|
953
941
|
msgid "To deploy foreman_scap_client, ansible roles run needs to be triggered manually. Manual run is also required after any change to this policy."
|
954
942
|
msgstr ""
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_openscap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- slukasik@redhat.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -294,41 +294,72 @@ files:
|
|
294
294
|
- lib/foreman_openscap/version.rb
|
295
295
|
- lib/tasks/foreman_openscap_tasks.rake
|
296
296
|
- locale/Makefile
|
297
|
-
- locale/action_names.rb
|
298
297
|
- locale/cs_CZ/LC_MESSAGES/foreman_openscap.mo
|
298
|
+
- locale/cs_CZ/foreman_openscap.edit.po
|
299
299
|
- locale/cs_CZ/foreman_openscap.po
|
300
|
+
- locale/cs_CZ/foreman_openscap.po.time_stamp
|
300
301
|
- locale/de/LC_MESSAGES/foreman_openscap.mo
|
302
|
+
- locale/de/foreman_openscap.edit.po
|
301
303
|
- locale/de/foreman_openscap.po
|
304
|
+
- locale/de/foreman_openscap.po.time_stamp
|
302
305
|
- locale/en/LC_MESSAGES/foreman_openscap.mo
|
306
|
+
- locale/en/foreman_openscap.edit.po
|
303
307
|
- locale/en/foreman_openscap.po
|
308
|
+
- locale/en/foreman_openscap.po.time_stamp
|
304
309
|
- locale/en_GB/LC_MESSAGES/foreman_openscap.mo
|
310
|
+
- locale/en_GB/foreman_openscap.edit.po
|
305
311
|
- locale/en_GB/foreman_openscap.po
|
312
|
+
- locale/en_GB/foreman_openscap.po.time_stamp
|
306
313
|
- locale/es/LC_MESSAGES/foreman_openscap.mo
|
314
|
+
- locale/es/foreman_openscap.edit.po
|
307
315
|
- locale/es/foreman_openscap.po
|
316
|
+
- locale/es/foreman_openscap.po.time_stamp
|
308
317
|
- locale/foreman_openscap.pot
|
309
318
|
- locale/fr/LC_MESSAGES/foreman_openscap.mo
|
319
|
+
- locale/fr/foreman_openscap.edit.po
|
310
320
|
- locale/fr/foreman_openscap.po
|
321
|
+
- locale/fr/foreman_openscap.po.time_stamp
|
311
322
|
- locale/gl/LC_MESSAGES/foreman_openscap.mo
|
323
|
+
- locale/gl/foreman_openscap.edit.po
|
312
324
|
- locale/gl/foreman_openscap.po
|
325
|
+
- locale/gl/foreman_openscap.po.time_stamp
|
313
326
|
- locale/it/LC_MESSAGES/foreman_openscap.mo
|
327
|
+
- locale/it/foreman_openscap.edit.po
|
314
328
|
- locale/it/foreman_openscap.po
|
329
|
+
- locale/it/foreman_openscap.po.time_stamp
|
315
330
|
- locale/ja/LC_MESSAGES/foreman_openscap.mo
|
331
|
+
- locale/ja/foreman_openscap.edit.po
|
316
332
|
- locale/ja/foreman_openscap.po
|
333
|
+
- locale/ja/foreman_openscap.po.time_stamp
|
317
334
|
- locale/ka/LC_MESSAGES/foreman_openscap.mo
|
335
|
+
- locale/ka/foreman_openscap.edit.po
|
318
336
|
- locale/ka/foreman_openscap.po
|
337
|
+
- locale/ka/foreman_openscap.po.time_stamp
|
319
338
|
- locale/ko/LC_MESSAGES/foreman_openscap.mo
|
339
|
+
- locale/ko/foreman_openscap.edit.po
|
320
340
|
- locale/ko/foreman_openscap.po
|
341
|
+
- locale/ko/foreman_openscap.po.time_stamp
|
321
342
|
- locale/pt_BR/LC_MESSAGES/foreman_openscap.mo
|
343
|
+
- locale/pt_BR/foreman_openscap.edit.po
|
322
344
|
- locale/pt_BR/foreman_openscap.po
|
345
|
+
- locale/pt_BR/foreman_openscap.po.time_stamp
|
323
346
|
- locale/ru/LC_MESSAGES/foreman_openscap.mo
|
347
|
+
- locale/ru/foreman_openscap.edit.po
|
324
348
|
- locale/ru/foreman_openscap.po
|
349
|
+
- locale/ru/foreman_openscap.po.time_stamp
|
325
350
|
- locale/sv_SE/LC_MESSAGES/foreman_openscap.mo
|
351
|
+
- locale/sv_SE/foreman_openscap.edit.po
|
326
352
|
- locale/sv_SE/foreman_openscap.po
|
353
|
+
- locale/sv_SE/foreman_openscap.po.time_stamp
|
327
354
|
- locale/zanata.xml
|
328
355
|
- locale/zh_CN/LC_MESSAGES/foreman_openscap.mo
|
356
|
+
- locale/zh_CN/foreman_openscap.edit.po
|
329
357
|
- locale/zh_CN/foreman_openscap.po
|
358
|
+
- locale/zh_CN/foreman_openscap.po.time_stamp
|
330
359
|
- locale/zh_TW/LC_MESSAGES/foreman_openscap.mo
|
360
|
+
- locale/zh_TW/foreman_openscap.edit.po
|
331
361
|
- locale/zh_TW/foreman_openscap.po
|
362
|
+
- locale/zh_TW/foreman_openscap.po.time_stamp
|
332
363
|
- package.json
|
333
364
|
- test/factories/arf_report_factory.rb
|
334
365
|
- test/factories/asset_factory.rb
|
@@ -377,8 +408,6 @@ files:
|
|
377
408
|
- test/unit/tailoring_file_test.rb
|
378
409
|
- webpack/components/ConfirmModal.js
|
379
410
|
- webpack/components/ConfirmModal.scss
|
380
|
-
- webpack/components/EditableInput.js
|
381
|
-
- webpack/components/EditableInput.scss
|
382
411
|
- webpack/components/EmptyState.js
|
383
412
|
- webpack/components/HostExtentions/HostKebabItems.js
|
384
413
|
- webpack/components/IndexLayout.js
|
@@ -413,7 +442,6 @@ files:
|
|
413
442
|
- webpack/components/withLoading.js
|
414
443
|
- webpack/global_index.js
|
415
444
|
- webpack/helpers/commonHelper.js
|
416
|
-
- webpack/helpers/formFieldsHelper.js
|
417
445
|
- webpack/helpers/globalIdHelper.js
|
418
446
|
- webpack/helpers/mutationHelper.js
|
419
447
|
- webpack/helpers/pageParamsHelper.js
|
@@ -441,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
441
469
|
- !ruby/object:Gem::Version
|
442
470
|
version: '0'
|
443
471
|
requirements: []
|
444
|
-
rubygems_version: 3.
|
472
|
+
rubygems_version: 3.2.33
|
445
473
|
signing_key:
|
446
474
|
specification_version: 4
|
447
475
|
summary: Foreman plug-in for displaying OpenSCAP audit reports
|
data/locale/action_names.rb
DELETED
@@ -1,166 +0,0 @@
|
|
1
|
-
import React, { useState } from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
4
|
-
import {
|
5
|
-
Button,
|
6
|
-
Split,
|
7
|
-
SplitItem,
|
8
|
-
Spinner,
|
9
|
-
FormGroup,
|
10
|
-
} from '@patternfly/react-core';
|
11
|
-
import {
|
12
|
-
TimesIcon,
|
13
|
-
CheckIcon,
|
14
|
-
PencilAltIcon,
|
15
|
-
ExclamationCircleIcon,
|
16
|
-
} from '@patternfly/react-icons';
|
17
|
-
|
18
|
-
import './EditableInput.scss';
|
19
|
-
|
20
|
-
const EditableInput = props => {
|
21
|
-
const [editing, setEditing] = useState(false);
|
22
|
-
const [submitting, setSubmitting] = useState(false);
|
23
|
-
const [inputValue, setInputValue] = useState(props.value);
|
24
|
-
const [error, setError] = useState('');
|
25
|
-
const [touched, setTouched] = useState(false);
|
26
|
-
|
27
|
-
const stopSubmitting = () => setSubmitting(false);
|
28
|
-
|
29
|
-
const handleSubmit = event => {
|
30
|
-
event.preventDefault();
|
31
|
-
onSubmit();
|
32
|
-
};
|
33
|
-
|
34
|
-
const onFinish = () => {
|
35
|
-
setSubmitting(false);
|
36
|
-
setEditing(false);
|
37
|
-
};
|
38
|
-
|
39
|
-
const onSubmit = () => {
|
40
|
-
setSubmitting(true);
|
41
|
-
props.onConfirm(inputValue, onFinish, stopSubmitting, onError);
|
42
|
-
};
|
43
|
-
|
44
|
-
const onError = err => {
|
45
|
-
setTouched(false);
|
46
|
-
setError(err);
|
47
|
-
};
|
48
|
-
|
49
|
-
const onCancel = () => {
|
50
|
-
setInputValue(props.value);
|
51
|
-
setEditing(false);
|
52
|
-
setError('');
|
53
|
-
};
|
54
|
-
|
55
|
-
const onChange = value => {
|
56
|
-
if (!touched) {
|
57
|
-
setTouched(true);
|
58
|
-
}
|
59
|
-
setInputValue(value);
|
60
|
-
};
|
61
|
-
|
62
|
-
const editBtn = (
|
63
|
-
<SplitItem>
|
64
|
-
<Button
|
65
|
-
ouiaId={`oscap-edit-${props.attrName}-edit-button`}
|
66
|
-
className="inline-edit-icon"
|
67
|
-
aria-label={`edit ${props.attrName}`}
|
68
|
-
variant="plain"
|
69
|
-
onClick={() => setEditing(true)}
|
70
|
-
>
|
71
|
-
<PencilAltIcon />
|
72
|
-
</Button>
|
73
|
-
</SplitItem>
|
74
|
-
);
|
75
|
-
|
76
|
-
if (!editing) {
|
77
|
-
return (
|
78
|
-
<Split>
|
79
|
-
<SplitItem>{props.value || <i>{__('None provided')}</i>}</SplitItem>
|
80
|
-
{props.allowed && editBtn}
|
81
|
-
</Split>
|
82
|
-
);
|
83
|
-
}
|
84
|
-
|
85
|
-
const Component = props.component;
|
86
|
-
|
87
|
-
const shouldValidate = (isTouched, err) => {
|
88
|
-
if (!isTouched) {
|
89
|
-
return err ? 'error' : 'success';
|
90
|
-
}
|
91
|
-
return 'noval';
|
92
|
-
};
|
93
|
-
|
94
|
-
const valid = shouldValidate(touched, error);
|
95
|
-
|
96
|
-
return (
|
97
|
-
<Split>
|
98
|
-
<SplitItem>
|
99
|
-
<form onSubmit={handleSubmit} className="pf-c-form">
|
100
|
-
<FormGroup
|
101
|
-
helperTextInvalid={error}
|
102
|
-
helperTextInvalidIcon={<ExclamationCircleIcon />}
|
103
|
-
validated={valid}
|
104
|
-
>
|
105
|
-
<Component
|
106
|
-
{...props.inputProps}
|
107
|
-
type="text"
|
108
|
-
aria-label={`${props.attrName} text input`}
|
109
|
-
isDisabled={submitting}
|
110
|
-
value={inputValue || ''}
|
111
|
-
onChange={onChange}
|
112
|
-
validated={valid}
|
113
|
-
/>
|
114
|
-
</FormGroup>
|
115
|
-
</form>
|
116
|
-
</SplitItem>
|
117
|
-
<SplitItem>
|
118
|
-
<Button
|
119
|
-
ouiaId={`oscap-edit-${props.attrName}-submit-button`}
|
120
|
-
aria-label={`submit ${props.attrName}`}
|
121
|
-
variant="plain"
|
122
|
-
onClick={onSubmit}
|
123
|
-
isDisabled={submitting}
|
124
|
-
>
|
125
|
-
<CheckIcon />
|
126
|
-
</Button>
|
127
|
-
</SplitItem>
|
128
|
-
<SplitItem>
|
129
|
-
<Button
|
130
|
-
ouiaId={`oscap-edit-${props.attrName}-cancel-button`}
|
131
|
-
aria-label={`cancel editing ${props.attrName}`}
|
132
|
-
variant="plain"
|
133
|
-
onClick={onCancel}
|
134
|
-
isDisabled={submitting}
|
135
|
-
>
|
136
|
-
<TimesIcon />
|
137
|
-
</Button>
|
138
|
-
</SplitItem>
|
139
|
-
<SplitItem>
|
140
|
-
{submitting && (
|
141
|
-
<Spinner
|
142
|
-
key="spinner"
|
143
|
-
size="lg"
|
144
|
-
id={`edit-${props.attrName}-spinner`}
|
145
|
-
/>
|
146
|
-
)}
|
147
|
-
</SplitItem>
|
148
|
-
</Split>
|
149
|
-
);
|
150
|
-
};
|
151
|
-
|
152
|
-
EditableInput.propTypes = {
|
153
|
-
allowed: PropTypes.bool.isRequired,
|
154
|
-
value: PropTypes.string,
|
155
|
-
onConfirm: PropTypes.func.isRequired,
|
156
|
-
attrName: PropTypes.string.isRequired,
|
157
|
-
component: PropTypes.object.isRequired,
|
158
|
-
inputProps: PropTypes.object,
|
159
|
-
};
|
160
|
-
|
161
|
-
EditableInput.defaultProps = {
|
162
|
-
inputProps: {},
|
163
|
-
value: '',
|
164
|
-
};
|
165
|
-
|
166
|
-
export default EditableInput;
|
@@ -1,114 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
|
4
|
-
import {
|
5
|
-
FormGroup,
|
6
|
-
TextInput,
|
7
|
-
TextArea,
|
8
|
-
FormSelect,
|
9
|
-
FormSelectOption,
|
10
|
-
} from '@patternfly/react-core';
|
11
|
-
import { ExclamationCircleIcon } from '@patternfly/react-icons';
|
12
|
-
|
13
|
-
export const SelectField = props => {
|
14
|
-
const { selectItems, field, form } = props;
|
15
|
-
const fieldProps = wrapFieldProps(field);
|
16
|
-
|
17
|
-
const valid = shouldValidate(form, field.name);
|
18
|
-
|
19
|
-
return (
|
20
|
-
<FormGroup
|
21
|
-
label={props.label}
|
22
|
-
isRequired={props.isRequired}
|
23
|
-
helperTextInvalid={form.errors[field.name]}
|
24
|
-
helperTextInvalidIcon={<ExclamationCircleIcon />}
|
25
|
-
validated={valid}
|
26
|
-
>
|
27
|
-
<FormSelect
|
28
|
-
ouiaId={`oscap-form-sel-${field.name}`}
|
29
|
-
{...fieldProps}
|
30
|
-
className="without_select2"
|
31
|
-
aria-label={fieldProps.name}
|
32
|
-
validated={valid}
|
33
|
-
isDisabled={form.isSubmitting}
|
34
|
-
>
|
35
|
-
<FormSelectOption key={0} value="" label={props.blankLabel} />
|
36
|
-
{selectItems.map((item, idx) => (
|
37
|
-
<FormSelectOption key={idx + 1} value={item.id} label={item.name} />
|
38
|
-
))}
|
39
|
-
</FormSelect>
|
40
|
-
</FormGroup>
|
41
|
-
);
|
42
|
-
};
|
43
|
-
|
44
|
-
SelectField.propTypes = {
|
45
|
-
selectItems: PropTypes.array,
|
46
|
-
label: PropTypes.string.isRequired,
|
47
|
-
isRequired: PropTypes.bool,
|
48
|
-
field: PropTypes.object.isRequired,
|
49
|
-
form: PropTypes.object.isRequired,
|
50
|
-
blankLabel: PropTypes.string.isRequired,
|
51
|
-
};
|
52
|
-
SelectField.defaultProps = {
|
53
|
-
selectItems: [],
|
54
|
-
isRequired: false,
|
55
|
-
};
|
56
|
-
|
57
|
-
const wrapFieldProps = fieldProps => {
|
58
|
-
const { onChange } = fieldProps;
|
59
|
-
// modify onChange args to correctly wire formik with pf4 input handlers
|
60
|
-
const wrappedOnChange = (value, event) => {
|
61
|
-
onChange(event);
|
62
|
-
};
|
63
|
-
|
64
|
-
return { ...fieldProps, onChange: wrappedOnChange };
|
65
|
-
};
|
66
|
-
|
67
|
-
const shouldValidate = (form, fieldName) => {
|
68
|
-
if (form.touched[fieldName]) {
|
69
|
-
return form.errors[fieldName] ? 'error' : 'success';
|
70
|
-
}
|
71
|
-
|
72
|
-
return 'noval';
|
73
|
-
};
|
74
|
-
|
75
|
-
const fieldWithHandlers = Component => {
|
76
|
-
const Subcomponent = ({ label, form, field, isRequired, ...rest }) => {
|
77
|
-
const fieldProps = wrapFieldProps(field);
|
78
|
-
const valid = shouldValidate(form, field.name);
|
79
|
-
|
80
|
-
return (
|
81
|
-
<FormGroup
|
82
|
-
label={label}
|
83
|
-
isRequired={isRequired}
|
84
|
-
helperTextInvalid={form.errors[field.name]}
|
85
|
-
helperTextInvalidIcon={<ExclamationCircleIcon />}
|
86
|
-
validated={valid}
|
87
|
-
>
|
88
|
-
<Component
|
89
|
-
aria-label={fieldProps.name}
|
90
|
-
{...fieldProps}
|
91
|
-
{...rest}
|
92
|
-
validated={valid}
|
93
|
-
isDisabled={form.isSubmitting}
|
94
|
-
/>
|
95
|
-
</FormGroup>
|
96
|
-
);
|
97
|
-
};
|
98
|
-
|
99
|
-
Subcomponent.propTypes = {
|
100
|
-
form: PropTypes.object.isRequired,
|
101
|
-
field: PropTypes.object.isRequired,
|
102
|
-
label: PropTypes.string.isRequired,
|
103
|
-
isRequired: PropTypes.bool,
|
104
|
-
};
|
105
|
-
|
106
|
-
Subcomponent.defaultProps = {
|
107
|
-
isRequired: false,
|
108
|
-
};
|
109
|
-
|
110
|
-
return Subcomponent;
|
111
|
-
};
|
112
|
-
|
113
|
-
export const TextField = fieldWithHandlers(TextInput);
|
114
|
-
export const TextAreaField = fieldWithHandlers(TextArea);
|