tui

package
v0.0.0-...-05f81da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WindowWidth is our desired terminal width
	WindowWidth = 80
	// WindowHeight is our desired terminal width
	WindowHeight = 24

	// ContentHeight is content frame height
	ContentHeight = 15

	// AutoSize is shortcut for clui.AutoSize flag
	AutoSize = clui.AutoSize

	// Fixed is shortcut for clui.Fixed flag
	Fixed = clui.Fixed

	// BorderNone is shortcut for clui.BorderNone flag
	BorderNone = clui.BorderNone

	// AlignLeft is shortcut for clui.AlignLeft flag
	AlignLeft = clui.AlignLeft

	// AlignRight is shortcut for clui.AlignRight flag
	AlignRight = clui.AlignRight

	// NoButtons mask defines a common Page will not set any control button
	NoButtons = 0

	// BackButton mask defines a common Page will have a back button
	BackButton = 1 << 1

	// ConfirmButton mask defines a common Page will have Confirm button
	ConfirmButton = 1 << 2

	// CancelButton mask defines a common Page will have a cancel button
	CancelButton = 1 << 3

	// AllButtons mask defines a common Page will have both Back and Confirm buttons
	AllButtons = BackButton | ConfirmButton

	// TuiPageMenu is the id for menu page
	TuiPageMenu = iota

	// TuiPageInstall is the id for install page
	TuiPageInstall

	// TuiPageLanguage is the id for language page
	TuiPageLanguage

	// TuiPageKeyboard is the id for keyboard page
	TuiPageKeyboard

	// TuiPageMediaConfig is the id for media configuration menu
	TuiPageMediaConfig

	// TuiPageNetwork is the id for network configuration page
	TuiPageNetwork

	// TuiPageProxy is the id for the proxy configuration page
	TuiPageProxy

	// TuiPageNetworkValidate is the id for the network validation page
	TuiPageNetworkValidate

	// TuiPageInterface is the id for the network interface configuration page
	TuiPageInterface

	// TuiPageBundle is the id for the bundle selection page
	TuiPageBundle

	// TuiPageTelemetry is the id for the telemetry enabling screen
	TuiPageTelemetry

	// TuiPageTimezone is the id for the timezone selection page
	TuiPageTimezone

	// TuiPageUserManager is the id for the user management page
	TuiPageUserManager

	// TuiPageUseradd is the id for the user add page
	TuiPageUseradd

	// TuiPageKernelCMDLine is the id for the kernel command line page
	TuiPageKernelCMDLine

	// TuiPageKernel is the id for the kernel selection page
	TuiPageKernel

	// TuiPageSwupdMirror is the id for the swupd mirror page
	TuiPageSwupdMirror

	// TuiPageHostname is the id for the hostname page
	TuiPageHostname

	// TuiPageAutoUpdate is the id for the Auto Update Enablement page
	TuiPageAutoUpdate

	// TuiPageSaveConfig is the id for the save YAML configuration file page
	TuiPageSaveConfig

	// ConfigDefinedByUser is used to determine a configuration was interactively
	// defined by the user
	ConfigDefinedByUser = iota

	// ConfigDefinedByConfig is used to determine a configuration was defined by
	// a configuration file
	ConfigDefinedByConfig

	// ConfigNotDefined is used to determine no configuration was provided yet
	ConfigNotDefined

	// ActionBackButton indicates the user has pressed back button
	ActionBackButton = iota

	// ActionConfirmButton indicates the user has pressed confirm button
	ActionConfirmButton

	// ActionCancelButton indicates the user has pressed cancel button
	ActionCancelButton

	// ActionNone indicates no action has been performed
	ActionNone
)
View Source
const (

	// MenuButtonStatusDefault means: not the auto detect,
	// not the user defined, not even failed
	MenuButtonStatusDefault = iota

	// MenuButtonStatusAutoDetect means: the current value was autodetected
	MenuButtonStatusAutoDetect

	// MenuButtonStatusUserDefined means: the user actively changed the value
	MenuButtonStatusUserDefined

	//MenuButtonStatusFailure means: the label displayed is an error message
	MenuButtonStatusFailure
)

Variables

This section is empty.

Functions

func GetMenuStatus

func GetMenuStatus(item Page) int

GetMenuStatus returns the menu button status id

Types

type AutoUpdatePage

type AutoUpdatePage struct {
	BasePage
}

AutoUpdatePage is the Page implementation for the auto update enable configuration page

func (*AutoUpdatePage) Activate

