Skip to content

Commit

Permalink
Merge branch 'xdmod8.5' into addChartLinkButton
Browse files Browse the repository at this point in the history
  • Loading branch information
mkzia authored Jul 12, 2019
2 parents 03f4914 + e0f06e4 commit e4acf8c
Show file tree
Hide file tree
Showing 16 changed files with 568 additions and 11 deletions.
2 changes: 1 addition & 1 deletion classes/ETL/Configuration/EtlConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ protected function registerAction(stdClass &$config, $sectionName)
// the action configuration.

if ( ! isset($config->options_class) ) {
$this->logAndThrowException("Options class not defined for $actionName");
$this->logAndThrowException("Key 'options_class' not defined for $actionName");
}

$optionsClassName = $config->options_class;
Expand Down
57 changes: 57 additions & 0 deletions classes/Rest/Controllers/AdminControllerProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

namespace Rest\Controllers;

use Models\Services\Organizations;
use Silex\Application;
use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request;
use DataWarehouse\Query\Exceptions\BadRequestException;
use XDUser;
use Rest\Utilities\Authentication;

/**
* @author Greg Dean <[email protected]>
*/
class AdminControllerProvider extends BaseControllerProvider
{
public function setupRoutes(Application $app, ControllerCollection $controller)
{
$root = $this->prefix;
$class = get_class($this);

$controller->post("$root/reset_user_tour_viewed", "$class::resetUserTourViewed");
}

/**
* @param Request $request
* @param Application $app
* @return \Symfony\Component\HttpFoundation\JsonResponse
* @throws \Exception
*/
public function resetUserTourViewed(Request $request, Application $app)
{
$this->authorize($request, array('mgr'));
$viewedTour = $this->getIntParam($request, 'viewedTour', true);
$selected_user = XDUser::getUserByID($this->getIntParam($request, 'uid', true));

if ($selected_user === null) {
throw new BadRequestException('User not found');
}

if (!in_array($viewedTour, [0,1])) {
throw new BadRequestException('Invalid data parameter');
}

$storage = new \UserStorage($selected_user, 'viewed_user_tour');
$storage->upsert(0, ['viewedTour' => $viewedTour]);

return $app->json(
array(
'success' => true,
'total' => 1,
'message' => 'This user will be now be prompted to view the New User Tour the next time they visit XDMoD'
)
);
}
}
83 changes: 83 additions & 0 deletions classes/Rest/Controllers/SummaryControllerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ public function setupRoutes(Application $app, ControllerCollection $controller)
$controller->post("$root/layout", "$class::setLayout");
$controller->delete("$root/layout", "$class::resetLayout");

$controller->post("$root/viewedUserTour", "$class::setViewedUserTour");
$controller->get("$root/viewedUserTour", "$class::getViewedUserTour");

$controller->get("$root/recentchartsreports", "$class::getRecentChartsReports");

$controller->get("$root/statistics", "$class::getStatistics");

}

/*
Expand Down Expand Up @@ -197,7 +203,84 @@ public function resetLayout(Request $request, Application $app)
));
}

/*
* Set value for if a user should view the help tour or not
*/
public function setViewedUserTour(Request $request, Application $app)
{
$user = $this->authorize($request);
$viewedTour = $this->getIntParam($request, 'viewedTour', true);

if (!in_array($viewedTour, [0,1])) {
throw new BadRequestException('Invalid data parameter');
}

$storage = new \UserStorage($user, 'viewed_user_tour');

return $app->json(array(
'success' => true,
'total' => 1,
'msg' => $storage->upsert(0, ['viewedTour' => $viewedTour])
));
}

/**
* Get stored value for if a user should view the help tour or not
*/
public function getViewedUserTour(Request $request, Application $app)
{
$user = $this->authorize($request);
$storage = new \UserStorage($user, 'viewed_user_tour');
return $app->json(array(
'success' => true,
'total' => 1,
'data' => $storage->get()
));
}
/**
* Get recent charts and reports.
**/
public function getRecentChartsReports(Request $request, Application $app)
{
$user = $this->authorize($request);
if (isset($user)) {
// fetch charts
$queries = new \UserStorage($user, 'queries_store');
$data = $queries->get();
foreach ($data as &$query) {
$query['name'] = htmlspecialchars($query['name'], ENT_COMPAT, 'UTF-8', false);
$query['type'] = 'Chart';
}
// fetch reports
$rm = new \XDReportManager($user);
$reports = $rm->fetchReportTable();
foreach ($reports as &$report) {
$tmp = array();
$tmp['type'] = 'Report';
$tmp['name'] = $report['report_name'];
$tmp['chart_count'] = $report['chart_count'];
$tmp['charts_per_page'] = $report['charts_per_page'];
$tmp['creation_method'] = $report['creation_method'];
$tmp['report_delivery'] = $report['report_delivery'];
$tmp['report_format'] = $report['report_format'];
$tmp['report_id'] = $report['report_id'];
$tmp['report_name'] = $report['report_name'];
$tmp['report_schedule'] = $report['report_schedule'];
$tmp['report_title'] = $report['report_title'];
$tmp['ts'] = $report['last_modified'];
$tmp['config'] = $report['report_id'];
$data[] = $tmp;
}
return $app->json(array(
'success' => true,
'total' => count($data),
'data' => $data
));
}
}

