Add textarea for environment variables

pull/4/head
Fantoccini 9 years ago
parent ed99f4b541
commit 0c6cc5512a

@ -69,7 +69,7 @@ app.post(routes.remove, function(req, res) {
res.end();
})
app.get(routes.crontab, function(req, res) {
crontab.set_crontab();
crontab.set_crontab(req.query.env_vars);
res.end();
})

@ -50,9 +50,12 @@ exports.crontabs = function(callback){
callback(docs);
});
}
exports.set_crontab = function(){
exports.set_crontab = function(env_vars){
exports.crontabs( function(tabs){
var crontab_string = "";
if (env_vars) {
crontab_string = env_vars + "\n";
}
tabs.forEach(function(tab){
if(!tab.stopped){
if (tab.logging && tab.logging == "true"){

@ -46,7 +46,7 @@ function startJob(_id){
function setCrontab(){
messageBox("<p> Do you want to set the crontab file? </p>", "Confirm crontab setup", null, null, function(){
$.get(routes.crontab, {}, function(){
$.get(routes.crontab, { "env_vars": $("#env_vars").val() }, function(){
// TODO show only if success
infoMessageBox("Successfuly set crontab file!","Information");
});
@ -155,4 +155,3 @@ function set_schedule(){
job_string();
}
// popup management ends

@ -20,7 +20,10 @@
<% include navbar %>
<div class="container">
<h2>Cronjobs</h2>
<div class="form-group">
<label for="env_vars">Environment Variables:</label>
<textarea class="form-control" rows="3" id="env_vars" placeholder="# Please set PATH, MAILTO, HOME... here"></textarea>
</div>
<a class="btn btn-primary" onclick="newJob();"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> New</a>
<a class="btn btn-info" onclick="doBackup();"><span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span> Backup</a>
<form id="import_form" enctype="multipart/form-data" action="<%= JSON.parse(routes).import %>" method="post" style="display:none">

Loading…
Cancel
Save