Module: Yast::PartitioningEpLvmInclude

Defined in:
../../src/include/partitioning/ep-lvm.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) CreateLvmLvPanel(user_data)



494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File '../../src/include/partitioning/ep-lvm.rb', line 494

def CreateLvmLvPanel(user_data)
  user_data = deep_copy(user_data)
  device = Convert.to_string(user_data)
  target_map = Storage.GetTargetMap

  fields = StorageSettings.FilterOverview(
    [
      :heading_device,
      :device,
      :size,
      :encrypted,
      :used_by,
      :heading_lvm,
      :stripes,
      :heading_filesystem,
      :fs_type,
      :mount_point,
      :mount_by,
      :uuid,
      :label
    ]
  )

  UI.ReplaceWidget(
    :tree_panel,
    Greasemonkey.Transform(
      VBox(
        HStretch(),
        # heading
        term(
          :IconAndHeading,
          Builtins.sformat(_("Logical Volume: %1"), device),
          StorageIcons.lvm_lv_icon
        ),
        StorageFields.Overview(fields, target_map, device),
        HBox(LvmButtonBox(), HStretch())
      )
    )
  )

  # helptext
  helptext = _(
    "<p>This view shows detailed information about the\nselected logical volume.</p>"
  )

  Wizard.RestoreHelp(
    Ops.add(helptext, StorageFields.OverviewHelptext(fields))
  )

  nil
end

- (Object) CreateLvmMainPanel(user_data)



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File '../../src/include/partitioning/ep-lvm.rb', line 156

def CreateLvmMainPanel(user_data)
  user_data = deep_copy(user_data)
  _Predicate = lambda do |disk, partition|
    disk = deep_copy(disk)
    partition = deep_copy(partition)
    StorageFields.PredicateDiskType(disk, partition, [:CT_LVM])
  end

  fields = StorageSettings.FilterTable(
    [
      :device,
      :size,
      :format,
      :encrypted,
      :type,
      :fs_type,
      :label,
      :mount_point,
      :mount_by,
      :used_by,
      :lvm_metadata,
      :pe_size,
      :stripes
    ]
  )

  target_map = Storage.GetTargetMap

  table_header = StorageFields.TableHeader(fields)
  table_contents = StorageFields.TableContents(
    fields,
    target_map,
    fun_ref(_Predicate, "symbol (map, map)")
  )
  mb_items = [Item(Id(:group), _("Volume Group"))]

  if !Builtins.isempty(table_contents)
    mb_items = Builtins.add(
      mb_items,
      Item(Id(:volume), _("Logical Volume"))
    )
  end

  UI.ReplaceWidget(
    :tree_panel,
    Greasemonkey.Transform(
      VBox(
        # heading
        term(:IconAndHeading, _("Volume Management"), StorageIcons.lvm_icon),
        Table(
          Id(:table),
          Opt(:keepSorting, :notify, :notifyContextMenu),
          table_header,
          table_contents
        ),
        HBox(
          # push button text
          MenuButton(Id(:add), Opt(:key_F3), _("Add..."), mb_items),
          LvmButtonBox(),
          HStretch()
        )
      )
    )
  )

  # helptext
  helptext = _(
    "<p>This view shows all LVM volume groups and\ntheir logical volumes.</p>"
  )

  Wizard.RestoreHelp(Ops.add(helptext, StorageFields.TableHelptext(fields)))

  nil
end

- (Object) CreateLvmVgLvsTab(user_data)



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File '../../src/include/partitioning/ep-lvm.rb', line 290

def CreateLvmVgLvsTab(user_data)
  user_data = deep_copy(user_data)
  device = Convert.to_string(user_data)

  _Predicate = lambda do |disk, partition|
    disk = deep_copy(disk)
    partition = deep_copy(partition)
    StorageFields.PredicateDiskDevice(disk, partition, [device])
  end

  fields = StorageSettings.FilterTable(
    [
      :device,
      :size,
      :format,
      :encrypted,
      :type,
      :fs_type,
      :label,
      :mount_point,
      :mount_by,
      :used_by,
      :stripes
    ]
  )

  target_map = Storage.GetTargetMap

  table_header = StorageFields.TableHeader(fields)
  table_contents = StorageFields.TableContents(
    fields,
    target_map,
    fun_ref(_Predicate, "symbol (map, map)")
  )

  UI.ReplaceWidget(
    :tab_panel,
    VBox(
      DiskBarGraph(device),
      Table(
        Id(:table),
        Opt(:keepSorting, :notify, :notifyContextMenu),
        table_header,
        table_contents
      ),
      HBox(
        # push button text
        PushButton(Id(:add), Opt(:key_F3), _("Add...")),
        LvmButtonBox(),
        HStretch()
      )
    )
  )

  # helptext
  helptext = _(
    "<p>This view shows all logical volumes of the\nselected volume group.</p>"
  )

  Wizard.RestoreHelp(Ops.add(helptext, StorageFields.TableHelptext(fields)))

  nil
