Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
adc2018-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
adc2018
adc2018-system
Commits
cf46e101
Commit
cf46e101
authored
Aug 14, 2018
by
Kento HASEGAWA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a stop button
parent
48485307
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletion
+45
-1
main.py
comm/server/main.py
+16
-0
pynq-manager.js
comm/server/static/js/pynq-manager.js
+28
-1
part_question_status.html
comm/server/templates/part_question_status.html
+1
-0
No files found.
comm/server/main.py
View file @
cf46e101
...
...
@@ -262,6 +262,22 @@ def solve_questions(qname, qstr):
return
res
@
app
.
route
(
"/stop"
,
methods
=
[
"POST"
])
def
stop
():
_client
=
request
.
form
[
"client"
]
_url
=
_client
+
"/stop"
try
:
r
=
requests
.
get
(
_url
)
client_res
=
json
.
loads
(
r
.
text
)[
"status"
]
except
Exception
as
e
:
client_res
=
"Connection error"
sys
.
stderr
.
write
(
str
(
e
)
+
"
\n
"
)
res
=
{
"status"
:
client_res
}
return
json
.
dumps
(
res
)
@
app
.
route
(
"/status"
,
methods
=
[
"POST"
])
def
get_status
():
_client
=
request
.
form
[
"client"
]
...
...
comm/server/static/js/pynq-manager.js
View file @
cf46e101
...
...
@@ -74,7 +74,31 @@ var PynqManager = (function(){
_p
.
sendStop
=
function
(){
console
.
log
(
"Not implemented!"
);
for
(
var
key
in
this
.
clients
){
(
function
(
_key
,
_client
){
var
statusObj
=
$
(
".client-status-row[data-cname='"
+
_key
+
"']"
).
find
(
".client-status-value"
).
eq
(
0
)
$
.
ajax
({
type
:
"POST"
,
url
:
"/stop"
,
dataType
:
"json"
,
data
:
{
"client"
:
_client
}
}).
done
(
function
(
res
){
var
answer
=
res
[
"status"
];
var
message
=
""
;
if
(
answer
)
{
message
=
answer
;
}
else
{
message
=
"Illegal response: "
+
res
;
}
statusObj
.
text
(
message
);
}).
fail
(
function
(){
statusObj
.
text
(
"Connection error"
);
});
})(
key
,
this
.
clients
[
key
]);
}
}
...
...
@@ -139,6 +163,9 @@ $(function(){
var
qname
=
$
(
this
).
data
(
"qname"
);
pm
.
sendQuestion
(
qname
,
after
=
refresh_question_table
);
});
$
(
"#client-control-pane"
).
find
(
".stop-button"
).
eq
(
0
).
click
(
function
(){
pm
.
sendStop
();
});
});
}
...
...
comm/server/templates/part_question_status.html
View file @
cf46e101
...
...
@@ -3,6 +3,7 @@
<h3>
【{{qname}}】
</h3>
<p>
<button
class=
"btn btn-primary btn-lg start-button"
type=
"button"
data-qname=
"{{qname}}"
>
Start
</button>
<button
class=
"btn btn-danger btn-lg stop-button"
type=
"button"
data-qname=
"all"
>
Stop
</button>
</p>
</div>
<div
class=
"col-8"
>
...
...
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