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

Mount point asterisk #728

Merged
merged 7 commits into from
Sep 4, 2018
Merged

Mount point asterisk #728

merged 7 commits into from
Sep 4, 2018

Conversation

jreidinger
Copy link
Member

how it looks:

snimek obrazovky_2018-09-03_19-16-40
snimek obrazovky_2018-09-03_19-16-18

@jreidinger jreidinger changed the title Mount point asterisk [RFC] Mount point asterisk Sep 3, 2018
@coveralls
Copy link

coveralls commented Sep 3, 2018

Coverage Status

Coverage increased (+0.002%) to 97.037% when pulling 42b8c68 on mount_point_asterisk into cb106f8 on master.

@jreidinger jreidinger changed the title [RFC] Mount point asterisk Mount point asterisk Sep 4, 2018
@@ -168,7 +169,14 @@ def device_filesystem
# @return [String]
def device_filesystem_mount_point
# TRANSLATORS: Mount point information, where %s is replaced by a mount point
format(_("Mount Point: %s"), blk_device.filesystem_mountpoint || "")
res = format(_("Mount Point: %s"), blk_device.filesystem_mountpoint || "")
return res unless Yast::Mode.normal
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the mode important?

Copy link
Member Author

Choose a reason for hiding this comment

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

because in installation it is useless as it shows only if it is part of proposal, so shows newly mounted partition not in staging, which is something very different. Also help text does not reflect it.

Copy link
Contributor

Choose a reason for hiding this comment

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

But during installation, all new mount points are always active, so the asterisk will be not shown in that case.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think only when they are in staging, so situation that they are not in staging cannot happen?

# TRANSLATORS: note appended to mount point if mount point is not now mounted
res += _(" (not mounted)") unless blk_device.blk_filesystem.mount_point.active?

res
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could avoid the high complexity error in codeclimate with a implementation like follows:

def device_filesystem_mount_point
  # TRANSLATORS: Mount point information, where %s is replaced by a mount point
  res = format(_("Mount Point: %s"), blk_device.filesystem_mountpoint || "")

  if Yast::Mode.normal && blk_device.filesystem && blk_device.filesystem.mount_point
  	mount_point = blk_device.filesystem.mount_point
  	# TRANSLATORS: note appended to mount point if mount point is not now mounted
  	res += _(" (not mounted)") unless mount_point.active?
  end

  res
end

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure that it helps. If we want to reduce maybe something like

if Yast::Mode.normal && blk_device&.filesystem&.mount_point&.active? == false
  res += _(" (not mounted)")
end

Copy link
Contributor

Choose a reason for hiding this comment

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

This version is difficult to read for me. What about adding a new auxiliary method that checks whether it is necessary to add the ending note?

res += "(*)" if fs.mount_point && !fs.mount_point.active?
end

res
Copy link
Contributor

Choose a reason for hiding this comment

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

And here, we try something like:

def mount_point_value(device)
  fs = filesystem(device)

  return "" if fs.nil? || fs.mount_path.nil?

  res += "(*)" if Yast::Mode.normal && !fs.mount_point.active?

  res
end

Copy link
Contributor

@joseivanlopez joseivanlopez Sep 4, 2018

Choose a reason for hiding this comment

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

BTW, comparing with old partitioner, I see it more clear when I see "/mount/point *". Current version "/mount/point(*)" looks a little bit strange to me, but it is only a personal feeling.

Copy link
Member Author

Choose a reason for hiding this comment

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

fine for me with changing it to " *"

Copy link
Contributor

@joseivanlopez joseivanlopez left a comment

Choose a reason for hiding this comment

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

LGTM

@jreidinger jreidinger merged commit 3a9113a into master Sep 4, 2018
@jreidinger jreidinger deleted the mount_point_asterisk branch September 4, 2018 14:09
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.

3 participants