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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
4e0f35e6
authored
Apr 29, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: support save_as with custom template name
parent
e5f5d4f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
3 deletions
+43
-3
circle/dashboard/templates/dashboard/_vm-save.html
+21
-0
circle/dashboard/views.py
+22
-3
No files found.
circle/dashboard/templates/dashboard/_vm-save.html
0 → 100644
View file @
4e0f35e6
{% extends "dashboard/operate.html" %}
{% load i18n %}
{% load sizefieldtags %}
{% block question %}
<p>
{% blocktrans %}
Choose a name for the new template.
{% endblocktrans %}
</p>
<p
class=
"text-info"
>
{{op.name}}: {{op.description}}
</p>
{% endblock %}
{% block formfields %}
<div
class=
"form-group"
>
<label
for=
"input-name"
class=
"col-sm-4"
>
{% trans "Name of template" %}
</label>
<div
class=
"col-sm-8"
>
<input
type=
"text"
value=
"{{name}}"
name=
"name"
class=
"form-control"
/>
</div>
</div>
{% endblock %}
circle/dashboard/views.py
View file @
4e0f35e6
...
@@ -513,7 +513,7 @@ class VmMigrateView(VmOperationView):
...
@@ -513,7 +513,7 @@ class VmMigrateView(VmOperationView):
template_name
=
'dashboard/_vm-migrate.html'
template_name
=
'dashboard/_vm-migrate.html'
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
ctx
=
super
(
Vm
Operation
View
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
=
super
(
Vm
Migrate
View
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
[
'nodes'
]
=
[
n
for
n
in
Node
.
objects
.
filter
(
enabled
=
True
)
ctx
[
'nodes'
]
=
[
n
for
n
in
Node
.
objects
.
filter
(
enabled
=
True
)
if
n
.
state
==
"ONLINE"
]
if
n
.
state
==
"ONLINE"
]
return
ctx
return
ctx
...
@@ -528,6 +528,26 @@ class VmMigrateView(VmOperationView):
...
@@ -528,6 +528,26 @@ class VmMigrateView(VmOperationView):
return
super
(
VmMigrateView
,
self
)
.
post
(
request
,
extra
,
*
args
,
**
kwargs
)
return
super
(
VmMigrateView
,
self
)
.
post
(
request
,
extra
,
*
args
,
**
kwargs
)
class
VmSaveView
(
VmOperationView
):
op
=
'save_as_template'
icon
=
'save'
template_name
=
'dashboard/_vm-save.html'
def
get_context_data
(
self
,
**
kwargs
):
ctx
=
super
(
VmSaveView
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
[
'name'
]
=
self
.
get_op
()
.
_rename
(
self
.
object
.
name
)
return
ctx
def
post
(
self
,
request
,
extra
=
None
,
*
args
,
**
kwargs
):
if
extra
is
None
:
extra
=
{}
name
=
self
.
request
.
POST
.
get
(
"name"
)
if
name
:
extra
[
"name"
]
=
name
return
super
(
VmSaveView
,
self
)
.
post
(
request
,
extra
,
*
args
,
**
kwargs
)
vm_ops
=
{
vm_ops
=
{
'reset'
:
VmOperationView
.
factory
(
op
=
'reset'
,
icon
=
'bolt'
),
'reset'
:
VmOperationView
.
factory
(
op
=
'reset'
,
icon
=
'bolt'
),
'deploy'
:
VmOperationView
.
factory
(
op
=
'deploy'
,
icon
=
'play'
),
'deploy'
:
VmOperationView
.
factory
(
op
=
'deploy'
,
icon
=
'play'
),
...
@@ -535,8 +555,7 @@ vm_ops = {
...
@@ -535,8 +555,7 @@ vm_ops = {
'reboot'
:
VmOperationView
.
factory
(
op
=
'reboot'
,
icon
=
'refresh'
),
'reboot'
:
VmOperationView
.
factory
(
op
=
'reboot'
,
icon
=
'refresh'
),
'shut_off'
:
VmOperationView
.
factory
(
op
=
'shut_off'
,
icon
=
'ban-circle'
),
'shut_off'
:
VmOperationView
.
factory
(
op
=
'shut_off'
,
icon
=
'ban-circle'
),
'shutdown'
:
VmOperationView
.
factory
(
op
=
'shutdown'
,
icon
=
'off'
),
'shutdown'
:
VmOperationView
.
factory
(
op
=
'shutdown'
,
icon
=
'off'
),
'save_as_template'
:
VmOperationView
.
factory
(
'save_as_template'
:
VmSaveView
,
op
=
'save_as_template'
,
icon
=
'save'
),
'destroy'
:
VmOperationView
.
factory
(
op
=
'destroy'
,
icon
=
'remove'
),
'destroy'
:
VmOperationView
.
factory
(
op
=
'destroy'
,
icon
=
'remove'
),
'sleep'
:
VmOperationView
.
factory
(
op
=
'sleep'
,
icon
=
'moon'
),
'sleep'
:
VmOperationView
.
factory
(
op
=
'sleep'
,
icon
=
'moon'
),
'wake_up'
:
VmOperationView
.
factory
(
op
=
'wake_up'
,
icon
=
'sun'
),
'wake_up'
:
VmOperationView
.
factory
(
op
=
'wake_up'
,
icon
=
'sun'
),
...
...
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