Class: Registration::UI::BaseSystemRegistrationDialog

Inherits:
Object
  • Object
show all
Includes:
UI::EventDispatcher, Yast, Yast::I18n, Yast::Logger, Yast::UIShortcuts
Defined in:
src/lib/registration/ui/base_system_registration_dialog.rb

Overview

this class displays and runs the dialog for registering the base system

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseSystemRegistrationDialog

the constructor


50
51
52
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 50

def initialize
  textdomain "registration"
end

Instance Attribute Details

#actionSymbol


26
27
28
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 26

def action
  @action
end

#registrationObject

Returns the value of attribute registration


165
166
167
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 165

def registration
  @registration
end

Class Method Details

.runSymbol

create and run the dialog for registering the base system


44
45
46
47
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 44

def self.run
  dialog = BaseSystemRegistrationDialog.new
  dialog.run
end

Instance Method Details

#abort_handlerSymbol?

Handle pushing the 'Abort' button

  • In normal mode returns :abort
  • In installation mode, ask for confirmation. If user confirms, returns :abort; nil otherwise.

See Also:

  • finish_di

118
119
120
121
122
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 118

def abort_handler
  result = (Yast::Mode.normal || AbortConfirmation.run) ? :abort : nil
  finish_dialog(result) unless result.nil?
  result
end

#back_handlerObject

Handle pushing the 'Back' button


161
162
163
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 161

def back_handler
  finish_dialog(:back)
end

#initial_actionSymbol

Set the initial action

  • If the system is registered:
    • using the default url -> :register_scc
    • using a custom URL -> :register_local
  • If the system is not registered -> :register_scc

83
84
85
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 83

def initial_action
  using_default_url? ? :register_scc : :register_local
end

#network_handlerObject

Handle pushing 'Network Configuration' button

Runs the network configuration


149
150
151
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 149

def network_handler
  Helpers.run_network_configuration
end

#next_handlerSymbol?

Handle pushing the 'Next' button depending on the action

When action is:

  • :skip_registration: returns :skip to skip the registration process.
  • :register_scc o :register_local: calls #handle_registration

See Also:

  • #handle_registration

97
98
99
100
101
102
103
104
105
106
107
108
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 97

def next_handler
  result =
    case action
    when :skip_registration
      log.info "Skipping registration on user request"
      :skip
    when :register_scc, :register_local
      handle_registration
    end
  finish_dialog(result) unless result.nil?
  result
end

#register_local_handlerObject

Handle selection the 'Register System via local SMT Server' option

Set the dialog's action to :register_local


142
143
144
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 142

def register_local_handler
  self.action = :register_local
end

#register_scc_handlerObject

Handle selection the 'Register System via scc.suse.com' option

Set the dialog's action to :register_scc


135
136
137
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 135

def register_scc_handler
  self.action = :register_scc
end

#reregister_addons_handlerObject

Handle pushing the button to register again

Just finish the dialog returning :reregister_addons


156
157
158
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 156

def reregister_addons_handler
  finish_dialog(:reregister_addons)
end

#runSymbol

display the extension selection dialog and wait for a button click


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 56

def run
  log.info "Displaying registration dialog"

  Yast::Wizard.SetContents(
    # dialog title
    _("Registration"),
    content,
    help_text,
    Yast::GetInstArgs.enable_back || (Yast::Mode.normal && Registration.is_registered?),
    Yast::GetInstArgs.enable_next || Yast::Mode.normal
  )

  # Set default action
  self.action = initial_action
  set_focus

  event_loop
end

#skip_registration_handlerObject

Handle selecting the 'Skip' option

Set the dialog's action to :skip_registration


127
128
129
130
# File 'src/lib/registration/ui/base_system_registration_dialog.rb', line 127

def skip_registration_handler
  self.action = :skip_registration
  show_skipping_warning
end