Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c290cae3
authored
Jun 18, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: merge same activites
parent
99df6972
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
circle/dashboard/templates/dashboard/vm-detail/_activity-timeline.html
+1
-0
circle/dashboard/views.py
+3
-2
circle/vm/models/instance.py
+17
-0
No files found.
circle/dashboard/templates/dashboard/vm-detail/_activity-timeline.html
View file @
c290cae3
...
...
@@ -6,6 +6,7 @@
</span>
<strong
{%
if
user
.
is_superuser
and
a
.
result
%}
title=
"{{ a.result }}"
{%
endif
%}
>
{% if user.is_superuser %}
<a
href=
"{{ a.get_absolute_url }}"
>
{% endif %}
{% if a.times > 1 %}({{ a.times }}x){% endif %}
{{ a.get_readable_name }}{% if user.is_superuser %}
</a>
{% endif %}
</strong>
{{ a.started|date:"Y-m-d H:i" }}{% if a.user %},
...
...
circle/dashboard/views.py
View file @
c290cae3
...
...
@@ -270,7 +270,8 @@ class VmDetailView(CheckedDetailView):
})
# activity data
context
[
'activities'
]
=
self
.
object
.
get_activities
(
self
.
request
.
user
)
context
[
'activities'
]
=
self
.
object
.
get_merged_activities
(
self
.
request
.
user
)
context
[
'vlans'
]
=
Vlan
.
get_objects_with_level
(
'user'
,
self
.
request
.
user
...
...
@@ -2103,7 +2104,7 @@ def vm_activity(request, pk):
if
only_status
==
"false"
:
# instance activity
context
=
{
'instance'
:
instance
,
'activities'
:
instance
.
get_activities
(
request
.
user
),
'activities'
:
instance
.
get_
merged_
activities
(
request
.
user
),
'ops'
:
get_operations
(
instance
,
request
.
user
),
}
...
...
circle/vm/models/instance.py
View file @
c290cae3
...
...
@@ -927,6 +927,23 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
user
=
user
)
return
acts
def
get_merged_activities
(
self
,
user
=
None
):
acts
=
list
(
self
.
get_activities
(
user
))
merged_acts
=
[]
latest
=
None
for
a
in
acts
:
if
(
latest
==
a
.
activity_code
and
merged_acts
[
-
1
]
.
result
==
a
.
result
and
(
merged_acts
[
-
1
]
.
finished
-
a
.
finished
)
.
days
<
7
):
merged_acts
[
-
1
]
.
times
+=
1
else
:
merged_acts
.
append
(
a
)
merged_acts
[
-
1
]
.
times
=
1
latest
=
a
.
activity_code
return
merged_acts
def
get_screenshot
(
self
,
timeout
=
5
):
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
return
vm_tasks
.
screenshot
.
apply_async
(
args
=
[
self
.
vm_name
],
...
...
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