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

View File

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

View File

@ -41,7 +41,7 @@ class HostsController < ApplicationController
def update def update
puts host_params puts host_params
respond_to do |format| 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() log.save()
if @host.update(host_params) if @host.update(host_params)
format.html { redirect_to host_url(@host), notice: "Host was successfully updated." } 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 # DELETE /hosts/1 or /hosts/1.json
def destroy def destroy
@host.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| respond_to do |format|
format.html { redirect_to hosts_url, notice: "Host was successfully destroyed." } format.html { redirect_to hosts_url, notice: "Host was successfully destroyed." }
format.json { head :no_content } format.json { head :no_content }

View File

@ -67,7 +67,7 @@ class InstalltemplatesController < ApplicationController
# Only allow a list of trusted parameters through. # Only allow a list of trusted parameters through.
def installtemplate_params 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 end
def check_group def check_group
if current_user.group != "admin" if current_user.group != "admin"

View File

@ -56,7 +56,7 @@ class ScriptsController < ApplicationController
# DELETE /scripts/1 or /scripts/1.json # DELETE /scripts/1 or /scripts/1.json
def destroy def destroy
@script.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() log.save()
respond_to do |format| respond_to do |format|
format.html { redirect_to scripts_url, notice: "Script was successfully destroyed." } 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 :kernel, type: String
field :initrd, type: String field :initrd, type: String
field :rootfile, type: String field :rootfile, type: String
field :lang, type: String
has_many :hostreferences, class_name: "Host", inverse_of: :installtemplate has_many :hostreferences, class_name: "Host", inverse_of: :installtemplate
belongs_to :boot , class_name: "Script", inverse_of: :bootref belongs_to :boot , class_name: "Script", inverse_of: :bootref
belongs_to :install , class_name: "Script", inverse_of: :installref belongs_to :install , class_name: "Script", inverse_of: :installref

View File

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

View File

@ -1,273 +1,229 @@
<div class="columns"> <%= form_with(model: host) do |form| %>
<div class="column"> <div class="field is-horizontal">
<div class="box"> <div class="field-label is-small">
<%= form_with(model: host) do |form| %> <label class="label">UUID</label>
<% if host.errors.any? %> </div>
<div style="color: red"> <div class="field-body">
<h2><%= pluralize(host.errors.count, "error") %> prohibited this host from being saved:</h2> <div class="field">
<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>
<div class="control"> <div class="control">
<button class="button is-link">Submit</button> <%= form.text_field :uuid , { class: "input", disabled: true } %>
<%= link_to "Return", "/hosts", class: "button is-success" %>
</div> </div>
<% end %> <p class="help">Uniq Identifier Refered by @host.uuid in script</p>
<%= button_to " Destroy ", @host, method: :delete, class: "button is-danger" %> </div>
</div> </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> <%= 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="columns">
<div class="column"> <div class="column">
<div class="box"> <div id="<%= dom_id @host %>">
<% 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 %>">
<p> <p>
<strong>Hostname:</strong> <strong>Hostname:</strong>
<%= @host.hostname %> <%= @host.hostname %>

View File

@ -1,9 +1,6 @@
<section> <section>
<p style="color: green"><%= notice %></p>
</section>
<section>
<%= render @host %> <%= render @host %>
</section> </section>
<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> </section>

View File

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

View File

@ -1,69 +1,76 @@
<div id="<%= dom_id installtemplate %>"> <div class="columns">
<p> <div class="column">
<strong>Name:</strong> <div id="<%= dom_id installtemplate %>">
<%= installtemplate.name %> <p>
</p> <strong>Name:</strong>
<%= installtemplate.name %>
</p>
<p> <p>
<strong>Ostype:</strong> <strong>Ostype:</strong>
<%= installtemplate.ostype %> <%= installtemplate.ostype %>
</p> </p>
<p> <p>
<strong>Osversion:</strong> <strong>Osversion:</strong>
<%= installtemplate.osversion %> <%= installtemplate.osversion %>
</p> </p>
<p> <p>
<strong>Repository:</strong> <strong>Repository:</strong>
<%= installtemplate.repository %> <%= installtemplate.repository %>
</p> </p>
<p> <p>
<strong>Nfsroot:</strong> <strong>Nfsroot:</strong>
<%= installtemplate.nfsroot %> <%= installtemplate.nfsroot %>
</p> </p>
<p> <p>
<strong>Kernel:</strong> <strong>Kernel:</strong>
<%= installtemplate.kernel %> <%= installtemplate.kernel %>
</p> </p>
<p> <p>
<strong>Initrd:</strong> <strong>Initrd:</strong>
<%= installtemplate.initrd %> <%= installtemplate.initrd %>
</p> </p>
<p> <p>
<strong>Rootfile:</strong> <strong>Rootfile:</strong>
<%= installtemplate.rootfile %> <%= installtemplate.rootfile %>
</p> </p>
<p> <p>
<strong>Boot Script</strong> <strong>Boot Script</strong>
<% if defined?installtemplate.boot.name %> <% if defined?installtemplate.boot.name %>
<%= installtemplate.boot.name %> <%= installtemplate.boot.name %>
<% else %> <% else %>
not set not set
<% end %> <% end %>
</p> </p>
<p> <p>
<strong>Install</strong> <strong>Install</strong>
<% if defined?installtemplate.install.name %> <% if defined?installtemplate.install.name %>
<%= installtemplate.install.name %> <%= installtemplate.install.name %>
<% else %> <% else %>
not set not set
<% end %> <% end %>
</p> </p>
<p> <p>
<strong>PostInstall</strong> <strong>PostInstall</strong>
<% if defined?installtemplate.boot.name %> <% if defined?installtemplate.postinstall.name %>
<%= installtemplate.boot.name %> <%= installtemplate.postinstall.name %>
<% else %> <% else %>
not set not set
<% end %> <% end %>
</p> </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> </div>

View File

@ -1,4 +1,13 @@
<tr> <tr>
<td><%= installtemplate.name %></td> <td><%= installtemplate.name %></td>
<td> <%= button_to "Edit", edit_installtemplate_path(installtemplate), method: :get, class: "button is-small is-primary" %></tr> <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> </tr>

View File

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

View File

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

View File

@ -1,7 +1,28 @@
<div class="container is-widescreen"> <div class="container is-widescreen">
<div class="notification is-primary"> <div class="notification is-primary">
<h1>Home#index</h1> <h1>Status</h1>
</div> </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"> <nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand"> <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' %> <%= image_tag "installerlogo.png", size: '112x28' %>
</a> </a>
@ -43,17 +43,19 @@
</div> </div>
</div> </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-end">
<div class="navbar-item"> <div class="navbar-item">
<div class="buttons"> <div class="buttons">
<% if !user_signed_in? %> <% if !user_signed_in? %>
>
<%= link_to "Login", new_user_session_path, class: "button is-light" %> <%= link_to "Login", new_user_session_path, class: "button is-light" %>
<% else %> <% else %>
<h1>Bonjour <%= current_user.name %></h2> <%= link_to "Profil", edit_user_registration_path, class: "button is-info" %>
<%= link_to "Profil", edit_user_registration_path, class: "button is-light" %> <%= button_to "Logout", destroy_user_session_path, method: :delete, class: "button is-info" %>
<%= button_to "Logout", destroy_user_session_path, method: :delete, class: "button is-light" %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -29,7 +29,7 @@
</div> </div>
<p class="help">Stage of script [boot,install,postinstall, ressources](@script.stage )</p> <p class="help">Stage of script [boot,install,postinstall, ressources](@script.stage )</p>
</div>ma </div>
<div class="field"> <div class="field">
<label class="label">Lang</label> <label class="label">Lang</label>
@ -74,4 +74,3 @@
</div> </div>
<% end %> <% end %>
</div> </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 style="color: green"><%= notice %></p>
<p> <div class="columns">
<strong>Name:</strong> <div class="column">
<%= script.name %> <div id="<%= dom_id @script %>">
</p> <p>
<strong>Name:</strong>
<p> <%= @script.name %>
<strong>Stage:</strong> </p>
<%= 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>
<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> </div>

View File

@ -2,6 +2,13 @@
<td><%= script.name %></td> <td><%= script.name %></td>
<td><%= script.stage %></td> <td><%= script.stage %></td>
<td><%= script.lang %></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> </tr>

View File

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

View File

@ -138,7 +138,7 @@
</div> </div>
<div class="control"> <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" %> <%= link_to "Return to Site index", "/sites", class: "button is-success" %>
</div> </div>
<% end %> <% end %>

View File

@ -1,37 +1,77 @@
<div id="<%= dom_id site %>"> <div class="columns">
<p> <div class="column">
<strong>Name:</strong> <div id="<%= dom_id site %>">
<%= site.name %> <p>
</p> <strong>Name</strong>
<%= site.name %>
</p>
<p> <p>
<strong>Domain:</strong> <strong>Domain</strong>
<%= site.domain %> <%= site.domain %>
</p> </p>
<p> <p>
<strong>Gateway:</strong> <strong>Gateway</strong>
<%= site.gateway %> <%= site.gateway %>
</p> </p>
<p> <p>
<strong>Nameserver:</strong> <strong>Nameserver</strong>
<%= site.nameserver %> <%= site.nameserver %>
</p> </p>
<p> <p>
<strong>Network:</strong> <strong>Network</strong>
<%= site.network %> <%= site.network %>
</p> </p>
<p> <p>
<strong>Netmask:</strong> <strong>Netmask</strong>
<%= site.netmask %> <%= site.netmask %>
</p> </p>
<p> <p>
<strong>Server:</strong> <strong>Api IP</strong>
<%= site.api_ip %>:<%= site.api_ip %>: <%= site.api_ip %>
</p> </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> </div>

View File

@ -1,5 +1,11 @@
<tr> <tr>
<td><%= site.name %></td> <td><%= site.name %></td>
<td><%= site.description %></td> <td><%= site.description %></td>
<td> <%= button_to "Edit", edit_site_path(site), method: :get, class: "button is-small is-primary" %></tr> <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> </tr>

View File

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

View File

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

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 # config.assume_ssl = true
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # 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 # Log to STDOUT by default
config.logger = ActiveSupport::Logger.new(STDOUT) config.logger = ActiveSupport::Logger.new(STDOUT)

View File

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