Merge branch 'fix-dview-response' into 'develop'

Distinguish empty set from errors

See merge request !256
parents 143dc6c9 2c501c64
...@@ -170,22 +170,21 @@ class DirectorView extends ControllerBase ...@@ -170,22 +170,21 @@ class DirectorView extends ControllerBase
); );
} }
} }
return $this->respondWithStatus( return $this->respondWithStatus($list, Response::HTTP_OK);
$list, Response::HTTP_OK);
} else { } else {
return $this->respondWithStatus([ return $this->respondWithStatus([
'message' => t('Students not found!'), 'message' => t('Students not found!'),
], Response::HTTP_FORBIDDEN); ], Response::HTTP_NOT_FOUND);
} }
} else { } else {
return $this->respondWithStatus([ return $this->respondWithStatus([
'message' => t('User not found!'), 'message' => t('User not found!'),
], Response::HTTP_FORBIDDEN); ], Response::HTTP_FORBIDDEN);
} }
} catch (\Exception $e) { } catch (\Exception $e) {
$this->logger->warning($e->getMessage()); $this->logger->warning($e->getMessage());
return $this->respondWithStatus([ return $this->respondWithStatus([
'message' => t('Unexpected Error'), 'message' => t('Unexpected Error'),
], Response::HTTP_FORBIDDEN); ], Response::HTTP_FORBIDDEN);
} }
} }
......
...@@ -235,9 +235,27 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -235,9 +235,27 @@ import { HelperDataService } from "../../services/helper-data-service";
</div> </div>
</div> </div>
<div id="errorselection" (onHidden)="onHidden('#errorselection')" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header modal-header-danger">
<h3 class="modal-title pull-left"><i class="fa fa-ban"></i>&nbsp;&nbsp;Προέκυψε σφάλμα</h3>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal('#errorselection')">
<span aria-hidden="true"><i class="fa fa-times"></i></span>
</button>
</div>
<div class="modal-body">
<p>Προέκυψε σφάλμα κατά τη διαδικασία άντλησης των στοιχείων δήλωσης προτίμησης στο συγκεκριμένο τμήμα του σχολείου σας.</p>
<p>Παρακαλώ προσπαθείστε ξανά αργότερα.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Κλείσιμο</button>
</div>
</div>
</div>
</div>
<div id="emptyselection" (onHidden)="onHidden('#emptyselection')" <div id="emptyselection" (onHidden)="onHidden('#emptyselection')" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header modal-header-danger"> <div class="modal-header modal-header-danger">
...@@ -255,7 +273,7 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -255,7 +273,7 @@ import { HelperDataService } from "../../services/helper-data-service";
</div> </div>
</div> </div>
</div> </div>
` `
}) })
@Injectable() export default class DirectorClassCapacity implements OnInit, OnDestroy { @Injectable() export default class DirectorClassCapacity implements OnInit, OnDestroy {
...@@ -326,6 +344,7 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -326,6 +344,7 @@ import { HelperDataService } from "../../services/helper-data-service";
(<any>$("#checksaved")).appendTo("body"); (<any>$("#checksaved")).appendTo("body");
(<any>$("#dangermodal")).appendTo("body"); (<any>$("#dangermodal")).appendTo("body");
(<any>$("#emptyselection")).appendTo("body"); (<any>$("#emptyselection")).appendTo("body");
(<any>$("#errorselection")).appendTo("body");
(<any>$("#applicationDeleteConfirm")).appendTo("body"); (<any>$("#applicationDeleteConfirm")).appendTo("body");
(<any>$("#applicationDeleteError")).appendTo("body"); (<any>$("#applicationDeleteError")).appendTo("body");
this.showLoader.next(true); this.showLoader.next(true);
...@@ -353,7 +372,11 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -353,7 +372,11 @@ import { HelperDataService } from "../../services/helper-data-service";
this.StudentInfo$.next([{}]); this.StudentInfo$.next([{}]);
console.log("Error Getting Students"); console.log("Error Getting Students");
this.showLoader.next(false); this.showLoader.next(false);
this.showModal("#emptyselection"); if (error.status === 404) {
this.showModal("#emptyselection");
} else {
this.showModal("#errorselection");
}
}); });
} }
...@@ -449,7 +472,11 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -449,7 +472,11 @@ import { HelperDataService } from "../../services/helper-data-service";
this.StudentInfo$.next([{}]); this.StudentInfo$.next([{}]);
console.log("Error Getting Students"); console.log("Error Getting Students");
this.showLoader.next(false); this.showLoader.next(false);
this.showModal("#emptyselection"); if (error.status === 404) {
this.showModal("#emptyselection");
} else {
this.showModal("#errorselection");
}
}); });
}).catch(err => { }).catch(err => {
this.showErrorModal(); this.showErrorModal();
......
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