[node-patches] Change in ovirt-node[master]: Let users continue if they cancel the custom device dialog

rbarry at redhat.com rbarry at redhat.com
Thu May 1 17:30:43 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Let users continue if they cancel the custom device dialog
......................................................................

Let users continue if they cancel the custom device dialog

If users close out of the dialog without saving for some reason,
remove their changes from the plugin model and retrigger
validation so they can continue as normal.

Change-Id: Ic2feb886bbfa738643394ebf540b75f7e84817d9
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1077786
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/installer/core/boot_device_page.py
M src/ovirt/node/installer/core/installation_device_page.py
2 files changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/12/27312/1

diff --git a/src/ovirt/node/installer/core/boot_device_page.py b/src/ovirt/node/installer/core/boot_device_page.py
index 8a26aaa..b891e65 100644
--- a/src/ovirt/node/installer/core/boot_device_page.py
+++ b/src/ovirt/node/installer/core/boot_device_page.py
@@ -123,7 +123,7 @@
                            self.application.product.PRODUCT_SHORT)
             self._dialog = CustomDeviceDialog("boot.device.custom",
                                               "Specify a boot device",
-                                              description)
+                                              description, self)
             self.widgets.add(self._dialog)
             return self._dialog
 
@@ -226,7 +226,11 @@
 class CustomDeviceDialog(ui.Dialog):
     """The dialog to input a custom root/boot device
     """
-    def __init__(self, path_prefix, title, description):
+    def __init__(self, path_prefix, title, description, plugin):
+        def clear_invalid(dialog, changes):
+            plugin._NodePlugin__invalid_changes.drop([path_prefix])
+            plugin._on_ui_change({})
+
         title = _("Custom Block Device")
 
         device_entry = ui.Entry(path_prefix, _("Device path:"))
@@ -239,3 +243,8 @@
                                       enabled=False),
                         ui.CloseButton("dialog.device.custom.close",
                                        _("Cancel"))]
+
+        b = plugins.UIElements(self.buttons)
+        b["dialog.device.custom.close"].on_activate.clear()
+        b["dialog.device.custom.close"].on_activate.connect(ui.CloseAction())
+        b["dialog.device.custom.close"].on_activate.connect(clear_invalid)
diff --git a/src/ovirt/node/installer/core/installation_device_page.py b/src/ovirt/node/installer/core/installation_device_page.py
index 364d099..f809695 100644
--- a/src/ovirt/node/installer/core/installation_device_page.py
+++ b/src/ovirt/node/installer/core/installation_device_page.py
@@ -157,7 +157,7 @@
                            self.application.product.PRODUCT_SHORT)
             self._dialog = CustomDeviceDialog("installation.device.custom",
                                               "Installation devices.",
-                                              description)
+                                              description, self)
             self.widgets.add(self._dialog)
             return self._dialog
 


-- 
To view, visit http://gerrit.ovirt.org/27312
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2feb886bbfa738643394ebf540b75f7e84817d9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list