Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Oleg Borisenko
tapebackup
Commits
72e255a6
Commit
72e255a6
authored
Sep 02, 2021
by
Oleg Borisenko
Browse files
queue and logs tab
parent
495988a1
Changes
4
Hide whitespace changes
Inline
Side-by-side
tapebackup/routes.py
View file @
72e255a6
...
...
@@ -5,6 +5,7 @@ def includeme(config):
config
.
add_route
(
'targets'
,
'/targets'
)
config
.
add_route
(
'tapes'
,
'/tapes'
)
config
.
add_route
(
'files'
,
'/files'
)
config
.
add_route
(
'queue_and_log'
,
'/queue_and_log'
)
config
.
add_route
(
'library_scan'
,
'/library_scan'
)
config
.
add_route
(
'add_backup_target'
,
'/add_backup_target'
)
...
...
tapebackup/templates/base.jinja2
View file @
72e255a6
...
...
@@ -35,6 +35,7 @@
кассет
</a>
<a
href=
"/files"
class=
"navbar-menu-link"
id=
"files"
>
Обзор файлов
</a>
<!--<a href="/labnums" class="navbar-menu-link" id="labnums">Обзор лаб.номеров</a>-->
<a
href=
"/queue_and_log"
class=
"navbar-menu-link"
id=
"queue_and_log"
>
Очереди и лог
</a>
</nav>
</div>
</div>
...
...
tapebackup/templates/queue_and_log.jinja2
0 → 100644
View file @
72e255a6
{% extends "base.jinja2" %}
{% block content %}
<p>Формируется очередей: {{ new_len }}</p>
<p>Очередей в процессе бэкапа: {{ in_progress_len }}</p>
<p>Файлов в текущей очереди бэкапа: {{ in_progress_remaining_files }}</p>
<p>Завершенных очередей бэкапа: {{ finished_len }}</p>
{# нужно вставить кнопку для очистки стертых файлов#}
{# нужно вставить отфильтрованный лог и поменять уровни логирования#}
{% endblock %}
\ No newline at end of file
tapebackup/views/default.py
View file @
72e255a6
...
...
@@ -313,3 +313,45 @@ def add_to_restore_queue(request):
_query
=
((
'result'
,
e
.
detail
),
(
'color'
,
'red'
)))
return
HTTPFound
(
location
=
next_url
)
@
view_config
(
route_name
=
"queue_and_log"
,
renderer
=
'tapebackup:templates/queue_and_log.jinja2'
)
def
queue_and_log
(
request
):
try
:
backup_queues
=
request
.
dbsession
.
query
(
models
.
Batch
).
all
()
new
=
[]
in_progress
=
[]
paused
=
[]
# need this state for clearer model state and debug
finished
=
[]
# need to be very careful here: shouldn't be able to start one if there is any in less state
cancelled
=
[]
finalized
=
[]
for
i
in
backup_queues
:
if
i
.
status
==
models
.
BatchStatus
.
new
:
new
.
append
(
i
)
if
i
.
status
==
models
.
BatchStatus
.
in_progress
:
in_progress
.
append
(
i
)
if
i
.
status
==
models
.
BatchStatus
.
paused
:
paused
.
append
(
i
)
if
i
.
status
==
models
.
BatchStatus
.
finished
:
finished
.
append
(
i
)
if
i
.
status
==
models
.
BatchStatus
.
cancelled
:
cancelled
.
append
(
i
)
if
i
.
status
==
models
.
BatchStatus
.
finalized
:
finalized
.
append
(
i
)
in_progress_remaining_files
=
0
for
i
in
in_progress
:
in_progress_remaining_files
+=
len
(
i
.
files_to_backup
)
return
{
"new_len"
:
len
(
new
),
"in_progress_len"
:
len
(
in_progress
),
"paused_len"
:
len
(
paused
),
"finished_len"
:
len
(
finished
),
"cancelled_len"
:
len
(
cancelled
),
"finalized_len"
:
len
(
finalized
),
"in_progress_remaining_files"
:
in_progress_remaining_files
}
except
HTTPException
as
e
:
next_url
=
request
.
route_url
(
'files'
,
_query
=
((
'result'
,
e
.
detail
),
(
'color'
,
'red'
)))
return
HTTPFound
(
location
=
next_url
)
\ No newline at end of file
Write
Preview
Supports
Markdown
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