Skip to content

Commit

Permalink
Adjust linkmode codes
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxin1300 committed Jul 6, 2023
1 parent 2d1a537 commit 07ae8ed
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/include/cluster/dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,12 @@ def CommunicationLayout
UI.ChangeWidget(Id(:transport), :Value, Cluster.transport)
UI.ChangeWidget(Id(:ip_version), :Value, Cluster.ip_version)

UI.ChangeWidget(Id(:linkmode), :Value, Cluster.link_mode)
if Cluster.firstrun
UI.ChangeWidget(Id(:linkmode), :Value, "passive")
UI.ChangeWidget(Id(:linkmode), :Enabled, false)
else
UI.ChangeWidget(Id(:linkmode), :Value, Cluster.link_mode)
end

nil
end
Expand Down Expand Up @@ -1032,13 +1037,6 @@ def fill_nodelist_entries
end

def switch_totem_button(transport)
if transport == "knet"
UI.ChangeWidget(Id(:linkmode), :Enabled, true)
else
UI.ChangeWidget(Id(:linkmode), :Value, "passive")
UI.ChangeWidget(Id(:linkmode), :Enabled, false)
end

# For UDPU an interface section is not needed
if transport == "udpu"
UI.ChangeWidget(Id(:ifacelist), :Enabled, false)
Expand All @@ -1055,6 +1053,19 @@ def switch_totem_button(transport)
nil
end

def switch_linkmode_button
if Cluster.node_list.size > 0
ringnum = Cluster.node_list[0]["IPs"].size
if ringnum > 1 && Cluster.transport == "knet"
UI.ChangeWidget(Id(:linkmode), :Enabled, true)
else
UI.ChangeWidget(Id(:linkmode), :Enabled, false)
end
else
UI.ChangeWidget(Id(:linkmode), :Enabled, false)
end
end

def CommunicationDialog
ret = nil

Expand All @@ -1066,6 +1077,7 @@ def CommunicationDialog
fill_nodelist_entries()
fill_interface_entries()
switch_totem_button(UI.QueryWidget(Id(:transport), :Value))
switch_linkmode_button()
switch_nodelist_button(Cluster.node_list)
switch_interface_list_button(Cluster.interface_list)

Expand Down

0 comments on commit 07ae8ed

Please sign in to comment.