Skip to content

Commit

Permalink
Unique names for query parameters (re #164)
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Short committed Mar 6, 2018
1 parent 80d9ab6 commit 6d6205c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/app/components/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function ParametersDirective($location, $uibModal) {
}
scope.parameters.forEach((param) => {
if (param.value !== null || param.value !== '') {
$location.search(`p_${param.name}`, param.value);
$location.search(`p_${param.name}_${param.queryId}`, param.value);
}
});
}, true);
Expand Down
6 changes: 3 additions & 3 deletions client/app/services/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ class Parameters {
const parameterExists = p => contains(parameterNames, p.name);
this.query.options.parameters = this.query.options.parameters
.filter(parameterExists)
.map(p => new Parameter(p));
.map(p => new Parameter(Object.assign({queryId: this.query.id}, p)));
}

initFromQueryString(queryString) {
this.get().forEach((param) => {
const queryStringName = `p_${param.name}`;
const queryStringName = `p_${param.name}_${this.query.id}`;
if (has(queryString, queryStringName)) {
param.value = queryString[queryStringName];
}
Expand Down Expand Up @@ -335,7 +335,7 @@ function QueryResource($resource, $http, $q, $location, currentUser, QueryResult
params += '&';
}

params += `p_${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
params += `p_${encodeURIComponent(name)}_${this.id}=${encodeURIComponent(value)}`;
});
}

Expand Down

0 comments on commit 6d6205c

Please sign in to comment.