Commit 33f9a127 authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

Fix bug result selection

parent c11c9733
Pipeline #1632 passed with stages
in 11 minutes and 13 seconds
......@@ -57,18 +57,18 @@ export class DatatableComponent {
toggleSelection(datum: any): void {
const attribute = this.datasetAttributeList.find(a => a.search_flag === 'ID');
const index = this.selectedData.indexOf(datum[attribute.name]);
const index = this.selectedData.indexOf(datum[attribute.label]);
if (index > -1) {
this.deleteSelectedData.emit(datum[attribute.name]);
this.deleteSelectedData.emit(datum[attribute.label]);
} else {
this.addSelectedData.emit(datum[attribute.name]);
this.addSelectedData.emit(datum[attribute.label]);
}
}
isSelected(datum: any): boolean {
const attribute = this.datasetAttributeList.find(a => a.search_flag === 'ID');
if (this.selectedData.indexOf(datum[attribute.name]) > -1) {
if (this.selectedData.indexOf(datum[attribute.label]) > -1) {
return true;
}
return false;
......
// import { async, ComponentFixture, TestBed } from '@angular/core/testing';
// import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
// import { HttpClient, HttpResponse } from '@angular/common/http';
// import { SearchService } from './search.service';
// import { SearchMeta } from './model';
// describe('SearchService', () => {
// let searchService: SearchService;
// let httpClient: HttpClient;
// let httpTestingController: HttpTestingController;
// beforeEach(() => {
// TestBed.configureTestingModule({
// // Import the HttpClient mocking services
// imports: [HttpClientTestingModule],
// // Provide the service-under-test and its dependencies
// providers: [SearchService]
// });
// });
// // Inject the http, test controller, and service-under-test
// // as they will be referenced by each test.
// httpClient = TestBed.get(HttpClient);
// httpTestingController = TestBed.get(HttpTestingController);
// searchService = TestBed.get(SearchService);
// afterEach(() => {
// // After every test, assert that there are no more pending requests.
// httpTestingController.verify();
// });
// /// SeroService method tests begin ///
// describe('#getMeta', () => {
// let query = 'query';
// let expectedMeta: SearchMeta;
// beforeEach(() => {
// searchService = TestBed.get(SearchService);
// query = 'query';
// expectedMeta = {
// dataset_selected: 'obs_cat',
// attributes_selected: [
// { name: 'id', label: 'ID' },
// { name: 'ra', label: 'RA' },
// { name: 'dec', label: 'DEC' }
// ],
// total_items: 10
// };
// });
// // it('should return expected meta (called once)', () => {
// // searchService.retrieveMeta(query).subscribe(
// // meta => expect(meta).toEqual(expectedMeta, 'should return expected meta'),
// // fail
// // );
// // SearchService should have made one request to GET meta from expected URL
// // const url = searchService.API_PATH + '/search/' + searchService.instanceName + '/meta/' + query;
// // const req = httpTestingController.expectOne(url);
// // expect(req.request.method).toEqual('GET');
// // Respond with the mock meta
// // req.flush(expectedMeta);
// // });
// });
// });
......@@ -21,7 +21,6 @@ export class SearchService {
executeProcess(typeProcess: string, dname: string, query: string) {
const url = this.API_PATH + '/service/' + this.instanceName + '/' + dname + '/' + typeProcess + query;
console.log(url);
return this.http.get<any>(url);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment