def ui_content(self): ws = [ ui.Header("header[0]", "Storage Volumes"), ui.Label( "label[0]", "Please enter the sizes for the " + "following partitions in MB"), ui.Divider("divider[0]"), ui.Entry("storage.efi_size", "UEFI/Bios:", enabled=False), ui.Divider("divider[1]"), ui.Entry("storage.root_size", "Root & RootBackup:", enabled=False), ui.Label("label[1]", "(2 partitions at 512MB each)"), ui.Divider("divider[2]"), ui.Entry("storage.swap_size", "Swap:"), ui.Entry("storage.config_size", "Config:"), ui.Entry("storage.logging_size", "Logging:"), ui.Entry("storage.data_size", "Data:"), ] self.widgets.add(ws) page = ui.Page("storage", ws) page.buttons = [ ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Next") ] return page
def ui_content(self): ws = [ ui.Header("header[0]", "Require a password for local console access?"), ui.Label( "label[0]", "Please enter the current admin " + "password. You may also change the admin password " + "if required. If the new password fields are left" + "blank the password will remain the same."), ui.Label("label[1]", "Password for local console access"), ui.Divider("divider[0]"), ui.PasswordEntry("upgrade.current_password", "Current Password:"******"divider[1]"), ui.PasswordEntry("upgrade.password", "Password:"******"upgrade.password_confirmation", "Confirm Password:"******"divider[2]"), ui.Label("current_password.info", ""), ui.Label("password.info", self.__no_new_password_msg) ] self.widgets.add(ws) page = ui.Page("password", ws) page.buttons = [ ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Update") ] return page
def ui_content(self): ws = [ ui.Header("header[0]", _("Require a password for the admin user?")), ui.Label( "label[0]", _("Please enter the current admin ") + _("password. You may also change the admin password ") + _("if required. If the new password fields are left ") + _("blank the password will remain the same.")), ui.Label("label[1]", _("Password for the admin user")), ui.Divider("divider[0]"), ui.PasswordEntry("upgrade.current_password", _("Current Password:"******"divider[1]"), ui.ConfirmedEntry("upgrade.password", _("Password:"******"current_password.info", ""), ui.Label("password.info", self.__no_new_password_msg) ] page = ui.Page("password", ws) page.buttons = [ ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Update") ] self.widgets.add(page) return page
def ui_content(self): sync_mgmt() buttons = [] net_is_configured = utils.network.NodeNetwork().is_configured() header_menu = "{engine_name} Configuration".format( engine_name=config.engine_name) if not net_is_configured: ws = [ ui.Header("header[0]", header_menu), ui.Notice( "network.notice", "Networking is not configured, " + "please configure it before " + "registering"), ui.Divider("divider[0]") ] elif self._hosted_engine_configured(): ws = [ ui.Header("header[0]", header_menu), ui.Notice( "he.notice", "Hosted Engine is configured. Engine registration " "is disabled, as this host is already registered to" " the hosted engine"), ui.Divider("divider[0]"), ui.Label("vdsm_cfg.password._label", "Password for adding additional hosts"), ui.Label( "vdsm_cfg.password._label2", "Note: This sets the root password and " "enables SSH"), ui.ConfirmedEntry("vdsm_cfg.password", "Password:"******"action.register", "Save")] else: ws = [ ui.Header("header[0]", header_menu), ui.Entry("vdsm_cfg.address", str(config.engine_name) + " FQDN (or fqdn:port):"), ui.Divider("divider[0]"), ui.Label( "vdsm_cfg.password._label", "Optional password for adding Node through " + str(config.engine_name)), ui.Label( "vdsm_cfg.password._label2", "Note: This sets the root password and " "enables SSH"), ui.ConfirmedEntry("vdsm_cfg.password", "Password:"******"action.register", "Save / Register")] page = ui.Page("page", ws) page.buttons = buttons self.widgets.add(page) return page
def __init__(self, plugin, path, title): self.plugin = plugin super(ConsoleDialog, self).__init__(path, title, []) self.plugin._extra_model.update({"console.path": self._console()}) self.plugin.model() self.children = [ ui.Label("Enter the path to a valid console device"), ui.Label("Example: /dev/ttyS0,115200n8"), ui.Entry("console.path", "Console path:") ]
def __additional_infos(self): ws = [] ws.append(ui.Label("welcome.virt", _("Info: %s") % virt.hardware_status())) if system.is_efi(): ws.append(ui.Label("welcome.efi", _("Info: Machine is booted in EFI mode"))) if self.application.args.dry: ws.append(ui.Label("dry", _("Info: DRY MODE"))) return ws
def __init__(self, path, title): super(HostkeyDialog, self).__init__(path, title, []) ssh = security.Ssh() fp, hk = ssh.get_hostkey() self.children = [ ui.Label("hostkey.label[0]", "RSA Host Key Fingerprint:"), ui.Label("hostkey.fp", fp), ui.Divider("hostkey.divider[0]"), ui.Label("hostkey.label[1]", "RSA Host Key:"), ui.Label("hostkey", "\n".join(textwrap.wrap(hk, 64))), ] self.buttons = [ui.CloseButton("dialog.close")]
def ui_content(self): ws = [ ui.Header("header[0]", _("Logging")), ui.Label( "logrotate.header", _("The logs will be rotated at the ") + _("specified size not more often than the ") + _("set inerval")), ui.Entry("logrotate.max_size", _("Logrotate Max Log ") + _("Size (KB):")), ui.Options("logrotate.interval", _("Interval"), self._intervals), ui.Divider("divider[0]") ] net_is_configured = utils.network.NodeNetwork().is_configured() if not net_is_configured: ws.extend([ ui.Notice( "network.notice", _("Networking is not configured, ") + _("please configure it before rsyslog ") + _("and/or netconsole")), ui.Divider("notice.divider") ]) ws.extend([ ui.Label( "rsyslog.header", _("RSyslog is an enhanced multi-") + _("threaded syslogd")), ui.Entry("rsyslog.address", _("Server Address:"), enabled=net_is_configured), ui.Entry("rsyslog.port", _("Server Port:"), enabled=net_is_configured), ui.Divider("divider[1]"), ui.Label( "netconsole.label", _("Netconsole service allows a remote sys") + _("log daemon to record printk() messages")), ui.Entry("netconsole.address", _("Server Address:"), enabled=net_is_configured), ui.Entry("netconsole.port", _("Server Port:"), enabled=net_is_configured) ]) page = ui.Page("page", ws) self.widgets.add(page) return page
def ___installation_options(self): block_upgrade = False has_hostvg = False if self.application.args.dry: return [ui.Button("button.install", _("Install (dry)")), ui.Button("button.upgrade", _("Upgrade (dry)")), ui.Button("button.downgrade", _("Downgrade (dry)")), ui.Button("button.reinstall", _("Reinstall (dry)"))] media = utils.system.InstallationMedia() if not is_reinstall(): # Only check installed, if reinstall, rhbz 1167240 installed = utils.system.InstalledMedia() is_installed = installed.available() if is_installed and \ (media.version_major != installed.version_major): block_upgrade = True if utils.system.has_hostvg(): has_hostvg = True if os.path.exists("/dev/disk/by-label/ROOT"): block_upgrade = True if block_upgrade: return [ui.Label("lbl.blockupgrade", "Major version upgrades " + "are unsupported, uninstall existing version " + "first")] if has_hostvg: try: installed = utils.system.InstalledMedia() if media > installed: return [ui.Button("button.upgrade", _("Upgrade %s to %s") % (installed, media))] elif media < installed: return [ui.Button("button.downgrade", _("Downgrade %s to %s") % (installed, media))] return [ui.Button("button.reinstall", _("Reinstall %s") % installed)] except: self.logger.error("Unable to get version numbers for " + "upgrade, invalid installation or media") return [ui.Label( "lbl.failinstall", _("Invalid installation, please reboot from ") + _("media and choose Reinstall"))] return [ui.Button("button.install", _("Install Hypervisor %s") % media)]
def ___installation_options(self): if self.application.args.dry: return [ ui.Button("button.install", _("Install (dry)")), ui.Button("button.upgrade", _("Upgrade (dry)")), ui.Button("button.downgrade", _("Downgrade (dry)")), ui.Button("button.reinstall", _("Reinstall (dry)")) ] media = utils.system.InstallationMedia() has_hostvg = utils.system.has_hostvg() has_root = os.path.exists("/dev/disk/by-label/ROOT") if has_hostvg and has_root: return [ ui.Label( _("Major version upgrades are unsupported, ") + _("uninstall existing version first")) ] if has_hostvg: try: installed = utils.system.InstalledMedia() if media > installed: return [ ui.Button("button.upgrade", _("Upgrade %s to %s") % (installed, media)) ] elif media < installed: return [ ui.Button("button.downgrade", _("Downgrade %s to %s") % (installed, media)) ] return [ ui.Button("button.reinstall", _("Reinstall %s") % installed) ] except: self.logger.error("Unable to get version numbers for " + "upgrade, invalid installation or media") return [ ui.Label( "lbl.failinstall", _("Invalid installation, please reboot from ") + _("media and choose Reinstall")) ] return [ ui.Button("button.install", _("Install Hypervisor %s") % media) ]
def ui_content(self): """Describes the UI this plugin requires This is an ordered list of (path, widget) tuples. """ # Function to expand all "keywords" to the same length aligned = lambda l: l.ljust(13) # Network related widgets, appearing in one row network_widgets = [ ui.KeywordLabel("networking", aligned(_("Networking: "))), ui.Label("networking.bridge", ""), ] action_widgets = [ ui.Button("action.lock", _("Lock")), ui.Button("action.logoff", _("Log Off")), ui.Button("action.restart", _("Restart")), ui.Button("action.poweroff", _("Power Off")) ] widgets = [ui.Header("header[0]", _("System Information"))] if self.model()["managed_by"]: widgets += [ ui.KeywordLabel("managed_by", aligned(_("Managed by: "))) ] widgets += [ ui.KeywordLabel("status", aligned(_("Status: "))), ui.Divider("divider[0]"), ui.Row("row[0]", network_widgets), ui.Label("networking.ip", ""), ui.Divider("divider[1]"), ui.KeywordLabel("logs", aligned(_("Logs: "))), ui.KeywordLabel("libvirt.num_guests", aligned(_("Running VMs: "))), ui.Divider("divider[2]"), ui.Label("support.hint", _("Press F8 for support menu")), ui.Row("row[1]", [ ui.Button("action.hostkey", _("View Host Key")), ui.Button("action.cpu_details", _("View CPU Details")) ]), ui.Button("action.console", "Set Console Path"), ui.Row("row[2]", action_widgets), ] self.widgets.add(widgets) page = ui.Page("page", widgets) page.buttons = [] return page
def ui_content(self): ws = [ui.Header("header[0]", _("Storage Volumes")), ui.KeywordLabel("storage.drive_size", "Drive size: ")] if not self.__enough_free_space(): ws.extend([ui.Notice("space.notice", "Not enough space! Needs at least " "%sMB for installation, %sMB " "available" % (str(self._min_drive_size), self._drive_size))]) if not self._fill: ws.extend([ui.KeywordLabel("storage.free_space", "Remaining Space: ")]) ws.extend([ui.Label("label[0]", "Please enter the sizes for the " + "following partitions in MB"), ui.Checkbox("storage.fill_data", "Fill disk with Data " + "partition", True), ui.Entry("storage.efi_size", _("UEFI/Bios:"), enabled=False), ui.Entry("storage.root_size", _("Root & RootBackup:"), enabled=False), ui.Label("label[1]", _("(2 partitions at %sMB each)") % self.model().get("storage.root_size")), ui.Divider("divider[2]"), ui.Entry("storage.swap_size", _("Swap MB:")), ui.Entry("storage.config_size", _("Config MB:")), ui.Entry("storage.logging_size", _("Logging MB:")), ui.Entry("storage.data_size", _("Data MB:"), enabled=not self._fill), ]) if not self._fill: ws.extend([ui.Label("label[2]", "(-1 fills all free space)")]) self.widgets.add(ws) page = ui.Page("storage", ws) page.buttons = [ui.QuitButton("button.quit", _("Quit")), ui.Button("button.back", _("Back"))] if self.__enough_free_space(): can_continue = self.model() and self.__calculate_free_space() >= 0 page.buttons.extend([ui.SaveButton("button.next", _("Continue"), enabled=can_continue)]) return page
def ui_content(self): page_title = "Please select the disk to use for booting %s" % \ self.application.product.PRODUCT_SHORT other_device = self._model.get("boot.device.custom", "") devices = self.storage_discovery.all_devices_for_ui_table(other_device) ws = [ui.Header("header[0]", page_title)] if devices: ws += [ ui.Table( "boot.device", "", " %6s %11s %5s" % ("Location", "Device Name", "Size"), devices), DeviceDetails("label.details", self, "(No device)") ] else: ws += [ ui.Label("boot.no_device", "No Valid Boot Devices Detected") ] page = ui.Page("boot", ws) page.buttons = [ ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Continue") ] self.widgets.add(page) return page
def _check_outstanding_changes(self): has_outstanding_changes = False if self.current_plugin(): pending_changes = self.current_plugin().pending_changes() if pending_changes: self.logger.warning("Pending changes: %s" % pending_changes) msg = "" elements = self.current_plugin().ui_content().elements() self.logger.debug("Available elements: %s" % elements) for path, value in pending_changes.items(): if path in elements: # assumption that element is a container element = elements[path] field = element.path self.logger.debug("Changed widget: " + "%s %s" % (path, element)) msg += "- %s\n" % (field.strip(":")) 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)])) has_outstanding_changes = True return has_outstanding_changes
def _check_outstanding_changes(self): """This function checks if any UI Element has changed """ has_outstanding_changes = False return has_outstanding_changes # FIXME the rest of this function has to be activated when it # is possible to set the selected menu item in the left-sided # main menu # otehrwise this popup will show, but the next menu item is selected # and we can not reset it to the entry which raised this popup if self.current_plugin() and self.current_plugin().pending_changes(): pending_changes = self.current_plugin().pending_changes() elements = self.current_plugin().widgets self.logger.debug("Pending changes: %s" % pending_changes) self.logger.debug("Available elements: %s" % elements) msg = "" for path in [p for p in pending_changes if p in elements]: self.logger.debug("Element '%s' changed" % path) # assumption that element is a container element = elements[path] field = element.label() self.logger.debug("Changed widget: " + "%s %s" % (path, element)) msg += "- %s\n" % (field.strip(":")) if msg: txt = "The following fields have changed:\n%s" % msg txt += "\n\nPlease save or reset the page." 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
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 = _("RHSM Proxy Information") entries = [ ui.Entry("rhn.proxyhost", "Server:"), ui.Entry("rhn.proxyport", "Port:"), ui.Entry("rhn.proxyuser", "Username:"******"rhn.proxypassword", "Password:"******"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)
def ui_content(self): page_title = _("Please select the disk to use for booting %s") % \ self.application.product.PRODUCT_SHORT other_device = self._model.get("boot.device.custom", "") devices = self.storage_discovery.all_devices_for_ui_table() ws = [ui.Header("header[0]", page_title)] tbl_head = self.storage_discovery.tbl_tpl.format(bus=_("Location"), name=_("Device Name"), size=_("Size (GB)")) if devices: ws += [ui.Table("boot.device", "", tbl_head, devices), ui.Divider("divider[0]"), ui.Button("button.other_device", "Other device: %s" % other_device), DeviceDetails("label.details", self, _("(No device)")) ] else: ws += [ui.Label("boot.no_device", _("No Valid Boot Devices Detected"))] page = ui.Page("boot", ws) page.buttons = [ui.QuitButton("button.quit", _("Quit")), ui.Button("button.back", _("Back")), ui.SaveButton("button.next", _("Continue"))] self.widgets.add(page) return page
def display_exception_as_notice(e): self.logger.debug(traceback.format_exc()) children = [ui.Label("dialog.notice.exception", "%s" % e)] notice = ui.Dialog("dialog.notice", "An exception occurred", children) notice.buttons = [ ui.CloseButton("dialog.notice.action.close", "Close") ] self.show(notice)
def notice(self, msg): """Displays a notice on the screen """ if True: children = [ui.Label("app.notice.text", msg)] dialog = ui.Dialog("app.notice", "Notice", children) dialog.buttons = [ui.CloseButton("app.notice.close")] self.show(dialog) else: self.ui._show_on_notice(msg)
def __init__(self, path, title, description): title = "Custom Block Device" device_entry = ui.Entry("boot.device.custom", "Device path:") children = [ui.Label("label[0]", description), ui.Divider("divider[0]"), device_entry] super(CustomDeviceDialog, self).__init__(path, title, children) self.buttons = [ui.SaveButton("dialog.device.custom.save"), ui.CloseButton("dialog.device.custom.close", "Cancel")]
def ui_content(self): ws = [ ui.Header("header[0]", _("Storage Volumes")), ui.KeywordLabel("storage.drive_size", "Drive size: ") ] if not self._fill: ws.extend( [ui.KeywordLabel("storage.free_space", "Remaining Space: ")]) ws.extend([ ui.Label( "label[0]", "Please enter the sizes for the " + "following partitions in MB"), ui.Checkbox("storage.fill_data", "Fill disk with Data " + "partition", True), ui.Entry("storage.efi_size", _("UEFI/Bios:"), enabled=False), ui.Entry("storage.root_size", _("Root & RootBackup:"), enabled=False), ui.Label( "label[1]", _("(2 partitions at %sMB each)") % self.model().get("storage.efi_size")), ui.Divider("divider[2]"), ui.Entry("storage.swap_size", _("Swap:")), ui.Entry("storage.config_size", _("Config:")), ui.Entry("storage.logging_size", _("Logging:")), ui.Entry("storage.data_size", _("Data:"), enabled=not self._fill), ]) if not self._fill: ws.extend([ui.Label("label[2]", "(-1 fills all free space)")]) self.widgets.add(ws) page = ui.Page("storage", ws) page.buttons = [ ui.QuitButton("button.quit", _("Quit")), ui.Button("button.back", _("Back")), ui.SaveButton("button.next", _("Continue")) ] return page
def ui_content(self): ws = [ui.Header("header[0]", "Monitoring Configuration"), ui.Label("label", "Collectd gathers statistics " + "about the system and can be used to find " + "performance bottlenecks and predict future " + "system load."), ui.Entry("collectd.address", "Server Address:"), ui.Entry("collectd.port", "Server Port:"), ] page = ui.Page("page", ws) self.widgets.add(page) return page
def ui_content(self): ws = [ ui.Header("header[0]", "Add Engine to Window AD"), ui.Label( "label", "When add your Engine to domain,you can login the Virtual Desktop as normal user." ), ui.Entry("collectd.address", "Domain:"), ui.Entry("collectd.port", "port:"), ] page = ui.Page("page", ws) self.widgets.add(page) return page
def ui_content(self): ws = [ ui.Header("header[0]", "Logging"), ui.Entry("logrotate.max_size", "Logrotate Max Log " + "Size (KB):"), ui.Divider("divider[0]") ] if not utils.network.is_configured(): ws.extend([ ui.Notice( "network.notice", "Networking is not configured, " + "please configure it before rsyslog and/or netconsole"), ui.Divider("notice.divider") ]) ws.extend([ ui.Label("rsyslog.header", "RSyslog is an enhanced multi-" + "threaded syslogd"), ui.Entry("rsyslog.address", "Server Address:", enabled=utils.network.is_configured()), ui.Entry("rsyslog.port", "Server Port:", enabled=utils.network.is_configured()), ui.Divider("divider[1]"), ui.Label( "netconsole.label", "Netconsole service allows a remote sys" + "log daemon to record printk() messages"), ui.Entry("netconsole.address", "Server Address:", enabled=utils.network.is_configured()), ui.Entry("netconsole.port", "Server Port:", enabled=utils.network.is_configured()) ]) page = ui.Page("page", ws) self.widgets.add(page) return page
def __init__(self, path_prefix, title, description): title = _("Custom Block Device") device_entry = ui.Entry(path_prefix, _("Device path:")) children = [ui.Label("label[0]", description), ui.Divider("divider[0]"), device_entry] super(CustomDeviceDialog, self).__init__("%s.dialog" % path_prefix, title, children) self.buttons = [ui.SaveButton("dialog.device.custom.save", _("Save"), enabled=False), ui.CloseButton("dialog.device.custom.close", _("Cancel"))]
def ui_content(self): ws = [ ui.Header("header[0]", "Add Hostname"), ui.Label( "label", "When you don't have a domain , please add your Node hostname to the Engine." ), ui.Entry("collectd.ip", "Node ip address:"), ui.Entry("collectd.hostname", "Node hostname:"), ] page = ui.Page("page", ws) self.widgets.add(page) return page
def ui_content(self): ws = [ ui.Header("header[0]", _("Support Info")), ui.Label("support.info", _("Select one of the logfiles below.")), ui.Divider("divider[0]"), ui.Table("support.logfile", "", _("Available Logfiles"), self.__debugfiles_to_offer()), ] page = ui.Page("page", ws) page.buttons = [] self.widgets.add(page) return page
def ui_content(self): page_title = \ _("Please select the disk(s) to use for installation of %s") \ % self.application.product.PRODUCT_SHORT other_device = self._model.get("installation.device.custom", "") devices = self.storage_discovery.all_devices_for_ui_table() ws = [ui.Header("header[0]", page_title)] tbl_head = self.storage_discovery.tbl_tpl.format(bus="Location", name="Device Name", size="Size (GB)") if devices: ws += [ ui.Table("installation.device.current", "", tbl_head, devices, 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)")) ] else: ws += [ ui.Label("installation.no_device", _("No Valid Install Devices Detected")) ] page = ui.Page("installation", ws) page.buttons = [ ui.QuitButton("button.quit", _("Quit")), ui.Button("button.back", _("Back")), ui.SaveButton("button.next", _("Continue")) ] self.widgets.add(page) # We are directly connecting to the table's on_change event # The tables on_change event is fired (in the multi-case) # when the highlighted entry is changed. table = self.widgets["installation.device.current"] table.on_change.connect(self.__update_details) return page
def ui_content(self): kbd = system.Keyboard() c = kbd.get_current() self.logger.debug("Current layout: %s" % c) ws = [ui.Header("header[0]", "Keyboard Layout Selection"), ui.Table("keyboard.layout", "", "Available Keyboard Layouts", kbd.available_layouts(), c), ui.Label("label[0]", "(Hit Enter to select a layout)") ] self.widgets.add(ws) page = ui.Page("keyboard", ws) page.buttons = [ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Continue")] return page
def ui_content(self): ws = [ ui.Header( "header[0]", "%s is beeing installed ..." % self.application.product.PRODUCT_SHORT), ui.Divider("divider[0]"), ui.ProgressBar("progressbar", 0), ui.Divider("divider[1]"), ui.Label("log", ""), ] self.widgets.add(ws) page = ui.Page("progress", ws) page.buttons = [] self._worker.start() return page