1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

improving photo error handling

This commit is contained in:
Braun Patrik 2017-07-17 23:11:35 +02:00
parent 2bdf5979f8
commit d274613e38
4 changed files with 14 additions and 13 deletions

View File

@ -1,5 +1,6 @@
<div class="static" *ngIf="animate == false">
<span class="glyphicon glyphicon-picture" aria-hidden="true">
<span class="glyphicon glyphicon-picture"
[ngClass]="error ? 'glyphicon-warning-sign' : 'glyphicon-picture'" aria-hidden="true">
</span>
</div>
<div class="sk-cube-grid animate" *ngIf="animate == true">

View File

@ -8,6 +8,7 @@ import {Component, Input} from "@angular/core";
export class GalleryPhotoLoadingComponent {
@Input() animate: boolean;
@Input() error: boolean;
}

View File

@ -2,6 +2,7 @@
<img #img [src]="thumbnail.Src" *ngIf="thumbnail.Available">
<gallery-grid-photo-loading
[error]="thumbnail.Error"
[animate]="thumbnail.loading"
*ngIf="!thumbnail.Available">
</gallery-grid-photo-loading>

View File

@ -30,7 +30,7 @@ export abstract class ThumbnailBase {
protected available: boolean = false;
protected src: string = null;
protected loading: boolean = false;
protected error: boolean = true;
protected error: boolean = false;
protected onLoad: Function = null;
protected thumbnailTask: ThumbnailTaskEntity;
@ -45,18 +45,22 @@ export abstract class ThumbnailBase {
}
get Available() {
get Available(): boolean {
return this.available;
}
get Src() {
get Src(): string {
return this.src;
}
get Loading() {
get Loading(): boolean {
return this.loading;
}
get Error(): boolean {
return this.error;
}
destroy() {
if (this.thumbnailTask != null) {
this.thumbnailService.removeTask(this.thumbnailTask);
@ -96,10 +100,6 @@ export class IconThumbnail extends ThumbnailBase {
this.thumbnailTask = null;
this.loading = false;
this.error = true;
//TODO: handle error
//TODO: not an error if its from cache
console.error("something bad happened");
console.error(error);
}
};
this.thumbnailTask = this.thumbnailService.loadIcon(this.photo, ThumbnailLoadingPriority.high, listener);
@ -153,10 +153,8 @@ export class Thumbnail extends ThumbnailBase {
},
onError: (error) => {//onError
this.thumbnailTask = null;
//TODO: handle error
//TODO: not an error if its from cache
console.error("something bad happened");
console.error(error);
this.loading = false;
this.error = true;
}
};
if (this.photo.isReplacementThumbnailAvailable()) {