/*
* Retrieve summary statistics
*
* @param Request $request
Expand Down
9 changes: 6 additions & 3 deletions classes/XDReportManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ public function fetchReportTable()
r.format,
r.schedule,
r.delivery,
COUNT(rc.chart_id) AS chart_count
COUNT(rc.chart_id) AS chart_count,
UNIX_TIMESTAMP(r.last_modified) as last_modified
FROM Reports r
LEFT JOIN ReportCharts rc ON rc.report_id = r.report_id
WHERE r.user_id = :user_id
Expand All @@ -487,7 +488,8 @@ public function fetchReportTable()
r.charts_per_page,
r.format,
r.schedule,
r.delivery
r.delivery,
r.last_modified
";

$Entries = array();
Expand All @@ -507,7 +509,8 @@ public function fetchReportTable()
'report_format' => $entry['format'],
'report_schedule' => $entry['schedule'],
'report_delivery' => $entry['delivery'],
'chart_count' => $entry['chart_count']
'chart_count' => $entry['chart_count'],
'last_modified' => $entry['last_modified']
);
}

Expand Down
3 changes: 2 additions & 1 deletion configuration/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"xdmod": {
"portal": {
"js": [
"gui/js/modules/summary/ChartPortlet.js"
"gui/js/modules/summary/ChartPortlet.js",
"gui/js/modules/summary/RecentChartsReportsPortlet.js"
]
}
}
Expand Down
19 changes: 18 additions & 1 deletion configuration/etl/etl.d/xdmod-migration-8_1_2-8_5_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"class": "ManageTables",
"options_class": "MaintenanceOptions",
"definition_file_list": [
"jobs/xdw/jobfact_by_day.json",
"jobs/xdw/jobfact_by_day_joblist.json"
],
"endpoints": {
Expand All @@ -19,6 +18,24 @@
"schema": "modw_aggregates"
}
}
},
{
"name": "update-moddb-tables",
"description": "Update moddb tables",
"namespace": "ETL\\Maintenance",
"class": "ManageTables",
"options_class": "MaintenanceOptions",
"definition_file_list": [
"xdb/reports.json"
],
"endpoints": {
"destination": {
"type": "mysql",
"name": "Database",
"config": "database",
"schema": "moddb"
}
}
}
]
}
7 changes: 7 additions & 0 deletions configuration/etl/etl_tables.d/xdb/reports.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@
"name": "active_role",
"type": "varchar(30)",
"nullable": true
},
{
"name": "last_modified",
"type": "timestamp",
"nullable": false,
"default": "CURRENT_TIMESTAMP",
"extra": "ON UPDATE CURRENT_TIMESTAMP"
}
],
"indexes": [],
Expand Down
6 changes: 6 additions & 0 deletions configuration/rest.d/admin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"admin": {
"prefix": "admin",
"controller": "Rest\\Controllers\\AdminControllerProvider"
}
}
9 changes: 9 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@ cores per node on their resources.
[14, 4097, 2147483647, "> 4k"]
]

After changing this file it must be re-ingested and all job data must be
re-aggregated. If the job data are not re-aggregated the new labels will be
displayed, but will not be accurate if the corresponding bucket has changed.

```sh
/usr/share/xdmod/tools/etl/etl_overseer.php -a xdmod.jobs-xdw-bootstrap.processorbuckets
xdmod-ingestor --aggregate=job --last-modified-start-date 1970-01-01
```

### roles.json

Defines roles and the modules and statistics that each role grants
Expand Down
7 changes: 7 additions & 0 deletions html/gui/js/CCR.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ XDMoD.GlobalToolbar.Help = function (tabPanel) {
}
];

if (CCR.xdmod.publicUser !== true) {
menuItems.push({
text: 'View XDMoD User Tour',
id: 'global-toolbar-help-new-user-tour'
});
}

if (CCR.xdmod.features.xsede) {
menuItems.splice(1, 0, {
text: 'FAQ',
Expand Down
Loading

0 comments on commit e4acf8c

Please sign in to comment.