foreman_snapshot_management 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/snapshots_controller.rb +4 -1
  3. data/app/controllers/concerns/foreman/controller/parameters/snapshot.rb +1 -1
  4. data/app/controllers/foreman_snapshot_management/snapshots_controller.rb +16 -2
  5. data/app/models/foreman_snapshot_management/proxmox_extensions.rb +3 -3
  6. data/app/models/foreman_snapshot_management/snapshot.rb +4 -4
  7. data/app/models/foreman_snapshot_management/vmware_extensions.rb +13 -3
  8. data/app/views/foreman_snapshot_management/snapshots/_index.html.erb +2 -1
  9. data/app/views/foreman_snapshot_management/snapshots/select_multiple_host.html.erb +5 -3
  10. data/lib/foreman_snapshot_management/version.rb +1 -1
  11. data/locale/Makefile +7 -3
  12. data/locale/cs_CZ/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  13. data/locale/cs_CZ/foreman_snapshot_management.po +195 -0
  14. data/locale/de/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  15. data/locale/de/foreman_snapshot_management.po +10 -10
  16. data/locale/el/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  17. data/locale/el/foreman_snapshot_management.po +190 -0
  18. data/locale/en/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  19. data/locale/en/foreman_snapshot_management.po +22 -13
  20. data/locale/foreman_snapshot_management.pot +56 -35
  21. data/locale/fr/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  22. data/locale/fr/foreman_snapshot_management.po +196 -0
  23. data/locale/ja/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  24. data/locale/ja/foreman_snapshot_management.po +189 -0
  25. data/locale/ka/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  26. data/locale/ka/foreman_snapshot_management.po +190 -0
  27. data/locale/zh_CN/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  28. data/locale/zh_CN/foreman_snapshot_management.po +191 -0
  29. data/package.json +3 -2
  30. data/test/controllers/foreman_snapshot_management/snapshots_controller_test.rb +17 -2
  31. data/webpack/components/SnapshotManagement/SnapshotManagement.js +2 -0
  32. data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotForm.js +53 -11
  33. data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/__snapshots__/SnapshotForm.test.js.snap +262 -24
  34. data/webpack/components/SnapshotManagementCard/SnapshotManagementCard.js +61 -0
  35. data/webpack/components/SnapshotManagementCard/__tests__/SnapshotManagementCard.test.js +53 -0
  36. data/webpack/components/SnapshotManagementCard/__tests__/__snapshots__/SnapshotManagementCard.test.js.snap +132 -0
  37. data/webpack/components/SnapshotManagementCard/index.js +1 -0
  38. data/webpack/global_index.js +13 -0
  39. metadata +21 -6
