foreman_snapshot_management 1.6.1 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -2
  3. data/Rakefile +7 -2
  4. data/app/controllers/api/v2/snapshots_controller.rb +37 -7
  5. data/app/controllers/concerns/foreman/controller/parameters/snapshot.rb +1 -1
  6. data/app/controllers/foreman_snapshot_management/snapshots_controller.rb +5 -5
  7. data/app/models/concerns/fog_extensions/proxmox/snapshots/mock.rb +24 -0
  8. data/app/models/foreman_snapshot_management/proxmox_extensions.rb +101 -0
  9. data/app/models/foreman_snapshot_management/snapshot.rb +28 -28
  10. data/app/models/foreman_snapshot_management/vmware_extensions.rb +40 -13
  11. data/app/views/api/v2/snapshots/base.json.rabl +2 -0
  12. data/app/views/api/v2/snapshots/main.json.rabl +2 -2
  13. data/app/views/foreman_snapshot_management/snapshots/_index.html.erb +12 -74
  14. data/app/views/hosts/_snapshots_tab.html.erb +8 -0
  15. data/lib/foreman_snapshot_management/engine.rb +35 -16
  16. data/lib/foreman_snapshot_management/version.rb +1 -1
  17. data/lib/tasks/foreman_snapshot_management_tasks.rake +2 -2
  18. data/locale/de/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  19. data/locale/de/foreman_snapshot_management.po +195 -0
  20. data/locale/en/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  21. data/locale/en/foreman_snapshot_management.po +179 -11
  22. data/locale/foreman_snapshot_management.pot +259 -8
  23. data/locale/gemspec.rb +1 -1
  24. data/package.json +46 -0
  25. data/test/controllers/api/v2/snapshots_test.rb +250 -39
  26. data/test/controllers/foreman_snapshot_management/snapshots_controller_test.rb +61 -9
  27. data/test/factories/proxmox_factory.rb +18 -0
  28. data/test/test_plugin_helper.rb +3 -0
  29. data/webpack/components/SnapshotManagement/SnapshotManagement.js +84 -0
  30. data/webpack/components/SnapshotManagement/SnapshotManagementActions.js +212 -0
  31. data/webpack/components/SnapshotManagement/SnapshotManagementConstants.js +9 -0
  32. data/webpack/components/SnapshotManagement/SnapshotManagementReducer.js +100 -0
  33. data/webpack/components/SnapshotManagement/SnapshotManagementSelectors.js +8 -0
  34. data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementActions.test.js +123 -0
  35. data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementReducer.test.js +157 -0
  36. data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementActions.test.js.snap +314 -0
  37. data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementReducer.test.js.snap +214 -0
  38. data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotForm.js +118 -0
  39. data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotFormConstants.js +5 -0
  40. data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/SnapshotForm.test.js +26 -0
  41. data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/__snapshots__/SnapshotForm.test.js.snap +476 -0
  42. data/webpack/components/SnapshotManagement/components/SnapshotForm/index.js +19 -0
  43. data/webpack/components/SnapshotManagement/components/SnapshotForm/snapshotForm.scss +3 -0
  44. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModal.js +37 -0
  45. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModalConstants.js +1 -0
  46. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/SnapshotFormModal.test.js +19 -0
  47. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/__snapshots__/SnapshotFormModal.test.js.snap +19 -0
  48. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/index.js +12 -0
  49. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/useSnapshotFormModal.js +7 -0
  50. data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotList.js +314 -0
  51. data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotListHelper.js +70 -0
  52. data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/SnapshotList.test.js +88 -0
  53. data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/__snapshots__/SnapshotList.test.js.snap +1081 -0
  54. data/webpack/components/SnapshotManagement/components/SnapshotList/snapshotList.scss +13 -0
  55. data/webpack/components/SnapshotManagement/index.js +33 -0
  56. data/webpack/components/SnapshotManagement/snapshotManagement.scss +5 -0
  57. data/webpack/global_index.js +7 -0
  58. data/webpack/global_test_setup.js +11 -0
  59. data/webpack/index.js +8 -0
  60. data/webpack/reducers.js +7 -0
  61. data/webpack/test_setup.js +17 -0
  62. metadata +50 -37
