Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
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
Show 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):
...
@@ -207,11 +207,7 @@ class VmDetailView(CheckedDetailView):
})
})
# activity data
# activity data
context
[
'activities'
]
=
(
context
[
'activities'
]
=
self
.
object
.
get_activities
(
self
.
request
.
user
)
InstanceActivity
.
objects
.
filter
(
instance
=
self
.
object
,
parent
=
None
)
.
order_by
(
'-started'
)
.
select_related
(
'user'
)
.
prefetch_related
(
'children'
))
context
[
'vlans'
]
=
Vlan
.
get_objects_with_level
(
context
[
'vlans'
]
=
Vlan
.
get_objects_with_level
(
'user'
,
self
.
request
.
user
'user'
,
self
.
request
.
user
...
@@ -1683,9 +1679,7 @@ def vm_activity(request, pk):
...
@@ -1683,9 +1679,7 @@ def vm_activity(request, pk):
if
only_status
==
"false"
:
# instance activity
if
only_status
==
"false"
:
# instance activity
context
=
{
context
=
{
'instance'
:
instance
,
'instance'
:
instance
,
'activities'
:
InstanceActivity
.
objects
.
filter
(
'activities'
:
instance
.
get_activities
(
request
.
user
),
instance
=
instance
,
parent
=
None
)
.
order_by
(
'-started'
)
.
select_related
(),
'ops'
:
get_operations
(
instance
,
request
.
user
),
'ops'
:
get_operations
(
instance
,
request
.
user
),
}
}
...
@@ -2290,10 +2284,8 @@ class InstanceActivityDetail(SuperuserRequiredMixin, DetailView):
...
@@ -2290,10 +2284,8 @@ class InstanceActivityDetail(SuperuserRequiredMixin, DetailView):
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
ctx
=
super
(
InstanceActivityDetail
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
=
super
(
InstanceActivityDetail
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
[
'activities'
]
=
(
ctx
[
'activities'
]
=
self
.
object
.
instance
.
get_activities
(
self
.
object
.
instance
.
activity_log
.
filter
(
parent
=
None
)
.
self
.
request
.
user
)
order_by
(
'-started'
)
.
select_related
(
'user'
)
.
prefetch_related
(
'children'
))
return
ctx
return
ctx
...
...
circle/vm/models/instance.py
View file @
028e8896
...
@@ -881,3 +881,9 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -881,3 +881,9 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
'PENDING'
:
'icon-rocket'
,
'PENDING'
:
'icon-rocket'
,
'DESTROYED'
:
'icon-trash'
,
'DESTROYED'
:
'icon-trash'
,
'MIGRATING'
:
'icon-truck'
}
.
get
(
self
.
status
,
'icon-question-sign'
)
'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