Module: Yast::NetworkLanWizardsInclude

Defined in:
src/include/network/lan/wizards.rb

Instance Method Summary collapse

Instance Method Details

#AddressSequence(_which, builder:) ⇒ Object


177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'src/include/network/lan/wizards.rb', line 177

def AddressSequence(_which, builder:)
  # TODO: add builder wherever needed
  aliases = {
    "address" => -> { AddressDialog(builder: builder) },
    "hosts"   => -> { HostsMainDialog(false) },
    "s390"    => -> { S390Dialog(builder: builder) },
    "commit"  => [-> { Commit(builder: builder) }, true]
  }

  sequence = {
    "ws_start" => "address",
    "address"  => {
      abort: :abort,
      next:  "commit",
      hosts: "hosts",
      s390:  "s390"
    },
    "s390"     => { abort: :abort, next: "address" },
    "hosts"    => { abort: :abort, next: "address" },
    "commit"   => { next: :next }
  }

  Sequencer.Run(aliases, sequence)
end

#initialize_network_lan_wizards(include_target) ⇒ Object


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'src/include/network/lan/wizards.rb', line 34

def initialize_network_lan_wizards(include_target)
  Yast.import "UI"

  textdomain "network"

  Yast.import "Arch"
  Yast.import "Label"
  Yast.import "Lan"
  Yast.import "Sequencer"
  Yast.import "Wizard"

  Yast.include include_target, "network/routines.rb"
  Yast.include include_target, "network/lan/address.rb"
  Yast.include include_target, "network/lan/complex.rb"
  Yast.include include_target, "network/lan/dhcp.rb"
  Yast.include include_target, "network/lan/hardware.rb"
  Yast.include include_target, "network/services/dns.rb"
  Yast.include include_target, "network/services/host.rb"
end

#LanAutoSequence(mode) ⇒ Object

Whole configuration of network but without reading and writing. For use with autoinstallation and proposal


100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'src/include/network/lan/wizards.rb', line 100

def LanAutoSequence(mode)
  caption = _("Network Card Configuration")
  contents = Label(_("Initializing..."))

  Wizard.CreateDialog
  Wizard.SetDesktopIcon("lan")
  Wizard.SetContentsButtons(
    caption,
    contents,
    "",
    Label.BackButton,
    Label.NextButton
  )

  ret = MainSequence(mode)

  UI.CloseDialog
  ret
end

#LanSequenceObject

Whole configuration of network


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'src/include/network/lan/wizards.rb', line 56

def LanSequence
  aliases = {
    "read"  => [-> { ReadDialog() }, true],
    "main"  => -> { MainSequence("") },
    "write" => [-> { WriteDialog() }, true]
  }

  if Mode.installation || Mode.update
    aliases["packages"] = [-> { add_pkgs_to_proposal(Lan.Packages) }, true]

    sequence = {
      "ws_start" => "read",
      "read"     => { abort: :abort, back: :back, next: "main" },
      "main"     => { abort: :abort, back: :back, next: "packages" },
      "packages" => { abort: :abort, back: :back, next: "write" },
      "write"    => { abort: :abort, back: :back, next: :next }
    }

    Wizard.OpenNextBackDialog
  else
    aliases["packages"] = [-> { PackagesInstall(Lan.Packages) }, true]

    sequence = {
      "ws_start" => "read",
      "read"     => { abort: :abort, next: "main" },
      "main"     => { abort: :abort, next: "packages" },
      "packages" => { abort: :abort, next: "write" },
      "write"    => { abort: :abort, next: :next }
    }

    Wizard.OpenCancelOKDialog
    Wizard.SetDesktopTitleAndIcon("lan")
  end

  ret = Sequencer.Run(aliases, sequence)

  UI.CloseDialog
  ret
end

#MainSequence(mode) ⇒ Object


120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'src/include/network/lan/wizards.rb', line 120

def MainSequence(mode)
  aliases = {
    "global"   => -> { MainDialog("global") },
    "overview" => -> { MainDialog("overview") }
  }

  start = "overview"
  # the NM decision is already present in the proposal.
  # see also #148485
  start = "global" if mode == "proposal"
  sequence = {
    "ws_start" => start,
    "global"   => {
      abort:  :abort,
      next:   :next,
      redraw: "global"
    },
    "overview" => {
      abort:  :abort,
      next:   :next,
      redraw: "overview"
    }
  }

  Sequencer.Run(aliases, sequence)
end

#NetworkCardSequence(action, builder:) ⇒ Object


147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'src/include/network/lan/wizards.rb', line 147

def NetworkCardSequence(action, builder:)
  ws_start = case action
  when "init_s390"
    # s390 may require configuring additional modules. Which
    # enables IBM net cards for linux. Basicaly it creates
    # linux devices with common api (e.g. eth0, hsi1, ...)
    "s390"
  when "edit"
    "address"
  else
    raise "Unknown action #{action}"
  end

  aliases = {
    # TODO: first param in AddressSequence seems to be never used
    "address" => -> { AddressSequence("", builder: builder) },
    "s390"    => -> { S390Dialog(builder: builder) }
  }

  Builtins.y2milestone("ws_start %1", ws_start)

  sequence = {
    "ws_start" => ws_start,
    "address"  => { abort: :abort, next: :next },
    "s390"     => { abort: :abort, next: "address" }
  }

  Sequencer.Run(aliases, sequence)
end