Skip to content

Commit

Permalink
Merge pull request #143 from vapadwal/issue_mtsj_142
Browse files Browse the repository at this point in the history
Fixed issue #142 for migration to devon4j
  • Loading branch information
sjimenez77 authored Nov 23, 2018
2 parents ca55bcf + b441201 commit a911fa8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class OrderCockpitComponent implements OnInit {
private pageable: Pageable = {
pageSize: 8,
pageNumber: 0,
//total: 1,
// total: 1,
};
private sorting: any[] = [];

Expand Down Expand Up @@ -69,7 +69,11 @@ export class OrderCockpitComponent implements OnInit {
applyFilters(): void {
this.waiterCockpitService.getOrders(this.pageable, this.sorting, this.filters)
.subscribe((data: any) => {
this.orders = data.content;
if (!data) {
this.orders = [];
} else {
this.orders = data.content;
}
this.totalOrders = data.totalElements;
});
}
Expand All @@ -84,7 +88,6 @@ export class OrderCockpitComponent implements OnInit {
pageSize: pagingEvent.pageSize,
pageNumber: pagingEvent.page - 1,
sort: this.pageable.sort,
//total: 1,
};
this.applyFilters();
}
Expand All @@ -95,7 +98,7 @@ export class OrderCockpitComponent implements OnInit {
property: sortEvent.name,
direction: '' + sortEvent.order,
});
this.applyFilters();
this.applyFilters();
}

selected(selection: ITdDataTableSelectAllEvent): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export class ReservationCockpitComponent implements OnInit {
pageable: Pageable = {
pageSize: 8,
pageNumber: 0,
//total: 1,
// total: 1,
};

reservations: ReservationView;
reservations: ReservationView[];
totalReservations: number;

columns: ITdDataTableColumn[];
Expand Down Expand Up @@ -74,7 +74,11 @@ export class ReservationCockpitComponent implements OnInit {
applyFilters(): void {
this.waiterCockpitService.getReservations(this.pageable, this.sorting, this.filters)
.subscribe((data: any) => {
this.reservations = data.content;
if (!data) {
this.reservations = [];
} else {
this.reservations = data.content;
}
this.totalReservations = data.totalElements;
});
}
Expand All @@ -89,7 +93,7 @@ export class ReservationCockpitComponent implements OnInit {
pageSize: pagingEvent.pageSize,
pageNumber: pagingEvent.page - 1,
sort: this.pageable.sort,
//total: 1,
// total: 1,
};
this.applyFilters();
}
Expand Down
21 changes: 11 additions & 10 deletions angular/src/app/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ export class MenuComponent {

dishes$: Observable<DishView[]>;

/*pageable: Pageable = {
pageSize: 8,
pageNumber: 0,
};*/

constructor(
private menuService: MenuService,
) {}
Expand All @@ -39,12 +34,18 @@ export class MenuComponent {
pageNumber: 0,
sort: [{
property: filters.sort.property,
direction: filters.sort.direction
}]
};
const composedFilters: Filter = this.menuService.composeFilters(pageable,filters);
direction: filters.sort.direction,
}],
};
const composedFilters: Filter = this.menuService.composeFilters(pageable, filters);
this.dishes$ = this.menuService.getDishes(composedFilters).pipe(
map((res) => res.content),
map((res) => {
if (!res) {
return [];
} else {
return res.content;
}
}),
);
}
}
10 changes: 5 additions & 5 deletions angular/src/app/menu/shared/menu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ export class MenuService {
};
}

composeFilters(pageable: Pageable,filters: FilterFormData): Filter {
composeFilters(pageable: Pageable, filters: FilterFormData): Filter {
const categories: { id: string }[] = Object.keys(filters.categories)
.filter((categoryKey: string) => filters.categories[categoryKey])
.map((categoryKey: string) => ({id: categoryNameToServerId[categoryKey].toString()}));
if (filters.sort.property == null) {
filters.sort = null;
pageable.sort = null;
}
if (!filters.sort.property) {
filters.sort = undefined;
pageable.sort = undefined;
}

return {
categories,
Expand Down
2 changes: 1 addition & 1 deletion java/mtsj/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<properties>
<spring.boot.version>2.0.4.RELEASE</spring.boot.version>
<devon4j.version>3.0.0-alpha.1</devon4j.version>
<devon4j.version>3.0.0</devon4j.version>
<java.version>1.8</java.version>
<devon.port.range>81</devon.port.range>
<devon.http.port>${devon.port.range}81</devon.http.port>
Expand Down

0 comments on commit a911fa8

Please sign in to comment.