foreman_scc_manager 5.0.4 → 5.1.0
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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/assets/javascripts/foreman_scc_manager/locale/de/foreman_scc_manager.js +55 -256
- data/app/assets/javascripts/foreman_scc_manager/locale/el/foreman_scc_manager.js +43 -244
- data/app/assets/javascripts/foreman_scc_manager/locale/en/foreman_scc_manager.js +381 -2
- data/app/assets/javascripts/foreman_scc_manager/locale/fr/foreman_scc_manager.js +58 -259
- data/app/assets/javascripts/foreman_scc_manager/locale/ja/foreman_scc_manager.js +58 -259
- data/app/assets/javascripts/foreman_scc_manager/locale/ka/foreman_scc_manager.js +58 -259
- data/app/assets/javascripts/foreman_scc_manager/locale/ko/foreman_scc_manager.js +55 -256
- data/app/assets/javascripts/foreman_scc_manager/locale/zh_CN/foreman_scc_manager.js +58 -259
- data/app/controllers/api/v2/scc_accounts_controller.rb +4 -2
- data/app/models/scc_account.rb +1 -1
- data/app/views/scc_accounts/edit.html.erb +24 -2
- data/app/views/scc_accounts/new.html.erb +12 -1
- data/lib/foreman_scc_manager/version.rb +1 -1
- data/locale/de/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/de/foreman_scc_manager.po +55 -257
- data/locale/el/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/el/foreman_scc_manager.po +44 -246
- data/locale/en/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/en/foreman_scc_manager.po +392 -0
- data/locale/foreman_scc_manager.pot +195 -461
- data/locale/fr/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/fr/foreman_scc_manager.po +58 -260
- data/locale/ja/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/ja/foreman_scc_manager.po +58 -260
- data/locale/ka/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/ka/foreman_scc_manager.po +58 -260
- data/locale/ko/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/ko/foreman_scc_manager.po +55 -257
- data/locale/zh_CN/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/zh_CN/foreman_scc_manager.po +58 -260
- data/test/controllers/api/v2/scc_accounts_test.rb +5 -5
- data/webpack/components/SCCAccountForm/SCCAccountForm.scss +49 -0
- data/webpack/components/SCCAccountForm/SCCAccountFormActions.js +74 -0
- data/webpack/components/SCCAccountForm/components/DateTimeField.js +72 -0
- data/webpack/components/SCCAccountForm/components/SCCCredentialsCard.js +150 -0
- data/webpack/components/SCCAccountForm/components/SCCSyncSettingsCard.js +256 -0
- data/webpack/components/SCCAccountForm/components/SCCTokenRefreshCard.js +133 -0
- data/webpack/components/SCCAccountForm/index.js +306 -0
- data/webpack/index.js +6 -0
- metadata +9 -18
- data/app/assets/javascripts/foreman_scc_manager/scc_accounts.js.coffee +0 -46
- data/app/views/scc_accounts/_form.html.erb +0 -51
@@ -0,0 +1,72 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import {
|
4
|
+
FormGroup,
|
5
|
+
InputGroup,
|
6
|
+
DatePicker,
|
7
|
+
TimePicker,
|
8
|
+
} from '@patternfly/react-core';
|
9
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
10
|
+
|
11
|
+
export const formatDateTime = (dateStr, timeStr) => {
|
12
|
+
if (!dateStr || !timeStr) return undefined;
|
13
|
+
|
14
|
+
const match = timeStr.match(/^(\d{1,2}):(\d{2})\s*([AP]M)$/i);
|
15
|
+
if (!match) return undefined;
|
16
|
+
|
17
|
+
const [, hourStr, minuteStr, ampm] = match;
|
18
|
+
const hour24 =
|
19
|
+
(parseInt(hourStr, 10) % 12) + (ampm.toUpperCase() === 'PM' ? 12 : 0);
|
20
|
+
|
21
|
+
const [year, month, day] = dateStr.split('-').map(Number);
|
22
|
+
if (!year || !month || !day) return undefined;
|
23
|
+
|
24
|
+
const date = new Date(
|
25
|
+
year,
|
26
|
+
month - 1,
|
27
|
+
day,
|
28
|
+
hour24,
|
29
|
+
parseInt(minuteStr, 10),
|
30
|
+
0,
|
31
|
+
0
|
32
|
+
);
|
33
|
+
return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
|
34
|
+
};
|
35
|
+
|
36
|
+
const DateTimeField = ({
|
37
|
+
id,
|
38
|
+
label,
|
39
|
+
date,
|
40
|
+
time,
|
41
|
+
onDateChange,
|
42
|
+
onTimeChange,
|
43
|
+
}) => (
|
44
|
+
<FormGroup label={label} fieldId={id} ouiaId={`${id}-form-group`}>
|
45
|
+
<InputGroup ouiaId={`${id}-input-group`}>
|
46
|
+
<DatePicker
|
47
|
+
value={date}
|
48
|
+
onChange={(_, val) => onDateChange(val)}
|
49
|
+
placeholder={__('YYYY-MM-DD')}
|
50
|
+
ouiaId={`${id}-date-picker`}
|
51
|
+
/>
|
52
|
+
<TimePicker
|
53
|
+
id={`${id}-time`}
|
54
|
+
time={time}
|
55
|
+
onChange={(_e, timeStr) => onTimeChange(timeStr)}
|
56
|
+
placeholder={__('HH:MM AM')}
|
57
|
+
ouiaId={`${id}-time-picker`}
|
58
|
+
/>
|
59
|
+
</InputGroup>
|
60
|
+
</FormGroup>
|
61
|
+
);
|
62
|
+
|
63
|
+
DateTimeField.propTypes = {
|
64
|
+
id: PropTypes.string.isRequired,
|
65
|
+
label: PropTypes.node.isRequired,
|
66
|
+
date: PropTypes.string.isRequired,
|
67
|
+
time: PropTypes.string.isRequired,
|
68
|
+
onDateChange: PropTypes.func.isRequired,
|
69
|
+
onTimeChange: PropTypes.func.isRequired,
|
70
|
+
};
|
71
|
+
|
72
|
+
export default DateTimeField;
|
@@ -0,0 +1,150 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
4
|
+
import {
|
5
|
+
Card,
|
6
|
+
CardTitle,
|
7
|
+
CardBody,
|
8
|
+
Grid,
|
9
|
+
GridItem,
|
10
|
+
FormGroup,
|
11
|
+
TextInput,
|
12
|
+
Button,
|
13
|
+
Tooltip,
|
14
|
+
CardHeader,
|
15
|
+
} from '@patternfly/react-core';
|
16
|
+
|
17
|
+
const SCCCredentialsCard = ({
|
18
|
+
name,
|
19
|
+
login,
|
20
|
+
password,
|
21
|
+
baseUrl,
|
22
|
+
testing,
|
23
|
+
onNameChange,
|
24
|
+
onLoginChange,
|
25
|
+
onPasswordChange,
|
26
|
+
onBaseUrlChange,
|
27
|
+
onTestConnection,
|
28
|
+
}) => (
|
29
|
+
<Card isFlat ouiaId="scc-credentials-card">
|
30
|
+
<CardHeader ouiaId="scc-credentials-card-header">
|
31
|
+
<CardTitle
|
32
|
+
component="h2"
|
33
|
+
className="pf-v5-u-font-size-xl pf-v5-u-mt-0"
|
34
|
+
ouiaId="scc-credentials-card-title"
|
35
|
+
>
|
36
|
+
{__('SCC Account Credentials')}
|
37
|
+
</CardTitle>
|
38
|
+
</CardHeader>
|
39
|
+
<CardBody ouiaId="scc-credentials-card-body">
|
40
|
+
<Grid hasGutter ouiaId="scc-credentials-grid">
|
41
|
+
<GridItem span={12} ouiaId="scc-name-grid-item">
|
42
|
+
<FormGroup
|
43
|
+
label={<span>{__('Name')}</span>}
|
44
|
+
isRequired
|
45
|
+
fieldId="scc-name"
|
46
|
+
ouiaId="scc-name-form-group"
|
47
|
+
>
|
48
|
+
<TextInput
|
49
|
+
id="scc-name"
|
50
|
+
isRequired
|
51
|
+
value={name}
|
52
|
+
onChange={(_, val) => onNameChange(val)}
|
53
|
+
ouiaId="scc-name-text-input"
|
54
|
+
/>
|
55
|
+
</FormGroup>
|
56
|
+
</GridItem>
|
57
|
+
|
58
|
+
<GridItem span={12} ouiaId="scc-login-grid-item">
|
59
|
+
<FormGroup
|
60
|
+
label={
|
61
|
+
<Tooltip
|
62
|
+
content={__(
|
63
|
+
"Use your 'Organization credentials' obtained from the SUSE Customer Center."
|
64
|
+
)}
|
65
|
+
ouiaId="scc-login-tooltip"
|
66
|
+
>
|
67
|
+
<span>{__('Login')}</span>
|
68
|
+
</Tooltip>
|
69
|
+
}
|
70
|
+
isRequired
|
71
|
+
fieldId="scc-login"
|
72
|
+
ouiaId="scc-login-form-group"
|
73
|
+
>
|
74
|
+
<TextInput
|
75
|
+
id="scc-login"
|
76
|
+
isRequired
|
77
|
+
value={login}
|
78
|
+
onChange={(_, val) => onLoginChange(val)}
|
79
|
+
ouiaId="scc-login-text-input"
|
80
|
+
/>
|
81
|
+
</FormGroup>
|
82
|
+
</GridItem>
|
83
|
+
|
84
|
+
<GridItem span={12} ouiaId="scc-password-grid-item">
|
85
|
+
<FormGroup
|
86
|
+
label={<span>{__('Password')}</span>}
|
87
|
+
isRequired
|
88
|
+
fieldId="scc-password"
|
89
|
+
ouiaId="scc-password-form-group"
|
90
|
+
>
|
91
|
+
<TextInput
|
92
|
+
id="scc-password"
|
93
|
+
type="password"
|
94
|
+
isRequired
|
95
|
+
value={password}
|
96
|
+
onChange={(_, val) => onPasswordChange(val)}
|
97
|
+
ouiaId="scc-password-text-input"
|
98
|
+
/>
|
99
|
+
</FormGroup>
|
100
|
+
</GridItem>
|
101
|
+
|
102
|
+
<GridItem span={12} ouiaId="scc-base-url-grid-item">
|
103
|
+
<FormGroup
|
104
|
+
label={<span>{__('Base URL')}</span>}
|
105
|
+
isRequired
|
106
|
+
fieldId="scc-base-url"
|
107
|
+
ouiaId="scc-base-url-form-group"
|
108
|
+
>
|
109
|
+
<TextInput
|
110
|
+
id="scc-base-url"
|
111
|
+
value={baseUrl}
|
112
|
+
onChange={(_, val) => onBaseUrlChange(val)}
|
113
|
+
placeholder="https://scc.suse.com"
|
114
|
+
ouiaId="scc-base-url-text-input"
|
115
|
+
/>
|
116
|
+
</FormGroup>
|
117
|
+
</GridItem>
|
118
|
+
|
119
|
+
<GridItem span={12} ouiaId="scc-test-connection-grid-item">
|
120
|
+
<div className="scc-account-form-test-connection">
|
121
|
+
<Button
|
122
|
+
variant="secondary"
|
123
|
+
onClick={onTestConnection}
|
124
|
+
isLoading={testing}
|
125
|
+
isDisabled={testing}
|
126
|
+
ouiaId="scc-test-connection-button"
|
127
|
+
>
|
128
|
+
{__('Test Connection')}
|
129
|
+
</Button>
|
130
|
+
</div>
|
131
|
+
</GridItem>
|
132
|
+
</Grid>
|
133
|
+
</CardBody>
|
134
|
+
</Card>
|
135
|
+
);
|
136
|
+
|
137
|
+
SCCCredentialsCard.propTypes = {
|
138
|
+
name: PropTypes.string.isRequired,
|
139
|
+
login: PropTypes.string.isRequired,
|
140
|
+
password: PropTypes.string.isRequired,
|
141
|
+
baseUrl: PropTypes.string.isRequired,
|
142
|
+
testing: PropTypes.bool.isRequired,
|
143
|
+
onNameChange: PropTypes.func.isRequired,
|
144
|
+
onLoginChange: PropTypes.func.isRequired,
|
145
|
+
onPasswordChange: PropTypes.func.isRequired,
|
146
|
+
onBaseUrlChange: PropTypes.func.isRequired,
|
147
|
+
onTestConnection: PropTypes.func.isRequired,
|
148
|
+
};
|
149
|
+
|
150
|
+
export default SCCCredentialsCard;
|
@@ -0,0 +1,256 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
4
|
+
import {
|
5
|
+
Card,
|
6
|
+
CardTitle,
|
7
|
+
CardBody,
|
8
|
+
Grid,
|
9
|
+
GridItem,
|
10
|
+
FormGroup,
|
11
|
+
Select,
|
12
|
+
SelectList,
|
13
|
+
SelectOption,
|
14
|
+
MenuToggle,
|
15
|
+
CardHeader,
|
16
|
+
Tooltip,
|
17
|
+
} from '@patternfly/react-core';
|
18
|
+
|
19
|
+
const SCCSyncSettingsCard = ({
|
20
|
+
gpgKey,
|
21
|
+
gpgKeyOptions,
|
22
|
+
openGpg,
|
23
|
+
downloadPolicy,
|
24
|
+
downloadPolicyOptions,
|
25
|
+
openDownload,
|
26
|
+
mirroringPolicy,
|
27
|
+
mirroringPolicyOptions,
|
28
|
+
openMirroring,
|
29
|
+
onGpgKeyChange,
|
30
|
+
onGpgOpenChange,
|
31
|
+
onDownloadPolicyChange,
|
32
|
+
onDownloadOpenChange,
|
33
|
+
onMirroringPolicyChange,
|
34
|
+
onMirroringOpenChange,
|
35
|
+
}) => (
|
36
|
+
<Card isFlat ouiaId="scc-sync-settings-card">
|
37
|
+
<CardHeader ouiaId="scc-sync-settings-card-header">
|
38
|
+
<CardTitle
|
39
|
+
component="h2"
|
40
|
+
className="pf-v5-u-font-size-xl pf-v5-u-mt-0"
|
41
|
+
ouiaId="scc-sync-settings-card-title"
|
42
|
+
>
|
43
|
+
{__('Repository Sync Settings')}
|
44
|
+
</CardTitle>
|
45
|
+
</CardHeader>
|
46
|
+
<CardBody ouiaId="scc-sync-settings-card-body">
|
47
|
+
<Grid hasGutter ouiaId="scc-sync-settings-grid">
|
48
|
+
<GridItem md={4} lg={4} sm={4} ouiaId="scc-gpg-key-grid-item">
|
49
|
+
<FormGroup
|
50
|
+
label={
|
51
|
+
<Tooltip
|
52
|
+
content={__(
|
53
|
+
"Use this setting if you want to automatically add a GPG key to your SUSE products upon subscription. You can change this setting in the 'Content' > 'Products' menu, later."
|
54
|
+
)}
|
55
|
+
ouiaId="scc-gpg-key-tooltip"
|
56
|
+
>
|
57
|
+
<span>{__('GPG key for SUSE products')}</span>
|
58
|
+
</Tooltip>
|
59
|
+
}
|
60
|
+
fieldId="scc-gpg"
|
61
|
+
ouiaId="scc-gpg-key-form-group"
|
62
|
+
>
|
63
|
+
<Select
|
64
|
+
id="scc-gpg"
|
65
|
+
isOpen={openGpg}
|
66
|
+
selected={gpgKey}
|
67
|
+
onSelect={(_, v) => {
|
68
|
+
onGpgKeyChange(String(v));
|
69
|
+
onGpgOpenChange(false);
|
70
|
+
}}
|
71
|
+
onOpenChange={onGpgOpenChange}
|
72
|
+
ouiaId="scc-gpg-key-select"
|
73
|
+
toggle={(ref) => (
|
74
|
+
<MenuToggle
|
75
|
+
ref={ref}
|
76
|
+
isExpanded={openGpg}
|
77
|
+
isFullWidth
|
78
|
+
onClick={() => onGpgOpenChange(!openGpg)}
|
79
|
+
ouiaId="scc-gpg-key-menu-toggle"
|
80
|
+
>
|
81
|
+
{gpgKey || __('None')}
|
82
|
+
</MenuToggle>
|
83
|
+
)}
|
84
|
+
>
|
85
|
+
<SelectList ouiaId="scc-gpg-key-select-list">
|
86
|
+
{gpgKeyOptions.length > 0 ? (
|
87
|
+
gpgKeyOptions.map(([label], index) => (
|
88
|
+
<SelectOption
|
89
|
+
key={index}
|
90
|
+
value={String(label)}
|
91
|
+
ouiaId={`scc-gpg-key-option-${index}`}
|
92
|
+
>
|
93
|
+
{String(label)}
|
94
|
+
</SelectOption>
|
95
|
+
))
|
96
|
+
) : (
|
97
|
+
<SelectOption value="" ouiaId="scc-gpg-key-option-none">
|
98
|
+
{__('None')}
|
99
|
+
</SelectOption>
|
100
|
+
)}
|
101
|
+
</SelectList>
|
102
|
+
</Select>
|
103
|
+
</FormGroup>
|
104
|
+
</GridItem>
|
105
|
+
|
106
|
+
<GridItem md={4} lg={4} sm={4} ouiaId="scc-download-policy-grid-item">
|
107
|
+
<FormGroup
|
108
|
+
label={
|
109
|
+
<Tooltip
|
110
|
+
content={__(
|
111
|
+
'The default download policy for repositories which were created using this SCC Account.'
|
112
|
+
)}
|
113
|
+
ouiaId="scc-download-policy-tooltip"
|
114
|
+
>
|
115
|
+
<span>{__('Download Policy')}</span>
|
116
|
+
</Tooltip>
|
117
|
+
}
|
118
|
+
fieldId="scc-download-policy"
|
119
|
+
ouiaId="scc-download-policy-form-group"
|
120
|
+
>
|
121
|
+
<Select
|
122
|
+
id="scc-download-policy"
|
123
|
+
isOpen={openDownload}
|
124
|
+
selected={downloadPolicy}
|
125
|
+
onSelect={(_, val) => {
|
126
|
+
onDownloadPolicyChange(String(val));
|
127
|
+
onDownloadOpenChange(false);
|
128
|
+
}}
|
129
|
+
onOpenChange={onDownloadOpenChange}
|
130
|
+
ouiaId="scc-download-policy-select"
|
131
|
+
toggle={(ref) => (
|
132
|
+
<MenuToggle
|
133
|
+
ref={ref}
|
134
|
+
isExpanded={openDownload}
|
135
|
+
onClick={() => onDownloadOpenChange(!openDownload)}
|
136
|
+
isFullWidth
|
137
|
+
ouiaId="scc-download-policy-menu-toggle"
|
138
|
+
>
|
139
|
+
{downloadPolicy}
|
140
|
+
</MenuToggle>
|
141
|
+
)}
|
142
|
+
>
|
143
|
+
<SelectList ouiaId="scc-download-policy-select-list">
|
144
|
+
{downloadPolicyOptions.map(([label], index) => (
|
145
|
+
<SelectOption
|
146
|
+
key={index}
|
147
|
+
value={String(label)}
|
148
|
+
ouiaId={`scc-download-policy-option-${index}`}
|
149
|
+
>
|
150
|
+
{String(label)}
|
151
|
+
</SelectOption>
|
152
|
+
))}
|
153
|
+
</SelectList>
|
154
|
+
</Select>
|
155
|
+
</FormGroup>
|
156
|
+
</GridItem>
|
157
|
+
|
158
|
+
<GridItem md={4} lg={4} sm={4} ouiaId="scc-mirroring-policy-grid-item">
|
159
|
+
<FormGroup
|
160
|
+
label={
|
161
|
+
<Tooltip
|
162
|
+
content={__(
|
163
|
+
'The default mirroring policy for repositories which were created using this SCC Account.'
|
164
|
+
)}
|
165
|
+
ouiaId="scc-mirroring-policy-tooltip"
|
166
|
+
>
|
167
|
+
<span>{__('Mirroring Policy')}</span>
|
168
|
+
</Tooltip>
|
169
|
+
}
|
170
|
+
fieldId="scc-mirroring-policy"
|
171
|
+
ouiaId="scc-mirroring-policy-form-group"
|
172
|
+
>
|
173
|
+
<Select
|
174
|
+
id="scc-mirroring-policy"
|
175
|
+
isOpen={openMirroring}
|
176
|
+
selected={mirroringPolicy}
|
177
|
+
onSelect={(_, val) => {
|
178
|
+
onMirroringPolicyChange(String(val));
|
179
|
+
onMirroringOpenChange(false);
|
180
|
+
}}
|
181
|
+
onOpenChange={onMirroringOpenChange}
|
182
|
+
ouiaId="scc-mirroring-policy-select"
|
183
|
+
toggle={(ref) => (
|
184
|
+
<MenuToggle
|
185
|
+
ref={ref}
|
186
|
+
isExpanded={openMirroring}
|
187
|
+
onClick={() => onMirroringOpenChange(!openMirroring)}
|
188
|
+
isFullWidth
|
189
|
+
ouiaId="scc-mirroring-policy-menu-toggle"
|
190
|
+
>
|
191
|
+
{mirroringPolicy}
|
192
|
+
</MenuToggle>
|
193
|
+
)}
|
194
|
+
>
|
195
|
+
<SelectList ouiaId="scc-mirroring-policy-select-list">
|
196
|
+
{mirroringPolicyOptions.map(([label], index) => (
|
197
|
+
<SelectOption
|
198
|
+
key={index}
|
199
|
+
value={String(label)}
|
200
|
+
ouiaId={`scc-mirroring-policy-option-${index}`}
|
201
|
+
>
|
202
|
+
{String(label)}
|
203
|
+
</SelectOption>
|
204
|
+
))}
|
205
|
+
</SelectList>
|
206
|
+
</Select>
|
207
|
+
</FormGroup>
|
208
|
+
</GridItem>
|
209
|
+
</Grid>
|
210
|
+
</CardBody>
|
211
|
+
</Card>
|
212
|
+
);
|
213
|
+
|
214
|
+
SCCSyncSettingsCard.propTypes = {
|
215
|
+
gpgKey: PropTypes.string.isRequired,
|
216
|
+
gpgKeyOptions: PropTypes.arrayOf(
|
217
|
+
PropTypes.arrayOf(
|
218
|
+
PropTypes.oneOfType([
|
219
|
+
PropTypes.string,
|
220
|
+
PropTypes.number,
|
221
|
+
PropTypes.oneOf([null]),
|
222
|
+
])
|
223
|
+
)
|
224
|
+
).isRequired,
|
225
|
+
openGpg: PropTypes.bool.isRequired,
|
226
|
+
downloadPolicy: PropTypes.string.isRequired,
|
227
|
+
downloadPolicyOptions: PropTypes.arrayOf(
|
228
|
+
PropTypes.oneOfType([
|
229
|
+
PropTypes.exact({
|
230
|
+
label: PropTypes.string.isRequired,
|
231
|
+
value: PropTypes.string.isRequired,
|
232
|
+
}),
|
233
|
+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string])),
|
234
|
+
])
|
235
|
+
).isRequired,
|
236
|
+
openDownload: PropTypes.bool.isRequired,
|
237
|
+
mirroringPolicy: PropTypes.string.isRequired,
|
238
|
+
mirroringPolicyOptions: PropTypes.arrayOf(
|
239
|
+
PropTypes.oneOfType([
|
240
|
+
PropTypes.exact({
|
241
|
+
label: PropTypes.string.isRequired,
|
242
|
+
value: PropTypes.string.isRequired,
|
243
|
+
}),
|
244
|
+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string])),
|
245
|
+
])
|
246
|
+
).isRequired,
|
247
|
+
openMirroring: PropTypes.bool.isRequired,
|
248
|
+
onGpgKeyChange: PropTypes.func.isRequired,
|
249
|
+
onGpgOpenChange: PropTypes.func.isRequired,
|
250
|
+
onDownloadPolicyChange: PropTypes.func.isRequired,
|
251
|
+
onDownloadOpenChange: PropTypes.func.isRequired,
|
252
|
+
onMirroringPolicyChange: PropTypes.func.isRequired,
|
253
|
+
onMirroringOpenChange: PropTypes.func.isRequired,
|
254
|
+
};
|
255
|
+
|
256
|
+
export default SCCSyncSettingsCard;
|
@@ -0,0 +1,133 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
4
|
+
import {
|
5
|
+
Card,
|
6
|
+
CardBody,
|
7
|
+
Grid,
|
8
|
+
GridItem,
|
9
|
+
FormGroup,
|
10
|
+
Select,
|
11
|
+
SelectList,
|
12
|
+
SelectOption,
|
13
|
+
MenuToggle,
|
14
|
+
Tooltip,
|
15
|
+
CardHeader,
|
16
|
+
CardTitle,
|
17
|
+
} from '@patternfly/react-core';
|
18
|
+
import DateTimeField from './DateTimeField';
|
19
|
+
|
20
|
+
const SCCTokenRefreshCard = ({
|
21
|
+
interval,
|
22
|
+
intervalOptions,
|
23
|
+
openInterval,
|
24
|
+
refreshDate,
|
25
|
+
refreshTime,
|
26
|
+
onIntervalChange,
|
27
|
+
onIntervalOpenChange,
|
28
|
+
onRefreshDateChange,
|
29
|
+
onRefreshTimeChange,
|
30
|
+
}) => (
|
31
|
+
<Card isFlat ouiaId="scc-token-refresh-card">
|
32
|
+
<CardHeader ouiaId="scc-token-refresh-card-header">
|
33
|
+
<CardTitle
|
34
|
+
component="h2"
|
35
|
+
className="pf-v5-u-font-size-xl pf-v5-u-mt-0"
|
36
|
+
ouiaId="scc-token-refresh-card-title"
|
37
|
+
>
|
38
|
+
{__('Token Refresh Settings')}
|
39
|
+
</CardTitle>
|
40
|
+
</CardHeader>
|
41
|
+
<CardBody ouiaId="scc-token-refresh-card-body">
|
42
|
+
<Grid hasGutter ouiaId="scc-token-refresh-grid">
|
43
|
+
<GridItem sm={6} md={6} lg={6} ouiaId="scc-interval-grid-item">
|
44
|
+
<FormGroup
|
45
|
+
label={
|
46
|
+
<Tooltip
|
47
|
+
content={__(
|
48
|
+
'The token refresh interval is used to periodically update the SCC authentication tokens of any imported products.'
|
49
|
+
)}
|
50
|
+
ouiaId="scc-interval-tooltip"
|
51
|
+
>
|
52
|
+
<span>{__('Refresh interval')}</span>
|
53
|
+
</Tooltip>
|
54
|
+
}
|
55
|
+
fieldId="scc-interval"
|
56
|
+
ouiaId="scc-interval-form-group"
|
57
|
+
>
|
58
|
+
<Select
|
59
|
+
id="scc-interval"
|
60
|
+
isOpen={openInterval}
|
61
|
+
selected={interval}
|
62
|
+
onSelect={(_, val) => {
|
63
|
+
onIntervalChange(String(val));
|
64
|
+
onIntervalOpenChange(false);
|
65
|
+
}}
|
66
|
+
onOpenChange={onIntervalOpenChange}
|
67
|
+
ouiaId="scc-interval-select"
|
68
|
+
toggle={(ref) => (
|
69
|
+
<MenuToggle
|
70
|
+
ref={ref}
|
71
|
+
isExpanded={openInterval}
|
72
|
+
isFullWidth
|
73
|
+
onClick={() => onIntervalOpenChange(!openInterval)}
|
74
|
+
ouiaId="scc-interval-menu-toggle"
|
75
|
+
>
|
76
|
+
{interval}
|
77
|
+
</MenuToggle>
|
78
|
+
)}
|
79
|
+
>
|
80
|
+
<SelectList ouiaId="scc-interval-select-list">
|
81
|
+
{intervalOptions.map((option, i) => (
|
82
|
+
<SelectOption
|
83
|
+
key={i}
|
84
|
+
value={String(option)}
|
85
|
+
ouiaId={`scc-interval-option-${i}`}
|
86
|
+
>
|
87
|
+
{String(option)}
|
88
|
+
</SelectOption>
|
89
|
+
))}
|
90
|
+
</SelectList>
|
91
|
+
</Select>
|
92
|
+
</FormGroup>
|
93
|
+
</GridItem>
|
94
|
+
|
95
|
+
<GridItem sm={6} md={6} lg={6} ouiaId="scc-refresh-time-grid-item">
|
96
|
+
<div className="pf-v5-u-w-100">
|
97
|
+
<DateTimeField
|
98
|
+
id="scc-refresh-time"
|
99
|
+
label={
|
100
|
+
<Tooltip
|
101
|
+
content={__(
|
102
|
+
'Specifies the daily time when the SCC authentication token refresh process starts. Set this to a time outside of business hours (e.g., during the night) to minimize disruption.'
|
103
|
+
)}
|
104
|
+
ouiaId="scc-refresh-time-tooltip"
|
105
|
+
>
|
106
|
+
<span>{__('Refresh time')}</span>
|
107
|
+
</Tooltip>
|
108
|
+
}
|
109
|
+
date={refreshDate}
|
110
|
+
time={refreshTime}
|
111
|
+
onDateChange={onRefreshDateChange}
|
112
|
+
onTimeChange={onRefreshTimeChange}
|
113
|
+
/>
|
114
|
+
</div>
|
115
|
+
</GridItem>
|
116
|
+
</Grid>
|
117
|
+
</CardBody>
|
118
|
+
</Card>
|
119
|
+
);
|
120
|
+
|
121
|
+
SCCTokenRefreshCard.propTypes = {
|
122
|
+
interval: PropTypes.string.isRequired,
|
123
|
+
intervalOptions: PropTypes.arrayOf(PropTypes.string).isRequired,
|
124
|
+
openInterval: PropTypes.bool.isRequired,
|
125
|
+
refreshDate: PropTypes.string.isRequired,
|
126
|
+
refreshTime: PropTypes.string.isRequired,
|
127
|
+
onIntervalChange: PropTypes.func.isRequired,
|
128
|
+
onIntervalOpenChange: PropTypes.func.isRequired,
|
129
|
+
onRefreshDateChange: PropTypes.func.isRequired,
|
130
|
+
onRefreshTimeChange: PropTypes.func.isRequired,
|
131
|
+
};
|
132
|
+
|
133
|
+
export default SCCTokenRefreshCard;
|