foreman_snapshot_management 1.7.1 → 2.0.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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/Rakefile +7 -2
  4. data/app/controllers/api/v2/snapshots_controller.rb +22 -6
  5. data/app/models/foreman_snapshot_management/proxmox_extensions.rb +1 -1
  6. data/app/models/foreman_snapshot_management/snapshot.rb +4 -0
  7. data/app/views/api/v2/snapshots/base.json.rabl +2 -0
  8. data/app/views/foreman_snapshot_management/snapshots/_index.html.erb +12 -80
  9. data/app/views/hosts/_snapshots_tab.html.erb +8 -0
  10. data/lib/foreman_snapshot_management/engine.rb +22 -21
  11. data/lib/foreman_snapshot_management/version.rb +1 -1
  12. data/lib/tasks/foreman_snapshot_management_tasks.rake +2 -2
  13. data/locale/de/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  14. data/locale/de/foreman_snapshot_management.po +52 -19
  15. data/locale/en/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  16. data/locale/en/foreman_snapshot_management.po +44 -11
  17. data/locale/foreman_snapshot_management.pot +87 -25
  18. data/package.json +46 -0
  19. data/test/controllers/api/v2/snapshots_test.rb +232 -109
  20. data/test/controllers/foreman_snapshot_management/snapshots_controller_test.rb +1 -1
  21. data/test/factories/proxmox_factory.rb +1 -1
  22. data/webpack/components/SnapshotManagement/SnapshotManagement.js +84 -0
  23. data/webpack/components/SnapshotManagement/SnapshotManagementActions.js +212 -0
  24. data/webpack/components/SnapshotManagement/SnapshotManagementConstants.js +9 -0
  25. data/webpack/components/SnapshotManagement/SnapshotManagementReducer.js +100 -0
  26. data/webpack/components/SnapshotManagement/SnapshotManagementSelectors.js +8 -0
  27. data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementActions.test.js +123 -0
  28. data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementReducer.test.js +157 -0
  29. data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementActions.test.js.snap +314 -0
  30. data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementReducer.test.js.snap +214 -0
  31. data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotForm.js +118 -0
  32. data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotFormConstants.js +5 -0
  33. data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/SnapshotForm.test.js +26 -0
  34. data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/__snapshots__/SnapshotForm.test.js.snap +476 -0
  35. data/webpack/components/SnapshotManagement/components/SnapshotForm/index.js +19 -0
  36. data/webpack/components/SnapshotManagement/components/SnapshotForm/snapshotForm.scss +3 -0
  37. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModal.js +37 -0
  38. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModalConstants.js +1 -0
  39. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/SnapshotFormModal.test.js +19 -0
  40. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/__snapshots__/SnapshotFormModal.test.js.snap +19 -0
  41. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/index.js +12 -0
  42. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/useSnapshotFormModal.js +7 -0
  43. data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotList.js +314 -0
  44. data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotListHelper.js +70 -0
  45. data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/SnapshotList.test.js +88 -0
  46. data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/__snapshots__/SnapshotList.test.js.snap +1081 -0
  47. data/webpack/components/SnapshotManagement/components/SnapshotList/snapshotList.scss +13 -0
  48. data/webpack/components/SnapshotManagement/index.js +33 -0
  49. data/webpack/components/SnapshotManagement/snapshotManagement.scss +5 -0
  50. data/webpack/global_index.js +7 -0
  51. data/webpack/global_test_setup.js +11 -0
  52. data/webpack/index.js +8 -0
  53. data/webpack/reducers.js +7 -0
  54. data/webpack/test_setup.js +17 -0
  55. metadata +39 -33
@@ -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,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_snapshot_management
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
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: 2020-03-02 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.75.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.75.0
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
+ dependencies: []
41
13
  description: Foreman-plugin to manage snapshots in a virtual-hardware environments.
42
14
  email:
43
15
  - info@atix.de
@@ -83,10 +55,44 @@ files:
83
55
  - locale/en/foreman_snapshot_management.po
84
56
  - locale/foreman_snapshot_management.pot
85
57
  - locale/gemspec.rb
58
+ - package.json
86
59
  - test/controllers/api/v2/snapshots_test.rb
87
60
  - test/controllers/foreman_snapshot_management/snapshots_controller_test.rb
88
61
  - test/factories/proxmox_factory.rb
89
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
90
96
  homepage: https://www.orcharhino.com
91
97
  licenses:
92
98
  - GPL-3.0-only
@@ -99,14 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
105
  requirements:
100
106
  - - ">="
101
107
  - !ruby/object:Gem::Version
102
- version: '0'
108
+ version: '2.5'
103
109
  required_rubygems_version: !ruby/object:Gem::Requirement
104
110
  requirements:
105
111
  - - ">="
106
112
  - !ruby/object:Gem::Version
107
113
  version: '0'
108
114
  requirements: []
109
- rubygems_version: 3.0.6
115
+ rubygems_version: 3.0.8
110
116
  signing_key:
111
117
  specification_version: 4
112
118
  summary: Snapshot Management for machines on virtualization-platforms