@@ -0,0 +1,190 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the foreman_snapshot_management package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ # Translators:
7
+ # Temuri Doghonadze <temuri.doghonadze@gmail.com>, 2022
8
+ #
9
+ #, fuzzy
10
+ msgid ""
11
+ msgstr ""
12
+ "Project-Id-Version: foreman_snapshot_management 2.0.2\n"
13
+ "Report-Msgid-Bugs-To: \n"
14
+ "PO-Revision-Date: 2019-10-22 11:54+0000\n"
15
+ "Last-Translator: Temuri Doghonadze <temuri.doghonadze@gmail.com>, 2022\n"
16
+ "Language-Team: Georgian (https://www.transifex.com/foreman/teams/114/ka/)\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Language: ka\n"
21
+ "Plural-Forms: nplurals=2; plural=(n!=1);\n"
22
+
23
+ msgid "Action"
24
+ msgstr "მოქმედება"
25
+
26
+ msgid "Create Snapshot"
27
+ msgstr "სწრაფი ასლის შექმნა"
28
+
29
+ msgid "Create Snapshot for %s"
30
+ msgstr "%s-ის სწრაფი ასლის შექმნა"
31
+
32
+ msgid "Create a snapshot"
33
+ msgstr "სწრაფი ასლის შექმნა"
34
+
35
+ msgid "Created %{snapshots} for %{num} %{hosts}"
36
+ msgstr "შექმნილია %{snapshots} %{num} %{hosts}-სთვის"
37
+
38
+ msgid "Delete"
39
+ msgstr "წაშლა"
40
+
41
+ msgid "Delete Snapshot \"%s\"?"
42
+ msgstr "წავშალო სწრაფი ასლი \"%s\"?"
43
+
44
+ msgid "Delete a snapshot"
45
+ msgstr "სწრაფი ასლის წაშლა"
46
+
47
+ msgid "Description"
48
+ msgstr "აღწერა"
49
+
50
+ msgid "Description of this snapshot"
51
+ msgstr "სწრაფი ასლის აღწერა"
52
+
53
+ msgid "Error occurred while creating Snapshot for:%s"
54
+ msgstr "სწრაფი ასლის შექმნის შეცდომა: %s"
55
+
56
+ msgid "Error occurred while creating Snapshot: %s"
57
+ msgstr "სწრაფი ასლის შექმნის შეცდომა: %s"
58
+
59
+ msgid "Error occurred while removing Snapshot: %s"
60
+ msgstr "სწრაფი ასლის წაშლის შეცდომა: %s"
61
+
62
+ msgid "Error occurred while rolling back VM: %s"
63
+ msgstr "შეცდომა ვმ-ს დაბრუნებისას: %s"
64
+
65
+ msgid "Error occurred while updating Snapshot: %s"
66
+ msgstr "შეცდომა სწრაფი ასლის განახლებისას: %s"
67
+
68
+ msgid "Failed to load snapshot list"
69
+ msgstr "სწრაფი ასლების სიის ჩატვირთვის შეცდომა"
70
+
71
+ msgid "Failed to update Snapshot: %s"
72
+ msgstr "სწრაფი ასლის განახლების შეცდომა"
73
+
74
+ msgid "Foreman-plugin to manage snapshots in a virtual-hardware environments."
75
+ msgstr "Foreman-ის დამატება ვირტუალურ გარემოში სწრაფი ასლების სამართავად."
76
+
77
+ msgid "Include RAM"
78
+ msgstr "RAM-ის ჩათვლით"
79
+
80
+ msgid "List all snapshots"
81
+ msgstr "სწრაფი ასლების სია"
82
+
83
+ msgid "Loading Snapshots information ..."
84
+ msgstr "სწრაფი ასლების ინფორმაციის ჩატვირთვა ..."
85
+
86
+ msgid "N/A"
87
+ msgstr "არარსებული"
88
+
89
+ msgid "Name"
90
+ msgstr "სახელი"
91
+
92
+ msgid "Name must contain at least 2 characters starting with alphabet. Valid characters are A-Z a-z 0-9 _"
93
+ msgstr "სახელი უნდა შეიცავდეს მინიმუმ 2 სიმბოლოს დაწყებული ასოებით. მისაღები სიმბოლოებია A-Z a-z 0-9 _"
94
+
95
+ msgid "Name of this snapshot"
96
+ msgstr "სწრაფი ასლის სახელი"
97
+
98
+ msgid "No capable hosts found."
99
+ msgstr "შესაძლებლობის მქონე ჰოსტები ნაპოვნი არაა."
100
+
101
+ msgid "No capable hosts selected"
102
+ msgstr "შესაძლებლობის მქონე ჰოსტები მონიშნული არაა"
103
+
104
+ msgid "No hosts were found with that id, name or query filter"
105
+ msgstr "მითითებული ID-ით, სახელით ან საძებნი სტრიქონით ჰოსტები ნაპოვნი არაა"
106
+
107
+ msgid "Revert Host to a snapshot"
108
+ msgstr "ჰოსტის სწრაფ ასლზე დაბრუნება"
109
+
110
+ msgid "Rollback"
111
+ msgstr "უკან დაბრუნება"
112
+
113
+ msgid "Rollback to \"%s\"?"
114
+ msgstr "დავაბრუნო \"%s\"-ზე?"
115
+
116
+ msgid "Snapshot"
117
+ msgid_plural "Snapshots"
118
+ msgstr[0] "სწრაფი ასლი"
119
+ msgstr[1] "სწრაფი ასლები"
120
+
121
+ msgid "Snapshot name cannot be changed"
122
+ msgstr "სწრაფი ასლის სახელის შეცვლა შეუძლებელია"
123
+
124
+ msgid "Snapshot successfully created!"
125
+ msgstr "სწრაფი ასლი წარმატებით შეიქმნა!"
126
+
127
+ msgid "Snapshots"
128
+ msgstr "სწრაფი ასლები"
129
+
130
+ msgid "Something went wrong while selecting hosts - %s"
131
+ msgstr "შეცდომა ჰოსტების მონიშვნისას - %s"
132
+
133
+ msgid "Successfully removed Snapshot \"%s\" from host %s"
134
+ msgstr "სწრაფი ასლის (%s) წაშლა ჰოსტიდან %s წარმატებით დასრულდა"
135
+
136
+ msgid "Successfully rolled back Snapshot \"%s\" on host %s"
137
+ msgstr "ჰოსტი %s წარმატებით დაბრუნდა სწრაფ ასლზე \"%s\""
138
+
139
+ msgid "Successfully updated Snapshot \"%s\""
140
+ msgstr "სწრაფი ასლი (%s) წარმატებით განახლდა"
141
+
142
+ msgid "Unable to create Proxmox Snapshot"
143
+ msgstr "Proxmox-ის სწრაფი ასლის შექმნა შეუძლებელია"
144
+
145
+ msgid "Unable to create VMWare Snapshot"
146
+ msgstr "VMWare-ის სწრაფი ასლის შექმნა შეუძლებელია"
147
+
148
+ msgid "Unable to create VMWare Snapshot with Quiesce. Check Power and VMWare Tools status."
149
+ msgstr "Quiesce-ით VMWare-ის სწრაფი ასლის შექმნა შეუძლებელია. შეამოწმეთ მისი კვება და VMWare Tools-ის მდგომარეობა."
150
+
151
+ msgid "Unable to create VMWare Snapshot. Cannot set both Memory and Quiesce options."
152
+ msgstr "VMWare-ის სწრაფი ასლის შექმნის შეცდომა. Quiesce -ის და მეხსიერების პარამეტრების ერთდროული დაყენება შეუძლებელია."
153
+
154
+ msgid "Unable to remove Proxmox Snapshot"
155
+ msgstr "Proxmox-ის სწრაფი ასლის წაშლა შეუძლებელია"
156
+
157
+ msgid "Unable to remove VMWare Snapshot"
158
+ msgstr "VMWare-ის სწრაფი ასლის წაშლა შეუძლებელია"
159
+
160
+ msgid "Unable to revert Proxmox Snapshot"
161
+ msgstr "Proxmox-ის სწრაფი ასლის დაბრუნება შეუძლებელია"
162
+
163
+ msgid "Unable to revert VMWare Snapshot"
164
+ msgstr "VMWare-ის სწრაფი ასლის დაბრუნება შეუძლებელია"
165
+
166
+ msgid "Unable to update Proxmox Snapshot"
167
+ msgstr "Proxmox-ის სწრაფი ასლის განახლება შეუძლებელია"
168
+
169
+ msgid "Unable to update VMWare Snapshot"
170
+ msgstr "VMWare-ის სწრაფი ასლის განახლება შეუძლებელია"
171
+
172
+ msgid "Update a snapshot"
173
+ msgstr "სწრაფი ასლის განახლება"
174
+
175
+ msgid "VM successfully rolled back."
176
+ msgstr "ვმ-ი წარმატებით დაბრუნდა."
177
+
178
+ msgid "Whether to include the Quiesce state in the snapshot"
179
+ msgstr "იქნება თუ არა ჩასმული სწრაფ ასლში Quiesce -ის მდგომარეობა"
180
+
181
+ msgid "Whether to include the RAM state in the snapshot"
182
+ msgstr "სწრაფ ასლში ოპერატიული მეხსიერების მდგომარეობის შენახვა"
183
+
184
+ msgid "edit entry"
185
+ msgstr "ჩანაწერის ჩასწორება"
186
+
187
+ msgid "host"
188
+ msgid_plural "hosts"
189
+ msgstr[0] "ჰოსტი"
190
+ msgstr[1] "ჰოსტი"
@@ -0,0 +1,191 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the foreman_snapshot_management package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ # Translators:
7
+ # 0868a4d1af5275b3f70b0a6dac4c99a4, 2019
8
+ # Bryan Kearney <bryan.kearney@gmail.com>, 2019
9
+ # Amit Upadhye <aupadhye@redhat.com>, 2022
10
+ #
11
+ #, fuzzy
12
+ msgid ""
13
+ msgstr ""
14
+ "Project-Id-Version: foreman_snapshot_management 2.0.2\n"
15
+ "Report-Msgid-Bugs-To: \n"
16
+ "PO-Revision-Date: 2019-10-22 11:54+0000\n"
17
+ "Last-Translator: Amit Upadhye <aupadhye@redhat.com>, 2022\n"
18
+ "Language-Team: Chinese (China) (https://www.transifex.com/foreman/teams/114/zh"
19
+ "_CN/)\n"
20
+ "MIME-Version: 1.0\n"
21
+ "Content-Type: text/plain; charset=UTF-8\n"
22
+ "Content-Transfer-Encoding: 8bit\n"
23
+ "Language: zh_CN\n"
24
+ "Plural-Forms: nplurals=1; plural=0;\n"
25
+
26
+ msgid "Action"
27
+ msgstr "操作"
28
+
29
+ msgid "Create Snapshot"
30
+ msgstr "创建快照"
31
+
32
+ msgid "Create Snapshot for %s"
33
+ msgstr "为 %s 创建快照"
34
+
35
+ msgid "Create a snapshot"
36
+ msgstr "创建快照"
37
+
38
+ msgid "Created %{snapshots} for %{num} %{hosts}"
39
+ msgstr "为 %{num} %{hosts} 创建的 %{snapshots}"
40
+
41
+ msgid "Delete"
42
+ msgstr "刪除"
43
+
44
+ msgid "Delete Snapshot \"%s\"?"
45
+ msgstr "删除快照 \"%s\"?"
46
+
47
+ msgid "Delete a snapshot"
48
+ msgstr "删除快照"
49
+
50
+ msgid "Description"
51
+ msgstr "描述"
52
+
53
+ msgid "Description of this snapshot"
54
+ msgstr "此快照的描述"
55
+
56
+ msgid "Error occurred while creating Snapshot for:%s"
57
+ msgstr "创建产品时发生错误:%s"
58
+
59
+ msgid "Error occurred while creating Snapshot: %s"
60
+ msgstr "创建快照时出现错误:%s"
61
+
62
+ msgid "Error occurred while removing Snapshot: %s"
63
+ msgstr "删除快照时发生错误:%s"
64
+
65
+ msgid "Error occurred while rolling back VM: %s"
66
+ msgstr "回滚虚拟机时出现错误:%s"
67
+
68
+ msgid "Error occurred while updating Snapshot: %s"
69
+ msgstr "更新快照时发生错误:%s"
70
+
71
+ msgid "Failed to load snapshot list"
72
+ msgstr "加载快照列表失败"
73
+
74
+ msgid "Failed to update Snapshot: %s"
75
+ msgstr "更新快照失败:%s"
76
+
77
+ msgid "Foreman-plugin to manage snapshots in a virtual-hardware environments."
78
+ msgstr "Foreman-plugin,用于在虚拟硬件环境中管理快照。"
79
+
80
+ msgid "Include RAM"
81
+ msgstr "包括 RAM"
82
+
83
+ msgid "List all snapshots"
84
+ msgstr "列出所有快照"
85
+
86
+ msgid "Loading Snapshots information ..."
87
+ msgstr "加载快照信息..."
88
+
89
+ msgid "N/A"
90
+ msgstr "不适用"
91
+
92
+ msgid "Name"
93
+ msgstr "名称"
94
+
95
+ msgid "Name must contain at least 2 characters starting with alphabet. Valid characters are A-Z a-z 0-9 _"
96
+ msgstr "名称必须至少包含以字面开头的 2 个字符。有效字符为 A-Z a-z 0-9 _"
97
+
98
+ msgid "Name of this snapshot"
99
+ msgstr "此快照的名称"
100
+
101
+ msgid "No capable hosts found."
102
+ msgstr "未找到可用的主机。"
103
+
104
+ msgid "No capable hosts selected"
105
+ msgstr "没有选择可用的主机"
106
+
107
+ msgid "No hosts were found with that id, name or query filter"
108
+ msgstr "未找到符合此 id、名称或者查询过滤器的主机"
109
+
110
+ msgid "Revert Host to a snapshot"
111
+ msgstr "将主机恢复到快照"
112
+
113
+ msgid "Rollback"
114
+ msgstr "回滚rollback"
115
+
116
+ msgid "Rollback to \"%s\"?"
117
+ msgstr "回滚到 \"%s\"?"
118
+
119
+ msgid "Snapshot"
120
+ msgid_plural "Snapshots"
121
+ msgstr[0] "快照"
122
+
123
+ msgid "Snapshot name cannot be changed"
124
+ msgstr "无法更改快照名称"
125
+
126
+ msgid "Snapshot successfully created!"
127
+ msgstr "成功创建快照!"
128
+
129
+ msgid "Snapshots"
130
+ msgstr "快照"
131
+
132
+ msgid "Something went wrong while selecting hosts - %s"
133
+ msgstr "选择主机时出错 - %s"
134
+
135
+ msgid "Successfully removed Snapshot \"%s\" from host %s"
136
+ msgstr "成功从主机 %s 中删除快照 \"%s\""
137
+
138
+ msgid "Successfully rolled back Snapshot \"%s\" on host %s"
139
+ msgstr "在主机 %s 上成功回滚快照 \"%s\""
140
+
141
+ msgid "Successfully updated Snapshot \"%s\""
142
+ msgstr "成功更新快照 \"%s\""
143
+
144
+ msgid "Unable to create Proxmox Snapshot"
145
+ msgstr "无法创建 Proxmox 快照"
146
+
147
+ msgid "Unable to create VMWare Snapshot"
148
+ msgstr "无法创建 VMWare 快照"
149
+
150
+ msgid "Unable to create VMWare Snapshot with Quiesce. Check Power and VMWare Tools status."
151
+ msgstr "无法使用 Quiesce 创建 VMWare 快照。检查 Power 和 VMWare 工具状态。"
152
+
153
+ msgid "Unable to create VMWare Snapshot. Cannot set both Memory and Quiesce options."
154
+ msgstr "无法创建 VMWare 快照。无法同时设置 Memory 和 Quiesce 选项。"
155
+
156
+ msgid "Unable to remove Proxmox Snapshot"
157
+ msgstr "无法删除 Proxmox 快照"
158
+
159
+ msgid "Unable to remove VMWare Snapshot"
160
+ msgstr "无法删除 VMWare 快照"
161
+
162
+ msgid "Unable to revert Proxmox Snapshot"
163
+ msgstr "无法恢复 Proxmox 快照"
164
+
165
+ msgid "Unable to revert VMWare Snapshot"
166
+ msgstr "无法恢复 VMWare 快照"
167
+
168
+ msgid "Unable to update Proxmox Snapshot"
169
+ msgstr "无法更新 Proxmox 快照"
170
+
171
+ msgid "Unable to update VMWare Snapshot"
172
+ msgstr "无法更新 VMWare 快照"
173
+
174
+ msgid "Update a snapshot"
175
+ msgstr "更新快照"
176
+
177
+ msgid "VM successfully rolled back."
178
+ msgstr "虚拟机成功回滚。"
179
+
180
+ msgid "Whether to include the Quiesce state in the snapshot"
181
+ msgstr "是否在快照中包含 Quiesce 状态"
182
+
183
+ msgid "Whether to include the RAM state in the snapshot"
184
+ msgstr "是否在快照中包含 RAM 状态"
185
+
186
+ msgid "edit entry"
187
+ msgstr "编辑条目"
188
+
189
+ msgid "host"
190
+ msgid_plural "hosts"
191
+ msgstr[0] "主机"
data/package.json CHANGED
@@ -7,8 +7,9 @@
7
7
  "lint": "tfm-lint --plugin -d /webpack",
8
8
  "stylelint": "stylelint webpack/**/*.scss",
9
9
  "test": "tfm-test --config jest.config.js",
10
- "test:watch": "tfm-test --plugin --watchAll",
11
- "test:current": "tfm-test --plugin --watch",
10
+ "test:compat": "tfm-test --config jest.config.js --testPathIgnorePatterns='SnapshotManagementCard'",
11
+ "test:watch": "tfm-test --config jest.config.js --plugin --watchAll",
12
+ "test:current": "tfm-test --config jest.config.js --plugin --watch",
12
13
  "publish-coverage": "tfm-publish-coverage",
13
14
  "stories": "tfm-stories --plugin",
14
15
  "stories:build": "tfm-build-stories --plugin",
@@ -11,7 +11,7 @@ module ForemanSnapshotManagement
11
11
  ComputeResource.find_by(id: cr.id)
12
12
  end
13
13
  let(:uuid) { '5032c8a5-9c5e-ba7a-3804-832a03e16381' }
14
- let(:uuid2) { 'a7169e20-74d3-4367-afc2-d355716e7555' }
14
+ let(:uuid2) { '502916a3-b42e-17c7-43ce-b3206e9524dc' }
15
15
  let(:host) { FactoryBot.create(:host, :managed, :compute_resource => compute_resource, :uuid => uuid) }
