Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
cb2d9cff
authored
Apr 05, 2016
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
views: add basic json vm-detail
parent
13207ada
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
circle/dashboard/views/vm.py
+13
-0
No files found.
circle/dashboard/views/vm.py
View file @
cb2d9cff
...
...
@@ -104,6 +104,19 @@ class VmDetailView(GraphMixin, CheckedDetailView):
template_name
=
"dashboard/vm-detail.html"
model
=
Instance
def
get
(
self
,
*
args
,
**
kwargs
):
if
self
.
request
.
is_ajax
():
return
JsonResponse
(
self
.
get_json_data
())
else
:
return
super
(
VmDetailView
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
get_json_data
(
self
):
instance
=
self
.
get_object
()
return
{
"status"
:
instance
.
status
,
"host"
:
instance
.
get_connect_host
(),
"port"
:
instance
.
get_connect_port
(),
"password"
:
instance
.
pw
}
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
VmDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
instance
=
context
[
'instance'
]
...
...
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