foreman_snapshot_management 1.7.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/Rakefile +7 -2
- data/app/controllers/api/v2/snapshots_controller.rb +22 -6
- data/app/models/foreman_snapshot_management/proxmox_extensions.rb +1 -1
- data/app/models/foreman_snapshot_management/snapshot.rb +4 -0
- data/app/views/api/v2/snapshots/base.json.rabl +2 -0
- data/app/views/foreman_snapshot_management/snapshots/_index.html.erb +12 -80
- data/app/views/hosts/_snapshots_tab.html.erb +8 -0
- data/lib/foreman_snapshot_management/engine.rb +22 -21
- data/lib/foreman_snapshot_management/version.rb +1 -1
- data/lib/tasks/foreman_snapshot_management_tasks.rake +2 -2
- data/locale/de/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
- data/locale/de/foreman_snapshot_management.po +52 -19
- data/locale/en/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
- data/locale/en/foreman_snapshot_management.po +44 -11
- data/locale/foreman_snapshot_management.pot +87 -25
- data/package.json +46 -0
- data/test/controllers/api/v2/snapshots_test.rb +232 -109
- data/test/controllers/foreman_snapshot_management/snapshots_controller_test.rb +1 -1
- data/test/factories/proxmox_factory.rb +1 -1
- data/webpack/components/SnapshotManagement/SnapshotManagement.js +84 -0
- data/webpack/components/SnapshotManagement/SnapshotManagementActions.js +212 -0
- data/webpack/components/SnapshotManagement/SnapshotManagementConstants.js +9 -0
- data/webpack/components/SnapshotManagement/SnapshotManagementReducer.js +100 -0
- data/webpack/components/SnapshotManagement/SnapshotManagementSelectors.js +8 -0
- data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementActions.test.js +123 -0
- data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementReducer.test.js +157 -0
- data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementActions.test.js.snap +314 -0
- data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementReducer.test.js.snap +214 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotForm.js +118 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotFormConstants.js +5 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/SnapshotForm.test.js +26 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/__snapshots__/SnapshotForm.test.js.snap +476 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/index.js +19 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/snapshotForm.scss +3 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModal.js +37 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModalConstants.js +1 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/SnapshotFormModal.test.js +19 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/__snapshots__/SnapshotFormModal.test.js.snap +19 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/index.js +12 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/useSnapshotFormModal.js +7 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotList.js +314 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotListHelper.js +70 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/SnapshotList.test.js +88 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/__snapshots__/SnapshotList.test.js.snap +1081 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/snapshotList.scss +13 -0
- data/webpack/components/SnapshotManagement/index.js +33 -0
- data/webpack/components/SnapshotManagement/snapshotManagement.scss +5 -0
- data/webpack/global_index.js +7 -0
- data/webpack/global_test_setup.js +11 -0
- data/webpack/index.js +8 -0
- data/webpack/reducers.js +7 -0
- data/webpack/test_setup.js +17 -0
- metadata +39 -33
@@ -0,0 +1,214 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`SnapshotManagementReducer should handle DELETE_FAILURE 1`] = `
|
4
|
+
Object {
|
5
|
+
"hasError": false,
|
6
|
+
"isLoading": false,
|
7
|
+
"isWorking": false,
|
8
|
+
"snapshots": Array [
|
9
|
+
Object {
|
10
|
+
"children_ids": null,
|
11
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
12
|
+
"description": "123 testSnapshot",
|
13
|
+
"id": "snapshot-15776",
|
14
|
+
"name": "test",
|
15
|
+
"parent_id": null,
|
16
|
+
},
|
17
|
+
],
|
18
|
+
}
|
19
|
+
`;
|
20
|
+
|
21
|
+
exports[`SnapshotManagementReducer should handle DELETE_REQUEST 1`] = `
|
22
|
+
Object {
|
23
|
+
"hasError": false,
|
24
|
+
"isLoading": false,
|
25
|
+
"isWorking": true,
|
26
|
+
"snapshots": Array [
|
27
|
+
Object {
|
28
|
+
"children_ids": null,
|
29
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
30
|
+
"description": "123 testSnapshot",
|
31
|
+
"id": "snapshot-15776",
|
32
|
+
"name": "test",
|
33
|
+
"parent_id": null,
|
34
|
+
},
|
35
|
+
],
|
36
|
+
}
|
37
|
+
`;
|
38
|
+
|
39
|
+
exports[`SnapshotManagementReducer should handle DELETE_SUCCESS 1`] = `
|
40
|
+
Object {
|
41
|
+
"hasError": false,
|
42
|
+
"isLoading": false,
|
43
|
+
"isWorking": false,
|
44
|
+
"snapshots": Array [
|
45
|
+
Object {
|
46
|
+
"children_ids": null,
|
47
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
48
|
+
"description": "123 testSnapshot",
|
49
|
+
"id": "snapshot-15776",
|
50
|
+
"name": "test",
|
51
|
+
"parent_id": null,
|
52
|
+
},
|
53
|
+
],
|
54
|
+
}
|
55
|
+
`;
|
56
|
+
|
57
|
+
exports[`SnapshotManagementReducer should handle LIST_FAILURE 1`] = `
|
58
|
+
Object {
|
59
|
+
"error": Object {
|
60
|
+
"message": "Something went wrong",
|
61
|
+
},
|
62
|
+
"hasError": true,
|
63
|
+
"isLoading": false,
|
64
|
+
"isWorking": false,
|
65
|
+
"needsReload": false,
|
66
|
+
"snapshots": Array [
|
67
|
+
Object {
|
68
|
+
"children_ids": null,
|
69
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
70
|
+
"description": "123 testSnapshot",
|
71
|
+
"id": "snapshot-15776",
|
72
|
+
"name": "test",
|
73
|
+
"parent_id": null,
|
74
|
+
},
|
75
|
+
],
|
76
|
+
}
|
77
|
+
`;
|
78
|
+
|
79
|
+
exports[`SnapshotManagementReducer should handle LIST_REQUEST 1`] = `
|
80
|
+
Object {
|
81
|
+
"hasError": false,
|
82
|
+
"isLoading": true,
|
83
|
+
"isWorking": false,
|
84
|
+
"needsReload": false,
|
85
|
+
"snapshots": Array [],
|
86
|
+
}
|
87
|
+
`;
|
88
|
+
|
89
|
+
exports[`SnapshotManagementReducer should handle LIST_SUCCESS 1`] = `
|
90
|
+
Object {
|
91
|
+
"hasError": false,
|
92
|
+
"isLoading": false,
|
93
|
+
"isWorking": false,
|
94
|
+
"needsReload": false,
|
95
|
+
"snapshots": Array [],
|
96
|
+
}
|
97
|
+
`;
|
98
|
+
|
99
|
+
exports[`SnapshotManagementReducer should handle ROLLBACK_FAILURE 1`] = `
|
100
|
+
Object {
|
101
|
+
"hasError": false,
|
102
|
+
"isLoading": false,
|
103
|
+
"isWorking": false,
|
104
|
+
"snapshots": Array [
|
105
|
+
Object {
|
106
|
+
"children_ids": null,
|
107
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
108
|
+
"description": "123 testSnapshot",
|
109
|
+
"id": "snapshot-15776",
|
110
|
+
"name": "test",
|
111
|
+
"parent_id": null,
|
112
|
+
},
|
113
|
+
],
|
114
|
+
}
|
115
|
+
`;
|
116
|
+
|
117
|
+
exports[`SnapshotManagementReducer should handle ROLLBACK_REQUEST 1`] = `
|
118
|
+
Object {
|
119
|
+
"hasError": false,
|
120
|
+
"isLoading": false,
|
121
|
+
"isWorking": true,
|
122
|
+
"snapshots": Array [
|
123
|
+
Object {
|
124
|
+
"children_ids": null,
|
125
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
126
|
+
"description": "123 testSnapshot",
|
127
|
+
"id": "snapshot-15776",
|
128
|
+
"name": "test",
|
129
|
+
"parent_id": null,
|
130
|
+
},
|
131
|
+
],
|
132
|
+
}
|
133
|
+
`;
|
134
|
+
|
135
|
+
exports[`SnapshotManagementReducer should handle ROLLBACK_SUCCESS 1`] = `
|
136
|
+
Object {
|
137
|
+
"hasError": false,
|
138
|
+
"isLoading": false,
|
139
|
+
"isWorking": false,
|
140
|
+
"snapshots": Array [
|
141
|
+
Object {
|
142
|
+
"children_ids": null,
|
143
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
144
|
+
"description": "123 testSnapshot",
|
145
|
+
"id": "snapshot-15776",
|
146
|
+
"name": "test",
|
147
|
+
"parent_id": null,
|
148
|
+
},
|
149
|
+
],
|
150
|
+
}
|
151
|
+
`;
|
152
|
+
|
153
|
+
exports[`SnapshotManagementReducer should handle UPDATE_FAILURE 1`] = `
|
154
|
+
Object {
|
155
|
+
"hasError": false,
|
156
|
+
"isLoading": false,
|
157
|
+
"isWorking": false,
|
158
|
+
"snapshots": Array [
|
159
|
+
Object {
|
160
|
+
"children_ids": null,
|
161
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
162
|
+
"description": "123 testSnapshot",
|
163
|
+
"id": "snapshot-15776",
|
164
|
+
"name": "test",
|
165
|
+
"parent_id": null,
|
166
|
+
},
|
167
|
+
],
|
168
|
+
}
|
169
|
+
`;
|
170
|
+
|
171
|
+
exports[`SnapshotManagementReducer should handle UPDATE_REQUEST 1`] = `
|
172
|
+
Object {
|
173
|
+
"hasError": false,
|
174
|
+
"isLoading": false,
|
175
|
+
"isWorking": true,
|
176
|
+
"snapshots": Array [
|
177
|
+
Object {
|
178
|
+
"children_ids": null,
|
179
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
180
|
+
"description": "123 testSnapshot",
|
181
|
+
"id": "snapshot-15776",
|
182
|
+
"name": "test",
|
183
|
+
"parent_id": null,
|
184
|
+
},
|
185
|
+
],
|
186
|
+
}
|
187
|
+
`;
|
188
|
+
|
189
|
+
exports[`SnapshotManagementReducer should handle UPDATE_SUCCESS 1`] = `
|
190
|
+
Object {
|
191
|
+
"hasError": false,
|
192
|
+
"isLoading": false,
|
193
|
+
"isWorking": false,
|
194
|
+
"snapshots": Array [
|
195
|
+
Object {
|
196
|
+
"children_ids": null,
|
197
|
+
"created_at": "2021-01-19 15:03:47 UTC",
|
198
|
+
"description": "My most important snapshot.",
|
199
|
+
"id": "snapshot-15776",
|
200
|
+
"name": "test snapshot",
|
201
|
+
"parent_id": null,
|
202
|
+
},
|
203
|
+
],
|
204
|
+
}
|
205
|
+
`;
|
206
|
+
|
207
|
+
exports[`SnapshotManagementReducer should return initial state 1`] = `
|
208
|
+
Object {
|
209
|
+
"hasError": false,
|
210
|
+
"isLoading": true,
|
211
|
+
"isWorking": false,
|
212
|
+
"snapshots": Array [],
|
213
|
+
}
|
214
|
+
`;
|
@@ -0,0 +1,118 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import * as Yup from 'yup';
|
4
|
+
|
5
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
6
|
+
// import CheckBox from 'foremanReact/components/common/forms/Checkbox';
|
7
|
+
// import TextInput from 'foremanReact/components/common/forms/TextInput';
|
8
|
+
import ForemanForm from 'foremanReact/components/common/forms/ForemanForm';
|
9
|
+
import TextField from 'foremanReact/components/common/forms/TextField';
|
10
|
+
|
11
|
+
import { SNAPSHOT_CREATE_URL } from './SnapshotFormConstants';
|
12
|
+
import './snapshotForm.scss';
|
13
|
+
|
14
|
+
const SnapshotForm = ({
|
15
|
+
hostId,
|
16
|
+
initialValues,
|
17
|
+
submitForm,
|
18
|
+
capabilities,
|
19
|
+
...props
|
20
|
+
}) => {
|
21
|
+
let nameValidation = Yup.string().max(80, 'Too Long!');
|
22
|
+
if (capabilities.limitSnapshotNameFormat)
|
23
|
+
nameValidation = nameValidation
|
24
|
+
.min(2, 'Too Short!')
|
25
|
+
.matches(
|
26
|
+
/^[A-z]\w+$/,
|
27
|
+
__(
|
28
|
+
'Name must contain at least 2 characters starting with alphabet. Valid characters are A-Z a-z 0-9 _'
|
29
|
+
)
|
30
|
+
)
|
31
|
+
.max(40, 'Too Long!');
|
32
|
+
|
33
|
+
const validationSchema = Yup.object().shape({
|
34
|
+
name: nameValidation.required('is required'),
|
35
|
+
description: Yup.string(),
|
36
|
+
includeRam: Yup.bool(),
|
37
|
+
});
|
38
|
+
|
39
|
+
const handleSubmit = async (values, actions) => {
|
40
|
+
const submitValues = {
|
41
|
+
includeRam: values.includeRam || false,
|
42
|
+
snapshot: {
|
43
|
+
name: values.name,
|
44
|
+
description: values.description || '',
|
45
|
+
},
|
46
|
+
};
|
47
|
+
|
48
|
+
await submitForm({
|
49
|
+
item: 'Snapshot',
|
50
|
+
url: SNAPSHOT_CREATE_URL.replace(':hostId', hostId),
|
51
|
+
values: submitValues,
|
52
|
+
message: __('Snapshot successfully created!'),
|
53
|
+
});
|
54
|
+
actions.setSubmitting(false);
|
55
|
+
props.setModalClosed();
|
56
|
+
};
|
57
|
+
|
58
|
+
return (
|
59
|
+
<ForemanForm
|
60
|
+
onSubmit={(values, actions) => handleSubmit(values, actions)}
|
61
|
+
initialValues={initialValues}
|
62
|
+
validationSchema={validationSchema}
|
63
|
+
onCancel={() => props.setModalClosed()}
|
64
|
+
>
|
65
|
+
<TextField
|
66
|
+
name="name"
|
67
|
+
type="text"
|
68
|
+
required="true"
|
69
|
+
label={__('Name')}
|
70
|
+
inputClassName="col-md-8"
|
71
|
+
/>
|
72
|
+
<TextField
|
73
|
+
name="description"
|
74
|
+
type="textarea"
|
75
|
+
label={__('Description')}
|
76
|
+
inputClassName="col-md-8"
|
77
|
+
/>
|
78
|
+
<TextField
|
79
|
+
type="checkbox"
|
80
|
+
name="includeRam"
|
81
|
+
label={__('Include RAM')}
|
82
|
+
inputClassName="col-md-8"
|
83
|
+
/>
|
84
|
+
</ForemanForm>
|
85
|
+
);
|
86
|
+
};
|
87
|
+
|
88
|
+
SnapshotForm.propTypes = {
|
89
|
+
children: PropTypes.node,
|
90
|
+
className: PropTypes.string,
|
91
|
+
hostId: PropTypes.number.isRequired,
|
92
|
+
initialValues: PropTypes.shape({
|
93
|
+
name: PropTypes.string.isRequired,
|
94
|
+
description: PropTypes.string.isRequired,
|
95
|
+
includeRam: PropTypes.bool.isRequired,
|
96
|
+
}),
|
97
|
+
submitForm: PropTypes.func.isRequired,
|
98
|
+
setModalClosed: PropTypes.func,
|
99
|
+
capabilities: PropTypes.shape({
|
100
|
+
limitSnapshotNameFormat: PropTypes.bool,
|
101
|
+
}),
|
102
|
+
};
|
103
|
+
|
104
|
+
SnapshotForm.defaultProps = {
|
105
|
+
className: '',
|
106
|
+
children: null,
|
107
|
+
initialValues: {
|
108
|
+
name: '',
|
109
|
+
description: '',
|
110
|
+
includeRam: false,
|
111
|
+
},
|
112
|
+
setModalClosed: () => {},
|
113
|
+
capabilities: {
|
114
|
+
limitSnapshotNameFormat: false,
|
115
|
+
},
|
116
|
+
};
|
117
|
+
|
118
|
+
export default SnapshotForm;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export const GET_SNAPSHOT_CREATE_REQUEST = 'GET_SNAPSHOT_CREATE_REQUEST';
|
2
|
+
export const GET_SNAPSHOT_CREATE_SUCCESS = 'GET_SNAPSHOT_CREATE_SUCCESS';
|
3
|
+
export const GET_SNAPSHOT_CREATE_FAILURE = 'GET_SNAPSHOT_CREATE_FAILURE';
|
4
|
+
|
5
|
+
export const SNAPSHOT_CREATE_URL = '/api/hosts/:hostId/snapshots';
|
data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/SnapshotForm.test.js
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import SnapshotForm from '../SnapshotForm';
|
4
|
+
|
5
|
+
const fixtures = {
|
6
|
+
render: { hostId: 42, submitForm: () => null },
|
7
|
+
'render with limitSnapshotNameFormat capability': {
|
8
|
+
hostId: 42,
|
9
|
+
submitForm: () => null,
|
10
|
+
capabilities: { limitSnapshotNameFormat: true },
|
11
|
+
},
|
12
|
+
'render with optional Props': {
|
13
|
+
hostId: 42,
|
14
|
+
submitForm: () => null,
|
15
|
+
initialValues: {
|
16
|
+
name: 'Snapshot1',
|
17
|
+
description: 'Hello World',
|
18
|
+
includeRam: true,
|
19
|
+
},
|
20
|
+
},
|
21
|
+
};
|
22
|
+
|
23
|
+
describe('SnapshotForm', () => {
|
24
|
+
describe('rendering', () =>
|
25
|
+
testComponentSnapshotsWithFixtures(SnapshotForm, fixtures));
|
26
|
+
});
|
@@ -0,0 +1,476 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`SnapshotForm rendering render 1`] = `
|
4
|
+
<ForemanForm
|
5
|
+
enableReinitialize={false}
|
6
|
+
initialValues={
|
7
|
+
Object {
|
8
|
+
"description": "",
|
9
|
+
"includeRam": false,
|
10
|
+
"name": "",
|
11
|
+
}
|
12
|
+
}
|
13
|
+
onCancel={[Function]}
|
14
|
+
onSubmit={[Function]}
|
15
|
+
validationSchema={
|
16
|
+
ObjectSchema {
|
17
|
+
"_blacklist": RefSet {
|
18
|
+
"list": Array [],
|
19
|
+
"refs": Array [],
|
20
|
+
},
|
21
|
+
"_conditions": Array [],
|
22
|
+
"_defaultDefault": [Function],
|
23
|
+
"_deps": Array [],
|
24
|
+
"_excludedEdges": Array [],
|
25
|
+
"_exclusive": Object {},
|
26
|
+
"_mutate": undefined,
|
27
|
+
"_nodes": Array [
|
28
|
+
"includeRam",
|
29
|
+
"description",
|
30
|
+
"name",
|
31
|
+
],
|
32
|
+
"_options": Object {
|
33
|
+
"abortEarly": true,
|
34
|
+
"recursive": true,
|
35
|
+
},
|
36
|
+
"_type": "object",
|
37
|
+
"_typeError": [Function],
|
38
|
+
"_whitelist": RefSet {
|
39
|
+
"list": Array [],
|
40
|
+
"refs": Array [],
|
41
|
+
},
|
42
|
+
"fields": Object {
|
43
|
+
"description": StringSchema {
|
44
|
+
"_blacklist": RefSet {
|
45
|
+
"list": Array [],
|
46
|
+
"refs": Array [],
|
47
|
+
},
|
48
|
+
"_conditions": Array [],
|
49
|
+
"_deps": Array [],
|
50
|
+
"_exclusive": Object {},
|
51
|
+
"_mutate": undefined,
|
52
|
+
"_options": Object {
|
53
|
+
"abortEarly": true,
|
54
|
+
"recursive": true,
|
55
|
+
},
|
56
|
+
"_type": "string",
|
57
|
+
"_typeError": [Function],
|
58
|
+
"_whitelist": RefSet {
|
59
|
+
"list": Array [],
|
60
|
+
"refs": Array [],
|
61
|
+
},
|
62
|
+
"tests": Array [],
|
63
|
+
"transforms": Array [
|
64
|
+
[Function],
|
65
|
+
],
|
66
|
+
"type": "string",
|
67
|
+
},
|
68
|
+
"includeRam": BooleanSchema {
|
69
|
+
"_blacklist": RefSet {
|
70
|
+
"list": Array [],
|
71
|
+
"refs": Array [],
|
72
|
+
},
|
73
|
+
"_conditions": Array [],
|
74
|
+
"_deps": Array [],
|
75
|
+
"_exclusive": Object {},
|
76
|
+
"_mutate": undefined,
|
77
|
+
"_options": Object {
|
78
|
+
"abortEarly": true,
|
79
|
+
"recursive": true,
|
80
|
+
},
|
81
|
+
"_type": "boolean",
|
82
|
+
"_typeError": [Function],
|
83
|
+
"_whitelist": RefSet {
|
84
|
+
"list": Array [],
|
85
|
+
"refs": Array [],
|
86
|
+
},
|
87
|
+
"tests": Array [],
|
88
|
+
"transforms": Array [
|
89
|
+
[Function],
|
90
|
+
],
|
91
|
+
"type": "boolean",
|
92
|
+
},
|
93
|
+
"name": StringSchema {
|
94
|
+
"_blacklist": RefSet {
|
95
|
+
"list": Array [],
|
96
|
+
"refs": Array [],
|
97
|
+
},
|
98
|
+
"_conditions": Array [],
|
99
|
+
"_deps": Array [],
|
100
|
+
"_exclusive": Object {
|
101
|
+
"max": true,
|
102
|
+
"required": true,
|
103
|
+
},
|
104
|
+
"_mutate": undefined,
|
105
|
+
"_options": Object {
|
106
|
+
"abortEarly": true,
|
107
|
+
"recursive": true,
|
108
|
+
},
|
109
|
+
"_type": "string",
|
110
|
+
"_typeError": [Function],
|
111
|
+
"_whitelist": RefSet {
|
112
|
+
"list": Array [],
|
113
|
+
"refs": Array [],
|
114
|
+
},
|
115
|
+
"tests": Array [
|
116
|
+
[Function],
|
117
|
+
[Function],
|
118
|
+
],
|
119
|
+
"transforms": Array [
|
120
|
+
[Function],
|
121
|
+
],
|
122
|
+
"type": "string",
|
123
|
+
},
|
124
|
+
},
|
125
|
+
"tests": Array [],
|
126
|
+
"transforms": Array [
|
127
|
+
[Function],
|
128
|
+
],
|
129
|
+
"type": "object",
|
130
|
+
}
|
131
|
+
}
|
132
|
+
>
|
133
|
+
<TextField
|
134
|
+
className=""
|
135
|
+
inputClassName="col-md-8"
|
136
|
+
label="Name"
|
137
|
+
name="name"
|
138
|
+
required="true"
|
139
|
+
type="text"
|
140
|
+
/>
|
141
|
+
<TextField
|
142
|
+
className=""
|
143
|
+
inputClassName="col-md-8"
|
144
|
+
label="Description"
|
145
|
+
name="description"
|
146
|
+
required={false}
|
147
|
+
type="textarea"
|
148
|
+
/>
|
149
|
+
<TextField
|
150
|
+
className=""
|
151
|
+
inputClassName="col-md-8"
|
152
|
+
label="Include RAM"
|
153
|
+
name="includeRam"
|
154
|
+
required={false}
|
155
|
+
type="checkbox"
|
156
|
+
/>
|
157
|
+
</ForemanForm>
|
158
|
+
`;
|
159
|
+
|
160
|
+
exports[`SnapshotForm rendering render with limitSnapshotNameFormat capability 1`] = `
|
161
|
+
<ForemanForm
|
162
|
+
enableReinitialize={false}
|
163
|
+
initialValues={
|
164
|
+
Object {
|
165
|
+
"description": "",
|
166
|
+
"includeRam": false,
|
167
|
+
"name": "",
|
168
|
+
}
|
169
|
+
}
|
170
|
+
onCancel={[Function]}
|
171
|
+
onSubmit={[Function]}
|
172
|
+
validationSchema={
|
173
|
+
ObjectSchema {
|
174
|
+
"_blacklist": RefSet {
|
175
|
+
"list": Array [],
|
176
|
+
"refs": Array [],
|
177
|
+
},
|
178
|
+
"_conditions": Array [],
|
179
|
+
"_defaultDefault": [Function],
|
180
|
+
"_deps": Array [],
|
181
|
+
"_excludedEdges": Array [],
|
182
|
+
"_exclusive": Object {},
|
183
|
+
"_mutate": undefined,
|
184
|
+
"_nodes": Array [
|
185
|
+
"includeRam",
|
186
|
+
"description",
|
187
|
+
"name",
|
188
|
+
],
|
189
|
+
"_options": Object {
|
190
|
+
"abortEarly": true,
|
191
|
+
"recursive": true,
|
192
|
+
},
|
193
|
+
"_type": "object",
|
194
|
+
"_typeError": [Function],
|
195
|
+
"_whitelist": RefSet {
|
196
|
+
"list": Array [],
|
197
|
+
"refs": Array [],
|
198
|
+
},
|
199
|
+
"fields": Object {
|
200
|
+
"description": StringSchema {
|
201
|
+
"_blacklist": RefSet {
|
202
|
+
"list": Array [],
|
203
|
+
"refs": Array [],
|
204
|
+
},
|
205
|
+
"_conditions": Array [],
|
206
|
+
"_deps": Array [],
|
207
|
+
"_exclusive": Object {},
|
208
|
+
"_mutate": undefined,
|
209
|
+
"_options": Object {
|
210
|
+
"abortEarly": true,
|
211
|
+
"recursive": true,
|
212
|
+
},
|
213
|
+
"_type": "string",
|
214
|
+
"_typeError": [Function],
|
215
|
+
"_whitelist": RefSet {
|
216
|
+
"list": Array [],
|
217
|
+
"refs": Array [],
|
218
|
+
},
|
219
|
+
"tests": Array [],
|
220
|
+
"transforms": Array [
|
221
|
+
[Function],
|
222
|
+
],
|
223
|
+
"type": "string",
|
224
|
+
},
|
225
|
+
"includeRam": BooleanSchema {
|
226
|
+
"_blacklist": RefSet {
|
227
|
+
"list": Array [],
|
228
|
+
"refs": Array [],
|
229
|
+
},
|
230
|
+
"_conditions": Array [],
|
231
|
+
"_deps": Array [],
|
232
|
+
"_exclusive": Object {},
|
233
|
+
"_mutate": undefined,
|
234
|
+
"_options": Object {
|
235
|
+
"abortEarly": true,
|
236
|
+
"recursive": true,
|
237
|
+
},
|
238
|
+
"_type": "boolean",
|
239
|
+
"_typeError": [Function],
|
240
|
+
"_whitelist": RefSet {
|
241
|
+
"list": Array [],
|
242
|
+
"refs": Array [],
|
243
|
+
},
|
244
|
+
"tests": Array [],
|
245
|
+
"transforms": Array [
|
246
|
+
[Function],
|
247
|
+
],
|
248
|
+
"type": "boolean",
|
249
|
+
},
|
250
|
+
"name": StringSchema {
|
251
|
+
"_blacklist": RefSet {
|
252
|
+
"list": Array [],
|
253
|
+
"refs": Array [],
|
254
|
+
},
|
255
|
+
"_conditions": Array [],
|
256
|
+
"_deps": Array [],
|
257
|
+
"_exclusive": Object {
|
258
|
+
"matches": false,
|
259
|
+
"max": true,
|
260
|
+
"min": true,
|
261
|
+
"required": true,
|
262
|
+
},
|
263
|
+
"_mutate": undefined,
|
264
|
+
"_options": Object {
|
265
|
+
"abortEarly": true,
|
266
|
+
"recursive": true,
|
267
|
+
},
|
268
|
+
"_type": "string",
|
269
|
+
"_typeError": [Function],
|
270
|
+
"_whitelist": RefSet {
|
271
|
+
"list": Array [],
|
272
|
+
"refs": Array [],
|
273
|
+
},
|
274
|
+
"tests": Array [
|
275
|
+
[Function],
|
276
|
+
[Function],
|
277
|
+
[Function],
|
278
|
+
[Function],
|
279
|
+
],
|
280
|
+
"transforms": Array [
|
281
|
+
[Function],
|
282
|
+
],
|
283
|
+
"type": "string",
|
284
|
+
},
|
285
|
+
},
|
286
|
+
"tests": Array [],
|
287
|
+
"transforms": Array [
|
288
|
+
[Function],
|
289
|
+
],
|
290
|
+
"type": "object",
|
291
|
+
}
|
292
|
+
}
|
293
|
+
>
|
294
|
+
<TextField
|
295
|
+
className=""
|
296
|
+
inputClassName="col-md-8"
|
297
|
+
label="Name"
|
298
|
+
name="name"
|
299
|
+
required="true"
|
300
|
+
type="text"
|
301
|
+
/>
|
302
|
+
<TextField
|
303
|
+
className=""
|
304
|
+
inputClassName="col-md-8"
|
305
|
+
label="Description"
|
306
|
+
name="description"
|
307
|
+
required={false}
|
308
|
+
type="textarea"
|
309
|
+
/>
|
310
|
+
<TextField
|
311
|
+
className=""
|
312
|
+
inputClassName="col-md-8"
|
313
|
+
label="Include RAM"
|
314
|
+
name="includeRam"
|
315
|
+
required={false}
|
316
|
+
type="checkbox"
|
317
|
+
/>
|
318
|
+
</ForemanForm>
|
319
|
+
`;
|
320
|
+
|
321
|
+
exports[`SnapshotForm rendering render with optional Props 1`] = `
|
322
|
+
<ForemanForm
|
323
|
+
enableReinitialize={false}
|
324
|
+
initialValues={
|
325
|
+
Object {
|
326
|
+
"description": "Hello World",
|
327
|
+
"includeRam": true,
|
328
|
+
"name": "Snapshot1",
|
329
|
+
}
|
330
|
+
}
|
331
|
+
onCancel={[Function]}
|
332
|
+
onSubmit={[Function]}
|
333
|
+
validationSchema={
|
334
|
+
ObjectSchema {
|
335
|
+
"_blacklist": RefSet {
|
336
|
+
"list": Array [],
|
337
|
+
"refs": Array [],
|
338
|
+
},
|
339
|
+
"_conditions": Array [],
|
340
|
+
"_defaultDefault": [Function],
|
341
|
+
"_deps": Array [],
|
342
|
+
"_excludedEdges": Array [],
|
343
|
+
"_exclusive": Object {},
|
344
|
+
"_mutate": undefined,
|
345
|
+
"_nodes": Array [
|
346
|
+
"includeRam",
|
347
|
+
"description",
|
348
|
+
"name",
|
349
|
+
],
|
350
|
+
"_options": Object {
|
351
|
+
"abortEarly": true,
|
352
|
+
"recursive": true,
|
353
|
+
},
|
354
|
+
"_type": "object",
|
355
|
+
"_typeError": [Function],
|
356
|
+
"_whitelist": RefSet {
|
357
|
+
"list": Array [],
|
358
|
+
"refs": Array [],
|
359
|
+
},
|
360
|
+
"fields": Object {
|
361
|
+
"description": StringSchema {
|
362
|
+
"_blacklist": RefSet {
|
363
|
+
"list": Array [],
|
364
|
+
"refs": Array [],
|
365
|
+
},
|
366
|
+
"_conditions": Array [],
|
367
|
+
"_deps": Array [],
|
368
|
+
"_exclusive": Object {},
|
369
|
+
"_mutate": undefined,
|
370
|
+
"_options": Object {
|
371
|
+
"abortEarly": true,
|
372
|
+
"recursive": true,
|
373
|
+
},
|
374
|
+
"_type": "string",
|
375
|
+
"_typeError": [Function],
|
376
|
+
"_whitelist": RefSet {
|
377
|
+
"list": Array [],
|
378
|
+
"refs": Array [],
|
379
|
+
},
|
380
|
+
"tests": Array [],
|
381
|
+
"transforms": Array [
|
382
|
+
[Function],
|
383
|
+
],
|
384
|
+
"type": "string",
|
385
|
+
},
|
386
|
+
"includeRam": BooleanSchema {
|
387
|
+
"_blacklist": RefSet {
|
388
|
+
"list": Array [],
|
389
|
+
"refs": Array [],
|
390
|
+
},
|
391
|
+
"_conditions": Array [],
|
392
|
+
"_deps": Array [],
|
393
|
+
"_exclusive": Object {},
|
394
|
+
"_mutate": undefined,
|
395
|
+
"_options": Object {
|
396
|
+
"abortEarly": true,
|
397
|
+
"recursive": true,
|
398
|
+
},
|
399
|
+
"_type": "boolean",
|
400
|
+
"_typeError": [Function],
|
401
|
+
"_whitelist": RefSet {
|
402
|
+
"list": Array [],
|
403
|
+
"refs": Array [],
|
404
|
+
},
|
405
|
+
"tests": Array [],
|
406
|
+
"transforms": Array [
|
407
|
+
[Function],
|
408
|
+
],
|
409
|
+
"type": "boolean",
|
410
|
+
},
|
411
|
+
"name": StringSchema {
|
412
|
+
"_blacklist": RefSet {
|
413
|
+
"list": Array [],
|
414
|
+
"refs": Array [],
|
415
|
+
},
|
416
|
+
"_conditions": Array [],
|
417
|
+
"_deps": Array [],
|
418
|
+
"_exclusive": Object {
|
419
|
+
"max": true,
|
420
|
+
"required": true,
|
421
|
+
},
|
422
|
+
"_mutate": undefined,
|
423
|
+
"_options": Object {
|
424
|
+
"abortEarly": true,
|
425
|
+
"recursive": true,
|
426
|
+
},
|
427
|
+
"_type": "string",
|
428
|
+
"_typeError": [Function],
|
429
|
+
"_whitelist": RefSet {
|
430
|
+
"list": Array [],
|
431
|
+
"refs": Array [],
|
432
|
+
},
|
433
|
+
"tests": Array [
|
434
|
+
[Function],
|
435
|
+
[Function],
|
436
|
+
],
|
437
|
+
"transforms": Array [
|
438
|
+
[Function],
|
439
|
+
],
|
440
|
+
"type": "string",
|
441
|
+
},
|
442
|
+
},
|
443
|
+
"tests": Array [],
|
444
|
+
"transforms": Array [
|
445
|
+
[Function],
|
446
|
+
],
|
447
|
+
"type": "object",
|
448
|
+
}
|
449
|
+
}
|
450
|
+
>
|
451
|
+
<TextField
|
452
|
+
className=""
|
453
|
+
inputClassName="col-md-8"
|
454
|
+
label="Name"
|
455
|
+
name="name"
|
456
|
+
required="true"
|
457
|
+
type="text"
|
458
|
+
/>
|
459
|
+
<TextField
|
460
|
+
className=""
|
461
|
+
inputClassName="col-md-8"
|
462
|
+
label="Description"
|
463
|
+
name="description"
|
464
|
+
required={false}
|
465
|
+
type="textarea"
|
466
|
+
/>
|
467
|
+
<TextField
|
468
|
+
className=""
|
469
|
+
inputClassName="col-md-8"
|
470
|
+
label="Include RAM"
|
471
|
+
name="includeRam"
|
472
|
+
required={false}
|
473
|
+
type="checkbox"
|
474
|
+
/>
|
475
|
+
</ForemanForm>
|
476
|
+
`;
|