16
16
  let(:host2) { FactoryBot.create(:host, :managed, :compute_resource => compute_resource, :uuid => uuid2) }
17
17
  let(:snapshot_id) { 'snapshot-0101' }
@@ -64,8 +64,23 @@ module ForemanSnapshotManagement
64
64
  end
65
65
  end
66
66
 
67
- test 'create valid multiple' do
67
+ test 'create valid multiple with memory' do
68
+ post :create_multiple_host, params: { :host_ids => [host.id, host2.id], :snapshot => { :name => 'test', :snapshot_mode => 'memory' } }, session: set_session_user
69
+ puts @response
70
+ assert_redirected_to hosts_url
71
+ assert_includes flash[:notice] || flash[:success], 'Created Snapshots for 2 hosts'
72
+ end
73
+
74
+ test 'create valid multiple with quiesce' do
75
+ post :create_multiple_host, params: { :host_ids => [host.id], :snapshot => { :name => 'test', :snapshot_mode => 'quiesce' } }, session: set_session_user
76
+ puts @response
77
+ assert_redirected_to hosts_url
78
+ assert_includes flash[:notice] || flash[:success], 'Created Snapshot for 1 host'
79
+ end
80
+
81
+ test 'create valid multiple without specific mode' do
68
82
  post :create_multiple_host, params: { :host_ids => [host.id, host2.id], :snapshot => { :name => 'test' } }, session: set_session_user
83
+ puts @response
69
84
  assert_redirected_to hosts_url
70
85
  assert_includes flash[:notice] || flash[:success], 'Created Snapshots for 2 hosts'
71
86
  end
@@ -67,6 +67,7 @@ SnapshotManagement.propTypes = {
67
67
  capabilities: PropTypes.shape({
68
68
  editSnapshotName: PropTypes.bool,
69
69
  limitSnapshotNameFormat: PropTypes.bool,
70
+ quiesceOption: PropTypes.bool,
70
71
  }),
71
72
  };
72
73
 
@@ -78,6 +79,7 @@ SnapshotManagement.defaultProps = {
78
79
  capabilities: {
79
80
  editSnapshotName: true,
80
81
  limitSnapshotNameFormat: false,
82
+ quiesceOption: false,
81
83
  },
82
84
  };
83
85
 
@@ -1,13 +1,11 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import * as Yup from 'yup';
4
4
 
5
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
6
  import ForemanForm from 'foremanReact/components/common/forms/ForemanForm';
9
7
  import TextField from 'foremanReact/components/common/forms/TextField';
10
-
8
+ import { FieldLevelHelp } from 'patternfly-react';
11
9
  import { SNAPSHOT_CREATE_URL } from './SnapshotFormConstants';
12
10
  import './snapshotForm.scss';