func (aup *AutoUpdatePage) Activate()

Activate activates the proper button depending on the current model value. If Auto Update is enabled in the data model then the Confirm button will be active otherwise the Back button will be activated.

func (*AutoUpdatePage) DeActivate

func (aup *AutoUpdatePage) DeActivate()

DeActivate sets the model value and adjusts the "confirm" flag for this page

func (*AutoUpdatePage) GetConfigDefinition

func (aup *AutoUpdatePage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*AutoUpdatePage) GetConfiguredValue

func (aup *AutoUpdatePage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

type BasePage

type BasePage struct {
	// contains filtered or unexported fields
}

BasePage is the common implementation for the TUI frontend other pages will inherit this base page behaviours

func (*BasePage) Activate

func (page *BasePage) Activate()

Activate is a stub implementation for the Activate method of Page interface

func (*BasePage) DeActivate

func (page *BasePage) DeActivate()

DeActivate is a stub implementation for the DeActivate method of Page interface

func (*BasePage) GetActivated

func (page *BasePage) GetActivated() clui.Control

GetActivated returns the control set as activated for a page

func (*BasePage) GetConfigDefinition

func (page *BasePage) GetConfigDefinition() int

GetConfigDefinition is a stub implementation the real implementation must check with the model and return:

  • ConfigDefinedByUser: if the configuration was interactively defined by the user
  • ConfigDefinedByConfig: if the configuration was provided by a config file
  • ConfigNotDefined: if none of the above apply

func (*BasePage) GetConfiguredValue

func (page *BasePage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

func (*BasePage) GetData

func (page *BasePage) GetData() interface{}

GetData returns the current value of a page's data member

func (*BasePage) GetDone

func (page *BasePage) GetDone() bool

GetDone returns the current value of a page's done flag

func (*BasePage) GetID

func (page *BasePage) GetID() int

GetID returns the current page's identifier

func (*BasePage) GetMenuButton

func (page *BasePage) GetMenuButton() *MenuButton

GetMenuButton returns the page's menu control

func (*BasePage) GetMenuTitle

func (page *BasePage) GetMenuTitle() string

GetMenuTitle returns the current page's title string

func (*BasePage) GetWindow

func (page *BasePage) GetWindow() *clui.Window

GetWindow returns the current page's window control

func (*BasePage) GotoPage

func (page *BasePage) GotoPage(id int)

GotoPage transitions between 2 pages

func (*BasePage) IsRequired

func (page *BasePage) IsRequired() bool

IsRequired returns if this Page is required to be completed for the Install

func (*BasePage) Panic

func (page *BasePage) Panic(err error)

Panic write an error to the tui panicked channel - we'll deal the error, stop clui mainloop and nicely panic() the application

func (*BasePage) SetData

func (page *BasePage) SetData(data interface{})

SetData set the current value for the page's data member

func (*BasePage) SetDone

func (page *BasePage) SetDone(done bool) bool

SetDone sets the page's done flag

func (*BasePage) SetMenuButton

func (page *BasePage) SetMenuButton(mb *MenuButton)

SetMenuButton sets the page's menu control

type BundleCheck

type BundleCheck struct {
	// contains filtered or unexported fields
}

BundleCheck maps a map name and description with the actual checkbox

type BundlePage

type BundlePage struct {
	BasePage
}

BundlePage is the Page implementation for the proxy configuration page

func (*BundlePage) Activate

func (bp *BundlePage) Activate()

Activate marks the checkbox selections based on the data model

func (*BundlePage) GetConfiguredValue

func (bp *BundlePage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

type ByLogin

type ByLogin struct{ Users }

ByLogin implements sort.Interface for sorting by the for Login field

func (ByLogin) Less

func (users ByLogin) Less(a, b int) bool

Less is require comparison function of the Users list for ByLogin

type ByUserName

type ByUserName struct{ Users }

ByUserName implements sort.Interface for sorting by the for UserName field

func (ByUserName) Less

func (users ByUserName) Less(a, b int) bool

Less is require comparison function of the Users list for ByUserName

type ConfirmCancelDialog

type ConfirmCancelDialog struct {
	DialogBox *clui.Window
	Confirmed bool
	// contains filtered or unexported fields
}

ConfirmCancelDialog is dialog window use to stop all other user interaction and have them confirm the possible loss of changes due to pressing the Cancel button.

func CreateConfirmCancelDialogBox

func CreateConfirmCancelDialogBox(message string, title string) (*ConfirmCancelDialog, error)

CreateConfirmCancelDialogBox creates the Network PopUp

func (*ConfirmCancelDialog) Close

func (dialog *ConfirmCancelDialog) Close()

Close closes the dialog window and executes a callback if registered

func (*ConfirmCancelDialog) OnClose

func (dialog *ConfirmCancelDialog) OnClose(fn func())

OnClose sets the callback that is called when the dialog is closed

type ConfirmInstallDialog

type ConfirmInstallDialog struct {
	DialogBox *clui.Window
	Confirmed bool
	// contains filtered or unexported fields
}

ConfirmInstallDialog is dialog window use to stop all other user interaction and have the them confirm the destruction of the target media and start the install. Last change to abort.

func CreateConfirmInstallDialogBox

func CreateConfirmInstallDialogBox(modelSI *model.SystemInstall, options args.Args) (*ConfirmInstallDialog, error)

CreateConfirmInstallDialogBox creates the Network PopUp

func (*ConfirmInstallDialog) Close

func (dialog *ConfirmInstallDialog) Close()

Close closes the dialog window and executes a callback if registered

func (*ConfirmInstallDialog) OnClose

func (dialog *ConfirmInstallDialog) OnClose(fn func())

OnClose sets the callback that is called when the dialog is closed

type EncryptPassphraseDialog

type EncryptPassphraseDialog struct {
	DialogBox *clui.Window
	Confirmed bool
	// contains filtered or unexported fields
}

EncryptPassphraseDialog is dialog window use to stop all other user interaction and have the them confirm the destruction of the target media and start the install. Last change to abort.

func CreateEncryptPassphraseDialogBox

func CreateEncryptPassphraseDialogBox(modelSI *model.SystemInstall) (*EncryptPassphraseDialog, error)

CreateEncryptPassphraseDialogBox creates the Network PopUp

func (*EncryptPassphraseDialog) Close

func (dialog *EncryptPassphraseDialog) Close()

Close closes the dialog window and executes a callback if registered

func (*EncryptPassphraseDialog) OnClose

func (dialog *EncryptPassphraseDialog) OnClose(fn func())

OnClose sets the callback that is called when the dialog is closed

type HostnamePage

type HostnamePage struct {
	BasePage
	HostnameEdit    *clui.EditField
	HostnameWarning *clui.Label
	// contains filtered or unexported fields
}

HostnamePage is the Page implementation for the hostname input

func (*HostnamePage) Activate

func (page *HostnamePage) Activate()

Activate sets the hostname with the current model's value

func (*HostnamePage) GetConfigDefinition

func (page *HostnamePage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*HostnamePage) GetConfiguredValue

func (page *HostnamePage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

type InfoDialog

type InfoDialog struct {
	DialogBox *clui.Window
	// contains filtered or unexported fields
}

InfoDialog is dialog window use to stop all other user interaction and present them with an informational message

func CreateInfoDialogBox

func CreateInfoDialogBox(message string) (*InfoDialog, error)

CreateInfoDialogBox creates the Network PopUp

func (*InfoDialog) Close

func (dialog *InfoDialog) Close()

Close closes the dialog window and executes a callback if registered

func (*InfoDialog) OnClose

func (dialog *InfoDialog) OnClose(fn func())

OnClose sets the callback that is called when the dialog is closed

type InstallPage

type InstallPage struct {
	BasePage
	// contains filtered or unexported fields
}

InstallPage is the Page implementation for installation progress page, it also implements the progress.Client interface

func (*InstallPage) Activate

func (page *InstallPage) Activate()

Activate is called when the page is "shown"

func (*InstallPage) Desc

func (page *InstallPage) Desc(desc string)

Desc is part of the progress.Client implementation and sets the progress bar label

func (*InstallPage) Failure

func (page *InstallPage) Failure()

Failure is part of the progress.Client implementation and represents the unsuccessful progress completion of a task by setting the progress bar to "fail"

func (*InstallPage) LoopWaitDuration

func (page *InstallPage) LoopWaitDuration() time.Duration

LoopWaitDuration is part of the progress.Client implementation and returns the time duration each step should wait until calling Step again

func (*InstallPage) Partial

func (page *InstallPage) Partial(total int, step int)

Partial is part of the progress.Client implementation and adjusts the progress bar to the current completion percentage

func (*InstallPage) Step

func (page *InstallPage) Step()

Step is part of the progress.Client implementation and moves the progress bar one step case it becomes full it starts again

func (*InstallPage) Success

func (page *InstallPage) Success()

Success is part of the progress.Client implementation and represents the successful progress completion of a task by setting the progress bar to "full"

type KernelCMDLine

type KernelCMDLine struct {
	BasePage
	// contains filtered or unexported fields
}

KernelCMDLine is the Page implementation for the kernel cmd line configuration page

func (*KernelCMDLine) Activate

func (pp *KernelCMDLine) Activate()

Activate sets the kernel cmd line configuration with the current model's value

func (*KernelCMDLine) GetConfiguredValue

func (pp *KernelCMDLine) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

type KernelPage

type KernelPage struct {
	BasePage
	// contains filtered or unexported fields
}

KernelPage is the Page implementation for the proxy configuration page

func (*KernelPage) Activate

func (kp *KernelPage) Activate()

Activate marks selects the kernel radio based on the data model

func (*KernelPage) GetConfigDefinition

func (kp *KernelPage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*KernelPage) GetConfiguredValue

func (kp *KernelPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

type KernelRadio

type KernelRadio struct {
	// contains filtered or unexported fields
}

KernelRadio maps a map name and description with the actual checkbox

type KeyboardPage

type KeyboardPage struct {
	BasePage
	// contains filtered or unexported fields
}

KeyboardPage is the Page implementation for the keyboard configuration page

func (*KeyboardPage) DeActivate

func (page *KeyboardPage) DeActivate()

DeActivate will reset the selection case the user has pressed cancel

func (*KeyboardPage) GetConfigDefinition

func (page *KeyboardPage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*KeyboardPage) GetConfiguredValue

func (page *KeyboardPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently keyboard set

func (*KeyboardPage) SetDone

func (page *KeyboardPage) SetDone(done bool) bool

SetDone sets the keyboard page flag done, and sets back the configuration to the data model

type LanguagePage

type LanguagePage struct {
	BasePage
	// contains filtered or unexported fields
}

LanguagePage is the Page implementation for the language configuration page

func (*LanguagePage) DeActivate

func (page *LanguagePage) DeActivate()

DeActivate will reset the selection case the user has pressed cancel

func (*LanguagePage) GetConfigDefinition

func (page *LanguagePage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*LanguagePage) GetConfiguredValue

func (page *LanguagePage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently language set

func (*LanguagePage) SetDone

func (page *LanguagePage) SetDone(done bool) bool

SetDone sets the keyboard page flag done, and sets back the configuration to the data model

type MediaConfigPage

type MediaConfigPage struct {
	BasePage
	// contains filtered or unexported fields
}

MediaConfigPage is the Page implementation for the disk partitioning menu page

func (*MediaConfigPage) Activate

func (page *MediaConfigPage) Activate()

Activate updates the UI elements with the most current list of block devices

func (*MediaConfigPage) DeActivate

func (page *MediaConfigPage) DeActivate()

DeActivate will reset the selection case the user has pressed cancel

func (*MediaConfigPage) GetConfigDefinition

func (page *MediaConfigPage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*MediaConfigPage) GetConfiguredValue

func (page *MediaConfigPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

func (*MediaConfigPage) SetDone

func (page *MediaConfigPage) SetDone(done bool) bool

SetDone sets the configured disk into the model and sets the page as done

type MenuButton struct {
	clui.BaseControl
	// contains filtered or unexported fields
}

MenuButton is the implementation of a clui button with simpler visual elements (i.e no shadows).

func CreateMenuButton

func CreateMenuButton(parent clui.Control, status int, title string, sWidth int) *MenuButton

CreateMenuButton returns an instance of MenuButton parent - is the parent control this button is attached to status - one of: MenuButtonStatusDefault, MenuButtonStatusUserDefined, MenuButtonStatusFailure title - the button's label

func (mb *MenuButton) Draw()

Draw paints the button in the screen and adjust colors depending on the button state

func (mb *MenuButton) MenuItemValue() string

MenuItemValue returns the value set for itemValue (configured value for a menu item)

func (mb *MenuButton) OnClick(fn func(clui.Event))

OnClick sets the button's onClick callback

func (mb *MenuButton) ProcessEvent(event clui.Event) bool

ProcessEvent will process the events triggered by clui mainloop

func (mb *MenuButton) SetMenuItemValue(sv string)

SetMenuItemValue sets the value for the itemValue (configured value for a menu item)

func (mb *MenuButton) SetStatus(status int)

SetStatus sets the status attribute for a menu button

func (mb *MenuButton) Status() int

Status returns the currently set status for a menu button

type MenuPage struct {
	BasePage
	// contains filtered or unexported fields
}

MenuPage is the Page implementation for the main menu page

func (page *MenuPage) Activate()

Activate is called when the page is "shown" and it repaints the main menu based on the available menu pages and their confirm/unconfirm status

type NetworkInterfacePage

type NetworkInterfacePage struct {
	BasePage
	IPEdit           *clui.EditField
	IPWarning        *clui.Label
	NetMaskEdit      *clui.EditField
	NetMaskWarning   *clui.Label
	GatewayEdit      *clui.EditField
	GatewayWarning   *clui.Label
	DNSServerEdit    *clui.EditField
	DNSServerWarning *clui.Label
	DNSDomainEdit    *clui.EditField
	DNSDomainWarning *clui.Label

	DHCPCheck *clui.CheckBox
	// contains filtered or unexported fields
}

NetworkInterfacePage is the Page implementation for the network configuration page

func (*NetworkInterfacePage) Activate

func (page *NetworkInterfacePage) Activate()

Activate will set the fields with the selected interface info

type NetworkPage

type NetworkPage struct {
	BasePage
	// contains filtered or unexported fields
}

NetworkPage is the Page implementation for the network configuration page

func (*NetworkPage) Activate

func (page *NetworkPage) Activate()

Activate will recreate the network listing elements

func (*NetworkPage) GetConfigDefinition

func (page *NetworkPage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*NetworkPage) GetConfiguredValue

func (page *NetworkPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

type NetworkTestDialog

type NetworkTestDialog struct {
	DialogBox *clui.Window
	// contains filtered or unexported fields
}

NetworkTestDialog is dialog window use to stop all other user interaction while the network configuration is tested for connectivity to the swupd server. Check for: - Working network interface - Use of Proxy (if set) - use of Swupd Mirror (if set)

func CreateNetworkTestDialogBox

func CreateNetworkTestDialogBox(modelSI *model.SystemInstall) (*NetworkTestDialog, error)

CreateNetworkTestDialogBox creates the Network PopUp

func (*NetworkTestDialog) Close

func (dialog *NetworkTestDialog) Close()

Close closes the dialog window and executes a callback if registered

func (*NetworkTestDialog) Desc

func (dialog *NetworkTestDialog) Desc(desc string)

Desc is part of the progress.Client implementation and sets the progress bar label

func (*NetworkTestDialog) Failure

func (dialog *NetworkTestDialog) Failure()

Failure is part of the progress.Client implementation and represents the unsuccessful progress completion of a task by setting the progress bar to "fail"

func (*NetworkTestDialog) LoopWaitDuration

func (dialog *NetworkTestDialog) LoopWaitDuration() time.Duration

LoopWaitDuration is part of the progress.Client implementation and returns the time duration each step should wait until calling Step again

func (*NetworkTestDialog) OnClose

func (dialog *NetworkTestDialog) OnClose(fn func())

OnClose sets the callback that is called when the dialog is closed

func (*NetworkTestDialog) Partial

func (dialog *NetworkTestDialog) Partial(total int, step int)

Partial is part of the progress.Client implementation and adjusts the progress bar to the current completion percentage

func (*NetworkTestDialog) RunNetworkTest

func (dialog *NetworkTestDialog) RunNetworkTest() bool

RunNetworkTest runs the test function

func (*NetworkTestDialog) Step

func (dialog *NetworkTestDialog) Step()

Step is part of the progress.Client implementation and moves the progress bar one step case it becomes full it starts again

func (*NetworkTestDialog) Success

func (dialog *NetworkTestDialog) Success()

Success is part of the progress.Client implementation and represents the successful progress completion of a task by setting the progress bar to "full"

type NetworkValidatePage

type NetworkValidatePage struct {
	// contains filtered or unexported fields
}

NetworkValidatePage is a special PopUp Page implementation which implements the Page interface, but does not allocate a Window. Instead it will launch a modal PopUp window.

func (*NetworkValidatePage) Activate

func (page *NetworkValidatePage) Activate()

Activate resets the page state

func (*NetworkValidatePage) DeActivate

func (page *NetworkValidatePage) DeActivate()

DeActivate is a stub implementation for the DeActivate method of Page interface

func (*NetworkValidatePage) GetActivated

func (page *NetworkValidatePage) GetActivated() clui.Control

GetActivated returns the control set as activated for a page

func (*NetworkValidatePage) GetConfigDefinition

func (page *NetworkValidatePage) GetConfigDefinition() int

GetConfigDefinition is a stub implementation the real implementation must check with the model and return:

  • ConfigDefinedByUser: if the configuration was interactively defined by the user
  • ConfigDefinedByConfig: if the configuration was provided by a config file
  • ConfigNotDefined: if none of the above apply

func (*NetworkValidatePage) GetConfiguredValue

func (page *NetworkValidatePage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

func (*NetworkValidatePage) GetData

func (page *NetworkValidatePage) GetData() interface{}

GetData returns the current value of a page's data member

func (*NetworkValidatePage) GetDone

func (page *NetworkValidatePage) GetDone() bool

GetDone returns the current value of a page's done flag

func (*NetworkValidatePage) GetID

func (page *NetworkValidatePage) GetID() int

GetID returns the current page's identifier

func (*NetworkValidatePage) GetMenuButton

func (page *NetworkValidatePage) GetMenuButton() *MenuButton

GetMenuButton is a page implementation for network validate popup

func (*NetworkValidatePage) GetMenuStatus

func (page *NetworkValidatePage) GetMenuStatus(item Page) int

GetMenuStatus returns the menu button status id

func (*NetworkValidatePage) GetMenuTitle

func (page *NetworkValidatePage) GetMenuTitle() string

GetMenuTitle returns the current page's title string

func (*NetworkValidatePage) GetWindow

func (page *NetworkValidatePage) GetWindow() *clui.Window

GetWindow returns the current page's window control

func (*NetworkValidatePage) IsRequired

func (page *NetworkValidatePage) IsRequired() bool

IsRequired returns if this Page is required to be completed for the Install

func (*NetworkValidatePage) SetData

func (page *NetworkValidatePage) SetData(data interface{})

SetData set the current value for the page's data member

func (*NetworkValidatePage) SetDone

func (page *NetworkValidatePage) SetDone(done bool) bool

SetDone sets the page's done flag

func (*NetworkValidatePage) SetMenuButton

func (page *NetworkValidatePage) SetMenuButton(mb *MenuButton)

SetMenuButton is a no-op page implementation for network validate popup

type Page

type Page interface {
	GetID() int
	IsRequired() bool
	GetWindow() *clui.Window
	GetActivated() clui.Control
	GetMenuTitle() string
	SetData(data interface{})
	GetData() interface{}
	SetDone(done bool) bool
	GetDone() bool
	Activate()
	DeActivate()
	GetConfigDefinition() int
	GetConfiguredValue() string
	SetMenuButton(mb *MenuButton)
	GetMenuButton() *MenuButton
}

Page defines the methods a Page must implement

type ProxyPage

type ProxyPage struct {
	BasePage
	// contains filtered or unexported fields
}

ProxyPage is the Page implementation for the proxy configuration page

func (*ProxyPage) Activate

func (pp *ProxyPage) Activate()

Activate sets the https proxy with the current model's value

func (*ProxyPage) GetConfiguredValue

func (pp *ProxyPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

type SaveConfigPage

type SaveConfigPage struct {
	// contains filtered or unexported fields
}

SaveConfigPage is a special PopUp Page implementation which implements the Page interface, but does not allocate a Window. Instead it will launch a modal PopUp window.

func (*SaveConfigPage) Activate

func (page *SaveConfigPage) Activate()

Activate resets the page state

func (*SaveConfigPage) DeActivate

func (page *SaveConfigPage) DeActivate()

DeActivate is a stub implementation for the DeActivate method of Page interface

func (*SaveConfigPage) GetActivated

func (page *SaveConfigPage) GetActivated() clui.Control

GetActivated returns the control set as activated for a page

func (*SaveConfigPage) GetConfigDefinition

func (page *SaveConfigPage) GetConfigDefinition() int

GetConfigDefinition is a stub implementation the real implementation must check with the model and return:

  • ConfigDefinedByUser: if the configuration was interactively defined by the user
  • ConfigDefinedByConfig: if the configuration was provided by a config file
  • ConfigNotDefined: if none of the above apply

func (*SaveConfigPage) GetConfiguredValue

func (page *SaveConfigPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

func (*SaveConfigPage) GetData

func (page *SaveConfigPage) GetData() interface{}

GetData returns the current value of a page's data member

func (*SaveConfigPage) GetDone

func (page *SaveConfigPage) GetDone() bool

GetDone returns the current value of a page's done flag

func (*SaveConfigPage) GetID

func (page *SaveConfigPage) GetID() int

GetID returns the current page's identifier

func (*SaveConfigPage) GetMenuButton

func (page *SaveConfigPage) GetMenuButton() *MenuButton

GetMenuButton is a page implementation for network validate popup

func (*SaveConfigPage) GetMenuStatus

func (page *SaveConfigPage) GetMenuStatus(item Page) int

GetMenuStatus returns the menu button status id

func (*SaveConfigPage) GetMenuTitle

func (page *SaveConfigPage) GetMenuTitle() string

GetMenuTitle returns the current page's title string

func (*SaveConfigPage) GetWindow

func (page *SaveConfigPage) GetWindow() *clui.Window

GetWindow returns the current page's window control

func (*SaveConfigPage) IsRequired

func (page *SaveConfigPage) IsRequired() bool

IsRequired returns if this Page is required to be completed for the Install

func (*SaveConfigPage) SetData

func (page *SaveConfigPage) SetData(data interface{})

SetData set the current value for the page's data member

func (*SaveConfigPage) SetDone

func (page *SaveConfigPage) SetDone(done bool) bool

SetDone sets the page's done flag

func (*SaveConfigPage) SetMenuButton

func (page *SaveConfigPage) SetMenuButton(mb *MenuButton)

SetMenuButton is a no-op page implementation for network validate popup

type SelectedUser

type SelectedUser struct {
	// contains filtered or unexported fields
}

SelectedUser holds the shared date between the User Manager page and the user configuration page

type SimpleButton

type SimpleButton struct {
	clui.BaseControl
	// contains filtered or unexported fields
}

SimpleButton is the implementation of a clui button with simpler visual elements (i.e no shadows).

func CreateSimpleButton

func CreateSimpleButton(parent clui.Control, width, height int, title string, scale int) *SimpleButton

CreateSimpleButton returns an instance of SimpleButton parent - is the parent control this button is attached to width - the minimum width size height - the minimum height size title - the button's label scale - the amount of space to use whenever used in an adjustable layout

func (*SimpleButton) Draw

func (b *SimpleButton) Draw()

Draw paints the button in the screen and adjust colors depending on the button state

func (*SimpleButton) ForceActiveStyle

func (b *SimpleButton) ForceActiveStyle() bool

ForceActiveStyle returns the forceActiveStyle flag

func (*SimpleButton) OnClick

func (b *SimpleButton) OnClick(fn func(clui.Event))

OnClick sets the button's onClick callback

func (*SimpleButton) ProcessEvent

func (b *SimpleButton) ProcessEvent(event clui.Event) bool

ProcessEvent will process the events triggered by clui mainloop

func (*SimpleButton) ResizeChildren

func (b *SimpleButton) ResizeChildren()

ResizeChildren handles parent window resizing

func (*SimpleButton) SetForceActiveStyle

func (b *SimpleButton) SetForceActiveStyle(f bool)

SetForceActiveStyle even if the button is not active the user may want to force setting the active style

type SwupdMirrorPage

type SwupdMirrorPage struct {
	BasePage
	// contains filtered or unexported fields
}

SwupdMirrorPage is the Page implementation for the swupd mirror page

func (*SwupdMirrorPage) Activate

func (page *SwupdMirrorPage) Activate()

Activate sets the swupd mirror with the current model's value

func (*SwupdMirrorPage) GetConfigDefinition

func (page *SwupdMirrorPage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*SwupdMirrorPage) GetConfiguredValue

func (page *SwupdMirrorPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

type TabGroup

type TabGroup struct {
	// contains filtered or unexported fields
}

TabGroup represents a tab group and holds logically grouped tabs

func NewTabGroup

func NewTabGroup(parent clui.Control, paddingX int, height int) *TabGroup

NewTabGroup allocates a new TabGroup object and initializes the basic frames and triggers the events pooling

func (*TabGroup) AddTab

func (tg *TabGroup) AddTab(label string, hotKey rune) (*TabPage, error)

AddTab allocates a new TagPage, creates button and frame accordingly

func (*TabGroup) GetVisibleFrame

func (tg *TabGroup) GetVisibleFrame() *clui.Frame

GetVisibleFrame returns the visible page's content frame

func (*TabGroup) SetActive

func (tg *TabGroup) SetActive(idx int) error

SetActive sets the nth page of a TabGroup as active

type TabKeyCb

type TabKeyCb struct {
	// contains filtered or unexported fields
}

TabKeyCb holds the contexts for the keybinds handling iterations

type TabPage

type TabPage struct {
	// contains filtered or unexported fields
}

TabPage represents an individual element containing basically a hotkey, button and content

func (*TabPage) IsVisible

func (tp *TabPage) IsVisible() bool

IsVisible returns true if a given tab page is visible, and false otherwise

type TelemetryPage

type TelemetryPage struct {
	BasePage
}

TelemetryPage is the Page implementation for the telemetry configuration page

func (*TelemetryPage) Activate

func (tp *TelemetryPage) Activate()

Activate activates the proper button depending on the current model value if telemetry is enabled in the data model then the confirm button will be active otherwise the back button will be activated.

func (*TelemetryPage) DeActivate

func (tp *TelemetryPage) DeActivate()

DeActivate sets the model value and adjusts the "confirm" flag for this page

func (*TelemetryPage) GetConfigDefinition

func (tp *TelemetryPage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*TelemetryPage) GetConfiguredValue

func (tp *TelemetryPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

func (*TelemetryPage) GetDone

func (tp *TelemetryPage) GetDone() bool

GetDone returns the current value of a page's done flag

type TimezonePage

type TimezonePage struct {
	BasePage
	// contains filtered or unexported fields
}

TimezonePage is the Page implementation for the timezone configuration page

func (*TimezonePage) DeActivate

func (page *TimezonePage) DeActivate()

DeActivate will reset the selection case the user has pressed cancel

func (*TimezonePage) GetConfigDefinition

func (page *TimezonePage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*TimezonePage) GetConfiguredValue

func (page *TimezonePage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently timezone set

func (*TimezonePage) SetDone

func (page *TimezonePage) SetDone(done bool) bool

SetDone sets the selected timezone to data model

type Tui

type Tui struct {
	// contains filtered or unexported fields
}

Tui is the main tui data struct and holds data about the higher level data for this front end, it also implements the Frontend interface

func New

func New() *Tui

New creates a new Tui frontend instance

func (*Tui) MustRun

func (tui *Tui) MustRun(args *args.Args) bool

MustRun is part of the Frontend interface implementation and tells the core that this frontend wants/must run.

func (*Tui) Run

func (tui *Tui) Run(md *model.SystemInstall, rootDir string, options args.Args) (bool, error)

Run is part of the Frontend interface implementation and is the tui frontend main entry point

type UserManagerPage

type UserManagerPage struct {
	BasePage
	// contains filtered or unexported fields
}

UserManagerPage is the Page implementation for the disk partitioning menu page

func (*UserManagerPage) Activate

func (page *UserManagerPage) Activate()

Activate updates the UI elements with the most current list of block devices

func (*UserManagerPage) GetConfigDefinition

func (page *UserManagerPage) GetConfigDefinition() int

GetConfigDefinition returns if the config was interactively defined by the user, was loaded from a config file or if the config is not set.

func (*UserManagerPage) GetConfiguredValue

func (page *UserManagerPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

func (*UserManagerPage) GetDone

func (page *UserManagerPage) GetDone() bool

GetDone Returns true when there is an admin user

func (*UserManagerPage) SetDone

func (page *UserManagerPage) SetDone(done bool) bool

SetDone put list of users into the model and sets the page as done

type UseraddPage

type UseraddPage struct {
	BasePage
	// contains filtered or unexported fields
}

UseraddPage is the Page implementation for the user add configuration page

func (*UseraddPage) Activate

func (page *UseraddPage) Activate()

Activate updates the UI elements

func (*UseraddPage) GetConfiguredValue

func (page *UseraddPage) GetConfiguredValue() string

GetConfiguredValue Returns the string representation of currently value set

func (*UseraddPage) SetDone

func (page *UseraddPage) SetDone(done bool) bool

SetDone copies the edited user data into the cache and sets the page as done

type Users

type Users []*user.User

Users is a list of User

func (Users) Len

func (users Users) Len() int

Len is require to find the length of the Users list

func (Users) Swap

func (users Users) Swap(a, b int)

Swap is require for swapping two positions in Users list

type WarningDialog

type WarningDialog struct {
	DialogBox *clui.Window
	// contains filtered or unexported fields
}

WarningDialog is dialog window use to stop all other user interaction and present them with a warning message

func CreateWarningDialogBox

func CreateWarningDialogBox(message string) (*WarningDialog, error)

CreateWarningDialogBox creates the Network PopUp

func (*WarningDialog) Close

func (dialog *WarningDialog) Close()

Close closes the dialog window and executes a callback if registered

func (*WarningDialog) OnClose

func (dialog *WarningDialog) OnClose(fn func())

OnClose sets the callback that is called when the dialog is closed

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL