Skip to content

Commit

Permalink
CP-43651: Ask for confirmation when the user clicks to create a DVD d…
Browse files Browse the repository at this point in the history
…rive.

Signed-off-by: Konstantina Chremmou <[email protected]>
  • Loading branch information
kc284 committed Nov 1, 2023
1 parent fcd9b19 commit df69ec3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
23 changes: 16 additions & 7 deletions XenAdmin/Controls/MultipleDvdIsoList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,26 @@ private void comboBoxDrive_SelectedIndexChanged(object sender, EventArgs e)
cdChanger1.Drive = (comboBoxDrive.SelectedItem as VbdCombiItem)?.Vbd;
}


private void newCDLabel_Click(object sender, EventArgs e)
{
if (VM != null)
{
var createDriveAction = new CreateCdDriveAction(VM);
createDriveAction.ShowUserInstruction += CreateDriveAction_ShowUserInstruction;
if (VM == null)
return;

using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee))
dlg.ShowDialog(this);
if (VM.IsHVM())
{
using (var dialog = new WarningDialog(
string.Format(Messages.NEW_DVD_DRIVE_CREATE_CONFIRMATION, VM.Name()),
new ThreeButtonDialog.TBDButton(Messages.NEW_DVD_DRIVE_CREATE_YES_BUTTON, DialogResult.Yes, ThreeButtonDialog.ButtonType.ACCEPT, true),
ThreeButtonDialog.ButtonNo))
if (dialog.ShowDialog(Program.MainWindow) != DialogResult.Yes)
return;
}

var createDriveAction = new CreateCdDriveAction(VM);
createDriveAction.ShowUserInstruction += CreateDriveAction_ShowUserInstruction;

using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee))
dlg.ShowDialog(this);
}

private void CreateDriveAction_ShowUserInstruction(string message)
Expand Down
20 changes: 20 additions & 0 deletions XenModel/Messages.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions XenModel/Messages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -9101,6 +9101,14 @@ You should only proceed if you have verified that these settings are correct.</v
<data name="NEVER" xml:space="preserve">
<value>Never</value>
</data>
<data name="NEW_DVD_DRIVE_CREATE_CONFIRMATION" xml:space="preserve">
<value>Are you sure you want to create a new DVD drive on VM '{0}'?

This action will create a new Virtual Block Device (VBD) that cannot be hot-unplugged.</value>
</data>
<data name="NEW_DVD_DRIVE_CREATE_YES_BUTTON" xml:space="preserve">
<value>&amp;Yes, Create</value>
</data>
<data name="NEW_DVD_DRIVE_CREATE_TITLE" xml:space="preserve">
<value>Creating new DVD drive on VM {0}</value>
</data>
Expand Down

0 comments on commit df69ec3

Please sign in to comment.