save before devise update

main
zen 2024-05-05 08:20:13 +02:00
parent dd079ec88f
commit e11a37a8c2
40 changed files with 762 additions and 574 deletions

View File

@ -1 +1 @@
ruby-3.3.0
ruby-3.3.1

View File

@ -1,7 +1,7 @@
# syntax = docker/dockerfile:1
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.0
ARG RUBY_VERSION=3.3.1
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
# Rails app lives here
@ -22,8 +22,8 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential curl git node-gyp pkg-config python-is-python3
# Install JavaScript dependencies
ARG NODE_VERSION=21.6.1
ARG YARN_VERSION=1.22.21
ARG NODE_VERSION=22.0.0
ARG YARN_VERSION=1.22.22
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
@ -36,9 +36,7 @@ RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile
# Install node modules
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Copy application code
COPY . .
@ -46,8 +44,6 @@ COPY . .
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
# Final stage for app image
@ -72,4 +68,4 @@ ENTRYPOINT ["/rails/bin/docker-entrypoint"]
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]
CMD ["./bin/rails", "server" , "-b","0.0.0.0"]

View File

@ -1,35 +1,35 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.3)
actionpack (= 7.1.3)
activesupport (= 7.1.3)
actioncable (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.3)
actionpack (= 7.1.3)
activejob (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
actionmailbox (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3)
actionpack (= 7.1.3)
actionview (= 7.1.3)
activejob (= 7.1.3)
activesupport (= 7.1.3)
actionmailer (7.1.3.2)
actionpack (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activesupport (= 7.1.3.2)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.3)
actionview (= 7.1.3)
activesupport (= 7.1.3)
actionpack (7.1.3.2)
actionview (= 7.1.3.2)
activesupport (= 7.1.3.2)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
@ -37,35 +37,35 @@ GEM
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3)
actionpack (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
actiontext (7.1.3.2)
actionpack (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3)
activesupport (= 7.1.3)
actionview (7.1.3.2)
activesupport (= 7.1.3.2)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.3)
activesupport (= 7.1.3)
activejob (7.1.3.2)
activesupport (= 7.1.3.2)
globalid (>= 0.3.6)
activemodel (7.1.3)
activesupport (= 7.1.3)
activerecord (7.1.3)
activemodel (= 7.1.3)
activesupport (= 7.1.3)
activemodel (7.1.3.2)
activesupport (= 7.1.3.2)
activerecord (7.1.3.2)
activemodel (= 7.1.3.2)
activesupport (= 7.1.3.2)
timeout (>= 0.4.0)
activestorage (7.1.3)
actionpack (= 7.1.3)
activejob (= 7.1.3)
activerecord (= 7.1.3)
activesupport (= 7.1.3)
activestorage (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activesupport (= 7.1.3.2)
marcel (~> 1.0)
activesupport (7.1.3)
activesupport (7.1.3.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
@ -79,11 +79,11 @@ GEM
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
bcrypt (3.1.20)
bigdecimal (3.1.6)
bigdecimal (3.1.7)
bindex (0.8.1)
bootsnap (1.18.3)
msgpack (~> 1.2)
bson (4.15.0)
bson (5.0.0)
builder (3.2.4)
bulma-rails (0.9.4)
sassc (~> 2.0)
@ -102,32 +102,31 @@ GEM
cssbundling-rails (1.4.0)
railties (>= 6.0.0)
date (3.3.4)
debug (1.9.1)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
devise (4.9.3)
devise (4.9.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
drb (2.2.0)
ruby2_keywords
drb (2.2.1)
erubi (1.12.0)
ffi (1.16.3)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.7.2)
irb (1.11.2)
rdoc
irb (1.13.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jbuilder (2.11.5)
jbuilder (2.12.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jquery-rails (4.6.0)
@ -142,13 +141,13 @@ GEM
net-imap
net-pop
net-smtp
marcel (1.0.2)
marcel (1.0.4)
matrix (0.4.2)
mini_mime (1.1.5)
minitest (5.22.2)
mongo (2.19.3)
bson (>= 4.14.1, < 5.0.0)
mongoid (8.1.4)
minitest (5.22.3)
mongo (2.20.0)
bson (>= 4.14.1, < 6.0.0)
mongoid (8.1.5)
activemodel (>= 5.1, < 7.2, != 7.0.0)
concurrent-ruby (>= 1.0.5, < 2.0)
mongo (>= 2.18.0, < 3.0.0)
@ -162,29 +161,29 @@ GEM
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-smtp (0.5.0)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.2-aarch64-linux)
nio4r (2.7.1)
nokogiri (1.16.4-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.2-arm-linux)
nokogiri (1.16.4-arm-linux)
racc (~> 1.4)
nokogiri (1.16.2-arm64-darwin)
nokogiri (1.16.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86-linux)
nokogiri (1.16.4-x86-linux)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-darwin)
nokogiri (1.16.4-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-linux)
nokogiri (1.16.4-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
psych (5.1.2)
stringio
public_suffix (5.0.4)
public_suffix (5.0.5)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (3.0.9)
rack (3.0.10)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
@ -192,20 +191,20 @@ GEM
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.3)
actioncable (= 7.1.3)
actionmailbox (= 7.1.3)
actionmailer (= 7.1.3)
actionpack (= 7.1.3)
actiontext (= 7.1.3)
actionview (= 7.1.3)
activejob (= 7.1.3)
activemodel (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
rails (7.1.3.2)
actioncable (= 7.1.3.2)
actionmailbox (= 7.1.3.2)
actionmailer (= 7.1.3.2)
actionpack (= 7.1.3.2)
actiontext (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activemodel (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
bundler (>= 1.15.0)
railties (= 7.1.3)
railties (= 7.1.3.2)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
@ -213,19 +212,19 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.3)
actionpack (= 7.1.3)
activesupport (= 7.1.3)
railties (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.1.0)
rdoc (6.6.2)
rake (13.2.1)
rdoc (6.6.3.1)
psych (>= 4.0.0)
regexp_parser (2.9.0)
reline (0.4.2)
reline (0.5.4)
io-console (~> 0.5)
responders (3.1.1)
actionpack (>= 5.2)
@ -236,7 +235,7 @@ GEM
sassc (2.4.0)
ffi (~> 1.9)
securerandom (0.3.1)
selenium-webdriver (4.17.0)
selenium-webdriver (4.20.1)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
@ -251,9 +250,9 @@ GEM
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.0)
thor (1.3.0)
thor (1.3.1)
timeout (0.4.1)
turbo-rails (2.0.2)
turbo-rails (2.0.5)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
@ -308,4 +307,4 @@ RUBY VERSION
ruby 3.3.0p0
BUNDLED WITH
2.5.3
2.5.9

View File

@ -41,7 +41,7 @@ class HostsController < ApplicationController
def update
puts host_params
respond_to do |format|
log=Log.new({source: "host", crit: "info",message: "User #{current_user.name}, Update #{host_params[:hostname]}"})
log=Log.new({source: "Host", crit: "info",message: "User #{current_user.name}, Update #{host_params[:hostname]}"})
log.save()
if @host.update(host_params)
format.html { redirect_to host_url(@host), notice: "Host was successfully updated." }
@ -56,7 +56,8 @@ class HostsController < ApplicationController
# DELETE /hosts/1 or /hosts/1.json
def destroy
@host.destroy!
log=Log.new({source: "Host", crit: "warning",message: "User #{current_user.name}, Delete #{host_params[:hostname]}"})
log.save()
respond_to do |format|
format.html { redirect_to hosts_url, notice: "Host was successfully destroyed." }
format.json { head :no_content }

View File

@ -67,7 +67,7 @@ class InstalltemplatesController < ApplicationController
# Only allow a list of trusted parameters through.
def installtemplate_params
params.require(:installtemplate).permit(:name, :ostype, :osversion, :repository, :nfsroot, :kernel, :initrd, :rootfile, :boot_id, :install_id, :postinstall_id, :lang)
params.require(:installtemplate).permit(:name, :ostype, :osversion, :repository, :nfsroot, :kernel, :initrd, :rootfile, :boot_id, :install_id, :postinstall_id)
end
def check_group
if current_user.group != "admin"

View File

@ -56,7 +56,7 @@ class ScriptsController < ApplicationController
# DELETE /scripts/1 or /scripts/1.json
def destroy
@script.destroy!
log=Log.new({source: "Script", crit: "warning",message: "User #{current_user.name}, Delete #{script_params[:stage]} Script #{script_params[:name]}"})
log=Log.new({source: "Script", crit: "warning",message: "User #{current_user.name}, Delete #{@script.stage} Script: #{@script.name}"})
log.save()
respond_to do |format|
format.html { redirect_to scripts_url, notice: "Script was successfully destroyed." }

View File

@ -0,0 +1,59 @@
class UsersController < ApplicationController
before_action :authenticate_user!
before_action :check_group
before_action :set_user, only: %i[ show edit update destroy ]
# GET /user or /user.json
def index
@users = User.all
end
# GET /user/1 or /user/1.json
def show
end
# GET /user/1/edit
def edit
end
# PATCH/PUT /user/1 or /user/1.json
def update
respond_to do |format|
logger.debug(account_params)
if @user.update()
format.html { redirect_to account_url(@user), notice: "User was successfully updated." }
format.json { render :show, status: :ok, location: @user }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
# DELETE /user/1 or /user/1.json
def destroy
@user.destroy!
respond_to do |format|
format.html { redirect_to user_url, notice: "Account was successfully destroyed." }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_user
@user = Account.find(params[:id])
end
# Only allow a list of trusted parameters through.
def user_params
params.require(:user).permit(:name, :group)
end
def check_group
if current_user.group != "admin"
redirect_back_or_to("/")
end
end
end

View File

@ -9,7 +9,6 @@ class Installtemplate
field :kernel, type: String
field :initrd, type: String
field :rootfile, type: String
field :lang, type: String
has_many :hostreferences, class_name: "Host", inverse_of: :installtemplate
belongs_to :boot , class_name: "Script", inverse_of: :bootref
belongs_to :install , class_name: "Script", inverse_of: :installref

View File

@ -8,7 +8,6 @@ class User
## Database authenticatable
field :email, type: String, default: ""
field :encrypted_password, type: String, default: ""
field :name, type: String, default: ""
## Recoverable
field :reset_password_token, type: String
@ -35,5 +34,7 @@ class User
# field :unlock_token, type: String # Only if unlock strategy is :email or :both
# field :locked_at, type: Time
field :group, type: String, default: ""
field :name, type: String, default: ""
include Mongoid::Timestamps
end

View File

@ -1,273 +1,229 @@
<div class="columns">
<div class="column">
<div class="box">
<%= form_with(model: host) do |form| %>
<% if host.errors.any? %>
<div style="color: red">
<h2><%= pluralize(host.errors.count, "error") %> prohibited this host from being saved:</h2>
<ul>
<% host.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">UUID</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :uuid , { class: "input", disabled: true } %>
</div>
<p class="help">Uniq Identifier Refered by @host.uuid in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">product</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">serial</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Hostname</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :hostname , { class: "input"} %>
</div>
<p class="help">hostname, Refered by @host.hostname in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">ip</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Access ip</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">install_ip</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :install_ip , { class: "input", disabled: true } %>
</div>
<p class="help">Ip during install of host, Refered by @host.install_ip in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Status</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :status , { class: "input" , disabled: true } %>
</div>
<p class="help">Host status, Refered by @host.status in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">MAC Address</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :mac , { class: "input", disabled: true } %>
</div>
<p class="help">MAc Adress, Refered by @host.mac in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">host_device</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-grouped">
<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", disabled: true } %>
<p class="help">Lusk encrypt key, Refered by @host.lusk_key in script</p>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Interface</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Template</label>
</div>
<div class="field-body">
<div class="field">
<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-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>
<div class="field is-grouped">
<div class="control">
<%= form.label :rootaccount, class: "label is-small" %>
<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 %>
</div>
<div class="control">
<%= form.label :installed, class: "checkbox" %>
<%= form.check_box :installed %>
</div>
<div class="control">
<%= form.label :toinstall, class: "checkbox" %>
<%= form.check_box :toinstall %>
</div>
</div>
<%= form_with(model: host) do |form| %>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">UUID</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<button class="button is-link">Submit</button>
<%= link_to "Return", "/hosts", class: "button is-success" %>
<%= form.text_field :uuid , { class: "input", disabled: true } %>
</div>
<% end %>
<%= button_to " Destroy ", @host, method: :delete, class: "button is-danger" %>
<p class="help">Uniq Identifier Refered by @host.uuid in script</p>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">product</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">serial</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Hostname</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :hostname , { class: "input"} %>
</div>
<p class="help">hostname, Refered by @host.hostname in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">ip</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Access ip</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">install_ip</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :install_ip , { class: "input", disabled: true } %>
</div>
<p class="help">Ip during install of host, Refered by @host.install_ip in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Status</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :status , { class: "input" , disabled: true } %>
</div>
<p class="help">Host status, Refered by @host.status in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">MAC Address</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :mac , { class: "input", disabled: true } %>
</div>
<p class="help">MAc Adress, Refered by @host.mac in script</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">host_device</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-grouped">
<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", disabled: true } %>
<p class="help">Lusk encrypt key, Refered by @host.lusk_key in script</p>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Interface</label>
</div>
<div class="field-body">
<div class="field">
<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>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Template</label>
</div>
<div class="field-body">
<div class="field">
<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-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>
<div class="field is-grouped">
<div class="control">
<%= form.label :rootaccount, class: "label is-small" %>
<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 %>
</div>
<div class="control">
<%= form.label :installed, class: "checkbox" %>
<%= form.check_box :installed %>
</div>
<div class="control">
<%= form.label :toinstall, class: "checkbox" %>
<%= 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 %>
<div>
<%= button_to "Edit Template", "/installtemplates/#{@host.installtemplate_id}/edit", method: :get, class: "button is-small is-primary", form: {target: '_blank'}%></tr>
</div>

View File

@ -1,21 +1,7 @@
<p style="color: green"><%= notice %></p>
<div class="columns">
<div class="column">
<div class="box">
<% if @host.errors.any? %>
<div style="color: red">
<h2><%= pluralize(@host.errors.count, "error") %> prohibited this host from being saved:</h2>
<ul>
<% @host.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div id="<%= dom_id @host %>">
<div id="<%= dom_id @host %>">
<p>
<strong>Hostname:</strong>
<%= @host.hostname %>

View File

@ -1,9 +1,6 @@
<section>
<p style="color: green"><%= notice %></p>
</section>
<section>
<%= render @host %>
</section>
<section>
<%= link_to "Back to hosts", "/hosts", class: "button is-success is-small is-pulled-left" %>
<%= link_to "Back to hosts", hosts_path, class: "button is-success is-small is-pulled-left" %>
</section>

View File

@ -96,13 +96,6 @@
</div>
<div class="field">
<%= form.label :lang, class: "label" %>
<div class="control">
<%= form.text_field :lang , { class: "input"} %>
</div>
</div>
<div class="control">
<button class="button is-link">Submit</button>
<%= link_to "Return", "/installtemplates", class: "button is-success" %>

View File

@ -1,69 +1,76 @@
<div id="<%= dom_id installtemplate %>">
<p>
<strong>Name:</strong>
<%= installtemplate.name %>
</p>
<div class="columns">
<div class="column">
<div id="<%= dom_id installtemplate %>">
<p>
<strong>Name:</strong>
<%= installtemplate.name %>
</p>
<p>
<strong>Ostype:</strong>
<%= installtemplate.ostype %>
</p>
<p>
<strong>Ostype:</strong>
<%= installtemplate.ostype %>
</p>
<p>
<strong>Osversion:</strong>
<%= installtemplate.osversion %>
</p>
<p>
<strong>Osversion:</strong>
<%= installtemplate.osversion %>
</p>
<p>
<strong>Repository:</strong>
<%= installtemplate.repository %>
</p>
<p>
<strong>Repository:</strong>
<%= installtemplate.repository %>
</p>
<p>
<strong>Nfsroot:</strong>
<%= installtemplate.nfsroot %>
</p>
<p>
<strong>Nfsroot:</strong>
<%= installtemplate.nfsroot %>
</p>
<p>
<strong>Kernel:</strong>
<%= installtemplate.kernel %>
</p>
<p>
<strong>Kernel:</strong>
<%= installtemplate.kernel %>
</p>
<p>
<strong>Initrd:</strong>
<%= installtemplate.initrd %>
</p>
<p>
<strong>Initrd:</strong>
<%= installtemplate.initrd %>
</p>
<p>
<strong>Rootfile:</strong>
<%= installtemplate.rootfile %>
</p>
<p>
<strong>Rootfile:</strong>
<%= installtemplate.rootfile %>
</p>
<p>
<strong>Boot Script</strong>
<% if defined?installtemplate.boot.name %>
<%= installtemplate.boot.name %>
<% else %>
not set
<% end %>
</p>
<p>
<strong>Boot Script</strong>
<% if defined?installtemplate.boot.name %>
<%= installtemplate.boot.name %>
<% else %>
not set
<% end %>
</p>
<p>
<strong>Install</strong>
<% if defined?installtemplate.install.name %>
<%= installtemplate.install.name %>
<% else %>
not set
<% end %>
</p>
<p>
<strong>Install</strong>
<% if defined?installtemplate.install.name %>
<%= installtemplate.install.name %>
<% else %>
not set
<% end %>
</p>
<p>
<strong>PostInstall</strong>
<% if defined?installtemplate.boot.name %>
<%= installtemplate.boot.name %>
<% else %>
not set
<% end %>
</p>
<p>
<strong>PostInstall</strong>
<% if defined?installtemplate.postinstall.name %>
<%= installtemplate.postinstall.name %>
<% else %>
not set
<% end %>
</p>
</div>
<div class="buttons has-addons">
<%= button_to "Edit",edit_installtemplate_path(installtemplate), method: :get, class: "button is-small is-primary", form: {target: '_blank'}%></tr>
</div>
</div>
</div>

View File

@ -1,4 +1,13 @@
<tr>
<td><%= installtemplate.name %></td>
<td> <%= button_to "Edit", edit_installtemplate_path(installtemplate), method: :get, class: "button is-small is-primary" %></tr>
<td><%= installtemplate.name %></td>
<td><%= installtemplate.boot.name %></td>
<td><%= installtemplate.install.name %></td>
<td><%= installtemplate.postinstall.name %></td>
<td>
<div class="buttons has-addons">
<%= button_to "View",installtemplate_path(installtemplate), method: :get, class: "button is-small is-success"%>
<%= button_to "Edit", edit_installtemplate_path(installtemplate), method: :get, class: "button is-small is-primary" %>
<%= button_to "Delete",installtemplate_path(installtemplate), method: :delete, class: "button is-small is-danger" %>
</div>
</td>
</tr>

View File

@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<h1 class="title">Templates</h1>
<%= button_to "New Template", new_installtemplate_path, method: :get, class: "button is-small is-primary" %></tr>
<div class="box">
@ -7,6 +5,9 @@
<thead>
<tr>
<th colspan="1">Name</th>
<th colspan="1">Boot</th>
<th colspan="1">Install</th>
<th colspan="1">Postinstall</th>
<th colspan="1"></th>
</tr>
</thead>
@ -17,5 +18,3 @@
</tbody>
</table>
</div>

View File

@ -1,10 +1,6 @@
<p style="color: green"><%= notice %></p>
<section>
<%= render @installtemplate %>
<div>
<%= link_to "Edit this installtemplate", edit_installtemplate_path(@installtemplate) %> |
<%= link_to "Back to installtemplates", installtemplates_path %>
<%= button_to "Destroy this installtemplate", @installtemplate, method: :delete %>
</div>
</section>
<section>
<%= link_to "Back to Template", "/installtemplates", class: "button is-success is-small is-pulled-left" %>
</section>

View File

@ -1,7 +1,28 @@
<div class="container is-widescreen">
<div class="notification is-primary">
<h1>Home#index</h1>
<h1>Status</h1>
</div>
<p>Find me in app/views/pages/index.html.erb</p>
</div>
<div>
<div class="columns">
<div class="column"><%= link_to "Templates" , installtemplates_path, class: "button is-success is-small is-pulled-left" %></div>
<div class="column"><%= Installtemplate.count %></div>
</div>
<div class="columns">
<div class="column"><%= link_to "Scripts" , scripts_path, class: "button is-success is-small is-pulled-left" %></div>
<div class="column"><%= Script.count %></div>
</div>
<div class="columns">
<div class="column"><%= link_to "Sites" , sites_path, class: "button is-success is-small is-pulled-left" %></div>
<div class="column"><%= Site.count %></div>
</div>
<div class="columns">
<div class="column"><%= link_to "Hosts" , hosts_path, class: "button is-success is-small is-pulled-left" %></div>
<div class="column"><%= Host.count %></div>
</div>
<div class="columns">
<div class="column"><%= link_to "Accounts" , accounts_path, class: "button is-success is-small is-pulled-left" %></div>
<div class="column"><%= Account.count %></div>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://wiki.zen6.info/fr/documentation/ZenInstall">
<a class="navbar-item" href="/">
<%= image_tag "installerlogo.png", size: '112x28' %>
</a>
@ -43,17 +43,19 @@
</div>
</div>
</div>
<% if user_signed_in? %>
<div class="navbar-item">
<span class="tag is-info is-medium">Connected as <%= current_user.name %></span>
</div>
<% end %>
<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<% if !user_signed_in? %>
>
<%= link_to "Login", new_user_session_path, class: "button is-light" %>
<% else %>
<h1>Bonjour <%= current_user.name %></h2>
<%= link_to "Profil", edit_user_registration_path, class: "button is-light" %>
<%= button_to "Logout", destroy_user_session_path, method: :delete, class: "button is-light" %>
<%= link_to "Profil", edit_user_registration_path, class: "button is-info" %>
<%= button_to "Logout", destroy_user_session_path, method: :delete, class: "button is-info" %>
<% end %>
</div>
</div>

View File

@ -29,7 +29,7 @@
</div>
<p class="help">Stage of script [boot,install,postinstall, ressources](@script.stage )</p>
</div>ma
</div>
<div class="field">
<label class="label">Lang</label>
@ -74,4 +74,3 @@
</div>
<% end %>
</div>
<%= button_to "Delete", script_path( @script), method: :delete, class: "button is-small is-danger" %>

View File

@ -1,32 +1,33 @@
<div id="<%= dom_id script %>">
<p>
<strong>Name:</strong>
<%= script.name %>
</p>
<p>
<strong>Stage:</strong>
<%= script.stage %>
</p>
<p>
<strong>Lang:</strong>
<%= script.lang %>
</p>
<p>
<strong>Content:</strong>
<%= script.content %>
</p>
<p>
<strong>Lock:</strong>
<%= script.lock %>
</p>
<p>
<strong>Description:</strong>
<%= script.description %>
</p>
<p style="color: green"><%= notice %></p>
<div class="columns">
<div class="column">
<div id="<%= dom_id @script %>">
<p>
<strong>Name:</strong>
<%= @script.name %>
</p>
<p>
<strong>Stage:</strong>
<%= @script.stage %>
</p>
<p>
<strong>Lang:</strong>
<%= @script.lang %>
</p>
<p>
<strong>Content:</strong>
<textarea class="textarea readonly" name="script[content]" id="script_content" rows="10"><%= script.content %></textarea>
</p>
<p>
<strong>Lock:</strong>
<%= @script.lock %>
</p>
<p>
<strong>Description:</strong>
<textarea class="textarea readonly" name="script[description]" id="script_description" rows="5"><%= script.description %></textarea>
</p>
</div>
</div>
</div>
</div>

View File

@ -2,6 +2,13 @@
<td><%= script.name %></td>
<td><%= script.stage %></td>
<td><%= script.lang %></td>
<td> <%= button_to "Edit", edit_script_path(script), method: :get, class: "button is-small is-primary" %>
<td>
<div class="buttons has-addons">
<%= button_to "View", script_path(script), method: :get, class: "button is-small is-success"%>
<%= button_to "Edit", edit_script_path(script), method: :get, class: "button is-small is-primary" %>
<% if ! script.lock %>
<%= button_to "Delete", script_path(script), method: :delete, class: "button is-small is-danger" %>
<% end %>
</div>
</td>
</tr>

View File

@ -6,10 +6,10 @@
<table id="scripts" class="table">
<thead>
<tr>
<th colspan="1">Name</th>
<th colspan="1">Stage</th>
<th colspan="1">Lang</th>
<th colspan="1"></th>
<th colspan="1">Name</th>
<th colspan="1">Stage</th>
<th colspan="1">Lang</th>
<th colspan="1">Action</th>
</tr>
</thead>
<tbody>
@ -19,5 +19,3 @@
</tbody>
</table>
</div>

View File

@ -1,10 +1,11 @@
<p style="color: green"><%= notice %></p>
<section>
<p style="color: green"><%= notice %></p>
</section>
<section>
<%= render @script %>
</section>
<section>
<%= link_to "Back to scripts", "/scripts", class: "button is-success is-small is-pulled-left" %>
<%= button_to "Edit", edit_script_path(@script), method: :get, class: "button is-small is-primary" %>
<%= render @script %>
<div>
<%= link_to "Edit this script", edit_script_path(@script) %> |
<%= link_to "Back to scripts", scripts_path %>
<%= button_to "Destroy this script", @script, method: :delete %>
</div>
</section>

View File

@ -138,7 +138,7 @@
</div>
<div class="control">
<button class="button is-link">Submit In</button>
<button class="button is-link">Submit</button>
<%= link_to "Return to Site index", "/sites", class: "button is-success" %>
</div>
<% end %>

View File

@ -1,37 +1,77 @@
<div id="<%= dom_id site %>">
<p>
<strong>Name:</strong>
<%= site.name %>
</p>
<div class="columns">
<div class="column">
<div id="<%= dom_id site %>">
<p>
<strong>Name</strong>
<%= site.name %>
</p>
<p>
<strong>Domain:</strong>
<%= site.domain %>
</p>
<p>
<strong>Domain</strong>
<%= site.domain %>
</p>
<p>
<strong>Gateway:</strong>
<%= site.gateway %>
</p>
<p>
<strong>Gateway</strong>
<%= site.gateway %>
</p>
<p>
<strong>Nameserver:</strong>
<%= site.nameserver %>
</p>
<p>
<strong>Nameserver</strong>
<%= site.nameserver %>
</p>
<p>
<strong>Network:</strong>
<%= site.network %>
</p>
<p>
<strong>Network</strong>
<%= site.network %>
</p>
<p>
<strong>Netmask:</strong>
<%= site.netmask %>
</p>
<p>
<strong>Netmask</strong>
<%= site.netmask %>
</p>
<p>
<strong>Server:</strong>
<%= site.api_ip %>:<%= site.api_ip %>:
</p>
<p>
<strong>Api IP</strong>
<%= site.api_ip %>
</p>
<p>
<strong>Api Port</strong>
<%= site.api_port %>
</p>
<p>
<strong>Api Url</strong>
<%= site.api_url %>
</p>
<p>
<strong>Fileserver Uri</strong>
<%= site.fileserver_uri %>
</p>
<p>
<strong>Fileserver Basepath</strong>
<%= site.fileserver_basepath %>
</p>
<p>
<strong>Fileserver Url:</strong>
<%= site.fileserver_url %>
</p>
<p>
<strong>Nfsserver path:</strong>
<%= site.nfsserver_path %>
</p>
<p>
<strong>Country:</strong>
<%= site.country %>
</p>
<p>
<strong>Timezone:</strong>
<%= site.timezone %>
</p>
</div>
</div>

View File

@ -1,5 +1,11 @@
<tr>
<td><%= site.name %></td>
<td><%= site.description %></td>
<td> <%= button_to "Edit", edit_site_path(site), method: :get, class: "button is-small is-primary" %></tr>
<td><%= site.name %></td>
<td><%= site.description %></td>
<td>
<div class="buttons has-addons">
<%= button_to "View", site_path(site), method: :get, class: "button is-small is-success"%>
<%= button_to "Edit", edit_site_path(site), method: :get, class: "button is-small is-primary" %>
<%= button_to "Delete", site_path(site), method: :delete, class: "button is-small is-danger" %>
</td>
</div>
</tr>

View File

@ -1,13 +1,12 @@
<p style="color: green"><%= notice %></p>
<h1 class="title">Sites</h1>
<%= button_to "New Site", new_site_path, method: :get, class: "button is-small is-primary" %></tr>
<div class="box">
<table id="sites" class="table">
<thead>
<tr>
<th colspan="1">Site Name</th>
<th colspan="1"></th>
<th colspan="1">Site Name</th>
<th colspan="1">Description</th>
<th colspan="1"></th>
</tr>
</thead>
<tbody>
@ -17,6 +16,3 @@
</tbody>
</table>
</div>

View File

@ -1,10 +1,6 @@
<p style="color: green"><%= notice %></p>
<section>
<%= render @site %>
<div>
<%= link_to "Edit this site", edit_site_path(@site) %> |
<%= link_to "Back to sites", sites_path %>
<%= button_to "Destroy this site", @site, method: :delete %>
</div>
</section>
<section>
<%= link_to "Back to sites", sites_path, class: "button is-success is-small is-pulled-left" %>
</section>

View File

@ -0,0 +1,53 @@
<div class="columns">
<div class="column">
<div class="box">
<%= form_with(model: user) do |form| %>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="name">Name</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :name , { class: "input" } %>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Email</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :email , { class: "input" } %>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Group</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :group , { class: "input" } %>
</div>
</div>
</div>
</div>
<div class="control">
<button class="button is-link">Submit</button>
<%= link_to "Return", "/users", class: "button is-success" %>
</div>
<% end %>
<%= button_to "Destroy", @user, method: :delete, class: "button is-danger" %>
</div>
</div>
</div>

View File

@ -0,0 +1,25 @@
<div class="columns">
<div class="column">
<div id="<%= dom_id @user %>">
<p>
<strong>Email:</strong>
<%= @user.email %>
</p>
<p>
<strong>Name:</strong>
<%= @user.name %>
</p>
<p>
<strong>Group:</strong>
<%= @user.group %>
</p>
</div>
<div class="buttons has-addons">
<%= button_to "Edit User", edit_user_path(@user), method: :get, class: "button is-small is-primary" %>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,2 @@
json.extract! user, :id, :name, :group :created_at, :updated_at
json.url host_url(user, format: :json)

View File

@ -0,0 +1,12 @@
<tr>
<td><%= user.email %></td>
<td><%= user.group %></td>
<td>
<div class="buttons has-addons">
<%= button_to "View", user_path(user), method: :get, class: "button is-small is-success"%>
<%= button_to "Edit", edit_user_path(user), method: :get, class: "button is-small is-primary" %>
<%= button_to "Delete",user_path(user), method: :delete, class: "button is-small is-danger" %>
</div>
</td>
</tr>

View File

@ -0,0 +1,3 @@
<h1 class="title">Editing</h1>
<%= render "form", user: @user %>

View File

@ -0,0 +1,19 @@
<h1 class="title">Users</h1>
<div class="container">
<table id="users" class="table">
<thead>
<tr>
<th colspan="1">Name</th>
<th colspan="1">Group</th>
<th colspan="1"</th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<%= render :partial => 'userraw', :locals => { :user => user} %>
<% end %>
</tbody>
</table>
</div>

View File

@ -0,0 +1 @@
json.array! @users, partial: "users/user", as: :user

View File

@ -0,0 +1,6 @@
<section>
<%= render @user %>
</section>
<section>
<%= link_to "Back to users", users_path, class: "button is-success is-small is-pulled-left" %>
</section>

View File

@ -0,0 +1 @@
json.partial! "users/user", user: @user

View File

@ -46,7 +46,7 @@ Rails.application.configure do
# config.assume_ssl = true
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
config.force_ssl = false
# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new(STDOUT)

View File

@ -7,6 +7,7 @@ Rails.application.routes.draw do
resources :installtemplates
resources :hosts
resources :logs
resources :users
root 'pages#index'
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html