foreman_snapshot_management 1.5.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 +200 -2
- data/Rakefile +9 -2
- data/app/controllers/api/v2/snapshots_controller.rb +39 -7
- data/app/controllers/concerns/foreman/controller/parameters/snapshot.rb +2 -0
- data/app/controllers/foreman_snapshot_management/snapshots_controller.rb +10 -7
- data/app/helpers/concerns/foreman_snapshot_management/hosts_helper_extension.rb +2 -0
- data/app/helpers/foreman_snapshot_management/snapshot_helper.rb +2 -0
- data/app/models/concerns/fog_extensions/proxmox/snapshots/mock.rb +24 -0
- data/app/models/concerns/fog_extensions/vsphere/snapshots/mock.rb +2 -0
- data/app/models/concerns/fog_extensions/vsphere/snapshots/real.rb +4 -2
- data/app/models/foreman_snapshot_management/proxmox_extensions.rb +101 -0
- data/app/models/foreman_snapshot_management/snapshot.rb +36 -30
- data/app/models/foreman_snapshot_management/vmware_extensions.rb +42 -13
- data/app/views/api/v2/snapshots/base.json.rabl +4 -0
- data/app/views/api/v2/snapshots/create.json.rabl +2 -0
- data/app/views/api/v2/snapshots/destroy.json.rabl +2 -0
- data/app/views/api/v2/snapshots/index.json.rabl +2 -0
- data/app/views/api/v2/snapshots/main.json.rabl +4 -2
- data/app/views/api/v2/snapshots/revert.json.rabl +2 -0
- data/app/views/api/v2/snapshots/show.json.rabl +2 -0
- data/app/views/api/v2/snapshots/update.json.rabl +2 -0
- data/app/views/foreman_snapshot_management/snapshots/_index.html.erb +12 -74
- data/app/views/{foreman_snapshot_management/hosts/_snapshots_tab_content.html.erb → hosts/_snapshots_tab.html.erb} +8 -0
- data/config/routes.rb +2 -0
- data/lib/foreman_snapshot_management.rb +2 -0
- data/lib/foreman_snapshot_management/engine.rb +56 -17
- data/lib/foreman_snapshot_management/version.rb +3 -1
- data/lib/tasks/foreman_snapshot_management_tasks.rake +31 -10
- data/locale/de/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
- data/locale/de/foreman_snapshot_management.po +195 -0
- data/locale/en/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
- data/locale/en/foreman_snapshot_management.edit.po +0 -0
- data/locale/en/foreman_snapshot_management.po +179 -11
- data/locale/foreman_snapshot_management.pot +259 -8
- data/locale/gemspec.rb +3 -1
- data/package.json +46 -0
- data/test/controllers/api/v2/snapshots_test.rb +252 -39
- data/test/controllers/foreman_snapshot_management/snapshots_controller_test.rb +63 -9
- data/test/factories/proxmox_factory.rb +18 -0
- data/test/test_plugin_helper.rb +5 -0
- 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 +52 -54
- data/app/overrides/hosts/add_tab_to_host_overview.rb +0 -11
- data/app/views/foreman_snapshot_management/hosts/_snapshots_tab.html.erb +0 -3
@@ -0,0 +1,33 @@
|
|
1
|
+
import { connect } from 'react-redux';
|
2
|
+
|
3
|
+
import {
|
4
|
+
loadSnapshotList,
|
5
|
+
snapshotDeleteAction,
|
6
|
+
snapshotUpdateAction,
|
7
|
+
snapshotRollbackAction,
|
8
|
+
} from './SnapshotManagementActions';
|
9
|
+
import SnapshotManagement from './SnapshotManagement';
|
10
|
+
import * as Selector from './SnapshotManagementSelectors';
|
11
|
+
|
12
|
+
// process state from redux store
|
13
|
+
const mapStateToProps = state => ({
|
14
|
+
snapshots: Selector.selectSnapshots(state),
|
15
|
+
isLoading: Selector.selectIsLoading(state),
|
16
|
+
isWorking: Selector.selectIsWorking(state),
|
17
|
+
hasError: Selector.selectHasError(state),
|
18
|
+
error: Selector.selectError(state),
|
19
|
+
needsReload: Selector.selectNeedsReload(state),
|
20
|
+
});
|
21
|
+
|
22
|
+
// dispatch actions from Component to Store
|
23
|
+
const mapDispatchToProps = dispatch => ({
|
24
|
+
loadSnapshots: host => dispatch(loadSnapshotList(host)),
|
25
|
+
deleteAction: (hostId, rowData) =>
|
26
|
+
dispatch(snapshotDeleteAction(hostId, rowData)),
|
27
|
+
updateAction: (hostId, rowData) =>
|
28
|
+
dispatch(snapshotUpdateAction(hostId, rowData)),
|
29
|
+
rollbackAction: (hostId, rowData) =>
|
30
|
+
dispatch(snapshotRollbackAction(hostId, rowData)),
|
31
|
+
});
|
32
|
+
|
33
|
+
export default connect(mapStateToProps, mapDispatchToProps)(SnapshotManagement);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// runs before each test to make sure console.error output will
|
2
|
+
// fail a test (i.e. default PropType missing). Check the error
|
3
|
+
// output and traceback for actual error.
|
4
|
+
global.console.error = (error, stack) => {
|
5
|
+
/* eslint-disable-next-line no-console */
|
6
|
+
if (stack) console.log(stack); // Prints out original stack trace
|
7
|
+
throw new Error(error);
|
8
|
+
};
|
9
|
+
|
10
|
+
// Increase jest timeout as some tests using multiple http mocks can time out on CI systems.
|
11
|
+
jest.setTimeout(10000);
|
data/webpack/index.js
ADDED
data/webpack/reducers.js
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
import 'core-js/shim';
|
2
|
+
import 'regenerator-runtime/runtime';
|
3
|
+
import MutationObserver from '@sheerun/mutationobserver-shim';
|
4
|
+
|
5
|
+
import { configure } from 'enzyme';
|
6
|
+
import Adapter from 'enzyme-adapter-react-16';
|
7
|
+
|
8
|
+
configure({ adapter: new Adapter() });
|
9
|
+
|
10
|
+
// Mocking translation function
|
11
|
+
global.__ = text => text; // eslint-disable-line
|
12
|
+
|
13
|
+
// Mocking locales to prevent unnecessary fallback messages
|
14
|
+
window.locales = { en: { domain: 'app', locale_data: { app: { '': {} } } } };
|
15
|
+
|
16
|
+
// see https://github.com/testing-library/dom-testing-library/releases/tag/v7.0.0
|
17
|
+
window.MutationObserver = MutationObserver;
|
metadata
CHANGED
@@ -1,58 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_snapshot_management
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ATIX AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
-
|
14
|
-
name: deface
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rdoc
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rubocop
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.49.1
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.49.1
|
55
|
-
description: Foreman-plugin to manage snapshots in a vSphere environment.
|
11
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Foreman-plugin to manage snapshots in a virtual-hardware environments.
|
56
14
|
email:
|
57
15
|
- info@atix.de
|
58
16
|
executables: []
|
@@ -67,11 +25,12 @@ files:
|
|
67
25
|
- app/controllers/foreman_snapshot_management/snapshots_controller.rb
|
68
26
|
- app/helpers/concerns/foreman_snapshot_management/hosts_helper_extension.rb
|
69
27
|
- app/helpers/foreman_snapshot_management/snapshot_helper.rb
|
28
|
+
- app/models/concerns/fog_extensions/proxmox/snapshots/mock.rb
|
70
29
|
- app/models/concerns/fog_extensions/vsphere/snapshots/mock.rb
|
71
30
|
- app/models/concerns/fog_extensions/vsphere/snapshots/real.rb
|
31
|
+
- app/models/foreman_snapshot_management/proxmox_extensions.rb
|
72
32
|
- app/models/foreman_snapshot_management/snapshot.rb
|
73
33
|
- app/models/foreman_snapshot_management/vmware_extensions.rb
|
74
|
-
- app/overrides/hosts/add_tab_to_host_overview.rb
|
75
34
|
- app/views/api/v2/snapshots/base.json.rabl
|
76
35
|
- app/views/api/v2/snapshots/create.json.rabl
|
77
36
|
- app/views/api/v2/snapshots/destroy.json.rabl
|
@@ -80,24 +39,63 @@ files:
|
|
80
39
|
- app/views/api/v2/snapshots/revert.json.rabl
|
81
40
|
- app/views/api/v2/snapshots/show.json.rabl
|
82
41
|
- app/views/api/v2/snapshots/update.json.rabl
|
83
|
-
- app/views/foreman_snapshot_management/hosts/_snapshots_tab.html.erb
|
84
|
-
- app/views/foreman_snapshot_management/hosts/_snapshots_tab_content.html.erb
|
85
42
|
- app/views/foreman_snapshot_management/snapshots/_index.html.erb
|
86
43
|
- app/views/foreman_snapshot_management/snapshots/select_multiple_host.html.erb
|
44
|
+
- app/views/hosts/_snapshots_tab.html.erb
|
87
45
|
- config/routes.rb
|
88
46
|
- lib/foreman_snapshot_management.rb
|
89
47
|
- lib/foreman_snapshot_management/engine.rb
|
90
48
|
- lib/foreman_snapshot_management/version.rb
|
91
49
|
- lib/tasks/foreman_snapshot_management_tasks.rake
|
92
50
|
- locale/Makefile
|
51
|
+
- locale/de/LC_MESSAGES/foreman_snapshot_management.mo
|
52
|
+
- locale/de/foreman_snapshot_management.po
|
53
|
+
- locale/en/LC_MESSAGES/foreman_snapshot_management.mo
|
54
|
+
- locale/en/foreman_snapshot_management.edit.po
|
93
55
|
- locale/en/foreman_snapshot_management.po
|
94
56
|
- locale/foreman_snapshot_management.pot
|
95
57
|
- locale/gemspec.rb
|
58
|
+
- package.json
|
96
59
|
- test/controllers/api/v2/snapshots_test.rb
|
97
60
|
- test/controllers/foreman_snapshot_management/snapshots_controller_test.rb
|
61
|
+
- test/factories/proxmox_factory.rb
|
98
62
|
- test/test_plugin_helper.rb
|
63
|
+
- webpack/components/SnapshotManagement/SnapshotManagement.js
|
64
|
+
- webpack/components/SnapshotManagement/SnapshotManagementActions.js
|
65
|
+
- webpack/components/SnapshotManagement/SnapshotManagementConstants.js
|
66
|
+
- webpack/components/SnapshotManagement/SnapshotManagementReducer.js
|
67
|
+
- webpack/components/SnapshotManagement/SnapshotManagementSelectors.js
|
68
|
+
- webpack/components/SnapshotManagement/__tests__/SnapshotManagementActions.test.js
|
69
|
+
- webpack/components/SnapshotManagement/__tests__/SnapshotManagementReducer.test.js
|
70
|
+
- webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementActions.test.js.snap
|
71
|
+
- webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementReducer.test.js.snap
|
72
|
+
- webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotForm.js
|
73
|
+
- webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotFormConstants.js
|
74
|
+
- webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/SnapshotForm.test.js
|
75
|
+
- webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/__snapshots__/SnapshotForm.test.js.snap
|
76
|
+
- webpack/components/SnapshotManagement/components/SnapshotForm/index.js
|
77
|
+
- webpack/components/SnapshotManagement/components/SnapshotForm/snapshotForm.scss
|
78
|
+
- webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModal.js
|
79
|
+
- webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModalConstants.js
|
80
|
+
- webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/SnapshotFormModal.test.js
|
81
|
+
- webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/__snapshots__/SnapshotFormModal.test.js.snap
|
82
|
+
- webpack/components/SnapshotManagement/components/SnapshotFormModal/index.js
|
83
|
+
- webpack/components/SnapshotManagement/components/SnapshotFormModal/useSnapshotFormModal.js
|
84
|
+
- webpack/components/SnapshotManagement/components/SnapshotList/SnapshotList.js
|
85
|
+
- webpack/components/SnapshotManagement/components/SnapshotList/SnapshotListHelper.js
|
86
|
+
- webpack/components/SnapshotManagement/components/SnapshotList/__tests__/SnapshotList.test.js
|
87
|
+
- webpack/components/SnapshotManagement/components/SnapshotList/__tests__/__snapshots__/SnapshotList.test.js.snap
|
88
|
+
- webpack/components/SnapshotManagement/components/SnapshotList/snapshotList.scss
|
89
|
+
- webpack/components/SnapshotManagement/index.js
|
90
|
+
- webpack/components/SnapshotManagement/snapshotManagement.scss
|
91
|
+
- webpack/global_index.js
|
92
|
+
- webpack/global_test_setup.js
|
93
|
+
- webpack/index.js
|
94
|
+
- webpack/reducers.js
|
95
|
+
- webpack/test_setup.js
|
99
96
|
homepage: https://www.orcharhino.com
|
100
|
-
licenses:
|
97
|
+
licenses:
|
98
|
+
- GPL-3.0-only
|
101
99
|
metadata: {}
|
102
100
|
post_install_message:
|
103
101
|
rdoc_options: []
|
@@ -107,19 +105,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
105
|
requirements:
|
108
106
|
- - ">="
|
109
107
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
108
|
+
version: '2.5'
|
111
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
110
|
requirements:
|
113
111
|
- - ">="
|
114
112
|
- !ruby/object:Gem::Version
|
115
113
|
version: '0'
|
116
114
|
requirements: []
|
117
|
-
|
118
|
-
rubygems_version: 2.7.6
|
115
|
+
rubygems_version: 3.0.8
|
119
116
|
signing_key:
|
120
117
|
specification_version: 4
|
121
|
-
summary: Snapshot Management for
|
118
|
+
summary: Snapshot Management for machines on virtualization-platforms
|
122
119
|
test_files:
|
123
120
|
- test/controllers/api/v2/snapshots_test.rb
|
124
121
|
- test/controllers/foreman_snapshot_management/snapshots_controller_test.rb
|
125
122
|
- test/test_plugin_helper.rb
|
123
|
+
- test/factories/proxmox_factory.rb
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Add a Snapshots tab in the view of a host
|
2
|
-
Deface::Override.new(virtual_path: 'hosts/show',
|
3
|
-
name: 'add_host_snapshot_tab',
|
4
|
-
insert_bottom: 'ul',
|
5
|
-
partial: 'foreman_snapshot_management/hosts/snapshots_tab')
|
6
|
-
|
7
|
-
# Load content of Snapshots tab
|
8
|
-
Deface::Override.new(virtual_path: 'hosts/show',
|
9
|
-
name: 'add_host_snapshots_tab_content',
|
10
|
-
insert_bottom: 'div#myTabContent',
|
11
|
-
partial: 'foreman_snapshot_management/hosts/snapshots_tab_content')
|