[node-patches] Change in ovirt-node[master]: status page: Add confirmation dialog page for "reboot" and ...

hadong0720 at gmail.com hadong0720 at gmail.com
Thu May 30 08:50:53 UTC 2013


hadong has uploaded a new change for review.

Change subject: status page:  Add confirmation dialog page for "reboot" and "Power off" buttons
......................................................................

status page:  Add confirmation dialog page for "reboot" and
"Power off" buttons

Previously the status page missed confirmation dialog page for
"reboot" and " Power off" buttons.
Now this confirmation page has been added.

Change-Id: I23910959154642da4d186c8ae1884c323badc3d6
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=968886
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M src/ovirt/node/setup/core/status_page.py
1 file changed, 45 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/83/15183/1

diff --git a/src/ovirt/node/setup/core/status_page.py b/src/ovirt/node/setup/core/status_page.py
index d88a011..4e36f20 100644
--- a/src/ovirt/node/setup/core/status_page.py
+++ b/src/ovirt/node/setup/core/status_page.py
@@ -143,11 +143,23 @@
 
         elif "action.restart" in changes:
             self.logger.info("Restarting")
+            self._confirmrestart_dialog = ConfirmRestartDialog()
+            self.widgets.add(self._confirmrestart_dialog)
+            return self._confirmrestart_dialog
+
+        elif "action.confirm_restart" in changes:
+            self.logger.info("Confirm Restarting")
             self.dry_or(lambda: system.reboot())
 
         elif "action.poweroff" in changes:
             self.logger.info("Shutting down")
-            self.dry_or(lambda: system.poweroff())
+            self._confirmpoweroff_dialog = ConfirmPoweroffDialog()
+            self.widgets.add(self._confirmpoweroff_dialog)
+            return self._confirmpoweroff_dialog
+
+        elif "action.confirm_poweroff" in changes:
+            self.logger.info("Confirm Shutting down")
+            self.dry_or(lambda: system.poweroff()
 
         elif "action.hostkey" in changes:
             self.logger.info("Showing hostkey")
@@ -219,3 +231,35 @@
                          ]
         self.buttons = [ui.Button("action.unlock", "Unlock")]
         self.escape_key = None
+
+
+class ConfirmRestartDialog(ui.Dialog):
+    """The dialog beeing displayed when the user clicks Restart button
+    """
+    def __init__(self, path="ConfirmRestart.dialog", title="Confirm System Restart"):
+        super(ConfirmRestartDialog, self).__init__(path, title, [])
+	vmnumber="There are %s Virtual Machines running" % (virt.number_of_domains())
+        self.children = [ui.Divider("ConfirmRestart.divider[0]"),
+                         ui.Label("ConfirmRestart.label[0]",
+                                  vmnumber),
+                         ui.Label("ConfirmRestart.label[1]",
+                                  "This will restart the system,proceed?")
+                         ]
+        self.buttons = [ui.Button("action.confirm_restart", "OK"),ui.CloseButton("dialog.close")]
+        self.escape_key = None
+
+
+class ConfirmPoweroffDialog(ui.Dialog):
+    """The dialog beeing displayed when the user clicks shotdown button
+    """
+    def __init__(self, path="ConfirmPoweroffDialog.dialog", title="Confirm System Shutting down"):
+        super(ConfirmPoweroffDialog, self).__init__(path, title, [])
+	vmnumber="There are %s Virtual Machines running." % (virt.number_of_domains())
+        self.children = [ui.Divider("ConfirmPoweroffDialog.divider[0]"),
+                         ui.Label("ConfirmPoweroffDialog.label[0]",
+                                  vmnumber),
+                         ui.Label("ConfirmPoweroffDialog.label[1]",
+                                  "This will shut down the system,proceed?")
+                         ]
+        self.buttons = [ui.Button("action.confirm_poweroff", "OK"),ui.CloseButton("dialog.close")]
+        self.escape_key = None


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I23910959154642da4d186c8ae1884c323badc3d6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>



More information about the node-patches mailing list