Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
028e8896
authored
May 06, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add Instance.get_activities
parent
64f5b452
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
circle/dashboard/views.py
+4
-12
circle/vm/models/instance.py
+6
-0
No files found.
circle/dashboard/views.py
View file @
028e8896
...
...
@@ -207,11 +207,7 @@ class VmDetailView(CheckedDetailView):
})
# activity data
context
[
'activities'
]
=
(
InstanceActivity
.
objects
.
filter
(
instance
=
self
.
object
,
parent
=
None
)
.
order_by
(
'-started'
)
.
select_related
(
'user'
)
.
prefetch_related
(
'children'
))
context
[
'activities'
]
=
self
.
object
.
get_activities
(
self
.
request
.
user
)
context
[
'vlans'
]
=
Vlan
.
get_objects_with_level
(
'user'
,
self
.
request
.
user
...
...
@@ -1683,9 +1679,7 @@ def vm_activity(request, pk):
if
only_status
==
"false"
:
# instance activity
context
=
{
'instance'
:
instance
,
'activities'
:
InstanceActivity
.
objects
.
filter
(
instance
=
instance
,
parent
=
None
)
.
order_by
(
'-started'
)
.
select_related
(),
'activities'
:
instance
.
get_activities
(
request
.
user
),
'ops'
:
get_operations
(
instance
,
request
.
user
),
}
...
...
@@ -2290,10 +2284,8 @@ class InstanceActivityDetail(SuperuserRequiredMixin, DetailView):
def
get_context_data
(
self
,
**
kwargs
):
ctx
=
super
(
InstanceActivityDetail
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
[
'activities'
]
=
(
self
.
object
.
instance
.
activity_log
.
filter
(
parent
=
None
)
.
order_by
(
'-started'
)
.
select_related
(
'user'
)
.
prefetch_related
(
'children'
))
ctx
[
'activities'
]
=
self
.
object
.
instance
.
get_activities
(
self
.
request
.
user
)
return
ctx
...
...
circle/vm/models/instance.py
View file @
028e8896
...
...
@@ -881,3 +881,9 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
'PENDING'
:
'icon-rocket'
,
'DESTROYED'
:
'icon-trash'
,
'MIGRATING'
:
'icon-truck'
}
.
get
(
self
.
status
,
'icon-question-sign'
)
def
get_activities
(
self
,
user
=
None
):
acts
=
(
self
.
activity_log
.
filter
(
parent
=
None
)
.
order_by
(
'-started'
)
.
select_related
(
'user'
)
.
prefetch_related
(
'children'
))
return
acts
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