diff --git a/src/autogen/.ruby-version b/src/autogen/.ruby-version index 03463f3..4a85a55 100644 --- a/src/autogen/.ruby-version +++ b/src/autogen/.ruby-version @@ -1 +1 @@ -ruby-3.3.0 +ruby-3.3.1 diff --git a/src/autogen/Dockerfile b/src/autogen/Dockerfile index b537a1e..e76d0e0 100644 --- a/src/autogen/Dockerfile +++ b/src/autogen/Dockerfile @@ -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"] diff --git a/src/autogen/Gemfile.lock b/src/autogen/Gemfile.lock index f2d85a9..674aaf2 100644 --- a/src/autogen/Gemfile.lock +++ b/src/autogen/Gemfile.lock @@ -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 diff --git a/src/autogen/app/controllers/hosts_controller.rb b/src/autogen/app/controllers/hosts_controller.rb index 0adc4d3..be546a4 100644 --- a/src/autogen/app/controllers/hosts_controller.rb +++ b/src/autogen/app/controllers/hosts_controller.rb @@ -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 } diff --git a/src/autogen/app/controllers/installtemplates_controller.rb b/src/autogen/app/controllers/installtemplates_controller.rb index 7179f5f..1f6e7c5 100644 --- a/src/autogen/app/controllers/installtemplates_controller.rb +++ b/src/autogen/app/controllers/installtemplates_controller.rb @@ -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" diff --git a/src/autogen/app/controllers/scripts_controller.rb b/src/autogen/app/controllers/scripts_controller.rb index cb75424..cf37c85 100644 --- a/src/autogen/app/controllers/scripts_controller.rb +++ b/src/autogen/app/controllers/scripts_controller.rb @@ -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." } diff --git a/src/autogen/app/controllers/users_controller.rb b/src/autogen/app/controllers/users_controller.rb new file mode 100644 index 0000000..8f77ea2 --- /dev/null +++ b/src/autogen/app/controllers/users_controller.rb @@ -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 diff --git a/src/autogen/app/models/installtemplate.rb b/src/autogen/app/models/installtemplate.rb index 4da642b..bd6f3df 100644 --- a/src/autogen/app/models/installtemplate.rb +++ b/src/autogen/app/models/installtemplate.rb @@ -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 diff --git a/src/autogen/app/models/user.rb b/src/autogen/app/models/user.rb index 613cebb..4954aa9 100644 --- a/src/autogen/app/models/user.rb +++ b/src/autogen/app/models/user.rb @@ -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 diff --git a/src/autogen/app/views/hosts/_form.html.erb b/src/autogen/app/views/hosts/_form.html.erb index c8bd617..3652869 100644 --- a/src/autogen/app/views/hosts/_form.html.erb +++ b/src/autogen/app/views/hosts/_form.html.erb @@ -1,273 +1,229 @@ -
-
-
- <%= form_with(model: host) do |form| %> - <% if host.errors.any? %> -
-

<%= pluralize(host.errors.count, "error") %> prohibited this host from being saved:

- -
    - <% host.errors.each do |error| %> -
  • <%= error.full_message %>
  • - <% end %> -
-
- <% end %> -
-
- -
-
-
-
- <%= form.text_field :uuid , { class: "input", disabled: true } %> -
-

Uniq Identifier Refered by @host.uuid in script

-
-
-
- -
-
- -
-
-
-
- <%= form.text_field :product , { class: "input" , disabled: true } %> -
-

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

- -
-
-
- -
-
- -
-
-
-
- <%= form.text_field :serial , { class: "input" , disabled: true } %> -
-

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

-
-
-
- -
-
- -
-
-
-
- <%= form.text_field :hostname , { class: "input"} %> -
-

hostname, Refered by @host.hostname in script

- -
-
-
- - -
-
- -
-
-
-
- <%= form.text_field :ip , { class: "input"} %> -
-

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

