From 1efe8b430488fe7baf6874d17952ad09cb6e4ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 15:56:57 +0000 Subject: [PATCH] refactor: API_UsageGraphs implements AbstractUsageGraphs --- code/web/services/API/UsageGraphs.php | 28 ++------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/code/web/services/API/UsageGraphs.php b/code/web/services/API/UsageGraphs.php index 5fc4046654..50f66b8b5d 100644 --- a/code/web/services/API/UsageGraphs.php +++ b/code/web/services/API/UsageGraphs.php @@ -6,26 +6,9 @@ class API_UsageGraphs extends Admin_AbstractUsageGraphs { function launch(): void { - global $interface; - - $stat = $_REQUEST['stat']; - if (!empty($_REQUEST['instance'])) { - $instanceName = $_REQUEST['instance']; - } else { - $instanceName = ''; - } - - $title = 'Aspen Discovery API Usage Graph'; - $interface->assign('section', 'API'); - $interface->assign('showCSVExportButton', true); - $interface->assign('graphTitle', $title); - $this->assignGraphSpecificTitle($stat); - $this->getAndSetInterfaceDataSeries($stat, $instanceName); - $interface->assign('stat', $stat); - $interface->assign('propName', 'exportToCSV'); - $title = $interface->getVariable('graphTitle'); - $this->display('../Admin/usage-graph.tpl', $title); + $this->launchGraph('API'); } + function getBreadcrumbs(): array { $breadcrumbs = []; $breadcrumbs[] = new Breadcrumb('/Admin/Home', 'Administration Home'); @@ -39,13 +22,6 @@ function getActiveAdminSection(): string { return 'system_reports'; } - function canView(): bool { - return UserAccount::userHasPermission([ - 'View Dashboards', - 'View System Reports', - ]); - } - protected function getAndSetInterfaceDataSeries($stat, $instanceName): void { global $interface;