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
ed903e2f
Commit
ed903e2f
authored
Aug 17, 2018
by
Kento HASEGAWA
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'comm-server' into 'comm'
Merge comm-server See merge request adc2018/adc2018-system!17
parents
27ef2387
52c6bed8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
18 deletions
+29
-18
main.py
comm/server/main.py
+9
-3
pynq-manager.css
comm/server/static/css/pynq-manager.css
+3
-5
index.html
comm/server/templates/index.html
+2
-2
part_client_table.html
comm/server/templates/part_client_table.html
+3
-2
part_question_status.html
comm/server/templates/part_question_status.html
+12
-6
No files found.
comm/server/main.py
View file @
ed903e2f
...
@@ -115,6 +115,9 @@ def update_answer_list(qname):
...
@@ -115,6 +115,9 @@ def update_answer_list(qname):
answer_log
=
json
.
load
(
fp
)
answer_log
=
json
.
load
(
fp
)
questions
[
qname
][
'answers'
][
json_name
]
=
answer_log
questions
[
qname
][
'answers'
][
json_name
]
=
answer_log
if
answer_log
[
'solved'
]
==
"True"
:
is_solved
=
True
if
questions
[
qname
][
'answer'
]
==
answer_log
[
'answer'
]:
if
questions
[
qname
][
'answer'
]
==
answer_log
[
'answer'
]:
questions
[
qname
][
'best_json'
]
=
json_name
questions
[
qname
][
'best_json'
]
=
json_name
...
@@ -122,7 +125,6 @@ def update_answer_list(qname):
...
@@ -122,7 +125,6 @@ def update_answer_list(qname):
if
answer_log
[
'solver'
]
in
questions
[
qname
][
'solver'
]:
if
answer_log
[
'solver'
]
in
questions
[
qname
][
'solver'
]:
if
answer_log
[
'solved'
]
==
"True"
:
if
answer_log
[
'solved'
]
==
"True"
:
questions
[
qname
][
'solver'
][
answer_log
[
'solver'
]]
=
"Solved"
questions
[
qname
][
'solver'
][
answer_log
[
'solver'
]]
=
"Solved"
is_solved
=
True
else
:
else
:
questions
[
qname
][
'solver'
][
answer_log
[
'solver'
]]
=
"DNS"
questions
[
qname
][
'solver'
][
answer_log
[
'solver'
]]
=
"DNS"
...
@@ -133,7 +135,10 @@ def update_answer_list(qname):
...
@@ -133,7 +135,10 @@ def update_answer_list(qname):
def
before_request
():
def
before_request
():
global
app_args
global
app_args
g
.
local_mode
=
(
request
.
remote_addr
==
"127.0.0.1"
)
if
app_args
[
"force_local_mode"
]:
g
.
local_mode
=
True
else
:
g
.
local_mode
=
(
request
.
remote_addr
in
[
"127.0.0.1"
,
"::1"
])
@
app
.
route
(
"/post"
,
methods
=
[
"POST"
])
@
app
.
route
(
"/post"
,
methods
=
[
"POST"
])
def
post
():
def
post
():
...
@@ -586,7 +591,7 @@ def question_status():
...
@@ -586,7 +591,7 @@ def question_status():
update_answer_list
(
qname
)
update_answer_list
(
qname
)
qdata
=
questions
[
qname
]
qdata
=
questions
[
qname
]
return
render_template
(
"part_question_status.html"
,
qname
=
qname
,
qdata
=
qdata
,
solvers
=
clients
[
"solver"
])
return
render_template
(
"part_question_status.html"
,
qname
=
qname
,
qdata
=
qdata
,
solvers
=
clients
[
"solver"
]
,
localmode
=
g
.
local_mode
)
@
app
.
route
(
'/ws'
)
@
app
.
route
(
'/ws'
)
def
ws
():
def
ws
():
...
@@ -658,6 +663,7 @@ if __name__ == "__main__":
...
@@ -658,6 +663,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
"-a"
,
"--adccli"
,
action
=
"store"
,
type
=
str
,
default
=
"./adccli.json"
,
help
=
"Path to the ADCCLI configuration json file."
)
parser
.
add_argument
(
"-a"
,
"--adccli"
,
action
=
"store"
,
type
=
str
,
default
=
"./adccli.json"
,
help
=
"Path to the ADCCLI configuration json file."
)
parser
.
add_argument
(
"-q"
,
"--question"
,
action
=
"store"
,
type
=
str
,
default
=
"./problems"
,
help
=
"Path to the question folder."
)
parser
.
add_argument
(
"-q"
,
"--question"
,
action
=
"store"
,
type
=
str
,
default
=
"./problems"
,
help
=
"Path to the question folder."
)
parser
.
add_argument
(
"-o"
,
"--out"
,
action
=
"store"
,
type
=
str
,
default
=
"./answers"
,
help
=
"Path to the output folder."
)
parser
.
add_argument
(
"-o"
,
"--out"
,
action
=
"store"
,
type
=
str
,
default
=
"./answers"
,
help
=
"Path to the output folder."
)
parser
.
add_argument
(
"--force-local-mode"
,
action
=
"store_true"
,
default
=
False
,
help
=
"Apply local mode view to all clients."
)
parser
.
add_argument
(
"--debug"
,
action
=
"store_true"
,
default
=
False
,
help
=
"Debug mode."
)
parser
.
add_argument
(
"--debug"
,
action
=
"store_true"
,
default
=
False
,
help
=
"Debug mode."
)
args
=
vars
(
parser
.
parse_args
())
args
=
vars
(
parser
.
parse_args
())
app_args
=
args
app_args
=
args
...
...
comm/server/static/css/pynq-manager.css
View file @
ed903e2f
html
,
body
{
html
,
body
{
/*width: 800px;*/
/*height: 500px;*/
font-size
:
11px
;
font-size
:
11px
;
overflow
:
hidden
;
overflow
:
hidden
;
}
}
...
@@ -10,7 +8,7 @@ body{
...
@@ -10,7 +8,7 @@ body{
/* scrollbar settings */
/* scrollbar settings */
::-webkit-scrollbar
{
::-webkit-scrollbar
{
width
:
2
5
px
;
width
:
2
0
px
;
border
:
1px
solid
rgba
(
0
,
0
,
50
,
.2
);
border
:
1px
solid
rgba
(
0
,
0
,
50
,
.2
);
}
}
::-webkit-scrollbar-thumb
{
::-webkit-scrollbar-thumb
{
...
@@ -18,7 +16,7 @@ body{
...
@@ -18,7 +16,7 @@ body{
}
}
#question-table-wrapper
{
#question-table-wrapper
{
height
:
300px
;
height
:
calc
(
100vh
-
50px
)
;
overflow-y
:
scroll
;
overflow-y
:
scroll
;
overflow-x
:
hidden
;
overflow-x
:
hidden
;
}
}
...
@@ -45,7 +43,7 @@ body{
...
@@ -45,7 +43,7 @@ body{
}
}
#client-control-pane
{
#client-control-pane
{
height
:
330px
;
height
:
calc
(
100vh
-
20px
)
;
overflow-y
:
scroll
;
overflow-y
:
scroll
;
}
}
...
...
comm/server/templates/index.html
View file @
ed903e2f
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,9 @@
<div
id=
"wrapper"
>
<div
id=
"wrapper"
>
<div
id=
"cont
o
rol-panel-wrapper"
class=
"container-fluid"
>
<div
id=
"control-panel-wrapper"
class=
"container-fluid"
>
<div
class=
"row"
>
<div
id=
"control-panel-row"
class=
"row"
>
<div
class=
"col-5"
id=
"question-control-pane"
>
<div
class=
"col-5"
id=
"question-control-pane"
>
<h3>
問題一覧
</h3>
<h3>
問題一覧
</h3>
<span><a
href=
"/#"
id=
"view-server-status-button"
>
システム状況
</a></span>
<span><a
href=
"/#"
id=
"view-server-status-button"
>
システム状況
</a></span>
...
...
comm/server/templates/part_client_table.html
View file @
ed903e2f
...
@@ -9,12 +9,13 @@ Viewer Mode
...
@@ -9,12 +9,13 @@ Viewer Mode
{% endif %}
{% endif %}
</p>
</p>
{% if local_mode %}
<h4>
自動運営システム
</h4>
<h4>
自動運営システム
</h4>
<button
type=
"button"
class=
"btn btn-primary"
id=
"adccli-login-button"
>
Login
</button>
<button
type=
"button"
class=
"btn btn-primary"
id=
"adccli-login-button"
>
Login
</button>
<button
type=
"button"
class=
"btn btn-light"
id=
"adccli-logout-button"
>
Logout
</button>
<button
type=
"button"
class=
"btn btn-light"
id=
"adccli-logout-button"
>
Logout
</button>
<span
id=
"adccli-status"
></span>
<br
/>
<button
type=
"button"
class=
"btn btn-info"
id=
"adccli-get-all-q"
>
問題DL
</button>
<button
type=
"button"
class=
"btn btn-info"
id=
"adccli-get-all-q"
>
問題DL
</button>
<span
id=
"adccli-status"
></span>
{% endif %}
<h4>
クライアント
</h4>
<h4>
クライアント
</h4>
<table
class=
"table table-bordered"
id=
"clients-table"
>
<table
class=
"table table-bordered"
id=
"clients-table"
>
...
...
comm/server/templates/part_question_status.html
View file @
ed903e2f
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-4"
>
<div
class=
"col-4"
>
<h3>
【{{qname}}】
</h3>
<h3>
【{{qname}}】
</h3>
{% if localmode %}
<p>
<p>
<button
class=
"btn btn-primary btn-lg start-button"
type=
"button"
data-qname=
"{{qname}}"
>
Start
</button>
<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>
<button
class=
"btn btn-danger btn-lg stop-button"
type=
"button"
data-qname=
"all"
>
Stop
</button>
...
@@ -9,6 +10,9 @@
...
@@ -9,6 +10,9 @@
<button
class=
"btn btn-info btn-lg save-button"
type=
"button"
data-qname=
"{{qname}}"
>
Save
</button>
<button
class=
"btn btn-info btn-lg save-button"
type=
"button"
data-qname=
"{{qname}}"
>
Save
</button>
<button
class=
"btn btn-success btn-lg submit-button"
type=
"button"
data-qname=
"{{qname}}"
>
Up
</button>
<button
class=
"btn btn-success btn-lg submit-button"
type=
"button"
data-qname=
"{{qname}}"
>
Up
</button>
</p>
</p>
{% else %}
[View Only]
{% endif %}
</div>
</div>
<div
class=
"col-8"
>
<div
class=
"col-8"
>
<p>
処理結果
</p>
<p>
処理結果
</p>
...
@@ -44,20 +48,22 @@
...
@@ -44,20 +48,22 @@
<th>
Score
</th>
<th>
Score
</th>
</tr>
</tr>
{% for k, v in qdata.answers.items() %}
{% for k, v in qdata.answers.items() %}
{% if
qdata.best_json == k
%}
{% if
(qdata.best_json == k) and (v.answer != "")
%}
<tr
class=
"answer-detail-row submit-answer"
data-json=
"{{k}}"
data-qname=
"{{qname}}"
>
<tr
class=
"answer-detail-row submit-answer"
data-json=
"{{k}}"
data-qname=
"{{qname}}"
>
{% else %}
{% else %}
<tr
class=
"answer-detail-row"
data-json=
"{{k}}"
data-qname=
"{{qname}}"
>
<tr
class=
"answer-detail-row"
data-json=
"{{k}}"
data-qname=
"{{qname}}"
>
{% endif %}
{% endif %}
<td>
{{v.timestamp}}
</td>
<td>
{{v.timestamp}}
</td>
<td>
{{v.solver}}
</td>
<td>
{{v.solver}}
</td>
<td>
{{v.nlcheck}}
</td>
<td>
{% if v.nlcheck == -1 %}
Not solved
{% else %}
{{v.nlcheck}}
{% endif %}
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</table>
</table>
</div>
</div>
<p>
状況:
<span
id=
"solving-question-status"
>
{{qdata.status}}
</span></p>
<h4>
結果
</h4>
<p>
クライアント:
<span
id=
"solved-client"
>
{{qdata.answer.client}}
</span></p>
<pre
id=
"solved-result"
>
{{qdata.answer.answer}}
</pre>
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