-
-
-
- - -
-
- -
-
-
-
- <%= form.text_field :access_ip , { class: "input" , disabled: true } %> -
-

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

-
-
-
- -
-
- -
-
-
-
- <%= form.text_field :install_ip , { class: "input", disabled: true } %> -
-

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

-
-
-
- -
-
- -
-
-
-
- <%= form.text_field :status , { class: "input" , disabled: true } %> -
-

Host status, Refered by @host.status in script

-
-
-
- -
-
- -
-
-
-
- <%= form.text_field :mac , { class: "input", disabled: true } %> -
-

MAc Adress, Refered by @host.mac in script

-
-
-
-
-
- -
-
-
-
- <%= form.text_field :host_device , { class: "input"} %> -
-

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

-
-
-
-
-
- <%= 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", disabled: true } %> -

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

- -
-
- -
-
- -
-
-
-
- <%= form.text_field :interface , { class: "input"} %> -
-

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

- -
-
-
- -
-
- -
-
-
-
- <%= collection_select(:host, :installtemplate_id, Installtemplate.all, :_id, :name) %> -
-

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

-
-
-
- -
-
- <%= 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

-
-
- -
-
- <%= form.label :rootaccount, class: "label is-small" %> -
- <%= 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 %> -
-
- <%= form.label :installed, class: "checkbox" %> - <%= form.check_box :installed %> -
-
- <%= form.label :toinstall, class: "checkbox" %> - <%= form.check_box :toinstall %> -
-
- +<%= form_with(model: host) do |form| %> +
+
+ +
+
+
- - <%= link_to "Return", "/hosts", class: "button is-success" %> + <%= form.text_field :uuid , { class: "input", disabled: true } %>
- <% end %> - <%= button_to " Destroy ", @host, method: :delete, class: "button is-danger" %> - +

Uniq Identifier Refered by @host.uuid in script

+
-
+
+
+ +
+
+
+
+ <%= form.text_field :product , { class: "input" , disabled: true } %> +
+

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

+
+
+
+
+
+ +
+
+
+
+ <%= form.text_field :serial , { class: "input" , disabled: true } %> +
+

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

+
+
+
+
+
+ +
+
+
+
+ <%= form.text_field :hostname , { class: "input"} %> +
+

hostname, Refered by @host.hostname in script

+
+
+
+
+
+ +
+
+
+
+ <%= form.text_field :ip , { class: "input"} %> +
+

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

+
+
+
+
+
+ +
+
+
+
+ <%= form.text_field :access_ip , { class: "input" , disabled: true } %> +
+

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

+
+
+
+
+
+ +
+
+
+
+ <%= form.text_field :install_ip , { class: "input", disabled: true } %> +
+

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

+
+
+
+
+
+ +
+
+
+
+ <%= form.text_field :status , { class: "input" , disabled: true } %> +
+

Host status, Refered by @host.status in script

+
+
+
+
+
+ +
+
+
+
+ <%= form.text_field :mac , { class: "input", disabled: true } %> +
+

MAc Adress, Refered by @host.mac in script

+
+
+
+
+
+ +
+
+
+
+ <%= form.text_field :host_device , { class: "input"} %> +
+

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

+
+
+
+
+
+ <%= 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", disabled: true } %> +

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

+
+
+
+
+ +
+
+
+
+ <%= form.text_field :interface , { class: "input"} %> +
+

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

+
+
+
+
+
+ +
+
+
+
+ <%= collection_select(:host, :installtemplate_id, Installtemplate.all, :_id, :name) %> +
+

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

+
+
+
+
+
+ <%= 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

