pass lang to host

main
zen 2024-04-27 02:52:57 +02:00
parent b5c594aac0
commit 7d6b4393c3
4 changed files with 53 additions and 17 deletions

View File

@ -126,15 +126,18 @@ class EngineController < ApplicationController
@host.save!
end
end
# Only allow a list of trusted parameters through.
# Only allow a list of trusted parameters through.
def host_params
params.require(:host).permit(:uuid, :hostname, :ip, :status, :mac, :discover, :installed, :interface , :installtemplate, :site , :installtemplate_id, :site_id, :rootaccount_id, :mainaccount_id,:toinstall, :install_ip, :filename, :access_ip, :product, :serial,:p,:s)
end
def get_uri(site)
result=""
if site.api_url.empty?
return "http://#{site.api_ip}:#{site.api_port}"
result="http://#{site.api_ip}:#{site.api_port}"
else
return site.api_url
result=site.api_url
end
return result
end
end

View File

@ -146,6 +146,6 @@ class HostsController < ApplicationController
# Only allow a list of trusted parameters through.
def host_params
params.require(:host).permit(:uuid, :hostname, :ip, :install_ip,:access_ip,:status, :mac, :discover, :installed, :interface , :installtemplate, :site , :installtemplate_id, :site_id, :rootaccount_id, :mainaccount_id,:toinstall, :lusk_key,:lusk_device, :lusk_encrypt, :host_device)
params.require(:host).permit(:uuid, :hostname, :ip, :install_ip,:access_ip,:status, :mac, :discover, :installed, :interface , :installtemplate, :site , :installtemplate_id, :site_id, :rootaccount_id, :mainaccount_id,:toinstall, :lusk_key,:lusk_device, :lusk_encrypt, :host_device,:lang)
end
end

View File

@ -20,7 +20,8 @@ class Host
field :lastpostinstallgenerated, type: String, default: ''
field :lusk_encrypt, type: Mongoid::Boolean, default: false
field :lusk_device, type: String, default: ''
field :lusk_key, type: String, default: 'a changer'
field :lusk_key, type: String, default: ''
field :lang , type: String, default: ''
belongs_to :installtemplate , class_name: "Installtemplate", inverse_of: :hostreferences
belongs_to :site , class_name: "Site", inverse_of: :sitereferences
belongs_to :rootaccount , class_name: "Account", inverse_of: :rootref

View File

@ -21,8 +21,9 @@
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :uuid , { class: "input"} %>
<%= form.text_field :uuid , { class: "input", disabled: true } %>
</div>
<p class="help">Uniq Identifier Refered by @host.uuid in script</p>
</div>
</div>
</div>
@ -36,6 +37,8 @@
<div class="control">
<%= form.text_field :product , { class: "input" , disabled: true } %>
</div>
<p class="help">Bios product info, Refered by @host.product in script</p>
</div>
</div>
</div>
@ -49,6 +52,7 @@
<div class="control">
<%= form.text_field :serial , { class: "input" , disabled: true } %>
</div>
<p class="help">Bios serial info, Refered by @host.serial in script</p>
</div>
</div>
</div>
@ -62,6 +66,8 @@
<div class="control">
<%= form.text_field :hostname , { class: "input"} %>
</div>
<p class="help">hostname, Refered by @host.hostname in script</p>
</div>
</div>
</div>
@ -76,6 +82,7 @@
<div class="control">
<%= form.text_field :ip , { class: "input"} %>
</div>
<p class="help">ip of host, Refered by @host.ip in script</p>
</div>
</div>
</div>
@ -90,6 +97,7 @@
<div class="control">
<%= form.text_field :access_ip , { class: "input" , disabled: true } %>
</div>
<p class="help">Last detected ip of host, Refered by @host.access_ip in script</p>
</div>
</div>
</div>
@ -103,6 +111,7 @@
<div class="control">
<%= form.text_field :install_ip , { class: "input"} %>
</div>
<p class="help">Ip during install of host, Refered by @host.install_ip in script</p>
</div>
</div>
</div>
@ -116,6 +125,7 @@
<div class="control">
<%= form.text_field :status , { class: "input"} %>
</div>
<p class="help">Host status, Refered by @host.status in script</p>
</div>
</div>
</div>
@ -129,6 +139,7 @@
<div class="control">
<%= form.text_field :mac , { class: "input"} %>
</div>
<p class="help">MAc Adress, Refered by @host.mac in script</p>
</div>
</div>
</div>
@ -141,6 +152,7 @@
<div class="control">
<%= form.text_field :host_device , { class: "input"} %>
</div>
<p class="help">Default host disk, Refered by @host.host_device in script</p>
</div>
</div>
</div>
@ -148,14 +160,20 @@
<div class="control">
<%= form.label :lusk_encrypt, class: "checkbox" %>
<%= form.check_box :lusk_encrypt %>
<p class="help">Active Lusk encryption, Refered by @host.lusk_encrypt in script</p>
</div>
<div class="control">
<%= form.label :lusk_device, class: "label is-small" %>
<%= form.text_field :lusk_device , { class: "input"} %>
<p class="help">Partition to encrypt, Refered by @host.lusk_device in script</p>
</div>
<div class="control">
<%= form.label :lusk_key, class: "label is-small" %>
<%= form.text_field :lusk_key , { class: "input"} %>
<p class="help">Lusk encrypt key, Refered by @host.lusk_key in script</p>
</div>
</div>
@ -168,6 +186,8 @@
<div class="control">
<%= form.text_field :interface , { class: "input"} %>
</div>
<p class="help">Host interface name, Refered by @host.interface in script</p>
</div>
</div>
</div>
@ -181,20 +201,27 @@
<div class="select">
<%= collection_select(:host, :installtemplate_id, Installtemplate.all, :_id, :name) %>
</div>
<p class="help">Template to install, Refered by @host.installtemplate in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Site</label>
</div>
<div class="field-body">
<div class="field">
<div class="select">
<%= collection_select(:host, :site_id, Site.all, :_id, :name) %>
</div>
<div class="field is-grouped">
<div class="control">
<%= form.label :site, class: "label is-small" %>
<div class="select is-primary">
<%= collection_select(:host, :site_id, Site.all, :_id, :name, class: "select,is-primary") %>
</div>
<p class="help">Host location, Refered by @host.site in script</p>
</div>
<div class="control">
<%= form.label :lang, class: "label is-small" %>
<div class="select is-primary">
<%= form.select(:lang, ['fr', 'en'], {:selected => @host.lang }, {:class=>'select,is-primary'}) %>
</div>
<p class="help">Install Langage, Refered by @host.lang in script</p>
</div>
</div>
@ -204,16 +231,21 @@
<div class="select is-primary">
<%= form.collection_select :rootaccount_id, Account.all, :id, :name %>
</div>
<p class="help">Root account , Refered by @host.rootaccount in script</p>
</div>
<div class="control">
<%= form.label :mainaccount, class: "label is-small" %>
<div class="select is-primary">
<%= form.collection_select :mainaccount_id, Account.all, :id, :name %>
</div>
<p class="help">Main user account , Refered by @host.mainaccount in script</p>
</div>
</div>
<div class="field is-grouped">
<div class="control">
<%= form.label :discover, class: "checkbox" %>
<%= form.check_box :discover %>
@ -227,10 +259,10 @@
<%= form.check_box :toinstall %>
</div>
</div>
<div class="control">
<button class="button is-link">Submit</button>
<%= link_to "Return", "/hosts", class: "button is-success" %>
</div>
<% end %>
<%= button_to " Destroy ", @host, method: :delete, class: "button is-danger" %>