Implement monitor configuration download using Blob API

This way we no longer need round trip to the server.

Issue #12398

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2017-01-07 15:34:56 +01:00
parent 4ba0eb88d7
commit f2c5ecf311
2 changed files with 6 additions and 24 deletions

View File

@ -9,14 +9,7 @@
define('PMA_MINIMUM_COMMON', true);
require_once 'libraries/common.inc.php';
if (isset($_REQUEST['monitorconfig'])) {
/* For monitor chart config export */
PMA_downloadHeader('monitor.cfg', 'application/json; charset=UTF-8');
header('X-Content-Type-Options: nosniff');
echo urldecode($_REQUEST['monitorconfig']);
} else if (isset($_REQUEST['import'])) {
if (isset($_REQUEST['import'])) {
/* For monitor chart config import */
header('Content-Type: application/json; charset=UTF-8');
header('X-Content-Type-Options: nosniff');

View File

@ -569,22 +569,11 @@ AJAX.registerOnload('server_status_monitor.js', function () {
monitorCharts: gridCopy,
monitorSettings: monitorSettings
};
$('<form />', {
"class": "disableAjax",
method: "post",
action: "file_echo.php" + PMA_commonParams.get('common_query') + "&filename=1",
style: "display:none;"
})
.append(
$('<input />', {
type: "hidden",
name: "monitorconfig",
value: JSON.stringify(exportData)
})
)
.appendTo('body')
.submit()
.remove();
var blob = new Blob([JSON.stringify(exportData)], {type: "application/octet-stream"});
var url = window.URL.createObjectURL(blob);
window.location.href = url;
window.URL.revokeObjectURL(url);
});
$('a[href="#importMonitorConfig"]').click(function (event) {