mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Graphing cleanup (#14492)
* WIP * Fixes and cleanups * Move parseAtTime to Time util class * lint fixes, explicitly define variables * Style fixes
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Enum\ImageFormat;
|
||||
use LibreNMS\Exceptions\RrdGraphException;
|
||||
use LibreNMS\Util\Debug;
|
||||
use LibreNMS\Util\Graph;
|
||||
@@ -33,20 +34,20 @@ class GraphController extends Controller
|
||||
}
|
||||
|
||||
$headers = [
|
||||
'Content-type' => $graph->imageType(),
|
||||
'Content-type' => $graph->contentType(),
|
||||
];
|
||||
|
||||
if ($output == 'base64') {
|
||||
return response($graph, 200, $headers);
|
||||
}
|
||||
|
||||
return response($graph->data(), 200, $headers);
|
||||
return response($graph->data, 200, $headers);
|
||||
} catch (RrdGraphException $e) {
|
||||
if (Debug::isEnabled()) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return response($e->generateErrorImage(), 500, ['Content-type' => Graph::imageType()]);
|
||||
return response($e->generateErrorImage(), 500, ['Content-type' => ImageFormat::forGraph()->contentType()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user