Saved to crontab indicator
parent
d43ffa5814
commit
c9a3ab099c
4
app.js
4
app.js
|
@ -234,9 +234,9 @@ process.on('SIGTERM', function() {
|
|||
|
||||
app.listen(app.get('port'), app.get('host'), function() {
|
||||
console.log("Node version:", process.versions.node);
|
||||
fs.access(__dirname + "/crontabs/", fs.W_OK, function(err) {
|
||||
fs.access(crontab.db_folder, fs.W_OK, function(err) {
|
||||
if(err){
|
||||
console.error("Write access to", __dirname + "/crontabs/", "DENIED.");
|
||||
console.error("Write access to", crontab.db_folder, "DENIED.");
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
|
10
crontab.js
10
crontab.js
|
@ -45,11 +45,14 @@ crontab = function(name, command, schedule, stopped, logging, mailing){
|
|||
exports.create_new = function(name, command, schedule, logging, mailing){
|
||||
var tab = crontab(name, command, schedule, false, logging, mailing);
|
||||
tab.created = new Date().valueOf();
|
||||
tab.saved = false;
|
||||
db.insert(tab);
|
||||
};
|
||||
|
||||
exports.update = function(data){
|
||||
db.update({_id: data._id}, crontab(data.name, data.command, data.schedule, null, data.logging, data.mailing));
|
||||
var tab = crontab(data.name, data.command, data.schedule, null, data.logging, data.mailing);
|
||||
tab.saved = false;
|
||||
db.update({_id: data._id}, tab);
|
||||
};
|
||||
|
||||
exports.status = function(_id, stopped){
|
||||
|
@ -156,7 +159,10 @@ exports.set_crontab = function(env_vars, callback){
|
|||
console.error(err);
|
||||
return callback(err);
|
||||
}
|
||||
else callback();
|
||||
else {
|
||||
db.update({},{$set: {saved: true}}, {multi: true});
|
||||
callback();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -69,6 +69,7 @@ function setCrontab(){
|
|||
$.get(routes.crontab, { "env_vars": $("#env_vars").val() }, function(){
|
||||
// TODO show only if success
|
||||
infoMessageBox("Successfuly set crontab file!","Information");
|
||||
location.reload();
|
||||
}).fail(function(response) {
|
||||
errorMessageBox(response.statusText,"Error");
|
||||
});
|
||||
|
|
|
@ -70,6 +70,13 @@
|
|||
<% if (crontab.name) { %>
|
||||
<%= crontab.name %>
|
||||
<a class="btn" data-toggle="tooltip" data-placement="right" title="<%= crontab._id %>"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> </a>
|
||||
<% if (crontab.saved) { %>
|
||||
<span class="glyphicon glyphicon-floppy-saved" aria-hidden="true"></span>
|
||||
<% } else { %>
|
||||
<a data-toggle="tooltip" data-placement="right" title="'Save to crontab' to deploy">
|
||||
<span class="glyphicon glyphicon-floppy-remove" aria-hidden="true"></span>
|
||||
</a>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<%= crontab._id %>
|
||||
<% } %>
|
||||
|
@ -85,11 +92,11 @@
|
|||
<a class="btn btn-primary btn-danger" data-toggle="tooltip" data-placement="left" title="stderr" href="<%= JSON.parse(routes).logger + '?id=' + crontab._id %>" target="_blank"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span></a>
|
||||
<a class="btn btn-primary" data-toggle="tooltip" data-placement="left" title="stdout" href="<%= JSON.parse(routes).stdout + '?id=' + crontab._id %>" target="_blank"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span></a>
|
||||
<% } %>
|
||||
<a class="btn btn-info" onclick="runJob('<%= crontab._id %>')"><span class="glyphicon glyphicon-play" aria-hidden="true"></span> Run</a>
|
||||
<a class="btn btn-info" onclick="runJob('<%= crontab._id %>')"><span class="glyphicon glyphicon-play" aria-hidden="true"></span> Run now</a>
|
||||
<a class="btn btn-primary" onclick="editJob('<%= crontab._id %>')"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit</a>
|
||||
<a class="btn btn-info" onclick="stopJob('<%= crontab._id %>')"><span class="glyphicon glyphicon-stop" aria-hidden="true"></span> Stop</a>
|
||||
<a class="btn btn-info" onclick="stopJob('<%= crontab._id %>')"><span class="glyphicon glyphicon-stop" aria-hidden="true"></span> Disable</a>
|
||||
<% } else { %>
|
||||
<a class="btn btn-info" onclick="startJob('<%= crontab._id %>')"><span class="glyphicon glyphicon-play" aria-hidden="true"></span> Start</a>
|
||||
<a class="btn btn-info" onclick="startJob('<%= crontab._id %>')"><span class="glyphicon glyphicon-play" aria-hidden="true"></span> Enable</a>
|
||||
<% } %>
|
||||
<a class="btn btn-danger" onclick="deleteJob('<%= crontab._id %>')"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue