Skip to content

Commit

Permalink
refactor: API_UsageGraphs implements AbstractUsageGraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
Chloe070196 committed Dec 20, 2024
1 parent c60eed2 commit 1efe8b4
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions code/web/services/API/UsageGraphs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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;

Expand Down

0 comments on commit 1efe8b4

Please sign in to comment.