Module: Yast::ReiplDialogsInclude

Defined in:
../../src/include/reipl/dialogs.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) ConfigureDialog

Configure dialog

Returns:

  • dialog result



44
45
46
47
48
49
50
51
52
53
54
55
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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
146
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File '../../src/include/reipl/dialogs.rb', line 44

def ConfigureDialog
  ccw_map = Reipl.reipl_configuration["ccw"] ||
      { "device" => "", "loadparm" => "" }
  fcp_map = Reipl.reipl_configuration["fcp"] ||
      {
        "device"   => "",
        "wwpn"     => "",
        "lun"      => "",
        "bootprog" => "",
        "br_lba"   => ""
      }
  nss_map = Reipl.reipl_configuration["nss"] ||
      { "name" => "" }

  # Reipl configure dialog caption
  caption = _("Reipl Configuration")

  # Reipl configure dialog contents
  method_contents = Frame(
    _("reipl methods"),
    VBox(
      VSpacing(0.2),
      RadioButtonGroup(
        Id(:rbgroupmethods),
        VBox(
          Left(
            RadioButton(
              Id(:useccw),
              _("&ccw"),
              Reipl.ccw_exists
            )
          ),
          Left(
            RadioButton(
              Id(:usefcp),
              _("&fcp"),
              Reipl.fcp_exists
            )
          ),
          Left(
            RadioButton(
              Id(:usenss),
              _("&nss"),
              Reipl.nss_exists
            )
          ),
          VSpacing(0.2)
        )
      )
    )
  )

  ccw_contents = Frame(
    Id(:ccw_frame),
    _("ccw parameters"),
    VBox(
      VSpacing(0.2),
      TextEntry(
        Id(:ccw_device),
        _("&Device"),
        Ops.get_string(ccw_map, "device", "")
      ),
      VSpacing(0.2),
      TextEntry(
        Id(:ccw_loadparm),
        _("&Loadparm"),
        Ops.get_string(ccw_map, "loadparm", "")
      ),
      VSpacing(0.2)
    )
  )

  fcp_contents = Frame(
    Id(:fcp_frame),
    _("fcp parameters"),
    VBox(
      VSpacing(0.2),
      TextEntry(
        Id(:fcp_device),
        _("D&evice"),
        Ops.get_string(fcp_map, "device", "")
      ),
      VSpacing(0.2),
      TextEntry(
        Id(:fcp_wwpn),
        _("&Worldwide port number"),
        Ops.get_string(fcp_map, "wwpn", "")
      ),
      VSpacing(0.2),
      TextEntry(
        Id(:fcp_lun),
        _("Lo&gical unit number"),
        Ops.get_string(fcp_map, "lun", "")
      ),
      VSpacing(0.2),
      TextEntry(
        Id(:fcp_bootprog),
        _("B&oot program selector"),
        Ops.get_string(fcp_map, "bootprog", "")
      ),
      VSpacing(0.2)
    )
  )

  nss_contents = Frame(
    Id(:nss_frame),
    _("nss parameters"),
    VBox(
      VSpacing(0.2),
      TextEntry(
        Id(:nss_name),
        _("&Name"),
        Ops.get_string(ccw_map, "name", "")
      ),
      VSpacing(0.2)
    )
  )

  contents = HVSquash(
    VBox(
      method_contents,
      VSpacing(1),
      ccw_contents,
      VSpacing(1),
      fcp_contents,
      VSpacing(1),
      nss_contents
    )
  )

  Wizard.SetContents(
    _("reipl configuration"),
    contents,
    Ops.get_locale(@HELPS, "configure", _("help missing in helps.ycp")),
    true,
    true
  )

  UI.ChangeWidget(Id(:ccw_frame), :Enabled, Reipl.ccw_exists)
  UI.ChangeWidget(Id(:useccw), :Enabled, Reipl.ccw_exists)
  UI.ChangeWidget(Id(:fcp_frame), :Enabled, Reipl.fcp_exists)
  UI.ChangeWidget(Id(:usefcp), :Enabled, Reipl.fcp_exists)
  UI.ChangeWidget(Id(:nss_frame), :Enabled, Reipl.nss_exists)
  UI.ChangeWidget(Id(:usenss), :Enabled, Reipl.nss_exists)

  # @TODO
  #  UI::ChangeWidget(`id(`ccw_device), `ValidChars, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-");

  ret = nil
  while true
    ret = UI.UserInput

    # abort?
    if ret == :abort || ret == :cancel
      # Check to see if any of the data has been modified
      if Reipl.ccw_exists
        if Ops.get_string(ccw_map, "device", "") !=
            Convert.to_string(UI.QueryWidget(Id(:ccw_device), :Value))
          Reipl.modified = true
        end
        if Ops.get_string(ccw_map, "loadparm", "") !=
            Convert.to_string(UI.QueryWidget(Id(:ccw_loadparm), :Value))
          Reipl.modified = true
        end
      end

      if Reipl.fcp_exists
        if Ops.get_string(fcp_map, "device", "") !=
            Convert.to_string(UI.QueryWidget(Id(:fcp_device), :Value))
          Reipl.modified = true
        end
        if Ops.get_string(fcp_map, "wwpn", "") !=
            Convert.to_string(UI.QueryWidget(Id(:fcp_wwpn), :Value))
          Reipl.modified = true
        end
        if Ops.get_string(fcp_map, "lun", "") !=
            Convert.to_string(UI.QueryWidget(Id(:fcp_lun), :Value))
          Reipl.modified = true
        end
        if Ops.get_string(fcp_map, "bootprog", "") !=
            Convert.to_string(UI.QueryWidget(Id(:fcp_bootprog), :Value))
          Reipl.modified = true
        end
      end
      if Reipl.nss_exists
        if Ops.get_string(nss_map, "name", "") !=
            Convert.to_string(UI.QueryWidget(Id(:nss_name), :Value))
          Reipl.modified = true
        end
      end

      if ReallyAbort()
        break
      else
        next
      end
    elsif ret == :next
      # Grab the data from the entry fields
      if Reipl.ccw_exists
        Ops.set(ccw_map, "device",
          Convert.to_string(UI.QueryWidget(Id(:ccw_device), :Value))
        )
        Ops.set(ccw_map, "loadparm",
          Convert.to_string(UI.QueryWidget(Id(:ccw_loadparm), :Value))
        )

        # Apparently, maps are copy on write.  We need to put the new one back into the globals.
        Ops.set(Reipl.reipl_configuration, "ccw", ccw_map)
      end

      if Reipl.fcp_exists
        Ops.set(
          fcp_map,
          "device",
          Convert.to_string(UI.QueryWidget(Id(:fcp_device), :Value))
        )
        Ops.set(
          fcp_map,
          "wwpn",
          Convert.to_string(UI.QueryWidget(Id(:fcp_wwpn), :Value))
        )
        Ops.set(
          fcp_map,
          "lun",
          Convert.to_string(UI.QueryWidget(Id(:fcp_lun), :Value))
        )
        Ops.set(
          fcp_map,
          "bootprog",
          Convert.to_string(UI.QueryWidget(Id(:fcp_bootprog), :Value))
        )
        # Apparently, maps are copy on write.  We need to put the new one back into the globals.
        Ops.set(Reipl.reipl_configuration, "fcp", fcp_map)
      end

      if Reipl.nss_exists
        Ops.set(nss_map, "name",
          Convert.to_string(UI.QueryWidget(Id(:nss_name), :Value))
        )
        # Apparently, maps are copy on write.  We need to put the new one back into the globals.
        Ops.set(Reipl.reipl_configuration, "nss", nss_map)
      end

      break
    elsif ret == :back
      break
    else
      Builtins.y2error("unexpected retcode: %1", ret)
      next
    end
  end

  deep_copy(ret)
end

- (Object) initialize_reipl_dialogs(include_target)



32
33
34
35
36
37
38
39
40
# File '../../src/include/reipl/dialogs.rb', line 32

def initialize_reipl_dialogs(include_target)
  textdomain "reipl"

  Yast.import "Label"
  Yast.import "Wizard"
  Yast.import "Reipl"

  Yast.include include_target, "reipl/helps.rb"
end