Skip to content

Commit

Permalink
Enclose the whole #run logic within a dialog
Browse files Browse the repository at this point in the history
Moving the Wizard::CloseDialog to the end because the new
Yast2::ServiceWidget requires the content of dialog to work properly.
See [1] for more info.

[1] https://github.com/yast/yast-yast2/blob/a229cf9c2cf4a8cf0ae8bd29759ba802d8dec47f/library/systemd/src/lib/yast2/service_widget.rb#L116
  • Loading branch information
dgdavid committed Aug 9, 2018
1 parent 095c903 commit fd921c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
4 changes: 1 addition & 3 deletions src/clients/iscsi-lio-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
require "y2firewall/firewalld"

Yast.import "CWM"
Yast.import "CWMTab"
Yast.import "TablePopup"
Yast.import "Popup"
Yast.import "Wizard"
Expand Down Expand Up @@ -66,7 +65,6 @@ def run
contents = VBox(tabs,VStretch())
Yast::Wizard.CreateDialog
ret = CWM.show(contents, caption: _("Yast iSCSI Targets"),next_button: _("Finish"))
Yast::Wizard.CloseDialog
if ret == :next
firewalld.write
service_tab.write
Expand Down Expand Up @@ -106,8 +104,8 @@ def run
end
$global_data.execute_exit_commands
end
Yast::Wizard.CloseDialog
end

end
end

Expand Down
30 changes: 12 additions & 18 deletions src/include/iscsi-lio-server/UI_dialogs.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
require_relative './iscsi-lio-server_helper.rb'
require_relative './TargetData.rb'

require 'yast'
require 'yast2/execute'
require 'yast2/system_service'
Expand All @@ -10,15 +7,15 @@
require 'cwm/widget'
require 'cwm/service_widget'

require_relative './iscsi-lio-server_helper.rb'
require_relative './TargetData.rb'

Yast.import 'CWM'
Yast.import 'CWMTab'
Yast.import 'TablePopup'
Yast.import 'Popup'
Yast.import 'Wizard'
Yast.import 'CWMFirewallInterfaces'
Yast.import 'Service'
Yast.import 'UI'
Yast.import 'TablePopup'

class NoDiscoveryAuth_CheckBox < ::CWM::CheckBox
def initialize(container,value)
Expand Down Expand Up @@ -409,14 +406,20 @@ module Yast
class ServiceTab < ::CWM::Tab
include Yast::I18n
include Yast::UIShortcuts

def initialize
textdomain "iscsi-lio-server"

self.initial = true
@service = Yast2::SystemService.find("targetcli")
@service_widget = ::CWM::ServiceWidget.new(@service)
@firewall_widget = ::CWM::WrapperWidget.new(
CWMFirewallInterfaces.CreateOpenFirewallWidget("services" => ["iscsi-target"]),
)
CWMFirewallInterfaces.CreateOpenFirewallWidget("services" => ["iscsi-target"]),
)
end

def label
_('Service')
end

def contents
Expand All @@ -442,11 +445,6 @@ def store
@service_widget.store
end

# Saves the service with current settings
#
# @see Yast2::SystemService
#
# @return [Boolean] true if service is saved with success; false otherwise
def write
@service.save
end
Expand All @@ -455,12 +453,8 @@ def opt
[:notify]
end

def label
_('Service')
end

def help
help_msg = _("<h1>iSCSI Target</h1>")
help_msg = _("<h1>iSCSI Target</h1>")
help_msg += _("<h2>Service Start</h2>")
help_msg += _("To start the service every time your computer is booted, \
set <b>When Booting</b>. Otherwise set <b>Manually</b>.\n")
Expand Down

0 comments on commit fd921c7

Please sign in to comment.