foreman_openscap 10.0.0 → 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 -118
- data/app/assets/javascripts/foreman_openscap/locale/de/foreman_openscap.js +12 -15
- data/app/assets/javascripts/foreman_openscap/locale/en/foreman_openscap.js +1 -4
- data/app/assets/javascripts/foreman_openscap/locale/en_GB/foreman_openscap.js +3 -6
- data/app/assets/javascripts/foreman_openscap/locale/es/foreman_openscap.js +12 -15
- data/app/assets/javascripts/foreman_openscap/locale/fr/foreman_openscap.js +83 -86
- data/app/assets/javascripts/foreman_openscap/locale/gl/foreman_openscap.js +4 -7
- data/app/assets/javascripts/foreman_openscap/locale/it/foreman_openscap.js +10 -13
- data/app/assets/javascripts/foreman_openscap/locale/ja/foreman_openscap.js +68 -71
- data/app/assets/javascripts/foreman_openscap/locale/ka/foreman_openscap.js +28 -31
- data/app/assets/javascripts/foreman_openscap/locale/ko/foreman_openscap.js +12 -15
- data/app/assets/javascripts/foreman_openscap/locale/pt_BR/foreman_openscap.js +9 -12
- data/app/assets/javascripts/foreman_openscap/locale/ru/foreman_openscap.js +8 -11
- data/app/assets/javascripts/foreman_openscap/locale/sv_SE/foreman_openscap.js +6 -9
- data/app/assets/javascripts/foreman_openscap/locale/zh_CN/foreman_openscap.js +67 -70
- data/app/assets/javascripts/foreman_openscap/locale/zh_TW/foreman_openscap.js +9 -12
- 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 +121 -122
- data/locale/cs_CZ/foreman_openscap.po +120 -121
- data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/de/foreman_openscap.edit.po +17 -31
- data/locale/de/foreman_openscap.po +13 -16
- data/locale/en/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/en/foreman_openscap.edit.po +1 -5
- data/locale/en/foreman_openscap.po +1 -4
- data/locale/en_GB/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/en_GB/foreman_openscap.edit.po +4 -7
- data/locale/en_GB/foreman_openscap.po +3 -6
- data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/es/foreman_openscap.edit.po +16 -30
- data/locale/es/foreman_openscap.po +12 -15
- data/locale/foreman_openscap.pot +2 -6
- data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/fr/foreman_openscap.edit.po +87 -101
- data/locale/fr/foreman_openscap.po +83 -86
- data/locale/gl/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/gl/foreman_openscap.edit.po +5 -8
- data/locale/gl/foreman_openscap.po +4 -7
- data/locale/it/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/it/foreman_openscap.edit.po +11 -14
- data/locale/it/foreman_openscap.po +10 -13
- data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ja/foreman_openscap.edit.po +72 -82
- data/locale/ja/foreman_openscap.po +68 -71
- data/locale/ka/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ka/foreman_openscap.edit.po +32 -37
- data/locale/ka/foreman_openscap.po +28 -31
- data/locale/ko/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ko/foreman_openscap.edit.po +13 -16
- data/locale/ko/foreman_openscap.po +12 -15
- data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/pt_BR/foreman_openscap.edit.po +13 -27
- data/locale/pt_BR/foreman_openscap.po +9 -12
- data/locale/ru/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ru/foreman_openscap.edit.po +9 -12
- data/locale/ru/foreman_openscap.po +8 -11
- data/locale/sv_SE/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/sv_SE/foreman_openscap.edit.po +7 -10
- data/locale/sv_SE/foreman_openscap.po +6 -9
- data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/zh_CN/foreman_openscap.edit.po +71 -81
- data/locale/zh_CN/foreman_openscap.po +67 -70
- data/locale/zh_TW/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/zh_TW/foreman_openscap.edit.po +10 -13
- data/locale/zh_TW/foreman_openscap.po +9 -12
- metadata +2 -6
- 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
@@ -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);
|