Skip to content
Snippets Groups Projects
Commit 3f1b3685 authored by Reid Givens's avatar Reid Givens
Browse files

changing the http params encoder to work with '+' in a pattern search

parent f2415bab
No related branches found
No related tags found
No related merge requests found
import {CustomHttpParamEncoder} from './custom-http-param-encoder';
describe('CustomHttpParamEncoder', () => {
it('should create an instance', () => {
expect(new CustomHttpParamEncoder()).toBeTruthy();
});
});
import {HttpParameterCodec} from '@angular/common/http';
export class CustomHttpParamEncoder implements HttpParameterCodec {
encodeKey(key: string): string {
return encodeURIComponent(key);
}
encodeValue(value: string): string {
return encodeURIComponent(value);
}
decodeKey(key: string): string {
return decodeURIComponent(key);
}
decodeValue(value: string): string {
return decodeURIComponent(value);
}
}
......@@ -5,6 +5,7 @@ import {Observable} from "rxjs";
import {map, switchMap} from "rxjs/operators";
import {Job, JobExecution, JobSpec} from "../model/job";
import {FiltersService} from "./filters.service";
import {CustomHttpParamEncoder} from "../custom-http-param-encoder";
@Injectable({
providedIn: 'root'
......@@ -36,9 +37,9 @@ export class JobsService {
}
public getJobSpecPage(epoch: number, queue: string, pageId: number, pattern: string, status: string): Observable<Array<JobSpec>> {
let params = new HttpParams();
let params = new HttpParams({encoder: new CustomHttpParamEncoder()});
if (!!pattern) {
params = params.append('pattern', encodeURIComponent(pattern));
params = params.append('pattern', pattern);
}
if (!!status) {
params = params.append('status', status);
......@@ -58,9 +59,9 @@ export class JobsService {
}
public getJobPage(epoch: number, queue: string, pageId: number, pattern: string, status: string): Observable<Array<Job>> {
let params = new HttpParams();
let params = new HttpParams({encoder: new CustomHttpParamEncoder()});
if (!!pattern) {
params = params.append('pattern', encodeURIComponent(pattern));
params = params.append('pattern', pattern);
}
if (!!status) {
params = params.append('status', status);
......
......@@ -5,6 +5,7 @@ import {Observable} from "rxjs";
import {map} from "rxjs/operators";
import {Product} from "../model/product";
import {FiltersService} from "./filters.service";
import {CustomHttpParamEncoder} from "../custom-http-param-encoder";
@Injectable({
providedIn: 'root'
......@@ -28,9 +29,9 @@ export class ProductsService {
}
public getPage(epoch: number, type: number, pageId: number, pattern: string): Observable<Array<Product>> {
let params = new HttpParams();
let params = new HttpParams({encoder: new CustomHttpParamEncoder()});
if (pattern) {
params = params.append('pattern', encodeURIComponent(pattern));
params = params.append('pattern', pattern);
}
const sortName = this.filtersService.getCurrentSetting('PRODUCT_SORT');
......
......@@ -24,6 +24,6 @@ A service in angular will capture this info and add it to a service
/**
* If you need to overwrite this for this server, use the following
*/
window.__env.configUrl = 'https://webtest.aoc.nrao.edu/VlassMngr/services/configuration';
// window.__env.configUrl = 'https://webtest.aoc.nrao.edu/VlassMngr/services/configuration';
}(this));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment