Skip to content

Commit

Permalink
[dataquery] Fixed broken link for 'deleteAll' and fixed save error on…
Browse files Browse the repository at this point in the history
… query names that contain spaces (#5399)

This addresses the issues reported in #5364 for the data query module:

1. The Delete All link in DQT was broken and not actually deselecting the fields.
2. You couldn't save a query if it had a space in the name. No error was displayed, it just wouldn't save. The code now replaces any space by underscores.

Fixes #5364.
  • Loading branch information
jesscall authored and driusan committed Nov 18, 2019
1 parent bed8d21 commit 01643d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/dataquery/jsx/react.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class DataQueryApp extends Component {
for (let i = 0; i < this.state.queryIDs[key].length; i += 1) {
let curRequest;
curRequest = Promise.resolve(
$.ajax(loris.BaseURL + '/AjaxHelper.php?Module=dataquery&script=GetDoc.php&DocID=' + this.state.queryIDs[key][i]), {
$.ajax(loris.BaseURL + '/AjaxHelper.php?Module=dataquery&script=GetDoc.php&DocID=' + encodeURIComponent(this.state.queryIDs[key][i])), {
data: {
DocID: this.state.queryIDs[key][i]
},
Expand Down Expand Up @@ -472,7 +472,7 @@ class DataQueryApp extends Component {
} else {
// Query was saved in the new format
filterState = criteria;
selectedFields = fields;
selectedFields = fields ? fields : {};
for (let instrument in fields) {
for (let field in fields[instrument]) {
if (field !== 'allVisits') {
Expand Down
2 changes: 1 addition & 1 deletion modules/dataquery/jsx/react.fieldselector.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class FieldSelector extends Component {

deleteAll() {
// Deletes all fields the currently selected category
let i, index, fieldName;
let i, index, fieldName, category, isFile;
for (i in this.state.categoryFields[this.state.selectedCategory]) {
fieldName = this.state.categoryFields[this.state.selectedCategory][i].key[1];
category = this.state.categoryFields[this.state.selectedCategory][i].key[0];
Expand Down

0 comments on commit 01643d7

Please sign in to comment.