From 7d6b4393c366946cb989adc4e4949d89175942e9 Mon Sep 17 00:00:00 2001 From: zen Date: Sat, 27 Apr 2024 02:52:57 +0200 Subject: [PATCH] pass lang to host --- .../app/controllers/engine_controller.rb | 9 ++- .../app/controllers/hosts_controller.rb | 2 +- src/autogen/app/models/host.rb | 3 +- src/autogen/app/views/hosts/_form.html.erb | 56 +++++++++++++++---- 4 files changed, 53 insertions(+), 17 deletions(-) diff --git a/src/autogen/app/controllers/engine_controller.rb b/src/autogen/app/controllers/engine_controller.rb index 351fc81..097a6b4 100644 --- a/src/autogen/app/controllers/engine_controller.rb +++ b/src/autogen/app/controllers/engine_controller.rb @@ -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 diff --git a/src/autogen/app/controllers/hosts_controller.rb b/src/autogen/app/controllers/hosts_controller.rb index 3c87804..5cbae86 100644 --- a/src/autogen/app/controllers/hosts_controller.rb +++ b/src/autogen/app/controllers/hosts_controller.rb @@ -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 diff --git a/src/autogen/app/models/host.rb b/src/autogen/app/models/host.rb index 872198b..06453a7 100644 --- a/src/autogen/app/models/host.rb +++ b/src/autogen/app/models/host.rb @@ -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 diff --git a/src/autogen/app/views/hosts/_form.html.erb b/src/autogen/app/views/hosts/_form.html.erb index 4fee4a5..414e198 100644 --- a/src/autogen/app/views/hosts/_form.html.erb +++ b/src/autogen/app/views/hosts/_form.html.erb @@ -21,8 +21,9 @@
- <%= form.text_field :uuid , { class: "input"} %> + <%= form.text_field :uuid , { class: "input", disabled: true } %>
+

Uniq Identifier Refered by @host.uuid in script

@@ -36,6 +37,8 @@
<%= form.text_field :product , { class: "input" , disabled: true } %>
+

Bios product info, Refered by @host.product in script

+ @@ -49,6 +52,7 @@
<%= form.text_field :serial , { class: "input" , disabled: true } %>
+

Bios serial info, Refered by @host.serial in script

@@ -62,6 +66,8 @@
<%= form.text_field :hostname , { class: "input"} %>
+

hostname, Refered by @host.hostname in script

+ @@ -76,6 +82,7 @@
<%= form.text_field :ip , { class: "input"} %>
+

ip of host, Refered by @host.ip in script

@@ -90,6 +97,7 @@
<%= form.text_field :access_ip , { class: "input" , disabled: true } %>
+

Last detected ip of host, Refered by @host.access_ip in script

@@ -103,6 +111,7 @@
<%= form.text_field :install_ip , { class: "input"} %>
+

Ip during install of host, Refered by @host.install_ip in script

@@ -116,6 +125,7 @@
<%= form.text_field :status , { class: "input"} %>
+

Host status, Refered by @host.status in script

@@ -129,6 +139,7 @@
<%= form.text_field :mac , { class: "input"} %>
+

MAc Adress, Refered by @host.mac in script

@@ -141,6 +152,7 @@
<%= form.text_field :host_device , { class: "input"} %>
+

Default host disk, Refered by @host.host_device in script

@@ -148,14 +160,20 @@
<%= form.label :lusk_encrypt, class: "checkbox" %> <%= form.check_box :lusk_encrypt %> +

Active Lusk encryption, Refered by @host.lusk_encrypt in script

+
<%= form.label :lusk_device, class: "label is-small" %> <%= form.text_field :lusk_device , { class: "input"} %> +

Partition to encrypt, Refered by @host.lusk_device in script

+
<%= form.label :lusk_key, class: "label is-small" %> <%= form.text_field :lusk_key , { class: "input"} %> +

Lusk encrypt key, Refered by @host.lusk_key in script

+
@@ -168,6 +186,8 @@
<%= form.text_field :interface , { class: "input"} %>
+

Host interface name, Refered by @host.interface in script

+ @@ -181,20 +201,27 @@
<%= collection_select(:host, :installtemplate_id, Installtemplate.all, :_id, :name) %>
+

Template to install, Refered by @host.installtemplate in script

-
-
- -
-
-
-
- <%= collection_select(:host, :site_id, Site.all, :_id, :name) %> -
+
+
+ <%= form.label :site, class: "label is-small" %> +
+ <%= collection_select(:host, :site_id, Site.all, :_id, :name, class: "select,is-primary") %>
+

Host location, Refered by @host.site in script

+
+ +
+ <%= form.label :lang, class: "label is-small" %> +
+ <%= form.select(:lang, ['fr', 'en'], {:selected => @host.lang }, {:class=>'select,is-primary'}) %> + +
+

Install Langage, Refered by @host.lang in script

@@ -204,16 +231,21 @@
<%= form.collection_select :rootaccount_id, Account.all, :id, :name %>
+

Root account , Refered by @host.rootaccount in script

-
<%= form.label :mainaccount, class: "label is-small" %>
<%= form.collection_select :mainaccount_id, Account.all, :id, :name %>
+

Main user account , Refered by @host.mainaccount in script

+
+ + +
<%= form.label :discover, class: "checkbox" %> <%= form.check_box :discover %> @@ -227,10 +259,10 @@ <%= form.check_box :toinstall %>
+
<%= link_to "Return", "/hosts", class: "button is-success" %> -
<% end %> <%= button_to " Destroy ", @host, method: :delete, class: "button is-danger" %>