Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Partitioner UI based on dynamic menu-buttons #752

Merged
merged 24 commits into from
Oct 2, 2018

Conversation

ancorgs
Copy link
Contributor

@ancorgs ancorgs commented Oct 1, 2018

Main PR for https://trello.com/c/5rrmzwKh/276-3-partitioner-unleash-the-beast

This implements the UI described in this gist, check that document for the rationale.

The new UI fits into an 80x24 text console and allows all kind of operations. For example, it's possible to start with three empty disks and end up creating this complex setup using only the Partitioner.

super-devicegraph

There you can see:

  • /dev/md0 is an MD RAID defined on top of two partitions and formatted as "/" (nothing really new here),
  • /dev/md1 is an MD RAID defined on top of a combination of full disks (/dev/sdb) and partitions (/dev/sda3) and containing partitions like /dev/md1p1 and /dev/md1p2 itself (two things that were not possible in the old Partitioner),
  • /dev/volgroup0 is an LVM VG based on one of those MD partitions,
  • /dev/sdc is a disk hosting directly a file-system with no partitions in between (also a new possibility).

And this is how some parts of the process to create such setup look like in a text console.

Directly formatting a disk (no partitions):

formatting_a_disk

Playing with partitions.

playing_with_partitions

Creating an MD RAID on top of two full disks and then creating partitions within the RAID.

creating_partitioned_array

Last but not least, that's how those screens look in graphical mode (SLE-15-SP1 installation).

dynamic-md

dynamic-partitions

dynamic-vg

partition_buttons
else
raid_buttons
types = [:partition, :software_raid, :lvm_vg, :lvm_lv, :stray_blk_device]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like constant for list of supported device types?

working_graph.find_device(device_sid)
end

# @return [Array<[Symbol, String]>] list of menu options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, this comment is a bit imprecise. I prefer here simple see for CWM method which defines how it exactly have to look.

#
# @return [Boolean]
def validate_presence
return true unless device.nil?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP: but me is more nature return true if device

@@ -34,7 +34,8 @@ class LvmDevicesTable < ConfigurableBlkDevicesTable
# @param devices [Array<Y2Storage::Lvm_vg, Y2Storage::Lvm_lv>] devices to display
# @param pager [CWM::Pager] table have feature, that double click change content of pager
# if someone do not need this feature, make it only optional
def initialize(devices, pager)
# @param buttons_set [DeviceButtonsSet]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please document also why it is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, that whole documentation should not be there, in LvmDevicesTable, which is not the base class. #devices and #pager are already (better) documented in the base class.

def initialize(pager: nil, table: nil, device: nil, short: false)
super(pager: pager, table: table, device: device)
@short_label = short
# Constructor. See parent class.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry this see won;t create automatic link in yardoc

@@ -33,6 +33,8 @@
# @see http://www.rubydoc.info/github/yast/yast-yast2/CWM%2FCustomWidget:${0}
# @!macro [new] seeDialog
# @see http://www.rubydoc.info/github/yast/yast-yast2/CWM%2FDialog:${0}
# @!macro [new] seeItemsSelection
# @see http://www.rubydoc.info/github/yast/yast-yast2/CWM%2FItemsSelection:${0}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ancorgs ancorgs force-pushed the menu-buttons branch 2 times, most recently from 14e5416 to 2053c58 Compare October 1, 2018 13:33

# @see DevicesTable
def table_buttons
Empty()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, what about making this default behavior in base and redefine only when needed?

#
# @return [String]
def self.md_raids_label
N_("RAID")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it is not constant? We usually use N_ in constants. and _ in common methods. This usage of N_ and _ in caller looks strange for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved stuff from the previous place in a hurry (kind of). With UIState being a singleton class, it makes indeed no sense to keep the old N_ thingie.

# @macro seeAbstractWidget
def label
_(self.class.label)
_(UIState.lvm_label)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if label already have _() instead of N_ then we do not need to translate it again here.

@@ -129,6 +129,7 @@ def widget_id_for_action(action)
# @param id [Symbol, String]
# @return [Hash]
def action_for_widget_id(id)
return nil if id.nil?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be nil or exception? if so, then please document it that it can also return nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I would never expect #handle to be called with no arguments (or with a nil argument) since handle_all_events is used.

Unfortunately, supporting that case is needed in order to be able to use include_examples "CWM::AbstractWidget" which always calls #handle with no arguments, so I have to adapt the class to ignore such wrong calls.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, yeah. That is problematic, because for calls it uses arity and rspec mock basically mocks call with *args, so -1 arity and it breaks this test. Please add comment for it, as it is quite tricky.

@@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 4.1.20
Version: 4.1.21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should finally fix that indentation issue :)

@ancorgs ancorgs merged commit 99c4a57 into yast:master Oct 2, 2018
@yast-bot
Copy link

yast-bot commented Oct 2, 2018

✔️ Internal Jenkins job #46 successfully finished
✔️ Created IBS submit request #173325

@yast-bot
Copy link

yast-bot commented Oct 2, 2018

✔️ Public Jenkins job #42 successfully finished
✔️ Created OBS submit request #639614

dgdavid added a commit that referenced this pull request Jan 27, 2020
Sometime ago[1][2], the .label method from some pages was moved to the UIState
in order to avoid a dependency cycles. Since that is not the case
anymore, this commit "restore" the .label method for those pages.

[1] #752
[2] b107fc5
dgdavid added a commit that referenced this pull request Jan 27, 2020
Sometime ago[1][2], the .label method from some pages was moved to the UIState
in order to avoid a dependency cycles. Since that is not the case
anymore, this commit "restore" the .label method for those pages.

[1] #752
[2] b107fc5
dgdavid added a commit that referenced this pull request Jan 28, 2020
Sometime ago[1][2], the .label method from some pages was moved to the UIState
in order to avoid a dependency cycles. Since that is not the case
anymore, this commit "restore" the .label method for those pages.

[1] #752
[2] b107fc5
dgdavid added a commit that referenced this pull request Jan 29, 2020
Sometime ago[1][2], the .label method from some pages was moved to the UIState
in order to avoid a dependency cycles. Since that is not the case
anymore, this commit "restore" the .label method for those pages.

[1] #752
[2] b107fc5
dgdavid added a commit that referenced this pull request Jan 29, 2020
Sometime ago[1][2], the .label method from some pages was moved to the
UIState in order to avoid a dependency cycles. However, it was a kind of
temporary fix and it's time to really solve the problem.

As first step, this commit "restore" the .label method for those pages.

Subsequent commit(s) will avoid mentioned dependency.

[1] #752
[2] b107fc5
dgdavid added a commit that referenced this pull request Jan 29, 2020
Sometime ago[1][2], the .label method from some pages was moved to the
UIState in order to avoid a dependency cycles. However, it was a kind of
temporary fix and it's time to really solve the problem.

As first step, this commit "restore" the .label method for those pages.

Subsequent commit(s) will avoid mentioned dependency.

[1] #752
[2] b107fc5
dgdavid added a commit that referenced this pull request Feb 5, 2020
Sometime ago[1][2], the .label method from some pages was moved to the
UIState in order to avoid a dependency cycles. However, it was a kind of
temporary fix and it's time to really solve the problem.

As first step, this commit "restore" the .label method for those pages.

Subsequent commit(s) will avoid mentioned dependency.

[1] #752
[2] b107fc5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants