[node-patches] Change in ovirt-node[master]: installer: Use button for custom devices

fabiand at fedoraproject.org fabiand at fedoraproject.org
Wed Aug 21 16:04:49 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: installer: Use button for custom devices
......................................................................

installer: Use button for custom devices

Previously custom devices could be added by selecting a specific entry
in the table. But this became problematic with the parallel validation
changes.
The functionality is now pulled into a button to simplify the code.

Change-Id: I2a1fcf270ca2246d1c4d521f0d54b7e454276ff5
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/installer/core/boot_device_page.py
M src/ovirt/node/installer/core/installation_device_page.py
2 files changed, 14 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/80/18380/1

diff --git a/src/ovirt/node/installer/core/boot_device_page.py b/src/ovirt/node/installer/core/boot_device_page.py
index e212c78..9ff399c 100644
--- a/src/ovirt/node/installer/core/boot_device_page.py
+++ b/src/ovirt/node/installer/core/boot_device_page.py
@@ -60,13 +60,16 @@
                      self.application.product.PRODUCT_SHORT
 
         other_device = self._model.get("boot.device.custom", "")
-        devices = self.storage_discovery.all_devices_for_ui_table(other_device)
+        devices = self.storage_discovery.all_devices_for_ui_table()
 
         ws = [ui.Header("header[0]", page_title)]
 
         if devices:
             ws += [ui.Table("boot.device", "", " %6s  %11s  %5s" %
                             ("Location", "Device Name", "Size"), devices),
+                   ui.Divider("divider[0]"),
+                   ui.Button("button.other_device", "Other device: %s" %
+                             other_device),
                    DeviceDetails("label.details", self, "(No device)")
                    ]
         else:
@@ -148,12 +151,10 @@
             # I suppose the thread was not started
         return self._all_devices
 
-    def all_devices_for_ui_table(self, other_device=""):
+    def all_devices_for_ui_table(self):
         """Returns a ui.Table ready list of strings with all useable storage
         devices
 
-        Args:
-            other_devices: String-like to be used for the "Other"-Entry
         Returns:
             A list of strings to be used with ui.Table
         """
@@ -161,8 +162,6 @@
         devices = sorted([(name, " %6s  %11s  %5s GB" % (d.bus, d.name,
                                                          d.size))
                           for name, d in all_devices], key=lambda t: t[0])
-
-        devices += [("other", "Other Device: %s" % other_device)]
 
         return devices
 
@@ -203,13 +202,14 @@
 class CustomDeviceDialog(ui.Dialog):
     """The dialog to input a custom root/boot device
     """
-    def __init__(self, path, title, description):
+    def __init__(self, path_prefix, title, description):
         title = "Custom Block Device"
 
-        device_entry = ui.Entry("boot.device.custom", "Device path:")
+        device_entry = ui.Entry(path_prefix, "Device path:")
         children = [ui.Label("label[0]", description),
                     ui.Divider("divider[0]"),
                     device_entry]
-        super(CustomDeviceDialog, self).__init__(path, title, children)
+        super(CustomDeviceDialog, self).__init__("%s.dialog" % path_prefix,
+                                                 title, children)
         self.buttons = [ui.SaveButton("dialog.device.custom.save"),
                         ui.CloseButton("dialog.device.custom.close", "Cancel")]
diff --git a/src/ovirt/node/installer/core/installation_device_page.py b/src/ovirt/node/installer/core/installation_device_page.py
index c93b6bb..5563a67 100644
--- a/src/ovirt/node/installer/core/installation_device_page.py
+++ b/src/ovirt/node/installer/core/installation_device_page.py
@@ -71,7 +71,7 @@
                      "of %s" % self.application.product.PRODUCT_SHORT
 
         other_device = self._model.get("installation.device.custom", "")
-        devices = self.storage_discovery.all_devices_for_ui_table(other_device)
+        devices = self.storage_discovery.all_devices_for_ui_table()
 
         ws = [ui.Header("header[0]", page_title)]
 
@@ -79,7 +79,10 @@
             ws += [ui.Table("installation.device.current", "",
                             " %6s  %11s  %5s" %
                             ("Location", "Device Name", "Size"), devices,
-                            multi=True),
+                            height=3, multi=True),
+                   ui.Button("button.other_device", "Other Device: %s" %
+                             other_device),
+                   ui.Divider("divider[0]"),
                    DeviceDetails("installation.device.details", self,
                                  "(No device)")
                    ]


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a1fcf270ca2246d1c4d521f0d54b7e454276ff5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list