Skip to content

Commit 4c2fcec

Browse files
author
孙健
committed
fix console stop / start
1 parent 158c9dc commit 4c2fcec

File tree

5 files changed

+24
-39
lines changed

5 files changed

+24
-39
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'nlpcn.org'
2-
version '2.1.2'
2+
version '2.1.3'
33

44
apply plugin: 'java'
55
apply plugin: 'war'

src/main/java/org/nlpcn/jcoder/controller/ApiAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,9 @@ public Object stopApi(@Param("json") String jsonTask) {
473473

474474
String taskName = null;
475475
try {
476-
LOG.info(taskName + " will be to stop ! ");
477476
JSONObject json = JSONObject.parseObject(jsonTask);
478-
taskName = json.getString("task.name") + "@" + "0@" + Mvcs.getReq().getRemoteAddr();
477+
taskName = JavaSourceUtil.findClassName(json.getString("task.code")) + "@" + "0@" + Mvcs.getReq().getRemoteAddr();
478+
LOG.info(taskName + " will be to stop ! ");
479479
ThreadManager.stop(taskName);
480480
LOG.info(taskName + " stoped ! ");
481481
return StaticValue.OK;

src/main/webapp/js/console_socket.js

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -154,43 +154,28 @@ $(function() {
154154
});
155155

156156
$("#script_start").click(function() {
157-
if (status) {
158-
$("#code").val(editor.getValue());
159-
var json = $("#taskForm").serializeJson()
160-
if (status) {
161-
$.post("/run_api", {
162-
"json" : JSON.stringify(json)
163-
}, function(result) {
164-
content.append("<p>" + JSON.stringify(result) + "</p>");
165-
}, "json").error(function() {
166-
content.append("<p>run err !</p>");
167-
});
168-
} else {
169-
content.append("<p>server has beein break ! please reconnect</p>");
170-
}
171-
} else {
172-
content.append("<p>server has beein break ! please reconnect</p>");
173-
}
157+
$("#code").val(editor.getValue());
158+
var json = $("#taskForm").serializeJson();
159+
160+
$.post("/run_api", {
161+
"json" : JSON.stringify(json)
162+
}, function(result) {
163+
content.append("<p>" + JSON.stringify(result) + "</p>");
164+
}, "json").error(function() {
165+
content.append("<p>run err !</p>");
166+
});
174167
});
175168

176169
$("#script_stop").click(function() {
177-
if (status) {
178-
$("#code").val(editor.getValue());
179-
var json = $("#taskForm").serializeJson()
180-
if (status) {
181-
$.post("/stop_api", {
182-
"json" : JSON.stringify(json)
183-
}, function(result) {
184-
content.append("<p>" + JSON.stringify(result) + "</p>");
185-
}, "json").error(function() {
186-
content.append("<p>run err !" + JSON.stringify(result) + "</p>");
187-
});
188-
} else {
189-
content.append("<p>server has beein break ! please reconnect</p>");
190-
}
191-
} else {
192-
content.append("<p>server has beein break ! please reconnect</p>");
193-
}
170+
$("#code").val(editor.getValue());
171+
var json = $("#taskForm").serializeJson();
172+
$.post("/stop_api", {
173+
"json" : JSON.stringify(json)
174+
}, function(result) {
175+
content.append("<p>" + JSON.stringify(result) + "</p>");
176+
}, "json").error(function() {
177+
content.append("<p>run err !" + JSON.stringify(result) + "</p>");
178+
});
194179
});
195180

196181
$("#socket_connected").click(function() {

src/main/webapp/task/task_editor.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<div class="box-inner">
3131
<div class="box-header well " data-original-title="">
3232
<h2>
33-
<i class="glyphicon glyphicon-edit"></i> Code Platform
33+
<i class="glyphicon glyphicon-edit"></i> Code Platform - ${task.name }.java
3434
</h2>
3535
<i class="col-md-6"></i>
3636
<h2 class="progress" class="col-md-4">

src/main/webapp/thread_list.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<td class="center">${task.runStatus}</td>
125125
<td class="center">${task.message}</td>
126126
<td class="center">
127-
<a class="btn btn-info" href="${ctx }/task/editor/${task.groupId }/${task.name}"> <i class="glyphicon glyphicon-edit icon-white"></i> Edit </a>
127+
<a class="btn btn-info" href="${ctx }/task/editor/${task.groupId }/${task.id}"> <i class="glyphicon glyphicon-edit icon-white"></i> Edit </a>
128128
</td>
129129
</tr>
130130
</c:if>

0 commit comments

Comments
 (0)