@@ -0,0 +1,13 @@
1
+
2
+ .snapshot-date {
3
+ color: var(--pf-global--secondary-color--100);
4
+ font-size: calc(var(--pf-global--icon--FontSize--sm) * 0.9);
5
+ }
6
+
7
+ .description {
8
+ white-space: pre-wrap;
9
+ }
10
+
11
+ .action-buttons {
12
+ width: 20%;
13
+ }
@@ -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,5 @@
1
+ .snapshot-create {
2
+ font-size: var(--pf-global--FontSize--md);
3
+ margin-bottom: 20px;
4
+ margin-top: 10px;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { registerReducer } from 'foremanReact/common/MountingService';
2
+ import reducers from './reducers';
3
+
4
+ // register reducers
5
+ Object.entries(reducers).forEach(([key, reducer]) =>
6
+ registerReducer(key, reducer)
7
+ );
@@ -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
@@ -0,0 +1,8 @@
1
+ import componentRegistry from 'foremanReact/components/componentRegistry';
2
+
3
+ import SnapshotManagement from './components/SnapshotManagement';
4
+
5
+ componentRegistry.register({
6
+ name: 'SnapshotManagement',
7
+ type: SnapshotManagement,
8
+ });
@@ -0,0 +1,7 @@
1
+ import SnapshotManagementReducer from './components/SnapshotManagement/SnapshotManagementReducer';
2
+
3
+ const reducers = {
4
+ foremanSnapshotManagement: SnapshotManagementReducer,
5
+ };
6
+
7
+ export default reducers;
@@ -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,44 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_snapshot_management
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ATIX AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-17 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rdoc
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '5.1'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '5.1'
27
- - !ruby/object:Gem::Dependency
28
- name: rubocop
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 0.54.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.54.0
41
- description: Foreman-plugin to manage snapshots in a vSphere environment.
11
+ date: 2021-07-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Foreman-plugin to manage snapshots in a virtual-hardware environments.
42
14
  email:
43
15
  - info@atix.de
44
16
  executables: []
@@ -53,8 +25,10 @@ files:
53
25
  - app/controllers/foreman_snapshot_management/snapshots_controller.rb
54
26
  - app/helpers/concerns/foreman_snapshot_management/hosts_helper_extension.rb
55
27
  - app/helpers/foreman_snapshot_management/snapshot_helper.rb
28
+ - app/models/concerns/fog_extensions/proxmox/snapshots/mock.rb
56
29
  - app/models/concerns/fog_extensions/vsphere/snapshots/mock.rb
57
30
  - app/models/concerns/fog_extensions/vsphere/snapshots/real.rb
31
+ - app/models/foreman_snapshot_management/proxmox_extensions.rb
58
32
  - app/models/foreman_snapshot_management/snapshot.rb
59
33
  - app/models/foreman_snapshot_management/vmware_extensions.rb
60
34
  - app/views/api/v2/snapshots/base.json.rabl
@@ -74,14 +48,53 @@ files:
74
48
  - lib/foreman_snapshot_management/version.rb
75
49
  - lib/tasks/foreman_snapshot_management_tasks.rake
76
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
77
54
  - locale/en/foreman_snapshot_management.po
78
55
  - locale/foreman_snapshot_management.pot
79
56
  - locale/gemspec.rb
57
+ - package.json
80
58
  - test/controllers/api/v2/snapshots_test.rb
81
59
  - test/controllers/foreman_snapshot_management/snapshots_controller_test.rb
60
+ - test/factories/proxmox_factory.rb
82
61
  - test/test_plugin_helper.rb
62
+ - webpack/components/SnapshotManagement/SnapshotManagement.js
63
+ - webpack/components/SnapshotManagement/SnapshotManagementActions.js
64
+ - webpack/components/SnapshotManagement/SnapshotManagementConstants.js
65
+ - webpack/components/SnapshotManagement/SnapshotManagementReducer.js
66
+ - webpack/components/SnapshotManagement/SnapshotManagementSelectors.js
67
+ - webpack/components/SnapshotManagement/__tests__/SnapshotManagementActions.test.js
68
+ - webpack/components/SnapshotManagement/__tests__/SnapshotManagementReducer.test.js
69
+ - webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementActions.test.js.snap
70
+ - webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementReducer.test.js.snap
71
+ - webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotForm.js
72
+ - webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotFormConstants.js
73
+ - webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/SnapshotForm.test.js
74
+ - webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/__snapshots__/SnapshotForm.test.js.snap
75
+ - webpack/components/SnapshotManagement/components/SnapshotForm/index.js
76
+ - webpack/components/SnapshotManagement/components/SnapshotForm/snapshotForm.scss
77
+ - webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModal.js
78
+ - webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModalConstants.js
79
+ - webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/SnapshotFormModal.test.js
80
+ - webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/__snapshots__/SnapshotFormModal.test.js.snap
81
+ - webpack/components/SnapshotManagement/components/SnapshotFormModal/index.js
82
+ - webpack/components/SnapshotManagement/components/SnapshotFormModal/useSnapshotFormModal.js
83
+ - webpack/components/SnapshotManagement/components/SnapshotList/SnapshotList.js
84
+ - webpack/components/SnapshotManagement/components/SnapshotList/SnapshotListHelper.js
85
+ - webpack/components/SnapshotManagement/components/SnapshotList/__tests__/SnapshotList.test.js
86
+ - webpack/components/SnapshotManagement/components/SnapshotList/__tests__/__snapshots__/SnapshotList.test.js.snap
87
+ - webpack/components/SnapshotManagement/components/SnapshotList/snapshotList.scss
88
+ - webpack/components/SnapshotManagement/index.js
89
+ - webpack/components/SnapshotManagement/snapshotManagement.scss
90
+ - webpack/global_index.js
91
+ - webpack/global_test_setup.js
92
+ - webpack/index.js
93
+ - webpack/reducers.js
94
+ - webpack/test_setup.js
83
95
  homepage: https://www.orcharhino.com
84
- licenses: []
96
+ licenses:
97
+ - GPL-3.0-only
85
98
  metadata: {}
86
99
  post_install_message:
87
100
  rdoc_options: []
@@ -91,19 +104,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
104
  requirements:
92
105
  - - ">="
93
106
  - !ruby/object:Gem::Version
94
- version: '0'
107
+ version: '2.5'
95
108
  required_rubygems_version: !ruby/object:Gem::Requirement
96
109
  requirements:
97
110
  - - ">="
98
111
  - !ruby/object:Gem::Version
99
112
  version: '0'
100
113
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.7.6.2
114
+ rubygems_version: 3.0.8
103
115
  signing_key:
104
116
  specification_version: 4
105
- summary: Snapshot Management for VMware vSphere
117
+ summary: Snapshot Management for machines on virtualization-platforms
106
118
  test_files:
107
119
  - test/controllers/api/v2/snapshots_test.rb
108
120
  - test/controllers/foreman_snapshot_management/snapshots_controller_test.rb
109
121
  - test/test_plugin_helper.rb
122
+ - test/factories/proxmox_factory.rb