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

fixing loading sign error

This commit is contained in:
Patrik Braun 2017-07-21 19:14:22 +02:00
parent cd3e773018
commit e9b5758909
9 changed files with 25 additions and 22 deletions

View File

@ -59,8 +59,10 @@ export class GalleryManager implements IGalleryManager {
.where("photo.directory = :dir", {
dir: dir.directories[i].id
})
.orderBy("photo.metadata.creationDate", "ASC")
.setLimit(Config.Server.folderPreviewSize)
.getMany();
dir.directories[i].isPartial = true;
for (let j = 0; j < dir.directories[i].photos.length; j++) {
dir.directories[i].photos[j].directory = dir.directories[i];

View File

@ -8,25 +8,22 @@ export class DirectoryEntity implements DirectoryDTO {
@PrimaryGeneratedColumn()
id: number;
@Column({
length: 500
})
@Column()
name: string;
@Column({
length: 500
})
@Column()
path: string;
@Column('number')
@Column()
public lastModified: number;
@Column('number')
@Column()
public lastScanned: number;
@Column({type: 'smallint', length: 1})
@Column()
public scanned: boolean;
isPartial?: boolean;
@ManyToOne(type => DirectoryEntity, directory => directory.directories, {onDelete: "CASCADE"})
public parent: DirectoryEntity;

View File

@ -7,17 +7,13 @@ export class UserEntity implements UserDTO {
@PrimaryGeneratedColumn()
id: number;
@Column({
length: 500
})
@Column()
name: string;
@Column({
length: 500
})
@Column()
password: string;
@Column("int")
@Column("smallint")
role: UserRoles;
@Column("string", {nullable: true})

View File

@ -41,6 +41,7 @@ export class DiskMangerWorker {
lastModified: Math.max(stat.ctime.getTime(), stat.mtime.getTime()),
lastScanned: Date.now(),
directories: [],
isPartial: false,
photos: []
};
fs.readdir(absoluteDirectoryName, async (err, list) => {
@ -57,6 +58,7 @@ export class DiskMangerWorker {
Config.Server.folderPreviewSize, true
);
d.lastScanned = 0; //it was not a fully scan
d.isPartial = true;
directory.directories.push(d);
} else if (DiskMangerWorker.isImage(fullFilePath)) {
directory.photos.push(<PhotoDTO>{

View File

@ -6,7 +6,7 @@ export interface DirectoryDTO {
path: string;
lastModified: number;
lastScanned: number;
scanned: boolean;
isPartial?: boolean;
parent: DirectoryDTO;
directories: Array<DirectoryDTO>;
photos: Array<PhotoDTO>;

View File

@ -27,7 +27,12 @@ export class GalleryCacheService {
return;
}
localStorage.setItem(Utils.concatUrls(directory.path, directory.name), JSON.stringify(directory));
const key = Utils.concatUrls(directory.path, directory.name);
if (directory.isPartial == true && localStorage.getItem(key)) {
return;
}
localStorage.setItem(key, JSON.stringify(directory));
directory.directories.forEach((dir: DirectoryDTO) => {
let name = Utils.concatUrls(dir.path, dir.name);

View File

@ -17,7 +17,7 @@ gallery-directory {
}
.spinner {
margin-top: calc(50vh - 40px);
margin-top: 50px;
width: 80px;
height: 80px;
background-color: #333;

View File

@ -57,7 +57,7 @@
<div body class="container"
style="width: 100%; padding:0"
*ngIf="(!_galleryService.content.value.directory ||
!_galleryService.content.value.directory.scanned)
_galleryService.content.value.directory.isPartial == true)
&& !_galleryService.content.value.searchResult">
<div class="spinner">

View File

@ -42,7 +42,8 @@ export class GalleryService {
}
}
if (content.directory && content.directory.lastModified && content.directory.lastScanned) {
if (content.directory && content.directory.lastModified && content.directory.lastScanned &&
!content.directory.isPartial) {
params['knownLastModified'] = content.directory.lastModified;
params['knownLastScanned'] = content.directory.lastScanned;
}