Skip to content

Commit

Permalink
Merge pull request #1195 from yast/bsc-1183586
Browse files Browse the repository at this point in the history
Hide the abort button in a network subworkflow during installation
  • Loading branch information
dgdavid committed Apr 7, 2021
2 parents c7c776a + f979d85 commit 827f07d
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 14 deletions.
7 changes: 7 additions & 0 deletions package/yast2-network.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Apr 5 15:21:47 UTC 2021 - David Diaz <dgonzalez@suse.com>

- Do not show the "Abort" button when the inst_lan client is called
from another installation step (bsc#1183586).
- 4.4.0

-------------------------------------------------------------------
Mon Mar 29 11:52:08 UTC 2021 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-network.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-network
Version: 4.3.63
Version: 4.4.0
Release: 0
Summary: YaST2 - Network Configuration
License: GPL-2.0-only
Expand Down
45 changes: 37 additions & 8 deletions src/include/network/lan/complex.rb
Expand Up @@ -55,6 +55,7 @@ def initialize_network_lan_complex(include_target)
Yast.import "CWMTab"
Yast.import "Stage"
Yast.import "Systemd"
Yast.import "GetInstArgs"

Yast.include include_target, "network/routines.rb"
Yast.include include_target, "network/lan/help.rb"
Expand Down Expand Up @@ -242,30 +243,58 @@ def MainDialog(init_tab)

help = CWM.MergeHelps(w)
contents = CWM.PrepareDialog(contents, w)
running_installer = Mode.installation || Mode.update

Wizard.SetContentsButtons(
caption,
contents,
help,
Label.BackButton,
running_installer ? Label.NextButton : Label.OKButton
next_button_label
)

if running_installer
Wizard.SetAbortButton(:abort, Label.AbortButton)
else
Wizard.SetAbortButton(:abort, Label.CancelButton)
Wizard.HideBackButton
end
Wizard.SetAbortButton(:abort, abort_button_label)
Wizard.HideAbortButton if hide_abort_button?
Wizard.HideBackButton unless running_installer?

ret = nil

loop do
ret = CWM.Run(w, {})
break if input_done?(ret)
end

ret
end

# The label for the next/ok button
#
# @return [String]
def next_button_label
running_installer? ? Label.NextButton : Label.OKButton
end

# The label for the abort/quit button
#
# @return [String]
def abort_button_label
running_installer? ? Label.AbortButton : Label.CancelButton
end

# Whether abort button should be hide
#
# @return [Boolean] true if running during installation and disable_abort_button inst argument
# is present and true; false otherwise
def hide_abort_button?
return false unless running_installer?

GetInstArgs.argmap["hide_abort_button"] == true
end

# Whether running during installation
#
# @return [Boolean] true when running during installation, false otherwise
def running_installer?
Mode.installation || Mode.update
end
end
end
3 changes: 2 additions & 1 deletion src/lib/installation/console/plugins/network_button.rb
Expand Up @@ -41,7 +41,8 @@ def help
end

def handle
Yast::WFM.call("inst_lan", [{ "skip_detection" => true }])
Yast::WFM.call("inst_lan", [{ "skip_detection" => true, "hide_abort_button" => true }])

nil
end
end
Expand Down
11 changes: 8 additions & 3 deletions src/lib/network/clients/inst_lan.rb
Expand Up @@ -32,10 +32,15 @@ module Yast
# sequence.
#
# The configuration sequence can be forced passing the 'skip_detection'
# argument.
# argument. Additionally, the abort button could be hide passing the
# 'hide_abort_button' argument
#
# @example calling the client forcing the configuration sequence
# Yast::WFM.CallFunction("inst_lan", [args.merge("skip_detection" => true)])
# @example calling the client forcing the configuration sequence and hiding
# the abort button
# Yast::WFM.CallFunction(
# "inst_lan",
# [args.merge("skip_detection" => true, "hide_abort_button" => true)]
# )
#
# @example firsboot xml forcing the configuration sequence
# <module>
Expand Down
5 changes: 4 additions & 1 deletion src/lib/network/clients/network_proposal.rb
Expand Up @@ -138,7 +138,10 @@ def switch_backend_link
def launch_network_configuration(args)
log.info "Launching network configuration"
Yast::Wizard.OpenAcceptDialog
result = Yast::WFM.CallFunction("inst_lan", [args.merge("skip_detection" => true)])
result = Yast::WFM.CallFunction(
"inst_lan",
[args.merge("skip_detection" => true, "hide_abort_button" => true)]
)
log.info "Returning from the network configuration with: #{result}"
result
ensure
Expand Down

0 comments on commit 827f07d

Please sign in to comment.