Skip to content
Snippets Groups Projects
Commit 75069b07 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FIX #8956 fix bug init filter (first load)

parent 34e49ff3
No related branches found
No related tags found
No related merge requests found
......@@ -113,10 +113,6 @@ export class BasketListComponent implements OnInit {
this.mobileQuery = media.matchMedia('(max-width: 768px)');
this._mobileQueryListener = () => changeDetectorRef.detectChanges();
this.mobileQuery.addListener(this._mobileQueryListener);
route.params.forEach(params => {
this.basketUrl = '../../rest/resourcesList/users/' + params['userSerialId'] + '/groups/' + params['groupSerialId'] + '/baskets/' + params['basketId'];
});
}
ngOnInit(): void {
......@@ -139,6 +135,7 @@ export class BasketListComponent implements OnInit {
this.initResultList();
this.route.params.subscribe(params => {
this.basketUrl = '../../rest/resourcesList/users/' + params['userSerialId'] + '/groups/' + params['groupSerialId'] + '/baskets/' + params['basketId'];
this.currentBasketInfo = {
ownerId: params['userSerialId'],
......@@ -149,7 +146,6 @@ export class BasketListComponent implements OnInit {
this.filtersListService.filterMode = false;
window['MainHeaderComponent'].setSnav(this.sidenavLeft);
window['MainHeaderComponent'].setSnavRight(this.sidenavRight);
this.listProperties = this.filtersListService.initListsProperties('bbain', params['groupSerialId'], params['basketId']);
......@@ -180,7 +176,8 @@ export class BasketListComponent implements OnInit {
this.headerService.headerMessage = data.basketLabel;
return data.resources;
}),
catchError(() => {
catchError((err: any) => {
console.log(err);
this.isLoadingResults = false;
return observableOf([]);
})
......@@ -245,7 +242,6 @@ export class ResultListHttpDao {
constructor(private http: HttpClient, private filtersListService: FiltersListService) { }
getRepoIssues(sort: string, order: string, page: number, href: string, filters: string): Observable<BasketList> {
this.filtersListService.updateListsPropertiesPage(page);
let offset = page * 10;
const requestUrl = `${href}?limit=10&offset=${offset}${filters}`;
......
......@@ -64,13 +64,17 @@ export class FiltersListService {
}
updateListsPropertiesPage(page : number) {
this.listsProperties[this.listsPropertiesIndex].page = page;
this.saveListsProperties();
if (this.listsProperties) {
this.listsProperties[this.listsPropertiesIndex].page = page;
this.saveListsProperties();
}
}
updateListsProperties(listProperties : any) {
this.listsProperties[this.listsPropertiesIndex] = listProperties;
this.saveListsProperties();
if (this.listsProperties) {
this.listsProperties[this.listsPropertiesIndex] = listProperties;
this.saveListsProperties();
}
}
saveListsProperties() {
......@@ -79,49 +83,50 @@ export class FiltersListService {
getUrlFilters () {
let filters = '';
if (this.listsProperties[this.listsPropertiesIndex].delayed) {
filters += '&delayed=true';
}
if (this.listsProperties[this.listsPropertiesIndex].order.length > 0) {
filters += '&order='+this.listsProperties[this.listsPropertiesIndex].order + ' ' + this.listsProperties[this.listsPropertiesIndex].orderDir;
}
if (this.listsProperties[this.listsPropertiesIndex].search.length > 0) {
filters += '&search='+this.listsProperties[this.listsPropertiesIndex].search;
}
if (this.listsProperties[this.listsPropertiesIndex].categories.length > 0) {
let cat: any[] = [];
this.listsProperties[this.listsPropertiesIndex].categories.forEach((element: any) => {
cat.push(element.id);
});
filters += '&categories='+cat.join(',');
}
if (this.listsProperties[this.listsPropertiesIndex].priorities.length > 0) {
let prio: any[] = [];
this.listsProperties[this.listsPropertiesIndex].priorities.forEach((element: any) => {
prio.push(element.id);
});
filters += '&priorities='+prio.join(',');
}
if (this.listsProperties[this.listsPropertiesIndex].statuses.length > 0) {
let status: any[] = [];
this.listsProperties[this.listsPropertiesIndex].statuses.forEach((element: any) => {
status.push(element.id);
});
filters += '&statuses='+status.join(',');
}
if (this.listsProperties[this.listsPropertiesIndex].entities.length > 0) {
let ent: any[] = [];
this.listsProperties[this.listsPropertiesIndex].entities.forEach((element: any) => {
ent.push(element.id);
});
filters += '&entities='+ent.join(',');
if (this.listsProperties) {
if (this.listsProperties[this.listsPropertiesIndex].delayed) {
filters += '&delayed=true';
}
if (this.listsProperties[this.listsPropertiesIndex].order.length > 0) {
filters += '&order='+this.listsProperties[this.listsPropertiesIndex].order + ' ' + this.listsProperties[this.listsPropertiesIndex].orderDir;
}
if (this.listsProperties[this.listsPropertiesIndex].search.length > 0) {
filters += '&search='+this.listsProperties[this.listsPropertiesIndex].search;
}
if (this.listsProperties[this.listsPropertiesIndex].categories.length > 0) {
let cat: any[] = [];
this.listsProperties[this.listsPropertiesIndex].categories.forEach((element: any) => {
cat.push(element.id);
});
filters += '&categories='+cat.join(',');
}
if (this.listsProperties[this.listsPropertiesIndex].priorities.length > 0) {
let prio: any[] = [];
this.listsProperties[this.listsPropertiesIndex].priorities.forEach((element: any) => {
prio.push(element.id);
});
filters += '&priorities='+prio.join(',');
}
if (this.listsProperties[this.listsPropertiesIndex].statuses.length > 0) {
let status: any[] = [];
this.listsProperties[this.listsPropertiesIndex].statuses.forEach((element: any) => {
status.push(element.id);
});
filters += '&statuses='+status.join(',');
}
if (this.listsProperties[this.listsPropertiesIndex].entities.length > 0) {
let ent: any[] = [];
this.listsProperties[this.listsPropertiesIndex].entities.forEach((element: any) => {
ent.push(element.id);
});
filters += '&entities='+ent.join(',');
}
}
return filters;
}
......
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