forked from Aspen-Discovery/aspen-discovery
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move API usage files to API folders
Keeping the dashboard and usage graph service files for APIs in the Admin folder would have created the need for additional parameters and control flow logic in the exportUsageData method which both Admin usage data CSV export and API usage data CSV export relied on. Additionally, the resulting class names do not follow the same naming conventions (<serviceName>_Dashboard and <serviceName>_UsageGraphs) as the rest of Aspen. This refactor provides a separation of concerns by replacing services/Admin/APIUsageDashboard.php and services/Admin/APIUsageGraphs.php with services/API/Dashboard.php and services/API/UsageGraphs. In doing so, it also fixes an issue where only the csv file for 'runPendingDatabaseUpdates' could be downloaded. Test plan: 1) Log in to Aspen as an Admin 2) In Aspen Administration > System Reports, open API Usage Dashboard. Notice the title of the links match their section and header. 3) For each API and for each of their stats, open their usage graph page. Notice that the data matches the data on the dashboard, both in the raw data table and on the graph. Also notice that the tilte of the graph match its section and header in the dashboard. 4) Click 'Export to CSV' (bottom left of the page) to check that the downloaded file's contents match those of the raw data table and that its name includes the stat name. Run through this plan before applying the patch, and notice that the CSV export only works for 'runPendingDatabaseUpdates'. After the patch, it is expected to work for any usage graph.
- Loading branch information
1 parent
f5746df
commit 1d4edb6
Showing
6 changed files
with
19 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
require_once ROOT_DIR . '/JSON_Action.php'; | ||
|
||
class API_AJAX extends JSON_Action { | ||
public function exportUsageData() { | ||
require_once ROOT_DIR . '/services/API/UsageGraphs.php'; | ||
$aspenUsageGraph = new API_UsageGraphs(); | ||
$aspenUsageGraph->buildCSV(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters