Skip to content

Commit 85347aa

Browse files
Konstantina ChremmouKonstantina Chremmou
authored andcommitted
CP-43651: Ask for confirmation when the user clicks to create a DVD drive.
Signed-off-by: Konstantina Chremmou <[email protected]>
1 parent fcd9b19 commit 85347aa

File tree

3 files changed

+44
-7
lines changed

3 files changed

+44
-7
lines changed

XenAdmin/Controls/MultipleDvdIsoList.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,26 @@ private void comboBoxDrive_SelectedIndexChanged(object sender, EventArgs e)
251251
cdChanger1.Drive = (comboBoxDrive.SelectedItem as VbdCombiItem)?.Vbd;
252252
}
253253

254-
255254
private void newCDLabel_Click(object sender, EventArgs e)
256255
{
257-
if (VM != null)
258-
{
259-
var createDriveAction = new CreateCdDriveAction(VM);
260-
createDriveAction.ShowUserInstruction += CreateDriveAction_ShowUserInstruction;
256+
if (VM == null)
257+
return;
261258

262-
using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee))
263-
dlg.ShowDialog(this);
259+
if (VM.IsHVM())
260+
{
261+
using (var dialog = new WarningDialog(
262+
string.Format(Messages.NEW_DVD_DRIVE_CREATE_CONFIRMATION, VM.Name()),
263+
new ThreeButtonDialog.TBDButton(Messages.NEW_DVD_DRIVE_CREATE_YES_BUTTON, DialogResult.Yes, ThreeButtonDialog.ButtonType.ACCEPT, true),
264+
ThreeButtonDialog.ButtonNo))
265+
if (dialog.ShowDialog(Program.MainWindow) != DialogResult.Yes)
266+
return;
264267
}
268+
269+
var createDriveAction = new CreateCdDriveAction(VM);
270+
createDriveAction.ShowUserInstruction += CreateDriveAction_ShowUserInstruction;
271+
272+
using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee))
273+
dlg.ShowDialog(this);
265274
}
266275

267276
private void CreateDriveAction_ShowUserInstruction(string message)

XenModel/Messages.Designer.cs

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

XenModel/Messages.resx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9101,9 +9101,17 @@ You should only proceed if you have verified that these settings are correct.</v
91019101
<data name="NEVER" xml:space="preserve">
91029102
<value>Never</value>
91039103
</data>
9104+
<data name="NEW_DVD_DRIVE_CREATE_CONFIRMATION" xml:space="preserve">
9105+
<value>Are you sure you want to create a new DVD drive on VM '{0}'?
9106+
9107+
This action will create a new Virtual Block Device (VBD) that cannot be hot-unplugged.</value>
9108+
</data>
91049109
<data name="NEW_DVD_DRIVE_CREATE_TITLE" xml:space="preserve">
91059110
<value>Creating new DVD drive on VM {0}</value>
91069111
</data>
9112+
<data name="NEW_DVD_DRIVE_CREATE_YES_BUTTON" xml:space="preserve">
9113+
<value>&amp;Yes, Create</value>
9114+
</data>
91079115
<data name="NEW_DVD_DRIVE_CREATING" xml:space="preserve">
91089116
<value>Creating new DVD drive</value>
91099117
</data>

0 commit comments

Comments
 (0)