end

- (Object) CreateLvmVgOverviewTab(user_data)



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File '../../src/include/partitioning/ep-lvm.rb', line 250

def CreateLvmVgOverviewTab(user_data)
  user_data = deep_copy(user_data)
  device = Convert.to_string(user_data)

  target_map = Storage.GetTargetMap

  fields = StorageSettings.FilterOverview(
    [:heading_device, :device, :size, :heading_lvm, :lvm_metadata, :pe_size]
  )

  UI.ReplaceWidget(
    :tab_panel,
    VBox(StorageFields.Overview(fields, target_map, device))
  )

  # helptext
  helptext = _(
    "<p>This view shows detailed information about the\nselected volume group.</p>"
  )

  Wizard.RestoreHelp(
    Ops.add(helptext, StorageFields.OverviewHelptext(fields))
  )

  nil
end

- (Object) CreateLvmVgPanel(user_data)



429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File '../../src/include/partitioning/ep-lvm.rb', line 429

def CreateLvmVgPanel(user_data)
  user_data = deep_copy(user_data)
  device = Convert.to_string(user_data)

  data = {
    :overview => {
      :create    => fun_ref(method(:CreateLvmVgOverviewTab), "void (any)"),
      :handle    => fun_ref(
        method(:HandleLvmVgOverviewTab),
        "void (any, map)"
      ),
      :user_data => user_data
    },
    :lvs      => {
      :create    => fun_ref(method(:CreateLvmVgLvsTab), "void (any)"),
      :handle    => fun_ref(method(:HandleLvmVgLvsTab), "void (any, map)"),
      :user_data => user_data
    },
    :pvs      => {
      :create    => fun_ref(method(:CreateLvmVgPvsTab), "void (any)"),
      :user_data => user_data
    }
  }

  UI.ReplaceWidget(
    :tree_panel,
    Greasemonkey.Transform(
      VBox(
        # heading
        term(
          :IconAndHeading,
          Builtins.sformat(_("Volume Group: %1"), device),
          StorageIcons.lvm_icon
        ),
        DumbTab(
          Id(:tab),
          [
            # push button text
            Item(Id(:overview), _("&Overview")),
            # push button text
            Item(Id(:lvs), _("&Logical Volumes")),
            # push button text
            Item(Id(:pvs), _("&Physical Volumes"))
          ],
          ReplacePoint(Id(:tab_panel), TabPanel.empty_panel)
        )
      )
    )
  )

  TabPanel.Init(data, :lvs)

  nil
end

- (Object) CreateLvmVgPvsTab(user_data)



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File '../../src/include/partitioning/ep-lvm.rb', line 374

def CreateLvmVgPvsTab(user_data)
  user_data = deep_copy(user_data)
  disk_device = Convert.to_string(user_data)

  _Predicate = lambda do |disk, partition|
    disk = deep_copy(disk)
    partition = deep_copy(partition)
    StorageFields.PredicateUsedByDevice(disk, partition, [disk_device])
  end

  fields = StorageSettings.FilterTable(
    [
      :device,
      :udev_path,
      :udev_id,
      :size,
      :format,
      :encrypted,
      :type,
      :used_by
    ]
  )

  target_map = Storage.GetTargetMap

  table_header = StorageFields.TableHeader(fields)
  table_contents = StorageFields.TableContents(
    fields,
    target_map,
    fun_ref(_Predicate, "symbol (map, map)")
  )

  UI.ReplaceWidget(
    :tab_panel,
    VBox(
      Table(
        Id(:table),
        Opt(:keepSorting, :notify),
        table_header,
        table_contents
      )
    )
  )

  # helptext
  helptext = _(
    "<p>This view shows all physical volumes used by\nthe selected volume group.</p>"
  )

  Wizard.RestoreHelp(Ops.add(helptext, StorageFields.TableHelptext(fields)))

  nil
end

- (Object) EpContextMenuLvmLv(device)



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File '../../src/include/partitioning/ep-lvm.rb', line 61

def EpContextMenuLvmLv(device)
  widget = ContextMenu.Simple(
    [
      Item(Id(:edit), _("Edit")),
      Item(Id(:resize), _("Resize")),
      Item(Id(:delete), _("Delete"))
    ]
  )

  case widget
    when :edit
      EpEditLogicalVolume(device)
    when :resize
      EpResizeLogicalVolume(device)
    when :delete
      EpDeleteLogicalVolume(device, :table)
  end

  nil
end

- (Object) EpContextMenuLvmVg(device)



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File '../../src/include/partitioning/ep-lvm.rb', line 35

