Skip to content

Commit

Permalink
Merge current 8.5 changes into feature branch (#1081)
Browse files Browse the repository at this point in the history
* Bug fixes: Add mask and make chart name unique

* Refresh clears the search field

* Check for alternate timezone field (#1061)

* Data warehouse export tests and bug fix (#1063)

* Fix dry run behavior

* Add data warehouse export tests

* Add Usage Explorer Tests (#1062)

* Add Usage Tests for disabled Display Menu Items

* Document required file name extension (#1066)

* Fixing an infinite loop when discarding user changes (#1068)

* Replace previous year with year to date

* Ensure Jobs realm data access class provides required fields

* Force refresh dashboard tab
  • Loading branch information
smgallo authored Oct 1, 2019
1 parent aeed36d commit 1ee0708
Show file tree
Hide file tree
Showing 31 changed files with 1,084 additions and 38 deletions.
3 changes: 3 additions & 0 deletions classes/DataWarehouse/Data/RawDataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public function export()
if (isset($this->query_results[0]['timezone'])) {
$value = $this->formattime($value, $this->query_results[0]['timezone']);
$units = '';
} elseif (isset($this->query_results[0]['Timezone'])) {
$value = $this->formattime($value, $this->query_results[0]['Timezone']);
$units = '';
}
}

Expand Down
6 changes: 4 additions & 2 deletions classes/DataWarehouse/Export/BatchProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ private function processSubmittedRequest(array $request)
$dataSet = $this->getDataSet($request, $user);
$format = $this->dryRun ? 'null' : $request['export_file_format'];
$dataFile = $this->fileManager->writeDataSetToFile($dataSet, $format);
$this->fileManager->createZipFile($dataFile, $request);
if (!$this->dryRun) {
$this->fileManager->createZipFile($dataFile, $request);
}

// Delete file that was added to zip archive.
if (!unlink($dataFile)) {
if (!$this->dryRun && !unlink($dataFile)) {
$this->logger->err(sprintf(
'Failed to delete temporary data file "%s"',
$dataFile
Expand Down
1 change: 1 addition & 0 deletions classes/DataWarehouse/Export/FileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public function writeDataSetToFile(BatchDataset $dataSet, $format)
*
* @param string $dataFile Path to file that will be put in the zip file.
* @param array $request Batch export request data.
* @return string Zip file path.
* @throws \Exception If creating the zip file fails.
*/
public function createZipFile($dataFile, array $request)
Expand Down
12 changes: 12 additions & 0 deletions classes/DataWarehouse/Query/Jobs/RawData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use \DataWarehouse\Query\Model\Table;
use \DataWarehouse\Query\Model\TableField;
use \DataWarehouse\Query\Model\FormulaField;
use \DataWarehouse\Query\Model\WhereCondition;
use \DataWarehouse\Query\Model\Schema;

Expand Down Expand Up @@ -73,6 +74,9 @@ public function __construct(

$this->addField(new TableField($factTable, "job_id", "jobid"));
$this->addField(new TableField($factTable, "local_jobid", "local_job_id"));
$this->addField(new TableField($factTable, 'start_time_ts'));
$this->addField(new TableField($factTable, 'end_time_ts'));
$this->addField(new FormulaField('-1', 'cpu_user'));

$this->addTable($joblistTable);
$this->addTable($factTable);
Expand All @@ -99,6 +103,14 @@ public function __construct(
// All other metrics show running job count
break;
}

$this->prependOrder(
new \DataWarehouse\Query\Model\OrderBy(
new TableField($factTable, 'end_time_ts'),
'DESC',
'end_time_ts'
)
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
"schema": "${SOURCE_SCHEMA}",
"alias": "rtc",
"type": "left outer",
"on": "rtcs.template_id=rtc.template_id",
"where": [
"rtc.template_id IS NULL"
]
"on": "rtcs.template_id=rtc.template_id"
}
],
"where": [
"rtc.template_id IS NULL"
]
}
}
8 changes: 4 additions & 4 deletions configuration/etl/etl_action_defs.d/xdb/report-templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
"schema": "${SOURCE_SCHEMA}",
"alias": "rt",
"type": "left outer",
"on": "rts.id=rt.id",
"where": [
"rt.id IS NULL"
]
"on": "rts.id=rt.id"
}
],
"where": [
"rt.id IS NULL"
]
}
}
2 changes: 1 addition & 1 deletion configuration/roles.d/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dashboard_components": [
{
"config": {
"timeframe": "Previous year"
"timeframe": "1 year"
},
"name": "Chart Thumbnails",
"region": "top",
Expand Down
3 changes: 2 additions & 1 deletion docs/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ installed from source they will need to be adjusted accordingly.

## Input Format

Storage data must be formatted in JSON files. These files will be validated
Storage data must be formatted in JSON files and these files must use the
`.json` file extension (e.g. `2019-01-01.json`). These files will be validated
against the JSON Schema
`/etc/xdmod/etl/etl_schemas.d/storage/usage.schema.json`.

Expand Down
13 changes: 6 additions & 7 deletions html/gui/js/modules/dashboard/ReportThumbnailsComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,17 @@ XDMoD.Module.Dashboard.ReportThumbnailsComponent = Ext.extend(Ext.Panel, {
}
},
{
text: 'Previous year',
checked: timeframe_label === 'Previous year',
text: '1 year',
checked: timeframe_label === '1 year',
group: 'timeframe',
listeners: {
click: function () {
var today = new Date();
var oneYearAgoStart = new Date(today.getFullYear() - 1, 0, 1);
var oneYearAgoEnd = new Date(today.getFullYear() - 1, 11, 31);
var start = oneYearAgoStart;
var end = oneYearAgoEnd;
var lastYear = today.add(Date.YEAR, -1);
var start = lastYear;
var end = today;
this.ownerCt.ownerCt.ownerCt.ownerCt.fireEvent('timeframe_change', start, end);
this.ownerCt.ownerCt.ownerCt.items.items[1].setText('Previous year');
this.ownerCt.ownerCt.ownerCt.items.items[1].setText('1 year');
this.ownerCt.ownerCt.ownerCt.items.items[2].setText('<b>' + self.timeframe.start_date + ' to ' + self.timeframe.end_date + '</b>');
}
}
Expand Down
1 change: 1 addition & 0 deletions html/gui/js/report_builder/ReportsOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ XDMoD.ReportsOverview = Ext.extend(Ext.Panel, {
}

});//conn.request
CCR.xdmod.ui.tgSummaryViewer.fireEvent('request_refresh');

}//if (resp == 'yes')
else {
Expand Down
21 changes: 21 additions & 0 deletions html/internal_dashboard/js/admin_panel/SectionExistingUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,28 @@ XDMoD.ExistingUsers = Ext.extend(Ext.Panel, {
return false;
};

/**
* Reverts the User Settings ( E-Mail Address, User Type, Map To, Institution ) to their original values.
*/
var revertUserSettings = function () {
// eslint-disable-next-line no-use-before-define
var fieldValues = userSettings.getForm().getFieldValues();
for (var id in fieldValues) {
if (fieldValues.hasOwnProperty(id)) {
var field = Ext.getCmp(id);

// Only check a field if it's been rendered.
if (field.rendered) {
if (field.originalValue !== field.getValue()) {
field.setValue(field.originalValue);
}
}
}
}
};

self.resetDirtyState = function () {
revertUserSettings();
roleGrid.setDirtyState(false);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
[
1
],
[
2
],
[
3
],
[
10
],
[
100
],
[
12345
],
[
4294967296
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
[
{
"id": 1,
"user_id": 1,
"realm": "jobs",
"start_date": "2018-01-01",
"end_date": "2018-02-28",
"export_file_format": "CSV",
"requested_datetime": "2019-01-01 00:00:00",
"export_succeeded": null,
"export_created_datetime": null,
"downloaded_datetime": null,
"export_expires_datetime": null,
"export_expired": 0,
"last_modified": "2019-01-01 00:00:00"
}
],
[
{
"id": 2,
"user_id": 1,
"realm": "jobs",
"start_date": "2001-01-01",
"end_date": "2001-01-02",
"export_file_format": "JSON",
"requested_datetime": "2019-01-01 00:00:01",
"export_succeeded": null,
"export_created_datetime": null,
"downloaded_datetime": null,
"export_expires_datetime": null,
"export_expired": 0,
"last_modified": "2019-01-01 00:00:01"
}
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
heading1,heading2,heading3
0,1,2
a,b,c
17 changes: 17 additions & 0 deletions tests/artifacts/xdmod/component/export/file_manager/output/2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
[
"heading1",
"heading2",
"heading3"
],
[
0,
1,
2
],
[
"a",
"b",
"c"
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"Single record with one element": [
[
[
"a"
]
],
"a\n"
],
"Single record with two elements": [
[
[
"a",
"b"
]
],
"a,b\n"
],
"Two records with two elements each": [
[
[
"a",
"b"
],
[
"c",
"d"
]
],
"a,b\nc,d\n"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"CSV File Writer": [
"csv",
"\\DataWarehouse\\Export\\FileWriter\\CsvFileWriter"
],
"JSON File Writer": [
"json",
"\\DataWarehouse\\Export\\FileWriter\\JsonFileWriter"
],
"NULL File Writer": [
"null",
"\\DataWarehouse\\Export\\FileWriter\\NullFileWriter"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"Single record with one element": [
[
[
"a"
]
],
"[[\"a\"]]"
],
"Single record with two elements": [
[
[
"a",
"b"
]
],
"[[\"a\",\"b\"]]"
],
"Two records with two elements each": [
[
[
"a",
"b"
],
[
"c",
"d"
]
],
"[[\"a\",\"b\"],[\"c\",\"d\"]]"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"Single record with one element": [
[
[
"a"
]
]
],
"Single record with two elements": [
[
[
"a",
"b"
]
]
],
"Two records with two elements each": [
[
[
"a",
"b"
],
[
"c",
"d"
]
]
]
}
Loading

0 comments on commit 1ee0708

Please sign in to comment.