diff --git a/core/static/script/panel/panel.coffee b/core/static/script/panel/panel.coffee index 488fbb7..38b9cf5 100644 --- a/core/static/script/panel/panel.coffee +++ b/core/static/script/panel/panel.coffee @@ -6,6 +6,12 @@ $ -> .success -> location.reload() + $('.btn-kill').click -> + $.post '/plugin/ssh/kill/', JSON.stringify + pid: $(@).parents('tr').data 'id' + .success -> + location.reload() + service = $ '#service' service.find 'button' .on 'click', (e) -> diff --git a/plugin/ssh/action.coffee b/plugin/ssh/action.coffee index debfaff..656f95f 100644 --- a/plugin/ssh/action.coffee +++ b/plugin/ssh/action.coffee @@ -19,4 +19,5 @@ exports.post '/kill', (req, res) -> pid = parseInt req.body.pid child_process.exec "sudo su #{req.account.username} -c 'kill #{pid}'", (err, stdout, stderr) -> throw err if err - res.json {} + app.redis.del 'rp:process_list', -> + res.json {} diff --git a/plugin/ssh/view/widget.jade b/plugin/ssh/view/widget.jade index 0b74fa3..27348dd 100644 --- a/plugin/ssh/view/widget.jade +++ b/plugin/ssh/view/widget.jade @@ -23,4 +23,4 @@ header SSH td #{(process.rss / 1024).toFixed(1)}M td #{process.cpu_per}% td - button.btn.btn-danger.btn-xs Kill + button.btn-kill.btn.btn-danger.btn-xs Kill