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
6d4024aa
authored
Aug 19, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: allow selecting new state on forced status update
fixes
#255
parent
3ab3e26a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
+7
-1
circle/dashboard/forms.py
+4
-0
circle/dashboard/views.py
+3
-1
No files found.
circle/dashboard/forms.py
View file @
6d4024aa
...
@@ -720,13 +720,17 @@ class VmStateChangeForm(forms.Form):
...
@@ -720,13 +720,17 @@ class VmStateChangeForm(forms.Form):
"Forcibly interrupt all running activities."
),
"Forcibly interrupt all running activities."
),
help_text
=
_
(
"Set all activities to finished state, "
help_text
=
_
(
"Set all activities to finished state, "
"but don't interrupt any tasks."
))
"but don't interrupt any tasks."
))
new_state
=
forms
.
ChoiceField
(
Instance
.
STATUS
,
label
=
_
(
"New status"
))
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
show_interrupt
=
kwargs
.
pop
(
'show_interrupt'
)
show_interrupt
=
kwargs
.
pop
(
'show_interrupt'
)
status
=
kwargs
.
pop
(
'status'
)
super
(
VmStateChangeForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
VmStateChangeForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
if
not
show_interrupt
:
if
not
show_interrupt
:
self
.
fields
[
'interrupt'
]
.
widget
=
HiddenInput
()
self
.
fields
[
'interrupt'
]
.
widget
=
HiddenInput
()
self
.
fields
[
'new_state'
]
.
initial
=
status
@property
@property
def
helper
(
self
):
def
helper
(
self
):
...
...
circle/dashboard/views.py
View file @
6d4024aa
...
@@ -946,9 +946,11 @@ class VmStateChangeView(FormOperationMixin, VmOperationView):
...
@@ -946,9 +946,11 @@ class VmStateChangeView(FormOperationMixin, VmOperationView):
def
get_form_kwargs
(
self
):
def
get_form_kwargs
(
self
):
inst
=
self
.
get_op
()
.
instance
inst
=
self
.
get_op
()
.
instance
active_activities
=
InstanceActivity
.
objects
.
filter
(
finished__isnull
=
True
,
instance
=
inst
)
show_interrupt
=
active_activities
.
exists
()
show_interrupt
=
active_activities
.
exists
()
val
=
super
(
VmStateChangeView
,
self
)
.
get_form_kwargs
()
val
=
super
(
VmStateChangeView
,
self
)
.
get_form_kwargs
()
val
.
update
({
'show_interrupt'
:
show_interrupt
})
val
.
update
({
'show_interrupt'
:
show_interrupt
,
'status'
:
inst
.
status
})
return
val
return
val
...
...
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