mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
System: Trust: Revocation - work in progress for https://github.com/opnsense/core/issues/7248
move download_content() to opnsense.js for easier re-use.
This commit is contained in:
parent
d48dd6f9a3
commit
0591ff28a6
@ -26,21 +26,6 @@
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
function download_content(payload, filename, file_type) {
|
||||
let a_tag = $('<a></a>').attr('href','data:application/json;charset=utf8,' + encodeURIComponent(payload))
|
||||
.attr('download', filename).appendTo('body');
|
||||
|
||||
a_tag.ready(function() {
|
||||
if ( window.navigator.msSaveOrOpenBlob && window.Blob ) {
|
||||
var blob = new Blob( [ payload ], { type: file_type } );
|
||||
navigator.msSaveOrOpenBlob( blob, 'aliases.json' );
|
||||
} else {
|
||||
a_tag.get(0).click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function () {
|
||||
let grid_cert = $("#grid-cert").UIBootgrid({
|
||||
search:'/api/trust/ca/search/',
|
||||
|
||||
@ -26,21 +26,6 @@
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
function download_content(payload, filename, file_type) {
|
||||
let a_tag = $('<a></a>').attr('href','data:application/json;charset=utf8,' + encodeURIComponent(payload))
|
||||
.attr('download', filename).appendTo('body');
|
||||
|
||||
a_tag.ready(function() {
|
||||
if ( window.navigator.msSaveOrOpenBlob && window.Blob ) {
|
||||
var blob = new Blob( [ payload ], { type: file_type } );
|
||||
navigator.msSaveOrOpenBlob( blob, 'aliases.json' );
|
||||
} else {
|
||||
a_tag.get(0).click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function () {
|
||||
let grid_cert = $("#grid-cert").UIBootgrid({
|
||||
search:'/api/trust/cert/search/',
|
||||
|
||||
@ -332,3 +332,23 @@ function watchScrollPosition() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple wrapper to download a file received via an api endpoint
|
||||
* @param {*} payload
|
||||
* @param {*} filename
|
||||
* @param {*} file_type
|
||||
*/
|
||||
function download_content(payload, filename, file_type) {
|
||||
let a_tag = $('<a></a>').attr('href','data:application/json;charset=utf8,' + encodeURIComponent(payload))
|
||||
.attr('download', filename).appendTo('body');
|
||||
|
||||
a_tag.ready(function() {
|
||||
if ( window.navigator.msSaveOrOpenBlob && window.Blob ) {
|
||||
var blob = new Blob( [ payload ], { type: file_type } );
|
||||
navigator.msSaveOrOpenBlob( blob, filename);
|
||||
} else {
|
||||
a_tag.get(0).click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user