[node-patches] Change in ovirt-node[ovirt-3.5]: Rework the RHN page a little

fabiand at redhat.com fabiand at redhat.com
Tue Nov 25 17:38:09 UTC 2014


Hello Ryan Barry,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/35566

to review the following change.

Change subject: Rework the RHN page a little
......................................................................

Rework the RHN page a little

In order to make room for an Organization field for Sat6, move
the proxy config to a dialog and add the field. Look for
"organization" in the output and let users know they need it if
we catch it being prompted for.

Change-Id: Ic26be8601a3b4eb1a5f2ed58c8dcd07ee3af7890
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1067355
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/setup/rhn/rhn_page.py
1 file changed, 50 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/66/35566/1

diff --git a/src/ovirt/node/setup/rhn/rhn_page.py b/src/ovirt/node/setup/rhn/rhn_page.py
index 4967edb..35d7d64 100644
--- a/src/ovirt/node/setup/rhn/rhn_page.py
+++ b/src/ovirt/node/setup/rhn/rhn_page.py
@@ -146,6 +146,7 @@
         model["rhn.url"] = cfg["url"]
         model["rhn.ca"] = cfg["ca_cert"]
         model["rhn.proxyuser"] = cfg["proxyuser"]
+        model["rhn.org"] = cfg["org"]
         try:
             p_server, p_port = cfg["proxy"].rsplit(":", 1)
             model["rhn.proxyhost"] = p_server
@@ -163,6 +164,7 @@
                                   valid.URL() | valid.Empty()),
                 "rhn.proxyport": valid.Port() | valid.Empty(),
                 "rhn.proxyuser": valid.Text() | valid.Empty(),
+                "rhn.org": valid.Text() | valid.Empty(),
                 }
 
     def ui_content(self):
@@ -203,12 +205,8 @@
                   ui.Options("rhn.type", "Type", self._rhn_types),
                   ui.Entry("rhn.url", "URL:"),
                   ui.Entry("rhn.ca", "CA URL:"),
-                  ui.Header("header[1]", "HTTP Proxy Configuration"),
-                  ui.Row("row[0]", [ui.Entry("rhn.proxyhost", "Server:"),
-                                    ui.Entry("rhn.proxyport", "  Port:")]),
-                  ui.Entry("rhn.proxyuser", "Username:"),
-                  ui.PasswordEntry("rhn.proxypassword", "Password:"),
-                  ui.Divider("divider[1]"),
+                  ui.Entry("rhn.org", "Organization:"),
+                  ui.Button("button.proxy", "HTTP Proxy Configuration"),
                   ]
 
         page = ui.Page("page", ws)
@@ -224,6 +222,7 @@
                     self._fields_enabled = True
                     self.widgets["rhn.url"].enabled(True)
                     self.widgets["rhn.ca"].enabled(True)
+                    self.widgets["rhn.org"].enabled(True)
                     self.stash_pop_change("rhn.url", reuse_old=True)
                     self.stash_pop_change("rhn.ca", reuse_old=True)
             else:
@@ -232,6 +231,12 @@
                 self.widgets["rhn.ca"].enabled(False)
                 self.stash_change("rhn.url")
                 self.stash_change("rhn.ca")
+
+        # Don't run a transaction yet, just close it out, save if the
+        # normal save button is triggered
+        if "proxy.save" in changes:
+            self._dialog.close()
+            return
 
     def on_merge(self, effective_changes):
         self.logger.debug("Saving RHN page")
@@ -246,6 +251,14 @@
                     "rhn.type", "rhn.url", "rhn.ca", "rhn.proxyhost",
                     "rhn.proxyport", "rhn.proxyuser", "rhn.proxypassword",
                     "rhn.org", "rhn.activation_key"]
+
+        if "button.proxy" in changes:
+            description = ("Please enter the proxy details to use " +
+                           "for contacting the management server ")
+            self._dialog = ProxyDialog("Input proxy information",
+                                       description, self)
+            self.widgets.add(self._dialog)
+            return self._dialog
 
         txs = utils.Transaction("Updating RHN configuration")
 
@@ -301,3 +314,34 @@
                                                                txs, self)
                 progress_dialog.run()
         return self.ui_content()
+
+
+class ProxyDialog(ui.Dialog):
+    """A dialog to input proxy information
+    """
+    def __init__(self, title, description, plugin):
+        self.keys = ["rhn.proxyhost", "rhn.proxyport", "rhn.proxyuser",
+                     "rhn.proxypassword"]
+
+        def clear_invalid(dialog, changes):
+            [plugin.stash_change(prefix) for prefix in self.keys]
+
+        title = _("RHN Proxy Information")
+
+        entries = [ui.Entry("rhn.proxyhost", "Server:"),
+                   ui.Entry("rhn.proxyport", "Port:"),
+                   ui.Entry("rhn.proxyuser", "Username:"),
+                   ui.PasswordEntry("rhn.proxypassword", "Password:")]
+        children = [ui.Label("label[0]", description),
+                    ui.Divider("divider[0]")]
+        children.extend(entries)
+        super(ProxyDialog, self).__init__("proxy.dialog", title, children)
+        self.buttons = [ui.CloseButton("proxy.save", _("Save"),
+                                       enabled=True),
+                        ui.CloseButton("proxy.close",
+                                       _("Cancel"))]
+
+        b = plugins.UIElements(self.buttons)
+        b["proxy.close"].on_activate.clear()
+        b["proxy.close"].on_activate.connect(ui.CloseAction())
+        b["proxy.close"].on_activate.connect(clear_invalid)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic26be8601a3b4eb1a5f2ed58c8dcd07ee3af7890
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>
Gerrit-Reviewer: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list