[node-patches] Change in ovirt-node[master]: [DRAFT] ui: Check for pending changes on page switch

fabiand at fedoraproject.org fabiand at fedoraproject.org
Thu Feb 7 15:13:16 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: [DRAFT] ui: Check for pending changes on page switch
......................................................................

[DRAFT] ui: Check for pending changes on page switch

Previously the logic to detect pending (unsaved) changes on a page was
broken, this is fixed with this patch.

Change-Id: I4eeed71fac885958aa6cdd8ca1aa873a77c22f7f
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/app.py
M scripts/tui/src/ovirt/node/plugins.py
2 files changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/50/11850/1

diff --git a/scripts/tui/src/ovirt/node/app.py b/scripts/tui/src/ovirt/node/app.py
index 0807d3c..3711c81 100644
--- a/scripts/tui/src/ovirt/node/app.py
+++ b/scripts/tui/src/ovirt/node/app.py
@@ -313,10 +313,11 @@
             if pending_changes:
                 self.logger.warning("Pending changes: %s" % pending_changes)
                 msg = ""
-                elements = self.current_plugin().ui_content().elements()
+                elements = self.current_plugin().widgets
                 self.logger.debug("Available elements: %s" % elements)
                 for path, value in pending_changes.items():
                     if path in elements:
+                        self.logger.debug("Element '%s' changed" % path)
                         # assumption that element is a container
                         element = elements[path]
                         field = element.path
@@ -326,9 +327,11 @@
                 if msg:
                     txt = "The following fields have changed:\n%s" % msg
                     txt += "\n\nPlease save or reset the page."
-                    self.ui.display_as_dialog(ui.Dialog("pendin",
-                                                        "Pending Changes",
-                                                        [ui.Label(txt)]))
+                    dialog = ui.Dialog("dialog.changes", "Pending Changes",
+                                       [ui.Label("dialog.changes.txt", txt)])
+                    dialog.buttons = [ui.CloseButton("dialog.changes.close",
+                                                     "Back")]
+                    self.show(dialog)
                     has_outstanding_changes = True
         return has_outstanding_changes
 
diff --git a/scripts/tui/src/ovirt/node/plugins.py b/scripts/tui/src/ovirt/node/plugins.py
index 9444ce5..62ccd67 100644
--- a/scripts/tui/src/ovirt/node/plugins.py
+++ b/scripts/tui/src/ovirt/node/plugins.py
@@ -480,6 +480,9 @@
         for e in self._elements:
             yield e
 
+    def __str__(self):
+        return "<UIElements %s>" % self._elements
+
     class Group(list, base.Base):
         def __init__(self, uielements, paths):
             super(UIElements.Group, self).__init__()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4eeed71fac885958aa6cdd8ca1aa873a77c22f7f
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