foreman_snapshot_management 4.2.2 → 4.3.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/lib/foreman_snapshot_management/version.rb +1 -1
- data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotForm.js +19 -20
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModal.js +39 -28
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/SnapshotFormModal.test.js +1 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/__snapshots__/SnapshotFormModal.test.js.snap +24 -11
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/index.js +8 -2
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/useSnapshotFormModal.js +11 -2
- data/webpack/global_index.js +6 -3
- data/webpack/global_test_setup.js +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: deb81c67b22c5ed30be8993938a52780abca3e9b9412e2877c4c3a38df2e7ba6
|
|
4
|
+
data.tar.gz: 3eb82b7b35720848b9da71162fe726ae4f3964797fcdf7d55be84cf23425327e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e03c5e9461b79df46c914d14aab0a326511e9380c65ae9e94ca41f3d80516320ae7e9162e3758520492520dd90c637fc7377b22d62e30ce6cfc932124377aa8
|
|
7
|
+
data.tar.gz: a390ad53d5eef28fb75a9ad0705b33614643bb6b3d68beafd0d8eeadf87beb6a268e39eb0cff8811488c6f7923cd6a7b606400f4731cf973f668cbb7cc9b1327
|
|
@@ -5,7 +5,6 @@ import { Formik } from 'formik';
|
|
|
5
5
|
|
|
6
6
|
import { translate as __ } from 'foremanReact/common/I18n';
|
|
7
7
|
import TextField from 'foremanReact/components/common/forms/TextField';
|
|
8
|
-
import { FieldLevelHelp } from 'patternfly-react';
|
|
9
8
|
|
|
10
9
|
import {
|
|
11
10
|
Form as PfForm,
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
Button,
|
|
14
13
|
Card,
|
|
15
14
|
CardBody,
|
|
15
|
+
FormGroup,
|
|
16
16
|
Select,
|
|
17
17
|
SelectList,
|
|
18
18
|
SelectOption,
|
|
@@ -24,6 +24,9 @@ import {
|
|
|
24
24
|
|
|
25
25
|
import './snapshotForm.scss';
|
|
26
26
|
|
|
27
|
+
const MAX_SNAPSHOT_NAME_LENGTH = 80;
|
|
28
|
+
const LIMITED_MAX_SNAPSHOT_NAME_LENGTH = 40;
|
|
29
|
+
|
|
27
30
|
const SnapshotForm = ({
|
|
28
31
|
initialValues,
|
|
29
32
|
capabilities,
|
|
@@ -34,7 +37,7 @@ const SnapshotForm = ({
|
|
|
34
37
|
host,
|
|
35
38
|
selectAllMode,
|
|
36
39
|
}) => {
|
|
37
|
-
let nameValidation = Yup.string().max(
|
|
40
|
+
let nameValidation = Yup.string().max(MAX_SNAPSHOT_NAME_LENGTH, 'Too Long!');
|
|
38
41
|
if (capabilities.limitSnapshotNameFormat)
|
|
39
42
|
nameValidation = nameValidation
|
|
40
43
|
.min(2, 'Too Short!')
|
|
@@ -44,7 +47,7 @@ const SnapshotForm = ({
|
|
|
44
47
|
'Name must contain at least 2 characters starting with alphabet. Valid characters are A-Z a-z 0-9 _'
|
|
45
48
|
)
|
|
46
49
|
)
|
|
47
|
-
.max(
|
|
50
|
+
.max(LIMITED_MAX_SNAPSHOT_NAME_LENGTH, 'Too Long!');
|
|
48
51
|
|
|
49
52
|
const validationSchema = Yup.object().shape({
|
|
50
53
|
name: nameValidation.required('is required'),
|
|
@@ -158,22 +161,19 @@ const SnapshotForm = ({
|
|
|
158
161
|
inputClassName="pf-v5-u-w-90"
|
|
159
162
|
/>
|
|
160
163
|
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
)}
|
|
172
|
-
/>
|
|
173
|
-
</label>
|
|
174
|
-
|
|
164
|
+
<FormGroup
|
|
165
|
+
label={__('Snapshot Mode')}
|
|
166
|
+
fieldId="snapshot-mode-select"
|
|
167
|
+
labelHelp={{
|
|
168
|
+
content: __(
|
|
169
|
+
"Select Snapshot Mode between 'Disk only' (default) or mutually exclusive options, 'Memory' (includes RAM) and 'Quiesce'."
|
|
170
|
+
),
|
|
171
|
+
'aria-label': __('Snapshot mode help'),
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
175
174
|
<div className="pf-v5-u-mt-sm">
|
|
176
175
|
<Select
|
|
176
|
+
id="snapshot-mode-select"
|
|
177
177
|
isOpen={isSelectOpen}
|
|
178
178
|
selected={snapshotMode || undefined}
|
|
179
179
|
onOpenChange={setIsSelectOpen}
|
|
@@ -187,8 +187,7 @@ const SnapshotForm = ({
|
|
|
187
187
|
ref={toggleRef}
|
|
188
188
|
onClick={() => setIsSelectOpen(prev => !prev)}
|
|
189
189
|
isExpanded={isSelectOpen}
|
|
190
|
-
|
|
191
|
-
className="pf-v5-c-form-control"
|
|
190
|
+
style={{ width: '100%' }}
|
|
192
191
|
aria-label={__('Snapshot mode')}
|
|
193
192
|
ouiaId="snapshot-mode-toggle"
|
|
194
193
|
>
|
|
@@ -231,7 +230,7 @@ const SnapshotForm = ({
|
|
|
231
230
|
</HelperText>
|
|
232
231
|
)}
|
|
233
232
|
</div>
|
|
234
|
-
</
|
|
233
|
+
</FormGroup>
|
|
235
234
|
|
|
236
235
|
{status && (
|
|
237
236
|
<HelperText isLiveRegion className="pf-v5-u-mt-sm">
|
data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModal.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
Modal,
|
|
5
|
+
ModalVariant,
|
|
6
|
+
Title,
|
|
7
|
+
Text,
|
|
8
|
+
TextContent,
|
|
9
|
+
} from '@patternfly/react-core';
|
|
5
10
|
import { translate as __, sprintf } from 'foremanReact/common/I18n';
|
|
6
11
|
import SnapshotForm from '../SnapshotForm';
|
|
7
12
|
import { SNAPSHOT_FORM_MODAL } from './SnapshotFormModalConstants';
|
|
8
13
|
|
|
9
14
|
const SnapshotFormModal = ({
|
|
15
|
+
isOpen,
|
|
10
16
|
selectedHosts,
|
|
11
17
|
selectedHostsCount,
|
|
12
18
|
setModalClosed,
|
|
@@ -16,36 +22,39 @@ const SnapshotFormModal = ({
|
|
|
16
22
|
}) => {
|
|
17
23
|
const displayCount = selectedHostsCount === 0 ? 1 : selectedHostsCount;
|
|
18
24
|
const hasSelection = selectedHostsCount > 0 || host;
|
|
25
|
+
const header = (
|
|
26
|
+
<TextContent className="pf-v5-u-mb-md">
|
|
27
|
+
<Title headingLevel="h1" size="3xl" ouiaId="snapshot-modal-title">
|
|
28
|
+
{__('Create snapshot')}
|
|
29
|
+
</Title>
|
|
30
|
+
|
|
31
|
+
{hasSelection && (
|
|
32
|
+
<Text
|
|
33
|
+
component="small"
|
|
34
|
+
className="pf-v5-u-color-200 pf-v5-u-font-size-sm pf-v5-u-mt-sm"
|
|
35
|
+
ouiaId="snapshot-modal-hosts-count"
|
|
36
|
+
>
|
|
37
|
+
{sprintf(
|
|
38
|
+
displayCount === 1
|
|
39
|
+
? __('%s host is selected for snapshot creation')
|
|
40
|
+
: __('%s hosts are selected for snapshot creation'),
|
|
41
|
+
displayCount
|
|
42
|
+
)}
|
|
43
|
+
</Text>
|
|
44
|
+
)}
|
|
45
|
+
</TextContent>
|
|
46
|
+
);
|
|
19
47
|
|
|
20
48
|
return (
|
|
21
|
-
<
|
|
49
|
+
<Modal
|
|
22
50
|
id={SNAPSHOT_FORM_MODAL}
|
|
23
|
-
|
|
51
|
+
variant={ModalVariant.medium}
|
|
52
|
+
isOpen={isOpen}
|
|
53
|
+
onClose={setModalClosed}
|
|
54
|
+
onEscapePress={setModalClosed}
|
|
55
|
+
header={header}
|
|
24
56
|
ouiaId="snapshot-form-modal"
|
|
25
57
|
>
|
|
26
|
-
<ForemanModal.Header closeButton={false}>
|
|
27
|
-
<TextContent className="pf-v5-u-mb-md">
|
|
28
|
-
<Title headingLevel="h1" size="3xl" ouiaId="snapshot-modal-title">
|
|
29
|
-
{__('Create snapshot')}
|
|
30
|
-
</Title>
|
|
31
|
-
|
|
32
|
-
{hasSelection && (
|
|
33
|
-
<Text
|
|
34
|
-
component="small"
|
|
35
|
-
className="pf-v5-u-color-200 pf-v5-u-font-size-sm pf-v5-u-mt-sm"
|
|
36
|
-
ouiaId="snapshot-modal-hosts-count"
|
|
37
|
-
>
|
|
38
|
-
{sprintf(
|
|
39
|
-
displayCount === 1
|
|
40
|
-
? __('%s host is selected for snapshot creation')
|
|
41
|
-
: __('%s hosts are selected for snapshot creation'),
|
|
42
|
-
displayCount
|
|
43
|
-
)}
|
|
44
|
-
</Text>
|
|
45
|
-
)}
|
|
46
|
-
</TextContent>
|
|
47
|
-
</ForemanModal.Header>
|
|
48
|
-
|
|
49
58
|
{hasSelection && (
|
|
50
59
|
<SnapshotForm
|
|
51
60
|
setModalClosed={setModalClosed}
|
|
@@ -55,11 +64,12 @@ const SnapshotFormModal = ({
|
|
|
55
64
|
{...props}
|
|
56
65
|
/>
|
|
57
66
|
)}
|
|
58
|
-
</
|
|
67
|
+
</Modal>
|
|
59
68
|
);
|
|
60
69
|
};
|
|
61
70
|
|
|
62
71
|
SnapshotFormModal.propTypes = {
|
|
72
|
+
isOpen: PropTypes.bool,
|
|
63
73
|
selectedHosts: PropTypes.arrayOf(
|
|
64
74
|
PropTypes.shape({
|
|
65
75
|
id: PropTypes.number.isRequired,
|
|
@@ -82,6 +92,7 @@ SnapshotFormModal.propTypes = {
|
|
|
82
92
|
};
|
|
83
93
|
|
|
84
94
|
SnapshotFormModal.defaultProps = {
|
|
95
|
+
isOpen: false,
|
|
85
96
|
selectedHosts: [],
|
|
86
97
|
selectedHostsCount: 0,
|
|
87
98
|
host: null,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`SnapshotFormModal renders normal 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
<Modal
|
|
5
|
+
actions={Array []}
|
|
6
|
+
appendTo={[Function]}
|
|
7
|
+
aria-describedby=""
|
|
8
|
+
aria-label=""
|
|
9
|
+
aria-labelledby=""
|
|
10
|
+
className=""
|
|
11
|
+
hasNoBodyWrapper={false}
|
|
12
|
+
header={
|
|
13
13
|
<TextContent
|
|
14
14
|
className="pf-v5-u-mb-md"
|
|
15
15
|
>
|
|
@@ -28,7 +28,20 @@ exports[`SnapshotFormModal renders normal 1`] = `
|
|
|
28
28
|
1 host is selected for snapshot creation
|
|
29
29
|
</Text>
|
|
30
30
|
</TextContent>
|
|
31
|
-
|
|
31
|
+
}
|
|
32
|
+
id="foremanSnapshotMgmtSnapshotFormModal"
|
|
33
|
+
isOpen={true}
|
|
34
|
+
onClose={[Function]}
|
|
35
|
+
onEscapePress={[Function]}
|
|
36
|
+
ouiaId="snapshot-form-modal"
|
|
37
|
+
ouiaSafe={true}
|
|
38
|
+
position="default"
|
|
39
|
+
showClose={true}
|
|
40
|
+
title=""
|
|
41
|
+
titleIconVariant={null}
|
|
42
|
+
titleLabel=""
|
|
43
|
+
variant="medium"
|
|
44
|
+
>
|
|
32
45
|
<WrappedSnapshotForm
|
|
33
46
|
fetchBulkParams={[Function]}
|
|
34
47
|
host={
|
|
@@ -40,5 +53,5 @@ exports[`SnapshotFormModal renders normal 1`] = `
|
|
|
40
53
|
selectedHosts={Array []}
|
|
41
54
|
setModalClosed={[Function]}
|
|
42
55
|
/>
|
|
43
|
-
</
|
|
56
|
+
</Modal>
|
|
44
57
|
`;
|
|
@@ -3,9 +3,15 @@ import useSnapshotFormModal from './useSnapshotFormModal';
|
|
|
3
3
|
import SnapshotFormModal from './SnapshotFormModal';
|
|
4
4
|
|
|
5
5
|
const WrappedSnapshotFormModal = props => {
|
|
6
|
-
const { setModalClosed } = useSnapshotFormModal();
|
|
6
|
+
const { isOpen, setModalClosed } = useSnapshotFormModal();
|
|
7
7
|
|
|
8
|
-
return
|
|
8
|
+
return (
|
|
9
|
+
<SnapshotFormModal
|
|
10
|
+
isOpen={isOpen}
|
|
11
|
+
setModalClosed={setModalClosed}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
9
15
|
};
|
|
10
16
|
|
|
11
17
|
export default WrappedSnapshotFormModal;
|
data/webpack/components/SnapshotManagement/components/SnapshotFormModal/useSnapshotFormModal.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useBulkModalOpen } from 'foremanReact/common/BulkModalStateHelper';
|
|
2
2
|
|
|
3
3
|
import { SNAPSHOT_FORM_MODAL } from './SnapshotFormModalConstants';
|
|
4
4
|
|
|
5
|
-
const useSnapshotFormModal = () =>
|
|
5
|
+
const useSnapshotFormModal = () => {
|
|
6
|
+
const { isOpen, open, close, toggle } = useBulkModalOpen(SNAPSHOT_FORM_MODAL);
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
isOpen,
|
|
10
|
+
setModalOpen: open,
|
|
11
|
+
setModalClosed: close,
|
|
12
|
+
toggleModal: toggle,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
6
15
|
|
|
7
16
|
export default useSnapshotFormModal;
|
data/webpack/global_index.js
CHANGED
|
@@ -9,6 +9,9 @@ import SnapshotManagementCard from './components/SnapshotManagementCard';
|
|
|
9
9
|
import BulkCreateSnapshotMenuItem from './components/SnapshotManagement/components/BulkActions/BulkCreateSnapshotMenuItem/BulkCreateSnapshotMenuItem';
|
|
10
10
|
import BulkSnapshotModalScene from './components/SnapshotManagement/components/BulkActions/BulkSnapshotModalScene/BulkSnapshotModalScene';
|
|
11
11
|
|
|
12
|
+
const CARD_FILL_PRIORITY = 1000;
|
|
13
|
+
const BULK_ACTION_FILL_PRIORITY = 500;
|
|
14
|
+
|
|
12
15
|
// register reducers
|
|
13
16
|
Object.entries(reducers).forEach(([key, reducer]) =>
|
|
14
17
|
registerReducer(key, reducer)
|
|
@@ -19,19 +22,19 @@ addGlobalFill(
|
|
|
19
22
|
'host-overview-cards',
|
|
20
23
|
'foreman_snapshot_management-card',
|
|
21
24
|
<SnapshotManagementCard key="foreman_snapshot_management-card" />,
|
|
22
|
-
|
|
25
|
+
CARD_FILL_PRIORITY
|
|
23
26
|
);
|
|
24
27
|
|
|
25
28
|
addGlobalFill(
|
|
26
29
|
'_all-hosts-modals',
|
|
27
30
|
'foreman_snapshot_management-bulk-modal',
|
|
28
31
|
<BulkSnapshotModalScene key="foreman_snapshot_management-bulk-modal" />,
|
|
29
|
-
|
|
32
|
+
BULK_ACTION_FILL_PRIORITY
|
|
30
33
|
);
|
|
31
34
|
|
|
32
35
|
addGlobalFill(
|
|
33
36
|
'hosts-index-kebab',
|
|
34
37
|
'foreman_snapshot_management-bulk-create',
|
|
35
38
|
<BulkCreateSnapshotMenuItem key="foreman_snapshot_management-bulk-create" />,
|
|
36
|
-
|
|
39
|
+
BULK_ACTION_FILL_PRIORITY
|
|
37
40
|
);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// runs before each test to make sure console.error output will
|
|
2
2
|
// fail a test (i.e. default PropType missing). Check the error
|
|
3
3
|
// output and traceback for actual error.
|
|
4
|
+
const JEST_TIMEOUT_MS = 10000;
|
|
5
|
+
|
|
4
6
|
global.console.error = (error, stack) => {
|
|
5
7
|
/* eslint-disable-next-line no-console */
|
|
6
8
|
if (stack) console.log(stack); // Prints out original stack trace
|
|
@@ -8,4 +10,4 @@ global.console.error = (error, stack) => {
|
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
// Increase jest timeout as some tests using multiple http mocks can time out on CI systems.
|
|
11
|
-
jest.setTimeout(
|
|
13
|
+
jest.setTimeout(JEST_TIMEOUT_MS);
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_snapshot_management
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ATIX AG
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-08-05 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: Foreman plugin to manage snapshots of virtual machines.
|
|
13
13
|
email:
|
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
139
|
- !ruby/object:Gem::Version
|
|
140
140
|
version: '0'
|
|
141
141
|
requirements: []
|
|
142
|
-
rubygems_version: 4.0.
|
|
142
|
+
rubygems_version: 4.0.16
|
|
143
143
|
specification_version: 4
|
|
144
144
|
summary: Snapshot Management for virtual machines
|
|
145
145
|
test_files:
|