def EpContextMenuLvmVg(device)
  widget = ContextMenu.Simple(
    [
      Item(
        Id(:add),
        term(:icon, StorageIcons.lvm_lv_icon),
        _("Add Logical Volume")
      ),
      Item(Id(:resize), _("Resize")),
      Item(Id(:delete), _("Delete"))
    ]
  )

  case widget
    when :add
      EpCreateLogicalVolume(device)
    when :resize
      EpResizeVolumeGroup(device)
    when :delete
      EpDeleteVolumeGroup(device)
  end

  nil
end

- (Object) HandleLvmButtons(user_data, device, event)



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File '../../src/include/partitioning/ep-lvm.rb', line 95

def HandleLvmButtons(user_data, device, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  vg = ""
  is_vg = false

  if user_data == nil
    target_map = Storage.GetTargetMap

    disk = nil
    part = nil

    disk_ref = arg_ref(disk)
    part_ref = arg_ref(part)
    SplitDevice(target_map, device, disk_ref, part_ref)
    disk = disk_ref.value
    part = part_ref.value

    vg = Ops.get_string(disk, "device", "")
    is_vg = part == nil
  else
    vg = Convert.to_string(user_data)
  end

  case Event.IsWidgetActivated(event)
    when :add
      EpCreateLogicalVolume(vg)
    when :edit
      if is_vg
        TreePanel.SwitchToNew(vg)
      else
        EpEditLogicalVolume(device)
      end
    when :resize
      if is_vg
        EpResizeVolumeGroup(device)
      else
        EpResizeLogicalVolume(device)
      end
    when :delete
      if is_vg
        EpDeleteVolumeGroup(device)
      else
        EpDeleteLogicalVolume(
          device,
          UI.WidgetExists(Id(:table)) ? :table : :overview
        )
      end
  end

  case Event.IsMenu(event)
    when :group
      EpCreateVolumeGroup()
    when :volume
      EpCreateLogicalVolume(vg)
  end

  nil
end

- (Object) HandleLvmLvPanel(user_data, event)



547
548
549
550
551
552
553
554
555
556
# File '../../src/include/partitioning/ep-lvm.rb', line 547

def HandleLvmLvPanel(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  device = Convert.to_string(user_data)

  HandleLvmButtons(nil, device, event)
  UI.SetFocus(Id(:text))

  nil
end

- (Object) HandleLvmMainPanel(user_data, event)



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File '../../src/include/partitioning/ep-lvm.rb', line 232

def HandleLvmMainPanel(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  device = Convert.to_string(UI.QueryWidget(Id(:table), :CurrentItem))

  HandleLvmButtons(user_data, device, event)

  case Event.IsWidgetContextMenuActivated(event)
    when :table
      EpContextMenuDevice(device)
  end

  UI.SetFocus(Id(:table))

  nil
end

- (Object) HandleLvmVgLvsTab(user_data, event)



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File '../../src/include/partitioning/ep-lvm.rb', line 355

def HandleLvmVgLvsTab(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  vg_device = Convert.to_string(user_data)
  lv_device = Convert.to_string(UI.QueryWidget(Id(:table), :CurrentItem))

  HandleLvmButtons(vg_device, lv_device, event)

  case Event.IsWidgetContextMenuActivated(event)
    when :table
      EpContextMenuDevice(lv_device)
  end

  UI.SetFocus(Id(:table))

  nil
end

- (Object) HandleLvmVgOverviewTab(user_data, event)



278
279
280
281
282
283
284
285
286
287
# File '../../src/include/partitioning/ep-lvm.rb', line 278

def HandleLvmVgOverviewTab(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  device = Convert.to_string(user_data)

  HandleLvmButtons(nil, device, event)
  UI.SetFocus(Id(:text))

  nil
end

- (Object) HandleLvmVgPanel(user_data, event)



485
486
487
488
489
490
491
# File '../../src/include/partitioning/ep-lvm.rb', line 485

def HandleLvmVgPanel(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  TabPanel.Handle(event)

  nil
end

- (Object) initialize_partitioning_ep_lvm(include_target)



28
29
30
31
32
33
# File '../../src/include/partitioning/ep-lvm.rb', line 28

def initialize_partitioning_ep_lvm(include_target)
  textdomain "storage"

  Yast.include include_target, "partitioning/ep-lvm-dialogs.rb"
  Yast.include include_target, "partitioning/ep-lvm-lib.rb"
end

- (Object) LvmButtonBox



83
84
85
86
87
88
89
90
91
92
# File '../../src/include/partitioning/ep-lvm.rb', line 83

def LvmButtonBox
  HBox(
    # push button text
    PushButton(Id(:edit), Opt(:key_F4), _("Edit...")),
    # push button text
    PushButton(Id(:resize), Opt(:key_F6), _("Resize...")),
    # push button text
    PushButton(Id(:delete), Opt(:key_F5), _("Delete..."))
  )
end