Added delay patterns

This commit is contained in:
Jeroen De Meerleer 2021-04-13 19:04:32 +02:00
parent eff3429f43
commit d2e6812011
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 25 additions and 1 deletions

View File

@ -2,6 +2,7 @@ $(function() {
initDatePickers(); initDatePickers();
initCronType(); initCronType();
initSecretInputs(); initSecretInputs();
initDelayPattern();
}); });
function initDatePickers() function initDatePickers()
@ -27,3 +28,12 @@ function initSecretInputs()
$('.secrets-description').removeClass('hidden'); $('.secrets-description').removeClass('hidden');
}) })
} }
function initDelayPattern()
{
$('.delaypattern-item').on('click', function() {
let time = $(this).data('time');
$('#delay').val(time);
})
}

View File

@ -11,8 +11,22 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="name">Delay (in seconds)</label> <label for="name">Delay (in seconds)</label>
<div class="input-group">
<div class="dropdown input-group-prepend">
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="delayButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Patterns
</button>
<div class="dropdown-menu" aria-labelledby="delayButton">
<a class="dropdown-item delaypattern-item" href="#" data-time="60">Every minute</a>
<a class="dropdown-item delaypattern-item" href="#" data-time="3600">Every hour</a>
<a class="dropdown-item delaypattern-item" href="#" data-time="86400">Every day</a>
<a class="dropdown-item delaypattern-item" href="#" data-time="604800">Every week</a>
<a class="dropdown-item delaypattern-item" href="#" data-time="2419200">Every 4 weeks</a>
</div>
</div>
<input type="number" class="form-control" id="delay" name="delay"> <input type="number" class="form-control" id="delay" name="delay">
</div> </div>
</div>
<div class="mb-3"> <div class="mb-3">
<label for="nextrun">Next run</label> <label for="nextrun">Next run</label>
<input type="text" autocomplete="off" id="nextrunselector" class="form-control datetimepicker-input" data-target="#nextrunselector" data-toggle="datetimepicker" name="nextrun"> <input type="text" autocomplete="off" id="nextrunselector" class="form-control datetimepicker-input" data-target="#nextrunselector" data-toggle="datetimepicker" name="nextrun">