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:
parent
2bdf5979f8
commit
d274613e38
@ -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">
|
||||
|
@ -8,6 +8,7 @@ import {Component, Input} from "@angular/core";
|
||||
export class GalleryPhotoLoadingComponent {
|
||||
|
||||
@Input() animate: boolean;
|
||||
@Input() error: boolean;
|
||||
|
||||
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user