Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bsa_miner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nazarf
bsa_miner
Commits
ba5ae175
Commit
ba5ae175
authored
Mar 18, 2023
by
nazarf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add collectioon status
parent
2b794673
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
9 deletions
+15
-9
bootstrap_and_overrides.sass
app/assets/stylesheets/admin/bootstrap_and_overrides.sass
+3
-0
miners_controller.rb
app/controllers/miners_controller.rb
+1
-1
miner.rb
app/models/miner.rb
+1
-0
_form.html.haml
app/views/miners/_form.html.haml
+1
-1
index.html.haml
app/views/miners/index.html.haml
+3
-2
miners.rake
lib/tasks/miners.rake
+6
-5
No files found.
app/assets/stylesheets/admin/bootstrap_and_overrides.sass
View file @
ba5ae175
...
...
@@ -95,3 +95,6 @@ body.admin-body
.table-error
background-color
:
#f5c6cb
!
important
.table-warning
background-color
:
#ffc107
!
important
app/controllers/miners_controller.rb
View file @
ba5ae175
...
...
@@ -79,7 +79,7 @@ class MinersController < AdminController
end
def
set_miners_miss
Miner
.
update_all
(
status:
'miss'
,
last_activity:
Time
.
now
)
Miner
.
update_all
(
status:
Miner
::
STATUSES
[
0
]
,
last_activity:
Time
.
now
)
respond_to
do
|
format
|
format
.
html
{
redirect_to
miners_url
,
notice:
'Miners was set miss'
}
format
.
json
{
head
:no_content
}
...
...
app/models/miner.rb
View file @
ba5ae175
class
Miner
<
ActiveRecord
::
Base
STATUSES
=
%w(miss work restart)
end
app/views/miners/_form.html.haml
View file @
ba5ae175
...
...
@@ -3,7 +3,7 @@
.col-sm-2
=
f
.
input
:name
.col-sm-2
=
f
.
input
:status
=
f
.
input
:status
,
collection:
Miner
::
STATUSES
.row
.col-sm-2
=
f
.
input
:ip_address
...
...
app/views/miners/index.html.haml
View file @
ba5ae175
...
...
@@ -17,8 +17,9 @@
%i
.fa.fa-close
%tbody
-
@miners
.
each
do
|
miner
|
-
failed
=
miner
.
status
!=
'work'
%tr
{
:class
=>
(
"table-error"
if
failed
)}
-
miss
=
miner
.
status
==
Miner
::
STATUSES
[
0
]
-
restart
=
miner
.
status
==
Miner
::
STATUSES
[
2
]
%tr
{
:class
=>
(
miss
?
"table-error"
:
(
restart
?
"table-warning"
:
""
)
)}
%td
=
link_to
miner
.
name
,
miner_path
(
miner
)
%td
=
miner
.
status
%td
=
miner
.
ip_address
...
...
lib/tasks/miners.rake
View file @
ba5ae175
...
...
@@ -8,12 +8,13 @@ namespace :miners do
miners
=
Miner
.
all
if
response_json
==
[]
miners
.
each
do
|
miner
|
miner
.
update
(
status:
'miss'
)
end
miners
.
update_all
(
status:
Miner
::
STATUSES
[
0
])
end
miners
.
each
do
|
miner
|
if
miner
.
status
==
Miner
::
STATUSES
[
2
]
next
end
is_work
=
false
hr_stats
=
0
check_activity_time
=
(
DateTime
.
now
-
5
.
minutes
)
...
...
@@ -28,10 +29,10 @@ namespace :miners do
end
if
is_work
miner
.
update
(
status:
'work'
,
hash_rate:
hr_stats
)
miner
.
update
(
status:
Miner
::
STATUSES
[
1
]
,
hash_rate:
hr_stats
)
else
if
last_activity_time
<=
check_activity_time
miner
.
update
(
status:
'miss'
,
last_activity:
time
,
hash_rate:
hr_stats
)
miner
.
update
(
status:
Miner
::
STATUSES
[
0
]
,
last_activity:
time
,
hash_rate:
hr_stats
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment