Skip to content

Commit

Permalink
add save process
Browse files Browse the repository at this point in the history
  • Loading branch information
A1Gard committed Nov 16, 2017
1 parent c638e43 commit bb2f1f3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
27 changes: 26 additions & 1 deletion pm2panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ app.post('/addProccess', function (req, res) {
res.end();

} else {

// get json list from the json
if (req.body.path === undefined) {
res.writeHead(302, {
Expand Down Expand Up @@ -191,6 +191,31 @@ app.get('/delete', function (req, res) {
}
});

app.get('/dump', function (req, res) {
// send json header
if (!req.session.islogin) {
res.writeHead(302, {
'Location': '/login'
});
res.end();

} else {
// check id exits
// restart the process
exec("pm2 save", (error, stdout, stderr) => {
res.writeHead(302, {
'Location': '/'
});
console.log(error);
console.log(stdout);
console.log(stderr);
res.end();
});


}
});

app.get('/folder', function (req, res) {

if (!req.session.islogin) {
Expand Down
6 changes: 6 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ <h2>
<div class="button button-primary" id="frmCrtl">
Show/Hide add prcocess form
</div>
&nbsp;
&nbsp;
<a href="/dump" class="button">
Save current process
</a>
<br />


Expand All @@ -80,6 +85,7 @@ <h2>
<input type="text" name="path" v-model="choosedPath" />
</label>
<input type="submit" value="Add process now" class="button" />

</div>
<div class="column">
list of files:
Expand Down

0 comments on commit bb2f1f3

Please sign in to comment.