+
+
+
+
+ <%= form.label :rootaccount, class: "label is-small" %> +
+ <%= 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 %> +
+
+ <%= form.label :installed, class: "checkbox" %> + <%= form.check_box :installed %> +
+
+ <%= form.label :toinstall, class: "checkbox" %> + <%= form.check_box :toinstall %> +
+
+
+ + <%= link_to "Return", "/hosts", class: "button is-success" %> +
+<% end %> +
<%= button_to "Edit Template", "/installtemplates/#{@host.installtemplate_id}/edit", method: :get, class: "button is-small is-primary", form: {target: '_blank'}%> +
diff --git a/src/autogen/app/views/hosts/_host.html.erb b/src/autogen/app/views/hosts/_host.html.erb index c343c30..eb81a96 100644 --- a/src/autogen/app/views/hosts/_host.html.erb +++ b/src/autogen/app/views/hosts/_host.html.erb @@ -1,21 +1,7 @@ -

<%= notice %>

-
- <% if @host.errors.any? %> -
-

<%= pluralize(@host.errors.count, "error") %> prohibited this host from being saved:

-
    - <% @host.errors.each do |error| %> -
  • <%= error.full_message %>
  • - <% end %> -
-
- <% end %> - - -
+

Hostname: <%= @host.hostname %> diff --git a/src/autogen/app/views/hosts/show.html.erb b/src/autogen/app/views/hosts/show.html.erb index 60a6006..9824b4c 100644 --- a/src/autogen/app/views/hosts/show.html.erb +++ b/src/autogen/app/views/hosts/show.html.erb @@ -1,9 +1,6 @@

-

<%= notice %>

-
-
<%= render @host %>
-<%= 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" %>
diff --git a/src/autogen/app/views/installtemplates/_form.html.erb b/src/autogen/app/views/installtemplates/_form.html.erb index bd04456..d661eb1 100644 --- a/src/autogen/app/views/installtemplates/_form.html.erb +++ b/src/autogen/app/views/installtemplates/_form.html.erb @@ -96,13 +96,6 @@
-
- <%= form.label :lang, class: "label" %> -
- <%= form.text_field :lang , { class: "input"} %> -
-
-
<%= link_to "Return", "/installtemplates", class: "button is-success" %> diff --git a/src/autogen/app/views/installtemplates/_installtemplate.html.erb b/src/autogen/app/views/installtemplates/_installtemplate.html.erb index ba1917f..8f95a8e 100644 --- a/src/autogen/app/views/installtemplates/_installtemplate.html.erb +++ b/src/autogen/app/views/installtemplates/_installtemplate.html.erb @@ -1,69 +1,76 @@ -
-

- Name: - <%= installtemplate.name %> -

+
+
+
+

+ Name: + <%= installtemplate.name %> +

-

- Ostype: - <%= installtemplate.ostype %> -

+

+ Ostype: + <%= installtemplate.ostype %> +

-

- Osversion: - <%= installtemplate.osversion %> -

+

+ Osversion: + <%= installtemplate.osversion %> +

-

- Repository: - <%= installtemplate.repository %> -

+

+ Repository: + <%= installtemplate.repository %> +

-

- Nfsroot: - <%= installtemplate.nfsroot %> -

+

+ Nfsroot: + <%= installtemplate.nfsroot %> +

-

- Kernel: - <%= installtemplate.kernel %> -

+

+ Kernel: + <%= installtemplate.kernel %> +

-

- Initrd: - <%= installtemplate.initrd %> -

+

+ Initrd: + <%= installtemplate.initrd %> +

-

- Rootfile: - <%= installtemplate.rootfile %> -

+

+ Rootfile: + <%= installtemplate.rootfile %> +

-

- Boot Script - <% if defined?installtemplate.boot.name %> - <%= installtemplate.boot.name %> - <% else %> - not set - <% end %> -

+

+ Boot Script + <% if defined?installtemplate.boot.name %> + <%= installtemplate.boot.name %> + <% else %> + not set + <% end %> +

-

- Install - <% if defined?installtemplate.install.name %> - <%= installtemplate.install.name %> - <% else %> - not set - <% end %> -

+

+ Install + <% if defined?installtemplate.install.name %> + <%= installtemplate.install.name %> + <% else %> + not set + <% end %> +

-

- PostInstall - <% if defined?installtemplate.boot.name %> - <%= installtemplate.boot.name %> - <% else %> - not set - <% end %> -

+

+ PostInstall + <% if defined?installtemplate.postinstall.name %> + <%= installtemplate.postinstall.name %> + <% else %> + not set + <% end %> +

+
+
+ <%= button_to "Edit",edit_installtemplate_path(installtemplate), method: :get, class: "button is-small is-primary", form: {target: '_blank'}%> +
+
diff --git a/src/autogen/app/views/installtemplates/_templateraw.html.erb b/src/autogen/app/views/installtemplates/_templateraw.html.erb index 266810f..0608014 100644 --- a/src/autogen/app/views/installtemplates/_templateraw.html.erb +++ b/src/autogen/app/views/installtemplates/_templateraw.html.erb @@ -1,4 +1,13 @@ -<%= installtemplate.name %> - <%= button_to "Edit", edit_installtemplate_path(installtemplate), method: :get, class: "button is-small is-primary" %> + <%= installtemplate.name %> + <%= installtemplate.boot.name %> + <%= installtemplate.install.name %> + <%= installtemplate.postinstall.name %> + +
+ <%= 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" %> +
+ diff --git a/src/autogen/app/views/installtemplates/index.html.erb b/src/autogen/app/views/installtemplates/index.html.erb index fe952c4..32ee837 100644 --- a/src/autogen/app/views/installtemplates/index.html.erb +++ b/src/autogen/app/views/installtemplates/index.html.erb @@ -1,5 +1,3 @@ -

<%= notice %>

-

Templates

<%= button_to "New Template", new_installtemplate_path, method: :get, class: "button is-small is-primary" %>
@@ -7,6 +5,9 @@ Name + Boot + Install + Postinstall @@ -17,5 +18,3 @@
- - diff --git a/src/autogen/app/views/installtemplates/show.html.erb b/src/autogen/app/views/installtemplates/show.html.erb index ae9e8a9..bcdc4cf 100644 --- a/src/autogen/app/views/installtemplates/show.html.erb +++ b/src/autogen/app/views/installtemplates/show.html.erb @@ -1,10 +1,6 @@ -

<%= notice %>

- +
<%= render @installtemplate %> - -
- <%= link_to "Edit this installtemplate", edit_installtemplate_path(@installtemplate) %> | - <%= link_to "Back to installtemplates", installtemplates_path %> - - <%= button_to "Destroy this installtemplate", @installtemplate, method: :delete %> -
+
+
+<%= link_to "Back to Template", "/installtemplates", class: "button is-success is-small is-pulled-left" %> +
diff --git a/src/autogen/app/views/pages/index.html.erb b/src/autogen/app/views/pages/index.html.erb index 88279b0..be372b4 100644 --- a/src/autogen/app/views/pages/index.html.erb +++ b/src/autogen/app/views/pages/index.html.erb @@ -1,7 +1,28 @@
-

Home#index

+

Status

-

Find me in app/views/pages/index.html.erb

-
\ No newline at end of file +
+
+
<%= link_to "Templates" , installtemplates_path, class: "button is-success is-small is-pulled-left" %>
+
<%= Installtemplate.count %>
+
+
+
<%= link_to "Scripts" , scripts_path, class: "button is-success is-small is-pulled-left" %>
+
<%= Script.count %>
+
+
+
<%= link_to "Sites" , sites_path, class: "button is-success is-small is-pulled-left" %>
+
<%= Site.count %>
+
+
+
<%= link_to "Hosts" , hosts_path, class: "button is-success is-small is-pulled-left" %>
+
<%= Host.count %>
+
+
+
<%= link_to "Accounts" , accounts_path, class: "button is-success is-small is-pulled-left" %>
+
<%= Account.count %>
+
+
+
diff --git a/src/autogen/app/views/partials/_top-menu.html.erb b/src/autogen/app/views/partials/_top-menu.html.erb index b7837a8..889c57c 100644 --- a/src/autogen/app/views/partials/_top-menu.html.erb +++ b/src/autogen/app/views/partials/_top-menu.html.erb @@ -1,6 +1,6 @@
- + <% if user_signed_in? %> + + <% end %>

Stage of script [boot,install,postinstall, ressources](@script.stage )

-
ma +
@@ -74,4 +74,3 @@
<% end %>
-<%= button_to "Delete", script_path( @script), method: :delete, class: "button is-small is-danger" %> diff --git a/src/autogen/app/views/scripts/_script.html.erb b/src/autogen/app/views/scripts/_script.html.erb index 4e11b1a..f629220 100644 --- a/src/autogen/app/views/scripts/_script.html.erb +++ b/src/autogen/app/views/scripts/_script.html.erb @@ -1,32 +1,33 @@ -
-

- Name: - <%= script.name %> -

- -

- Stage: - <%= script.stage %> -

- -

- Lang: - <%= script.lang %> -

- -

- Content: - <%= script.content %> -

- -

- Lock: - <%= script.lock %> -

- -

- Description: - <%= script.description %> -

+

<%= notice %>

+
+
+
+

+ Name: + <%= @script.name %> +

+

+ Stage: + <%= @script.stage %> +

+

+ Lang: + <%= @script.lang %> +

+

+ Content: + +

+

+ Lock: + <%= @script.lock %> +

+

+ Description: + +

+
+
+
diff --git a/src/autogen/app/views/scripts/_script_raw.html.erb b/src/autogen/app/views/scripts/_script_raw.html.erb index ed33169..bfb8923 100644 --- a/src/autogen/app/views/scripts/_script_raw.html.erb +++ b/src/autogen/app/views/scripts/_script_raw.html.erb @@ -2,6 +2,13 @@ <%= script.name %> <%= script.stage %> <%= script.lang %> - <%= button_to "Edit", edit_script_path(script), method: :get, class: "button is-small is-primary" %> + +
+ <%= 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 %> +
+ - diff --git a/src/autogen/app/views/scripts/index.html.erb b/src/autogen/app/views/scripts/index.html.erb index f6b1243..84909e9 100644 --- a/src/autogen/app/views/scripts/index.html.erb +++ b/src/autogen/app/views/scripts/index.html.erb @@ -6,10 +6,10 @@ - - - - + + + + @@ -19,5 +19,3 @@
NameStageLangNameStageLangAction
- - diff --git a/src/autogen/app/views/scripts/show.html.erb b/src/autogen/app/views/scripts/show.html.erb index 10af54d..26548c7 100644 --- a/src/autogen/app/views/scripts/show.html.erb +++ b/src/autogen/app/views/scripts/show.html.erb @@ -1,10 +1,11 @@ -

<%= notice %>

+
+

<%= notice %>

+
+
+ <%= render @script %> +
+
+ <%= 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 %> - -
- <%= link_to "Edit this script", edit_script_path(@script) %> | - <%= link_to "Back to scripts", scripts_path %> - - <%= button_to "Destroy this script", @script, method: :delete %> -
+
diff --git a/src/autogen/app/views/sites/_form.html.erb b/src/autogen/app/views/sites/_form.html.erb index 4d2822d..7185c4e 100644 --- a/src/autogen/app/views/sites/_form.html.erb +++ b/src/autogen/app/views/sites/_form.html.erb @@ -138,7 +138,7 @@
- + <%= link_to "Return to Site index", "/sites", class: "button is-success" %>
<% end %> diff --git a/src/autogen/app/views/sites/_site.html.erb b/src/autogen/app/views/sites/_site.html.erb index baead43..3ccb6f1 100644 --- a/src/autogen/app/views/sites/_site.html.erb +++ b/src/autogen/app/views/sites/_site.html.erb @@ -1,37 +1,77 @@ -
-

- Name: - <%= site.name %> -

+
+
+
+

+ Name + <%= site.name %> +

-

- Domain: - <%= site.domain %> -

+

+ Domain + <%= site.domain %> +

-

- Gateway: - <%= site.gateway %> -

+

+ Gateway + <%= site.gateway %> +

-

- Nameserver: - <%= site.nameserver %> -

+

+ Nameserver + <%= site.nameserver %> +

-

- Network: - <%= site.network %> -

+

+ Network + <%= site.network %> +

-

- Netmask: - <%= site.netmask %> -

+

+ Netmask + <%= site.netmask %> +

-

- Server: - <%= site.api_ip %>:<%= site.api_ip %>: -

+

+ Api IP + <%= site.api_ip %> +

+

+ Api Port + <%= site.api_port %> +

+ +

+ Api Url + <%= site.api_url %> +

+ +

+ Fileserver Uri + <%= site.fileserver_uri %> +

+ +

+ Fileserver Basepath + <%= site.fileserver_basepath %> +

+ +

+ Fileserver Url: + <%= site.fileserver_url %> +

+ +

+ Nfsserver path: + <%= site.nfsserver_path %> +

+

+ Country: + <%= site.country %> +

+

+ Timezone: + <%= site.timezone %> +

+
diff --git a/src/autogen/app/views/sites/_siteraw.html.erb b/src/autogen/app/views/sites/_siteraw.html.erb index e1b5aeb..98faf12 100644 --- a/src/autogen/app/views/sites/_siteraw.html.erb +++ b/src/autogen/app/views/sites/_siteraw.html.erb @@ -1,5 +1,11 @@ -<%= site.name %> -<%= site.description %> - <%= button_to "Edit", edit_site_path(site), method: :get, class: "button is-small is-primary" %> + <%= site.name %> + <%= site.description %> + +
+ <%= 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" %> + +
diff --git a/src/autogen/app/views/sites/index.html.erb b/src/autogen/app/views/sites/index.html.erb index 54132bc..6b9202b 100644 --- a/src/autogen/app/views/sites/index.html.erb +++ b/src/autogen/app/views/sites/index.html.erb @@ -1,13 +1,12 @@ -

<%= notice %>

-

Sites

<%= button_to "New Site", new_site_path, method: :get, class: "button is-small is-primary" %>
- - + + + @@ -17,6 +16,3 @@
Site NameSite NameDescription
- - - diff --git a/src/autogen/app/views/sites/show.html.erb b/src/autogen/app/views/sites/show.html.erb index 8f0234d..e413bbd 100644 --- a/src/autogen/app/views/sites/show.html.erb +++ b/src/autogen/app/views/sites/show.html.erb @@ -1,10 +1,6 @@ -

<%= notice %>

- +
<%= render @site %> - -
- <%= link_to "Edit this site", edit_site_path(@site) %> | - <%= link_to "Back to sites", sites_path %> - - <%= button_to "Destroy this site", @site, method: :delete %> -
+
+
+<%= link_to "Back to sites", sites_path, class: "button is-success is-small is-pulled-left" %> +
diff --git a/src/autogen/app/views/users/_form.html.erb b/src/autogen/app/views/users/_form.html.erb new file mode 100644 index 0000000..bbd1ff1 --- /dev/null +++ b/src/autogen/app/views/users/_form.html.erb @@ -0,0 +1,53 @@ +
+
+
+ <%= form_with(model: user) do |form| %> +
+
+ +
+
+
+
+ <%= form.text_field :name , { class: "input" } %> +
+
+
+
+ +
+
+ +
+
+
+
+ <%= form.text_field :email , { class: "input" } %> +
+
+
+
+ +
+
+ +
+
+
+
+ <%= form.text_field :group , { class: "input" } %> +
+
+
+
+ +
+ + <%= link_to "Return", "/users", class: "button is-success" %> +
+ <% end %> + <%= button_to "Destroy", @user, method: :delete, class: "button is-danger" %> + +
+
+
diff --git a/src/autogen/app/views/users/_user.html.erb b/src/autogen/app/views/users/_user.html.erb new file mode 100644 index 0000000..67d711d --- /dev/null +++ b/src/autogen/app/views/users/_user.html.erb @@ -0,0 +1,25 @@ +
+
+ +
+

+ Email: + <%= @user.email %> +

+ +

+ Name: + <%= @user.name %> +

+ +

+ Group: + <%= @user.group %> +

+
+
+ <%= button_to "Edit User", edit_user_path(@user), method: :get, class: "button is-small is-primary" %> +
+
+
+
diff --git a/src/autogen/app/views/users/_user.json.jbuilder b/src/autogen/app/views/users/_user.json.jbuilder new file mode 100644 index 0000000..92ee3d3 --- /dev/null +++ b/src/autogen/app/views/users/_user.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! user, :id, :name, :group :created_at, :updated_at +json.url host_url(user, format: :json) \ No newline at end of file diff --git a/src/autogen/app/views/users/_userraw.html.erb b/src/autogen/app/views/users/_userraw.html.erb new file mode 100644 index 0000000..d708e04 --- /dev/null +++ b/src/autogen/app/views/users/_userraw.html.erb @@ -0,0 +1,12 @@ + + + <%= user.email %> + <%= user.group %> + +
+ <%= 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" %> +
+ + diff --git a/src/autogen/app/views/users/edit.html.erb b/src/autogen/app/views/users/edit.html.erb new file mode 100644 index 0000000..f2ccc60 --- /dev/null +++ b/src/autogen/app/views/users/edit.html.erb @@ -0,0 +1,3 @@ +

Editing

+ +<%= render "form", user: @user %> diff --git a/src/autogen/app/views/users/index.html.erb b/src/autogen/app/views/users/index.html.erb new file mode 100644 index 0000000..b71aba9 --- /dev/null +++ b/src/autogen/app/views/users/index.html.erb @@ -0,0 +1,19 @@ + +

Users

+
+ + + + + + + + + <% @users.each do |user| %> + <%= render :partial => 'userraw', :locals => { :user => user} %> + <% end %> + +
NameGroup +
+ +
diff --git a/src/autogen/app/views/users/index.json.builder b/src/autogen/app/views/users/index.json.builder new file mode 100644 index 0000000..297a0f4 --- /dev/null +++ b/src/autogen/app/views/users/index.json.builder @@ -0,0 +1 @@ +json.array! @users, partial: "users/user", as: :user \ No newline at end of file diff --git a/src/autogen/app/views/users/show.html.erb b/src/autogen/app/views/users/show.html.erb new file mode 100644 index 0000000..75d8f9a --- /dev/null +++ b/src/autogen/app/views/users/show.html.erb @@ -0,0 +1,6 @@ +
+<%= render @user %> +
+
+<%= link_to "Back to users", users_path, class: "button is-success is-small is-pulled-left" %> +
diff --git a/src/autogen/app/views/users/show.json.jbuilder b/src/autogen/app/views/users/show.json.jbuilder new file mode 100644 index 0000000..a2e64e0 --- /dev/null +++ b/src/autogen/app/views/users/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "users/user", user: @user \ No newline at end of file diff --git a/src/autogen/config/environments/production.rb b/src/autogen/config/environments/production.rb index 2d97372..f0b972c 100644 --- a/src/autogen/config/environments/production.rb +++ b/src/autogen/config/environments/production.rb @@ -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) diff --git a/src/autogen/config/routes.rb b/src/autogen/config/routes.rb index 12cc7d3..1a21987 100644 --- a/src/autogen/config/routes.rb +++ b/src/autogen/config/routes.rb @@ -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