13
11
 
@@ -35,17 +33,37 @@ const SnapshotForm = ({
35
33
  name: nameValidation.required('is required'),
36
34
  description: Yup.string(),
37
35
  includeRam: Yup.bool(),
36
+ useQuiesce: Yup.bool(),
37
+ snapshotMode: Yup.string(),
38
38
  });
39
39
 
40
+ const [snapshotMode, setSnapshotMode] = useState();
41
+
42
+ const options = [
43
+ { name: '', value: '' },
44
+ { name: 'Memory', value: __('Memory') },
45
+ ];
46
+ if (capabilities.quiesceOption) {
47
+ options.push({ name: 'Quiesce', value: __('Quiesce') });
48
+ }
49
+
40
50
  const handleSubmit = (values, actions) => {
51
+ if (snapshotMode === 'Quiesce') {
52
+ values.useQuiesce = true;
53
+ values.includeRam = false;
54
+ } else if (snapshotMode === 'Memory') {
55
+ values.includeRam = true;
56
+ values.useQuiesce = false;
57
+ }
58
+
41
59
  const submitValues = {
42
60
  include_ram: values.includeRam || false,
61
+ quiesce: values.useQuiesce || false,
43
62
  snapshot: {
44
63
  name: values.name,
45
64
  description: values.description || '',
46
65
  },
47
66
  };
48
-
49
67
  submitForm({
50
68
  item: 'Snapshot',
51
69
  url: SNAPSHOT_CREATE_URL.replace(':hostId', hostId),
@@ -76,12 +94,31 @@ const SnapshotForm = ({
76
94
  label={__('Description')}
77
95
  inputClassName="col-md-8"
78
96
  />
79
- <TextField
80
- type="checkbox"
81
- name="includeRam"
82
- label={__('Include RAM')}
83
- inputClassName="col-md-8"
84
- />
97
+ <div className="form-group">
98
+ <label className="col-md-2 control-label">
99
+ {__('Snapshot Mode')}
100
+ <FieldLevelHelp
101
+ buttonClass="field-help"
102
+ placement="top"
103
+ content={__(
104
+ "Select Snapshot Mode between mutually exclusive options, 'Memory' (includes RAM) and 'Quiesce'."
105
+ )}
106
+ />
107
+ </label>
108
+ <div className="col-md-8">
109
+ <select
110
+ className="common-select form-control"
111
+ value={snapshotMode}
112
+ onChange={e => setSnapshotMode(e.target.value)}
113
+ >
114
+ {options.map(item => (
115
+ <option key={item.value} value={item.value}>
116
+ {item.name}
117
+ </option>
118
+ ))}
119
+ </select>
120
+ </div>
121
+ </div>
85
122
  </ForemanForm>
86
123
  );
87
124
  };
@@ -94,11 +131,13 @@ SnapshotForm.propTypes = {
94
131
  name: PropTypes.string.isRequired,
95
132
  description: PropTypes.string.isRequired,
96
133
  includeRam: PropTypes.bool.isRequired,
134
+ useQuiesce: PropTypes.bool,
97
135
  }),
98
136
  submitForm: PropTypes.func.isRequired,
99
137
  setModalClosed: PropTypes.func,
100
138
  capabilities: PropTypes.shape({
101
139
  limitSnapshotNameFormat: PropTypes.bool,
140
+ quiesceOption: PropTypes.bool,
102
141
  }),
103
142
  };
104
143
 
@@ -109,10 +148,13 @@ SnapshotForm.defaultProps = {
109
148
  name: '',
110
149
  description: '',
111
150
  includeRam: false,
151
+ useQuiesce: false,
152
+ snapshotMode: '',
112
153
  },
113
154
  setModalClosed: () => {},
114
155
  capabilities: {
115
156
  limitSnapshotNameFormat: false,
157
+ quiesceOption: false,
116
158
  },
117
159
  };
118
160