webcron/public/resources/job/add.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-04-13 14:07:11 +02:00
$(function() {
initDatePickers();
initCronType();
2021-04-13 14:44:58 +02:00
initSecretInputs();
2021-04-13 19:04:32 +02:00
initDelayPattern();
2021-04-15 13:52:27 +02:00
bsCustomFileInput.init()
2021-04-13 14:07:11 +02:00
});
function initDatePickers()
{
$('#nextrunselector').datetimepicker({format: 'L LTS'});
$('#lastrunselector').datetimepicker({format: 'L LTS'});
}
function initCronType()
{
$('.crontype-item').on('click', function() {
let type = $(this).data('type');
$('.crontype').val(type);
2021-04-13 14:44:58 +02:00
$('.crontype-inputs:not(.hidden)').addClass('hidden');
$('.crontype-' + type).removeClass('hidden');
2021-04-15 13:52:27 +02:00
$('.crontype-inputs:not(.hidden) input').prop('disabled', false);
$('.crontype-inputs.hidden input').prop('disabled', true);
2021-04-13 14:44:58 +02:00
})
}
function initSecretInputs()
{
$('.addsecret-btn').on('click', function() {
$('.secret-group:first-child').clone().appendTo('.secrets').removeClass('hidden');
$('.secrets-description').removeClass('hidden');
2021-04-13 14:07:11 +02:00
})
2021-04-13 19:04:32 +02:00
}
function initDelayPattern()
{
$('.delaypattern-item').on('click', function() {
let time = $(this).data('time');
$('#delay').val(time);
})
2021-04-13 14:07:11 +02:00
}