Skip to content

Commit

Permalink
translate FCoE config values bnc #877911
Browse files Browse the repository at this point in the history
  • Loading branch information
gabi2 committed Jun 3, 2014
1 parent 50d99b0 commit 87da883
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 30 deletions.
56 changes: 40 additions & 16 deletions src/include/fcoe-client/complex.rb
Expand Up @@ -42,6 +42,14 @@ def initialize_fcoe_client_complex(include_target)

Yast.include include_target, "fcoe-client/helps.rb"
Yast.include include_target, "fcoe-client/dialogs.rb"

@yes_no_mapping = {
# setting of config value is 'yes'
"yes" => _("yes"),
# setting of config value is 'no'
"no" => _("no"),
nil => ""
}
end

# Show a popup on abort if data are modified and
Expand Down Expand Up @@ -182,6 +190,22 @@ def ShowInterfaces

table_items = []

fcoe_vlan_mapping = {
# FCoE is not available on the interface
@NOT_AVAILABLE => _("not available"),
# the interface is not configured for FCoE
@NOT_CONFIGURED => _("not configured"),
nil => ""
}

flags_mapping = {
# the flag is 'true'
true => _("true"),
# the flag is 'false'
false => _("false"),
# the flag is not set at all
nil => _("not set")
}
Builtins.foreach(netcards) do |card|
table_items = Builtins.add(
table_items,
Expand All @@ -190,16 +214,16 @@ def ShowInterfaces
card["dev_name"] || "",
card["mac_addr"] || "",
card["device"] || "",
card["vlan_interface"] ||"",
card["fcoe_vlan"] || "",
card["fcoe_enable"] || "",
card["dcb_required"] || "",
card["auto_vlan"] || "",
card["dcb_capable"] || "",
card["vlan_interface"] || "",
fcoe_vlan_mapping[card["fcoe_vlan"]] || card["fcoe_vlan"],
@yes_no_mapping[card["fcoe_enable"]],
@yes_no_mapping[card["dcb_required"]],
@yes_no_mapping[card["auto_vlan"]],
@yes_no_mapping[card["dcb_capable"]],
card["driver"] || "",
card["fcoe_flag"] || "",
card["iscsi_flag"] || "",
card["storage_only"] || ""
flags_mapping[card["fcoe_flag"]],
flags_mapping[card["iscsi_flag"]],
flags_mapping[card["storage_only"]]
)
)
row = Ops.add(row, 1)
Expand Down Expand Up @@ -537,17 +561,17 @@ def HandleInterfacesDialog(id, event)
UI.ChangeWidget(
Id(:interfaces),
Cell(FcoeClient.current_card, 5),
Ops.get_string(status_map, "FCOE_ENABLE", "")
@yes_no_mapping[status_map["FCOE_ENABLE"]]
)
UI.ChangeWidget(
Id(:interfaces),
Cell(FcoeClient.current_card, 6),
Ops.get_string(status_map, "DCB_REQUIRED", "")
@yes_no_mapping[status_map["DCB_REQUIRED"]]
)
UI.ChangeWidget(
Id(:interfaces),
Cell(FcoeClient.current_card, 7),
Ops.get_string(status_map, "AUTO_VLAN", "")
@yes_no_mapping[status_map["AUTO_VLAN"]]
)
AdjustButtons()
elsif action == :remove
Expand Down Expand Up @@ -702,22 +726,22 @@ def HandleInterfacesDialog(id, event)
UI.ChangeWidget(
Id(:interfaces),
Cell(FcoeClient.current_card, 4),
Ops.get_string(card, "fcoe_vlan", "")
card["fcoe_vlan"] || ""
)
UI.ChangeWidget(
Id(:interfaces),
Cell(FcoeClient.current_card, 5),
Ops.get_string(card, "fcoe_enable", "")
@yes_no_mapping[card["fcoe_enable"]]
)
UI.ChangeWidget(
Id(:interfaces),
Cell(FcoeClient.current_card, 6),
Ops.get_string(card, "dcb_required", "")
@yes_no_mapping[card["dcb_required"]]
)
UI.ChangeWidget(
Id(:interfaces),
Cell(FcoeClient.current_card, 7),
Ops.get_string(card, "auto_vlan", "")
@yes_no_mapping[card["auto_vlan"]]
)
AdjustButtons()
else
Expand Down
20 changes: 6 additions & 14 deletions src/modules/FcoeClient.rb
Expand Up @@ -1044,22 +1044,14 @@ def DetectNetworkCards(netcards)
dcb_capable = DCBCapable(device) # DCB capable
flags_map = {}

if card["fcoeoffload"] == nil
# it's about a flag which is not set at all
flags_map["fcoe_flag"] = _("not set")
else
# also about setting of a flag
flags_map["fcoe_flag"] = card["fcoeoffload"]?_("true"):_("false")
if card["fcoeoffload"] != nil
flags_map["fcoe_flag"] = card["fcoeoffload"]
end
if card["iscsioffload"] == nil
flags_map["iscsi_flag"] = _("not set")
else
flags_map["iscsi_flag"] = card["iscsioffload"]?_("true"):_("false")
if card["iscsioffload"] != nil
flags_map["fcoe_flag"] = card["fcoeoffload"]
end
if card["storageonly"] == nil
flags_map["storage_only"] = _("not set")
else
flags_map["storage_only"] = card["storageonly"]?_("true"):_("false")
if card["storageonly"] != nil
flags_map["storage_only"] = card["storageonly"]
end

if Ops.get(vlan_info, device, []).empty?
Expand Down

0 comments on commit 87da883

Please sign in to comment.