Skip to content

Commit

Permalink
Merge pull request #2 from teythoon/rename_conf_mode
Browse files Browse the repository at this point in the history
Rename 'conf_mode' to 'bootproto'.
  • Loading branch information
mvidner committed Sep 19, 2011
2 parents 51dfe40 + 7d23fcf commit 78fa758
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions plugins/network/app/controllers/network_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ def index

# FIXME tests for YSRB

@conf_mode = ifc.bootproto
@conf_mode = STATIC_BOOT_ID if @conf_mode.blank?
@bootproto = ifc.bootproto
@bootproto = STATIC_BOOT_ID if @bootproto.blank?

if @conf_mode == STATIC_BOOT_ID
if @bootproto == STATIC_BOOT_ID
ipaddr = ifc.ipaddr
else
ipaddr = "/"
Expand All @@ -120,8 +120,8 @@ def index
@nameservers = dns.nameservers
@searchdomains = dns.searches
@default_route = rt.via
@conf_modes = {_("Manual")=>STATIC_BOOT_ID, _("Automatic")=>"dhcp"}
@conf_modes[@conf_mode] =@conf_mode unless @conf_modes.has_value? @conf_mode
@bootprotos = {_("Manual")=>STATIC_BOOT_ID, _("Automatic")=>"dhcp"}
@bootprotos[@bootproto] =@bootproto unless @bootprotos.has_value? @bootproto
end


Expand Down Expand Up @@ -174,10 +174,10 @@ def update
ifc = Interface.find params["interface"]
return false unless ifc

dirty_ifc = true unless (ifc.bootproto == params["conf_mode"])
dirty_ifc = true unless (ifc.bootproto == params["bootproto"])
logger.info "dirty after interface config: #{dirty}"

ifc.bootproto=params["conf_mode"]
ifc.bootproto=params["bootproto"]

if ifc.bootproto==STATIC_BOOT_ID
#ip addr is returned in another state then given, but restart of static address is not problem
Expand Down
4 changes: 2 additions & 2 deletions plugins/network/app/views/network/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@
<div class="left">
<label class="plugin-icon-container"><img class="plugin-icon" src="/icons/network.png"></label>
<label class="plugin-name"><%=_("Network")%></label><span id="questionMark" style="margin:2px 15px; float:none;">?</span>
<%=text_field_tag :conf_mode, @conf_mode, :type=>"hidden", :disabled => write_disabled %>
<%=text_field_tag :bootproto, @bootproto, :type=>"hidden", :disabled => write_disabled %>
</div>

<div class="right" >
<span class="right" style="padding:2px; background:#fff; -moz-border-radius:2px; -webkit-border-radius:2px;">
<% if(@conf_mode != 'static') %>
<% if(@bootproto != 'static') %>
<button id="autoMode" class="active" value="dhcp"><%=_("Automatic")%></button>
<button id="manualMode" value="static"><%=_("Manual")%></button>
<% else %>
Expand Down
2 changes: 1 addition & 1 deletion plugins/network/test/functional/network_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_with_dhcp
end

def test_dhcp_without_change
put :update, { :interface => "eth2", :conf_mode => "dhcp", :default_route => "192.168.1.1", :nameservers => "192.168.1.2 192.168.1.42", :searchdomains => "labs.example.com example.com", :hostname => "arthur", :domain => "britons" }
put :update, { :interface => "eth2", :bootproto => "dhcp", :default_route => "192.168.1.1", :nameservers => "192.168.1.2 192.168.1.42", :searchdomains => "labs.example.com example.com", :hostname => "arthur", :domain => "britons" }
assert_response :redirect
assert_redirected_to :controller => "controlpanel", :action => "index"
end
Expand Down
6 changes: 3 additions & 3 deletions webclient/public/javascripts/webyast-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $(function(){
var $auto = $('#autoMode');
var $manual = $('#manualMode');

$("#conf_mode").val() == "dhcp"? enableAuto(): enableStatic();
$("#bootproto").val() == "dhcp"? enableAuto(): enableStatic();

function enableAuto() {
$('#dnsForm').find('div.auto').hide();
Expand All @@ -51,12 +51,12 @@ $(function(){
if($id.val() == "dhcp") {
$auto.addClass('active');
$manual.removeClass('active');
$('#conf_mode').val($auto.val());
$('#bootproto').val($auto.val());
enableAuto();
} else {
$manual.addClass('active');
$auto.removeClass('active');
$('#conf_mode').val($manual.val());
$('#bootproto').val($manual.val());
enableStatic()
}
}
Expand Down

0 comments on commit 78fa758

Please sign in to comment.