make selection of config-services downloadable as json e.g. for config-services script

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-04-30 11:26:39 +02:00
parent 422950d386
commit c7226a16d2
3 changed files with 31 additions and 0 deletions

View File

@@ -104,7 +104,9 @@
{{ lng('admin.configfiles.recommendednote') }}
</div>
<div class="col-12 col-md-6 text-end">
<input type="hidden" name="dist" value="{{ distribution }}" />
<button type="button" class="btn btn-outline-secondary" id="selectRecommendedConfig">{{ lng('admin.configfiles.selectrecommended') }}</button>
<button type="button" class="btn btn-outline-secondary" id="downloadSelectionAsJson"><i class="fa-solid fa-download"></i> {{ lng('admin.configfiles.downloadselected') }}</button>
<button type="submit" class="btn btn-primary">{{ lng('update.proceed') }}</button>
</div>
</div>

View File

@@ -12,6 +12,18 @@ $(function () {
})
});
/*
* export/download JSON file (e.g. for usage with config-services)
*/
$('#downloadSelectionAsJson').on('click', function () {
var formData = $(this).closest('form').serialize();
window.location = "lib/ajax.php?action=getConfigJsonExport&" + formData;
});
/*
* open modal window to show selected config-commands/files
* for selected daemon
*/
$('.show-config').on('click', function () {
var distro = $(this).data('dist');
var section = $(this).data('section');