Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clowdflows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Shakour
clowdflows
Commits
71a426c1
Commit
71a426c1
authored
Nov 04, 2013
by
Janez K
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reset widget dela tko k more
parent
0aaf1463
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
10 deletions
+25
-10
workflows/models.py
workflows/models.py
+20
-0
workflows/static/js/new-script.js
workflows/static/js/new-script.js
+4
-9
workflows/views.py
workflows/views.py
+1
-1
No files found.
workflows/models.py
View file @
71a426c1
...
...
@@ -565,6 +565,26 @@ class Widget(models.Model):
self
.
running
=
False
self
.
save
()
def
reset_descendants
(
self
):
#find all descendants and reset them as well
widgets
=
self
.
workflow
.
widgets
.
prefetch_related
(
'inputs'
,
'outputs'
,
'inputs__connections'
,
'outputs__connections'
,
'outputs__connections__input'
,
'inputs__connections__output'
)
widgets_dict
=
{}
widgets_that_need_reset
=
set
([
self
.
pk
,])
current_widgets_that_need_reset
=
set
([
self
.
pk
,])
for
w
in
widgets
:
widgets_dict
[
w
.
pk
]
=
w
while
len
(
current_widgets_that_need_reset
)
>
0
:
new_widgets_that_need_reset
=
set
()
for
w_id
in
current_widgets_that_need_reset
:
for
o
in
widgets_dict
[
w_id
].
outputs
.
all
():
for
c
in
o
.
connections
.
all
():
new_widgets_that_need_reset
.
add
(
c
.
input
.
widget_id
)
widgets_that_need_reset
.
add
(
c
.
input
.
widget_id
)
current_widgets_that_need_reset
=
new_widgets_that_need_reset
for
w
in
widgets_that_need_reset
:
widgets_dict
[
w
].
reset
(
False
)
return
widgets_that_need_reset
def
run_post
(
self
,
request
):
if
not
self
.
ready_to_run
():
raise
WidgetException
(
"The prerequisites for running this widget have not been met."
)
...
...
workflows/static/js/new-script.js
View file @
71a426c1
...
...
@@ -460,12 +460,7 @@ function runTree(widgetId) {
if
(
executed
[
widgetId
])
//first reset widget and then run tree
$
.
post
(
url
[
'
reset-widget
'
],
{
'
widget_id
'
:
widgetId
},
function
(
data
)
{
unfinishOne
(
widgetId
)
for
(
c
in
connections
)
{
if
(
connections
[
c
].
outputWidget
==
widgetId
)
{
resetWidget
(
connections
[
c
].
inputWidget
);
}
}
unfinish
(
widgetId
)
runTreeRec
(
widgetId
);
},
'
json
'
);
else
...
...
@@ -487,12 +482,12 @@ function runTreeRec(widgetId) {
function
resetWidget
(
widgetId
)
{
$
.
post
(
url
[
'
reset-widget
'
],
{
'
widget_id
'
:
widgetId
},
function
(
data
)
{
unfinish
One
(
widgetId
)
for
(
c
in
connections
)
{
unfinish
(
widgetId
)
/*
for (c in connections) {
if (connections[c].outputWidget==widgetId) {
resetWidget(connections[c].inputWidget);
}
}
}
*/
},
'
json
'
);
}
...
...
workflows/views.py
View file @
71a426c1
...
...
@@ -914,7 +914,7 @@ def reset_widget(request):
w
=
get_object_or_404
(
Widget
,
pk
=
request
.
POST
[
'widget_id'
])
if
(
w
.
workflow
.
user
==
request
.
user
):
try
:
w
.
reset
(
False
)
w
.
reset
_descendants
(
)
data
=
simplejson
.
dumps
({
'status'
:
'ok'
,
'message'
:
'Widget '
+
w
.
name
+
' reset successfully.'
})
mimetype
=
'application/javascript'
except
Exception
,
e
:
...
...
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