Module: Yast::AutoinstallVolgroupDialogInclude
- Defined in:
- ../../src/include/autoinstall/VolgroupDialog.rb
Instance Method Summary (collapse)
- - (Object) initialize_autoinstall_VolgroupDialog(include_target)
-
- (Object) VolgroupAddTypePrefix(s)
SYNCING GUI DATA.
- - (Object) VolgroupCheck
- - (Object) VolgroupDelete
- - (Object) VolgroupDisplay
- - (Object) VolgroupEventHandler
-
- (Object) VolgroupLoad(drive)
GENERAL DIALOG IFACE.
- - (Object) VolgroupNew
- - (Object) VolgroupRemoveTypePrefix(s)
- - (Object) VolgroupStore
- - (Object) VolgroupUpdateData(vg)
- - (Object) VolgroupUpdateGUI(d)
Instance Method Details
- (Object) initialize_autoinstall_VolgroupDialog(include_target)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 11 def initialize_autoinstall_VolgroupDialog(include_target) textdomain "autoinst" Yast.include include_target, "autoinstall/common.rb" Yast.include include_target, "autoinstall/types.rb" Yast.import "AutoinstPartPlan" Yast.import "AutoinstDrive" # INTERNAL STUFF # local copy of current device the user wants to # edit using this dialog @currentVolgroup = {} @currentVolgroupIdx = 999 @volgroupTypes = ["LVM"] @volgroupTypePrefix = "CT_" @volgroupPrefix = "/dev/" @newVolgroupName = "NewVg" @volgroupDialogTitle = _("Edit Volume Group") # INITIALIZE DIALOG @volgroupType = "volgroup" @volgroupDialog = { :type => @volgroupType, :display => lambda { VolgroupDisplay() }, :eventHandler => lambda { VolgroupEventHandler() }, :store => lambda { VolgroupStore() }, :new => lambda { VolgroupNew() }, :delete => lambda { VolgroupDelete() }, :check => lambda { VolgroupCheck() } } Builtins.y2milestone("adding volgroup dialog to dialog list.") addDialog(@volgroupType, @volgroupDialog) end |
- (Object) VolgroupAddTypePrefix(s)
SYNCING GUI <-> DATA
52 53 54 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 52 def VolgroupAddTypePrefix(s) string2symbol(addPrefix(symbol2string(s), @volgroupTypePrefix)) end |
- (Object) VolgroupCheck
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 108 def VolgroupCheck @currentVolgroup = VolgroupUpdateData(@currentVolgroup) storedVolgroup = AutoinstPartPlan.getDrive(@currentVolgroupIdx) if !AutoinstDrive.areEqual(@currentVolgroup, storedVolgroup) if Popup.YesNo(_("Store unsaved changes to volume group?")) AutoinstPartPlan.updateDrive(@currentVolgroup) end end Builtins.y2milestone( "updated drive('%1'): '%2'", Ops.get_string(@currentVolgroup, "device", ""), @currentVolgroup ) nil end |
- (Object) VolgroupDelete
159 160 161 162 163 164 165 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 159 def VolgroupDelete drive = Ops.get_string(@stack, :which, "") Builtins.y2milestone("VolgroupDelete('%1')", drive) AutoinstPartPlan.removeDrive(Builtins.tointeger(drive)) nil end |
- (Object) VolgroupDisplay
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 125 def VolgroupDisplay drive = Ops.get_string(@stack, :which, "") Builtins.y2milestone("VolgroupDisplay('%1')", drive) @currentVolgroupIdx = Builtins.tointeger(drive) @currentVolgroup = VolgroupLoad(@currentVolgroupIdx) contents = VBox( Heading(@volgroupDialogTitle), HVCenter( HVSquash( VBox( TextEntry(Id(:vgDevice), _("Volgroup device name")), #`ComboBox( `id(`vgType), _("Type"), toItemList(volgroupTypes)), VSpacing(2), PushButton(Id(:apply), _("Apply")) ) ) ) ) UI.ReplaceWidget(Id(@replacement_point), contents) VolgroupUpdateGUI(drive) nil end |
- (Object) VolgroupEventHandler
150 151 152 153 154 155 156 157 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 150 def VolgroupEventHandler Builtins.y2milestone( "VolgroupEventHandler(): current event: '%1'", @currentEvent ) nil end |
- (Object) VolgroupLoad(drive)
GENERAL DIALOG IFACE
90 91 92 93 94 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 90 def VolgroupLoad(drive) vg = AutoinstPartPlan.getDrive(drive) Builtins.y2milestone("loaded drive('%1'): '%2'", drive, vg) deep_copy(vg) end |
- (Object) VolgroupNew
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 167 def VolgroupNew defaultDevice = Ops.add(@volgroupPrefix, @newVolgroupName) newDrive = AutoinstPartPlan.addDrive( AutoinstDrive.new(defaultDevice, :CT_LVM) ) selectTreeItem(AutoinstDrive.getNodeReference(newDrive)) Ops.set( @stack, :which, Builtins.tostring(Ops.get_integer(newDrive, "_id", 999)) ) VolgroupDisplay() nil end |
- (Object) VolgroupRemoveTypePrefix(s)
55 56 57 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 55 def VolgroupRemoveTypePrefix(s) string2symbol(removePrefix(symbol2string(s), @volgroupTypePrefix)) end |
- (Object) VolgroupStore
96 97 98 99 100 101 102 103 104 105 106 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 96 def VolgroupStore @currentVolgroup = VolgroupUpdateData(@currentVolgroup) AutoinstPartPlan.updateDrive(@currentVolgroup) Builtins.y2milestone( "updated drive('%1'): '%2'", Ops.get_string(@currentVolgroup, "device", ""), @currentVolgroup ) nil end |
- (Object) VolgroupUpdateData(vg)
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 73 def VolgroupUpdateData(vg) vg = deep_copy(vg) # TODO: device name constraints vg = AutoinstDrive.set( vg, "device", addPrefix( Convert.to_string(UI.QueryWidget(Id(:vgDevice), :Value)), @volgroupPrefix ) ) # symbol vgType = VolgroupAddTypePrefix( (symbol)UI::QueryWidget(`id(`vgType), `Value) ); # vg = AutoinstDrive::set(vg, "type", vgType ); deep_copy(vg) end |
- (Object) VolgroupUpdateGUI(d)
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File '../../src/include/autoinstall/VolgroupDialog.rb', line 58 def VolgroupUpdateGUI(d) UI.ChangeWidget( Id(:vgDevice), :Value, removePrefix( Ops.get_string(@currentVolgroup, "device", "<not-set>"), @volgroupPrefix ) ) # symbol vgType = VolgroupRemoveTypePrefix( currentVolgroup["type"]:`CT_LVM ); # UI::ChangeWidget( `id(`vgType), `Value, vgType); nil end |