Commit 9448385f authored by nazarf's avatar nazarf

set and check miner status

parent e6391590
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="ruby">
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
\ No newline at end of file
This diff is collapsed.
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'rails', '4.2.8' gem 'rails', '4.2.8'
gem 'mysql2' gem 'mysql2', '~> 0.4.3'
gem 'uglifier', '>= 1.3.0' gem 'uglifier', '>= 1.3.0'
gem 'sass-rails', '~> 5.0' gem 'sass-rails', '~> 5.0'
gem 'coffee-rails', '~> 4.1.0' gem 'coffee-rails', '~> 4.1.0'
......
...@@ -35,53 +35,48 @@ GEM ...@@ -35,53 +35,48 @@ GEM
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
acts_as_list (0.9.4) acts_as_list (1.1.0)
activerecord (>= 3.0) activerecord (>= 4.2)
airbrussh (1.1.2) airbrussh (1.4.1)
sshkit (>= 1.6.1, != 1.7.0) sshkit (>= 1.6.1, != 1.7.0)
arel (6.0.4) arel (6.0.4)
autoprefixer-rails (6.7.7.1) autoprefixer-rails (10.4.13.0)
execjs execjs (~> 2)
bcrypt (3.1.11-x64-mingw32) bcrypt (3.1.18)
bcrypt (3.1.11-x86-mingw32) binding_of_caller (1.0.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.7) bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1) autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4) sass (>= 3.3.4)
bootstrap-will_paginate (0.0.11) bootstrap-will_paginate (1.0.0)
will_paginate will_paginate
bootstrap3-datetimepicker-rails (4.15.35) bootstrap3-datetimepicker-rails (4.15.35)
momentjs-rails (>= 2.8.1) momentjs-rails (>= 2.8.1)
builder (3.2.3) builder (3.2.4)
capistrano (3.7.2) capistrano (3.7.2)
airbrussh (>= 1.0.0) airbrussh (>= 1.0.0)
capistrano-harrow capistrano-harrow
i18n i18n
rake (>= 10.0.0) rake (>= 10.0.0)
sshkit (>= 1.9.0) sshkit (>= 1.9.0)
capistrano-bundler (1.2.0) capistrano-bundler (2.1.0)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.2) capistrano-faster-assets (1.1.0)
capistrano-faster-assets (1.0.2)
capistrano (>= 3.1) capistrano (>= 3.1)
capistrano-harrow (0.5.3) capistrano-harrow (0.5.3)
capistrano-rails (1.2.3) capistrano-rails (1.6.2)
capistrano (~> 3.1) capistrano (~> 3.1)
capistrano-bundler (~> 1.1) capistrano-bundler (>= 1.1, < 3)
capistrano-rvm (0.1.2) capistrano-rvm (0.1.2)
capistrano (~> 3.0) capistrano (~> 3.0)
sshkit (~> 1.2) sshkit (~> 1.2)
carrierwave (1.0.0) carrierwave (1.3.3)
activemodel (>= 4.0.0) activemodel (>= 4.0.0)
activesupport (>= 4.0.0) activesupport (>= 4.0.0)
mime-types (>= 1.16) mime-types (>= 1.16)
ckeditor (4.2.4) ssrf_filter (~> 1.0, < 1.1.0)
cocaine ckeditor (5.1.1)
orm_adapter (~> 0.5.0) orm_adapter (~> 0.5.0)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coffee-rails (4.1.1) coffee-rails (4.1.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x) railties (>= 4.0.0, < 5.1.x)
...@@ -90,39 +85,45 @@ GEM ...@@ -90,39 +85,45 @@ GEM
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
commonjs (0.2.7) commonjs (0.2.7)
concurrent-ruby (1.0.5) concurrent-ruby (1.2.2)
debug_inspector (0.0.2) crass (1.0.6)
devise (4.2.1) debug_inspector (1.1.0)
devise (4.9.0)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.1) railties (>= 4.1.0)
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
devise-i18n (1.1.2) devise-i18n (1.11.0)
devise (>= 4.9.0)
digest (3.1.1)
erubis (2.7.0) erubis (2.7.0)
execjs (2.7.0) execjs (2.8.1)
font-awesome-rails (4.7.0.1) ffi (1.15.5)
railties (>= 3.2, < 5.1) font-awesome-rails (4.7.0.8)
globalid (0.3.7) railties (>= 3.2, < 8.0)
activesupport (>= 4.1.0) globalid (0.4.2)
haml (4.0.7) activesupport (>= 4.2.0)
haml (5.2.2)
temple (>= 0.8.0)
tilt tilt
haml-rails (0.9.0) haml-rails (1.0.0)
actionpack (>= 4.0.1) actionpack (>= 4.0.1)
activesupport (>= 4.0.1) activesupport (>= 4.0.1)
haml (>= 4.0.6, < 5.0) haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1) html2haml (>= 1.0.1)
railties (>= 4.0.1) railties (>= 4.0.1)
html2haml (2.1.0) html2haml (2.3.0)
erubis (~> 2.7.0) erubis (~> 2.7.0)
haml (~> 4.0) haml (>= 4.0)
nokogiri (>= 1.6.0) nokogiri (>= 1.6.0)
ruby_parser (~> 3.5) ruby_parser (~> 3.5)
i18n (0.8.1) i18n (0.9.5)
jbuilder (2.6.3) concurrent-ruby (~> 1.0)
activesupport (>= 3.0.0, < 5.2) io-wait (0.3.0)
multi_json (~> 1.2) jbuilder (2.9.1)
jquery-rails (4.3.1) activesupport (>= 4.2.0)
jquery-rails (4.5.1)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
...@@ -131,36 +132,51 @@ GEM ...@@ -131,36 +132,51 @@ GEM
json (1.8.6) json (1.8.6)
less (2.6.0) less (2.6.0)
commonjs (~> 0.2.7) commonjs (~> 0.2.7)
less-rails (2.8.0) less-rails (4.0.0)
actionpack (>= 4.0) actionpack (>= 4)
less (~> 2.6.0) less (~> 2.6.0)
sprockets (> 2, < 4) sprockets (>= 2)
tilt loofah (2.19.1)
loofah (2.0.3) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.4) mail (2.8.1)
mime-types (>= 1.16, < 4) mini_mime (>= 0.1.1)
mime-types (3.1) net-imap
net-pop
net-smtp
mime-types (3.4.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521) mime-types-data (3.2023.0218.1)
mini_magick (4.6.1) mini_magick (4.12.0)
mini_portile2 (2.1.0) mini_mime (1.1.2)
minitest (5.10.1) mini_portile2 (2.6.1)
momentjs-rails (2.17.1) minitest (5.15.0)
momentjs-rails (2.29.4.1)
railties (>= 3.1) railties (>= 3.1)
multi_json (1.12.1) mysql2 (0.4.10)
mysql2 (0.4.5-x64-mingw32)
mysql2 (0.4.5-x86-mingw32)
nested_form (0.3.2) nested_form (0.3.2)
net-scp (1.2.1) net-imap (0.2.2)
net-ssh (>= 2.6.5) digest
net-ssh (4.1.0) net-protocol
nokogiri (1.7.1-x64-mingw32) strscan
mini_portile2 (~> 2.1.0) net-pop (0.1.2)
nokogiri (1.7.1-x86-mingw32) net-protocol
mini_portile2 (~> 2.1.0) net-protocol (0.1.2)
io-wait
timeout
net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-smtp (0.3.0)
digest
net-protocol
timeout
net-ssh (6.1.0)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
rack (1.6.5) racc (1.6.2)
rack (1.6.13)
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (4.2.8) rails (4.2.8)
...@@ -174,27 +190,35 @@ GEM ...@@ -174,27 +190,35 @@ GEM
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.8) railties (= 4.2.8)
sprockets-rails sprockets-rails
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.4)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.8) rails-dom-testing (1.0.9)
activesupport (>= 4.2.0.beta, < 5.0) activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6) nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1) rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.5.0)
loofah (~> 2.0) loofah (~> 2.19, >= 2.19.1)
railties (4.2.8) railties (4.2.8)
actionpack (= 4.2.8) actionpack (= 4.2.8)
activesupport (= 4.2.8) activesupport (= 4.2.8)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (12.0.0) rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdoc (4.3.0) rdoc (4.3.0)
responders (2.3.0) responders (2.4.1)
railties (>= 4.2.0, < 5.1) actionpack (>= 4.2.0, < 6.0)
ruby_parser (3.8.4) railties (>= 4.2.0, < 6.0)
sexp_processor (~> 4.1) ruby_parser (3.19.2)
sass (3.4.23) sexp_processor (~> 4.16)
sass-rails (5.0.6) sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6) railties (>= 4.0.0, < 6)
sass (~> 3.1) sass (~> 3.1)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
...@@ -203,36 +227,38 @@ GEM ...@@ -203,36 +227,38 @@ GEM
sdoc (0.4.2) sdoc (0.4.2)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0) rdoc (~> 4.0)
sexp_processor (4.8.0) sexp_processor (4.16.1)
simple_form (3.4.0) simple_form (4.0.0)
actionpack (> 4, < 5.1) actionpack (> 4)
activemodel (> 4, < 5.1) activemodel (> 4)
sprockets (3.7.1) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.0) sprockets-rails (3.2.2)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sshkit (1.12.0) sshkit (1.21.4)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
thor (0.19.4) ssrf_filter (1.0.8)
strscan (3.0.6)
temple (0.10.0)
thor (1.2.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.7) tilt (2.1.0)
turbolinks (5.0.1) timeout (0.3.2)
turbolinks-source (~> 5) turbolinks (5.2.1)
turbolinks-source (5.0.0) turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
twitter-bootstrap-rails (3.2.2) twitter-bootstrap-rails (3.2.2)
actionpack (>= 3.1) actionpack (>= 3.1)
execjs (>= 2.2.2, >= 2.2) execjs (>= 2.2.2, >= 2.2)
less-rails (>= 2.5.0) less-rails (>= 2.5.0)
railties (>= 3.1) railties (>= 3.1)
tzinfo (1.2.2) tzinfo (1.2.11)
thread_safe (~> 0.1) thread_safe (~> 0.1)
tzinfo-data (1.2017.1) uglifier (4.2.0)
tzinfo (>= 1.0.0)
uglifier (3.1.9)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
warden (1.2.7) warden (1.2.7)
rack (>= 1.0) rack (>= 1.0)
...@@ -241,11 +267,10 @@ GEM ...@@ -241,11 +267,10 @@ GEM
binding_of_caller (>= 0.7.2) binding_of_caller (>= 0.7.2)
railties (>= 4.0) railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
will_paginate (3.1.5) will_paginate (3.3.1)
PLATFORMS PLATFORMS
x64-mingw32 ruby
x86-mingw32
DEPENDENCIES DEPENDENCIES
acts_as_list acts_as_list
...@@ -269,7 +294,7 @@ DEPENDENCIES ...@@ -269,7 +294,7 @@ DEPENDENCIES
jquery-ui-rails jquery-ui-rails
mini_magick mini_magick
momentjs-rails (>= 2.9.0) momentjs-rails (>= 2.9.0)
mysql2 mysql2 (~> 0.4.3)
nested_form nested_form
rails (= 4.2.8) rails (= 4.2.8)
sass-rails (~> 5.0) sass-rails (~> 5.0)
...@@ -283,4 +308,4 @@ DEPENDENCIES ...@@ -283,4 +308,4 @@ DEPENDENCIES
will_paginate will_paginate
BUNDLED WITH BUNDLED WITH
1.14.3 1.17.3
...@@ -9,4 +9,10 @@ class FrontController < ApplicationController ...@@ -9,4 +9,10 @@ class FrontController < ApplicationController
@page = Page.find_by(url_id: params[:id]) || Page.find(params[:id]) @page = Page.find_by(url_id: params[:id]) || Page.find(params[:id])
end end
def update_miner_activity
miner = Miner.find_by(name: params[:name])
miner.update(status: 'work')
render json: {status: 'ok'}
end
end end
class MinersController < AdminController
before_action :set_miner, only: [:show, :edit, :update, :destroy]
before_action :check_administrator
# GET /miners
# GET /miners.json
def index
@miners = Miner.all
end
# GET /miners/1
# GET /miners/1.json
def show
end
# GET /miners/new
def new
@miner = Miner.new
end
# GET /miners/1/edit
def edit
end
# POST /miners
# POST /miners.json
def create
@miner = Miner.new(miner_params)
respond_to do |format|
if @miner.save
format.html { redirect_to @miner, notice: 'Miner was successfully created.' }
format.json { render :show, status: :created, location: @miner }
else
format.html { render :new }
format.json { render json: @miner.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /miners/1
# PATCH/PUT /miners/1.json
def update
respond_to do |format|
if @miner.update(miner_params)
format.html { redirect_to @miner, notice: 'Miner was successfully updated.' }
format.json { render :show, status: :ok, location: @miner }
else
format.html { render :edit }
format.json { render json: @miner.errors, status: :unprocessable_entity }
end
end
end
# DELETE /miners/1
# DELETE /miners/1.json
def destroy
@miner.destroy
respond_to do |format|
format.html { redirect_to miners_url, notice: 'Miner was successfully destroyed.' }
format.json { head :no_content }
end
end
def miners_activity
@data = Miner.all.map do |miner|
{
name: miner.name,
status: miner.status,
hash_rate: miner.hash_rate,
last_activity: miner.last_activity,
ip_address: miner.ip_address,
port: miner.port,
wallet_address: miner.wallet_address,
password: miner.password,
algorithm: miner.algorithm,
ip_address_2: miner.ip_address_2,
port_2: miner.port_2,
wallet_address_2: miner.wallet_address_2,
password_2: miner.password_2,
algorithm_2: miner.algorithm_2
}
end
render json: @data
end
private
# Use callbacks to share common setup or constraints between actions.
def set_miner
@miner = Miner.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def miner_params
params.require(:miner).permit(:name, :status, :ip_address, :port, :wallet_address, :password, :algorithm, :ip_address_2, :port_2, :wallet_address_2, :password_2, :algorithm_2, :hash_rate, :last_activity)
end
end
class Miner < ActiveRecord::Base
end
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
= link_to Account.model_name.human(count: 2).mb_chars.titleize, accounts_path = link_to Account.model_name.human(count: 2).mb_chars.titleize, accounts_path
%li{class: (:selected if controller.is_a? PagesController)} %li{class: (:selected if controller.is_a? PagesController)}
= link_to Page.model_name.human(count: 2).mb_chars.titleize, pages_path = link_to Page.model_name.human(count: 2).mb_chars.titleize, pages_path
%li{class: (:selected if controller.is_a? MinersController)}
= link_to Miner.model_name.human(count: 2).mb_chars.titleize, miners_path
%li{class: (:selected if controller.is_a? NewslettersController)} %li{class: (:selected if controller.is_a? NewslettersController)}
= link_to Newsletter.model_name.human(count: 2).mb_chars.titleize, newsletters_path = link_to Newsletter.model_name.human(count: 2).mb_chars.titleize, newsletters_path
%li{class: (:selected if controller.is_a? SettingsController)} %li{class: (:selected if controller.is_a? SettingsController)}
......
= simple_form_for @miner, :html => { :class => 'form-horizontal' } do |f|
= f.input :name
= f.input :status
= f.input :ip_address
= f.input :port
= f.input :wallet_address
= f.input :password
= f.input :algorithm
= f.input :ip_address_2
= f.input :port_2
= f.input :wallet_address_2
= f.input :password_2
= f.input :algorithm_2
= f.button :submit, :class => 'btn-primary'
= link_to t('.cancel', :default => t("helpers.links.cancel")), miners_path, :class => 'btn btn-default'
- model_class = Miner
.page-header
%h1=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize
= render :partial => "form"
- model_class = Miner
.page-header.refresh_pagination
%table.table.table-striped.filtered_table
%thead
%tr
%th= model_class.human_attribute_name(:name)
%th= model_class.human_attribute_name(:status)
%th= model_class.human_attribute_name(:ip_address)
%th= model_class.human_attribute_name(:port)
%th= model_class.human_attribute_name(:hash_rate)
%th= model_class.human_attribute_name(:last_activity)
%th= t 'helpers.actions'
= tabular_filter.row_helper ['name', '-', '-','-','-', '-', '-'] do
-link_to '?', class: 'btn btn-default btn-xs' do
%i.fa.fa-close
%tbody
- @miners.each do |miner|
%tr
%td= link_to miner.name, miner_path(miner)
%td= miner.status
%td= miner.ip_address
%td= miner.port
%td= miner.hash_rate
%td= miner.last_activity
%td.actions
= link_to edit_miner_path(miner), title: 'Edit', class: 'btn btn-default btn-xs' do
%i.fa.fa-edit
= link_to miner_path(miner), method: :delete, data: {confirm: 'Are you sure?'}, title: 'Destroy',
class: 'btn btn-xs btn-danger' do
%i.fa.fa-trash
= link_to t('helpers.links.new'), new_miner_path, class: 'btn btn-primary'
- model_class = Miner
.page-header
%h1=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize
= render :partial => "form"
- model_class = Miner
.page-header
%h1=model_class.model_name.human.titleize
%p
%strong= model_class.human_attribute_name(:email) + ':'
= @miner.name
%br
= link_to t('.back', :default => t("helpers.links.back")), miners_path, :class => 'btn btn-default'
= link_to t('.edit', :default => t("helpers.links.edit")), edit_miner_path(@miner), :class => 'btn btn-default'
= link_to t('.destroy', :default => t("helpers.links.destroy")), miner_path(@miner), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'
This diff is collapsed.
...@@ -7,18 +7,18 @@ default: &default ...@@ -7,18 +7,18 @@ default: &default
development: development:
<<: *default <<: *default
database: base_sites_development database: bsa_miner
username: devuser username: devuser
password: devpassword password: devpassword
test: test:
<<: *default <<: *default
database: base_sites_test database: bsa_miner_test
username: devuser username: devuser
password: devpassword password: devpassword
production: production:
<<: *default <<: *default
database: base_sites database: bsa_miner
username: spserviceuser username: spserviceuser
password: spservicepassword password: spservicepassword
Rails.application.routes.draw do Rails.application.routes.draw do
scope '(:locale)', {locale: Regexp.new(locales.join '|')} do
devise_for :accounts devise_for :accounts
scope '/admin' do scope '/admin' do
...@@ -13,6 +12,7 @@ Rails.application.routes.draw do ...@@ -13,6 +12,7 @@ Rails.application.routes.draw do
get 'newsletters/:id/send' => :sending, as: 'send_newsletter' get 'newsletters/:id/send' => :sending, as: 'send_newsletter'
get 'newsletters/:id/resend' => :resend, as: 'resend_newsletter' get 'newsletters/:id/resend' => :resend, as: 'resend_newsletter'
end end
resources :miners
controller :admin do controller :admin do
get '/' => :index, as: :admin_index get '/' => :index, as: :admin_index
...@@ -32,6 +32,8 @@ Rails.application.routes.draw do ...@@ -32,6 +32,8 @@ Rails.application.routes.draw do
get '/' => 'front#index' get '/' => 'front#index'
get 'pages/:id' => 'front#page', as: :front_page get 'pages/:id' => 'front#page', as: :front_page
get '/miners_activity', to: 'miners#miners_activity', as: 'miners_activity'
get '/update_miner_activity', to: 'front#update_miner_activity', as: 'update_miner_activity'
root 'front#index' root 'front#index'
end
end end
class CreateMiners < ActiveRecord::Migration
def change
create_table :miners do |t|
t.string :name
t.string :status
t.string :ip_address
t.string :port
t.string :wallet_address
t.string :password
t.string :algorithm
t.string :ip_address_2
t.string :port_2
t.string :wallet_address_2
t.string :password_2
t.string :algorithm_2
t.string :hash_rate
t.datetime :last_activity
t.timestamps null: false
end
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170215151410) do ActiveRecord::Schema.define(version: 20230312235403) do
create_table "accounts", force: :cascade do |t| create_table "accounts", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false t.string "email", limit: 255, default: "", null: false
...@@ -55,8 +55,8 @@ ActiveRecord::Schema.define(version: 20170215151410) do ...@@ -55,8 +55,8 @@ ActiveRecord::Schema.define(version: 20170215151410) do
create_table "block_versions", force: :cascade do |t| create_table "block_versions", force: :cascade do |t|
t.integer "account_id", limit: 4 t.integer "account_id", limit: 4
t.boolean "active" t.boolean "active"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
end end
add_index "block_versions", ["account_id"], name: "index_block_versions_on_account_id", using: :btree add_index "block_versions", ["account_id"], name: "index_block_versions_on_account_id", using: :btree
...@@ -94,6 +94,25 @@ ActiveRecord::Schema.define(version: 20170215151410) do ...@@ -94,6 +94,25 @@ ActiveRecord::Schema.define(version: 20170215151410) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "miners", force: :cascade do |t|
t.string "name", limit: 255
t.string "status", limit: 255
t.string "ip_address", limit: 255
t.string "port", limit: 255
t.string "wallet_address", limit: 255
t.string "password", limit: 255
t.string "algorithm", limit: 255
t.string "ip_address_2", limit: 255
t.string "port_2", limit: 255
t.string "wallet_address_2", limit: 255
t.string "password_2", limit: 255
t.string "algorithm_2", limit: 255
t.string "hash_rate", limit: 255
t.datetime "last_activity"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "newsletters", force: :cascade do |t| create_table "newsletters", force: :cascade do |t|
t.string "subject", limit: 255 t.string "subject", limit: 255
t.text "text", limit: 65535 t.text "text", limit: 65535
......
...@@ -145,3 +145,8 @@ Page.create title: 'SP Studio', mode: 'link', position: 7, enabled: true, url_id ...@@ -145,3 +145,8 @@ Page.create title: 'SP Studio', mode: 'link', position: 7, enabled: true, url_id
link: 'http://studio.sp-service.com.ua' link: 'http://studio.sp-service.com.ua'
Setting.delete_all Setting.delete_all
Miner.delete_all
Miner.create name: "bsa1", ip_address: "149.28.218.119", port: "4028",
wallet_address: "439JLdAVDN1ao9fp9VUQNZHL84HrBpcXbEXQSZxyToDQjXsmEyDsqV9YZj1iuUbjLwLUTxuhwfhD53MUCeRzv59C6hDexR1",
password: "bsa1", algorithm: "randomx"
\ No newline at end of file
require 'test_helper'
class MinersControllerTest < ActionController::TestCase
setup do
@miner = miners(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:miners)
end
test "should get new" do
get :new
assert_response :success
end
test "should create miner" do
assert_difference('Miner.count') do
post :create, miner: { }
end
assert_redirected_to miner_path(assigns(:miner))
end
test "should show miner" do
get :show, id: @miner
assert_response :success
end
test "should get edit" do
get :edit, id: @miner
assert_response :success
end
test "should update miner" do
patch :update, id: @miner, miner: { }
assert_redirected_to miner_path(assigns(:miner))
end
test "should destroy miner" do
assert_difference('Miner.count', -1) do
delete :destroy, id: @miner
end
assert_redirected_to miners_path
end
end
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
require 'test_helper'
class MinerTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment