mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-03-29 21:56:58 +02:00
improving linting
This commit is contained in:
parent
19aa1a0e90
commit
81068b6d66
@ -1,9 +1,7 @@
|
||||
import {NextFunction, Request, Response} from 'express';
|
||||
import {ErrorCodes, ErrorDTO} from '../../common/entities/Error';
|
||||
import {ObjectManagers} from '../model/ObjectManagers';
|
||||
import {
|
||||
PersonDTO,
|
||||
} from '../../common/entities/PersonDTO';
|
||||
import {PersonDTO,} from '../../common/entities/PersonDTO';
|
||||
import {Utils} from '../../common/Utils';
|
||||
import {PersonEntry} from '../model/database/enitites/PersonEntry';
|
||||
|
||||
|
@ -1,13 +1,8 @@
|
||||
import {
|
||||
ParentDirectoryDTO,
|
||||
} from '../../common/entities/DirectoryDTO';
|
||||
import {ParentDirectoryDTO,} from '../../common/entities/DirectoryDTO';
|
||||
import {Logger} from '../Logger';
|
||||
import {Config} from '../../common/config/private/Config';
|
||||
import {DiskManagerTH} from './threading/ThreadPool';
|
||||
import {
|
||||
DirectoryScanSettings,
|
||||
DiskMangerWorker,
|
||||
} from './threading/DiskMangerWorker';
|
||||
import {DirectoryScanSettings, DiskMangerWorker,} from './threading/DiskMangerWorker';
|
||||
import {FileDTO} from '../../common/entities/FileDTO';
|
||||
|
||||
const LOG_TAG = '[DiskManager]';
|
||||
|
@ -1,7 +1,4 @@
|
||||
import {
|
||||
NotificationDTO,
|
||||
NotificationType,
|
||||
} from '../../common/entities/NotificationDTO';
|
||||
import {NotificationDTO, NotificationType,} from '../../common/entities/NotificationDTO';
|
||||
import {Request} from 'express';
|
||||
|
||||
export class NotificationManager {
|
||||
|
@ -13,7 +13,8 @@ export class PasswordHelper {
|
||||
try {
|
||||
return bcrypt.compareSync(password, encryptedPassword);
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import {DiskManager} from '../DiskManger';
|
||||
import {PhotoEntity, PhotoMetadataEntity} from './enitites/PhotoEntity';
|
||||
import {Utils} from '../../../common/Utils';
|
||||
import {PhotoMetadata,} from '../../../common/entities/PhotoDTO';
|
||||
import {Connection, Repository} from 'typeorm';
|
||||
import {Connection, ObjectLiteral, Repository} from 'typeorm';
|
||||
import {MediaEntity} from './enitites/MediaEntity';
|
||||
import {MediaDTO, MediaDTOUtils} from '../../../common/entities/MediaDTO';
|
||||
import {VideoEntity} from './enitites/VideoEntity';
|
||||
@ -240,7 +240,7 @@ export class IndexingManager {
|
||||
await directoryRepository
|
||||
.createQueryBuilder()
|
||||
.update(DirectoryEntity)
|
||||
.set({parent: currentDirId as any})
|
||||
.set({parent: currentDirId as unknown})
|
||||
.where('path = :path', {
|
||||
path: DiskMangerWorker.pathFromParent(scannedDirectory),
|
||||
})
|
||||
@ -499,8 +499,8 @@ export class IndexingManager {
|
||||
});
|
||||
}
|
||||
|
||||
private async saveChunk<T>(
|
||||
repository: Repository<any>,
|
||||
private async saveChunk<T extends ObjectLiteral>(
|
||||
repository: Repository<T>,
|
||||
entities: T[],
|
||||
size: number
|
||||
): Promise<T[]> {
|
||||
@ -519,8 +519,8 @@ export class IndexingManager {
|
||||
return list;
|
||||
}
|
||||
|
||||
private async insertChunk<T>(
|
||||
repository: Repository<any>,
|
||||
private async insertChunk<T extends ObjectLiteral>(
|
||||
repository: Repository<T>,
|
||||
entities: T[],
|
||||
size: number
|
||||
): Promise<number[]> {
|
||||
@ -529,7 +529,7 @@ export class IndexingManager {
|
||||
}
|
||||
if (entities.length < size) {
|
||||
return (await repository.insert(entities)).identifiers.map(
|
||||
(i: any) => i.id
|
||||
(i: { id: number }) => i.id
|
||||
);
|
||||
}
|
||||
let list: number[] = [];
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
import {Connection, createConnection, DataSourceOptions, getConnection,} from 'typeorm';
|
||||
import {Connection, createConnection, DataSourceOptions, getConnection, LoggerOptions,} from 'typeorm';
|
||||
import {UserEntity} from './enitites/UserEntity';
|
||||
import {UserRoles} from '../../../common/entities/UserDTO';
|
||||
import {PhotoEntity} from './enitites/PhotoEntity';
|
||||
@ -26,33 +26,16 @@ import {MDFileEntity} from './enitites/MDFileEntity';
|
||||
|
||||
const LOG_TAG = '[SQLConnection]';
|
||||
|
||||
type Writeable<T> = { -readonly [P in keyof T]: T[P] };
|
||||
|
||||
export class SQLConnection {
|
||||
private static connection: Connection = null;
|
||||
|
||||
|
||||
public static async getConnection(): Promise<Connection> {
|
||||
if (this.connection == null) {
|
||||
const options: any = this.getDriver(Config.Database);
|
||||
// options.name = 'main';
|
||||
options.entities = [
|
||||
UserEntity,
|
||||
FileEntity,
|
||||
MDFileEntity,
|
||||
PersonJunctionTable,
|
||||
PersonEntry,
|
||||
MediaEntity,
|
||||
PhotoEntity,
|
||||
VideoEntity,
|
||||
DirectoryEntity,
|
||||
SharingEntity,
|
||||
AlbumBaseEntity,
|
||||
SavedSearchEntity,
|
||||
VersionEntity,
|
||||
];
|
||||
options.synchronize = false;
|
||||
if (Config.Server.Log.sqlLevel !== SQLLogLevel.none) {
|
||||
options.logging = SQLLogLevel[Config.Server.Log.sqlLevel];
|
||||
}
|
||||
const options = this.getDriver(Config.Database);
|
||||
|
||||
Logger.debug(
|
||||
LOG_TAG,
|
||||
'Creating connection: ' + DatabaseType[Config.Database.type],
|
||||
@ -73,27 +56,8 @@ export class SQLConnection {
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (err) {
|
||||
}
|
||||
const options: any = this.getDriver(config);
|
||||
const options = this.getDriver(config);
|
||||
options.name = 'test';
|
||||
options.entities = [
|
||||
UserEntity,
|
||||
FileEntity,
|
||||
MDFileEntity,
|
||||
PersonJunctionTable,
|
||||
PersonEntry,
|
||||
MediaEntity,
|
||||
PhotoEntity,
|
||||
VideoEntity,
|
||||
DirectoryEntity,
|
||||
SharingEntity,
|
||||
AlbumBaseEntity,
|
||||
SavedSearchEntity,
|
||||
VersionEntity,
|
||||
];
|
||||
options.synchronize = false;
|
||||
if (Config.Server.Log.sqlLevel !== SQLLogLevel.none) {
|
||||
options.logging = SQLLogLevel[Config.Server.Log.sqlLevel];
|
||||
}
|
||||
const conn = await this.createConnection(options);
|
||||
await SQLConnection.schemeSync(conn);
|
||||
await conn.close();
|
||||
@ -164,7 +128,7 @@ export class SQLConnection {
|
||||
}
|
||||
}
|
||||
|
||||
public static getSQLiteDB(config: ServerDataBaseConfig): any {
|
||||
public static getSQLiteDB(config: ServerDataBaseConfig): string {
|
||||
return path.join(ProjectPath.getAbsolutePath(config.dbFolder), 'sqlite.db');
|
||||
}
|
||||
|
||||
@ -236,8 +200,9 @@ export class SQLConnection {
|
||||
}
|
||||
}
|
||||
|
||||
private static getDriver(config: ServerDataBaseConfig): DataSourceOptions {
|
||||
let driver: DataSourceOptions = null;
|
||||
|
||||
private static getDriver(config: ServerDataBaseConfig): Writeable<DataSourceOptions> {
|
||||
let driver: Writeable<DataSourceOptions>;
|
||||
if (config.type === DatabaseType.mysql) {
|
||||
driver = {
|
||||
type: 'mysql',
|
||||
@ -257,6 +222,25 @@ export class SQLConnection {
|
||||
),
|
||||
};
|
||||
}
|
||||
driver.entities = [
|
||||
UserEntity,
|
||||
FileEntity,
|
||||
MDFileEntity,
|
||||
PersonJunctionTable,
|
||||
PersonEntry,
|
||||
MediaEntity,
|
||||
PhotoEntity,
|
||||
VideoEntity,
|
||||
DirectoryEntity,
|
||||
SharingEntity,
|
||||
AlbumBaseEntity,
|
||||
SavedSearchEntity,
|
||||
VersionEntity,
|
||||
];
|
||||
driver.synchronize = false;
|
||||
if (Config.Server.Log.sqlLevel !== SQLLogLevel.none) {
|
||||
driver.logging = SQLLogLevel[Config.Server.Log.sqlLevel] as LoggerOptions;
|
||||
}
|
||||
return driver;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export class SharingManager {
|
||||
|
||||
const sharing = await connection.getRepository(SharingEntity).findOneBy({
|
||||
id: inSharing.id,
|
||||
creator: inSharing.creator.id as any,
|
||||
creator: inSharing.creator.id as unknown,
|
||||
path: inSharing.path,
|
||||
});
|
||||
|
||||
|
@ -1,16 +1,5 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
Index,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
Unique,
|
||||
} from 'typeorm';
|
||||
import {
|
||||
ParentDirectoryDTO,
|
||||
SubDirectoryDTO,
|
||||
} from '../../../../common/entities/DirectoryDTO';
|
||||
import {Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, Unique,} from 'typeorm';
|
||||
import {ParentDirectoryDTO, SubDirectoryDTO,} from '../../../../common/entities/DirectoryDTO';
|
||||
import {MediaEntity} from './MediaEntity';
|
||||
import {FileEntity} from './FileEntity';
|
||||
import {columnCharsetCS} from './EntityUtils';
|
||||
@ -19,8 +8,7 @@ import { MediaDTO } from '../../../../common/entities/MediaDTO';
|
||||
@Entity()
|
||||
@Unique(['name', 'path'])
|
||||
export class DirectoryEntity
|
||||
implements ParentDirectoryDTO<MediaDTO>, SubDirectoryDTO<MediaDTO>
|
||||
{
|
||||
implements ParentDirectoryDTO<MediaDTO>, SubDirectoryDTO<MediaDTO> {
|
||||
@Index()
|
||||
@PrimaryGeneratedColumn({unsigned: true})
|
||||
id: number;
|
||||
@ -83,16 +71,16 @@ export class DirectoryEntity
|
||||
youngestMedia: number;
|
||||
|
||||
@Index()
|
||||
@ManyToOne((type) => DirectoryEntity, (directory) => directory.directories, {
|
||||
@ManyToOne(() => DirectoryEntity, (directory) => directory.directories, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
public parent: DirectoryEntity;
|
||||
|
||||
@OneToMany((type) => DirectoryEntity, (dir) => dir.parent)
|
||||
@OneToMany(() => DirectoryEntity, (dir) => dir.parent)
|
||||
public directories: DirectoryEntity[];
|
||||
|
||||
// not saving to database, it is only assigned when querying the DB
|
||||
@ManyToOne((type) => MediaEntity, { onDelete: 'SET NULL' })
|
||||
@ManyToOne(() => MediaEntity, {onDelete: 'SET NULL'})
|
||||
public cover: MediaEntity;
|
||||
|
||||
// On galley change, cover will be invalid
|
||||
|
@ -14,7 +14,7 @@ export class FileEntity implements FileDTO {
|
||||
name: string;
|
||||
|
||||
@Index()
|
||||
@ManyToOne((type) => DirectoryEntity, (directory) => directory.metaFile, {
|
||||
@ManyToOne(() => DirectoryEntity, (directory) => directory.metaFile, {
|
||||
onDelete: 'CASCADE',
|
||||
nullable: false,
|
||||
})
|
||||
|
@ -54,7 +54,7 @@ export class GPSMetadataEntity implements GPSMetadata {
|
||||
}
|
||||
|
||||
export class PositionMetaDataEntity implements PositionMetaData {
|
||||
@Column((type) => GPSMetadataEntity)
|
||||
@Column(() => GPSMetadataEntity)
|
||||
GPSData: GPSMetadataEntity;
|
||||
|
||||
@Column({
|
||||
@ -86,7 +86,7 @@ export class MediaMetadataEntity implements MediaMetadata {
|
||||
@Column('text')
|
||||
caption: string;
|
||||
|
||||
@Column((type) => MediaDimensionEntity)
|
||||
@Column(() => MediaDimensionEntity)
|
||||
size: MediaDimensionEntity;
|
||||
|
||||
/**
|
||||
@ -113,17 +113,17 @@ export class MediaMetadataEntity implements MediaMetadata {
|
||||
})
|
||||
keywords: string[];
|
||||
|
||||
@Column((type) => CameraMetadataEntity)
|
||||
@Column(() => CameraMetadataEntity)
|
||||
cameraData: CameraMetadataEntity;
|
||||
|
||||
@Column((type) => PositionMetaDataEntity)
|
||||
@Column(() => PositionMetaDataEntity)
|
||||
positionData: PositionMetaDataEntity;
|
||||
|
||||
@Column('tinyint', {unsigned: true})
|
||||
@Index()
|
||||
rating: 0 | 1 | 2 | 3 | 4 | 5;
|
||||
|
||||
@OneToMany((type) => PersonJunctionTable, (junctionTable) => junctionTable.media)
|
||||
@OneToMany(() => PersonJunctionTable, (junctionTable) => junctionTable.media)
|
||||
personJunction: PersonJunctionTable[];
|
||||
|
||||
@Column({
|
||||
@ -178,13 +178,13 @@ export abstract class MediaEntity implements MediaDTO {
|
||||
name: string;
|
||||
|
||||
@Index()
|
||||
@ManyToOne((type) => DirectoryEntity, (directory) => directory.media, {
|
||||
@ManyToOne(() => DirectoryEntity, (directory) => directory.media, {
|
||||
onDelete: 'CASCADE',
|
||||
nullable: false,
|
||||
})
|
||||
directory: DirectoryEntity;
|
||||
|
||||
@Column((type) => MediaMetadataEntity)
|
||||
@Column(() => MediaMetadataEntity)
|
||||
metadata: MediaMetadataEntity;
|
||||
|
||||
missingThumbnails: number;
|
||||
|
@ -1,12 +1,4 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
Index,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
Unique,
|
||||
} from 'typeorm';
|
||||
import {Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, Unique,} from 'typeorm';
|
||||
import {PersonJunctionTable} from './PersonJunctionTable';
|
||||
import {columnCharsetCS} from './EntityUtils';
|
||||
import {PersonDTO} from '../../../../common/entities/PersonDTO';
|
||||
@ -27,10 +19,10 @@ export class PersonEntry implements PersonDTO {
|
||||
@Column({default: false})
|
||||
isFavourite: boolean;
|
||||
|
||||
@OneToMany((type) => PersonJunctionTable, (junctionTable) => junctionTable.person)
|
||||
@OneToMany(() => PersonJunctionTable, (junctionTable) => junctionTable.person)
|
||||
public faces: PersonJunctionTable[];
|
||||
|
||||
@ManyToOne((type) => PersonJunctionTable, {
|
||||
@ManyToOne(() => PersonJunctionTable, {
|
||||
onDelete: 'SET NULL',
|
||||
nullable: true,
|
||||
})
|
||||
|
@ -13,14 +13,14 @@ export class PersonJunctionTable {
|
||||
id: number;
|
||||
|
||||
@Index()
|
||||
@ManyToOne((type) => MediaEntity, (media) => media.metadata.faces, {
|
||||
@ManyToOne(() => MediaEntity, (media) => media.metadata.faces, {
|
||||
onDelete: 'CASCADE',
|
||||
nullable: false,
|
||||
})
|
||||
media: MediaEntity;
|
||||
|
||||
@Index()
|
||||
@ManyToOne((type) => PersonEntry, (person) => person.faces, {
|
||||
@ManyToOne(() => PersonEntry, (person) => person.faces, {
|
||||
onDelete: 'CASCADE',
|
||||
nullable: false,
|
||||
})
|
||||
|
@ -1,8 +1,5 @@
|
||||
import {ChildEntity, Column} from 'typeorm';
|
||||
import {
|
||||
PhotoDTO,
|
||||
PhotoMetadata,
|
||||
} from '../../../../common/entities/PhotoDTO';
|
||||
import {PhotoDTO, PhotoMetadata,} from '../../../../common/entities/PhotoDTO';
|
||||
import {MediaEntity, MediaMetadataEntity} from './MediaEntity';
|
||||
|
||||
export class PhotoMetadataEntity
|
||||
@ -25,6 +22,6 @@ export class PhotoMetadataEntity
|
||||
|
||||
@ChildEntity()
|
||||
export class PhotoEntity extends MediaEntity implements PhotoDTO {
|
||||
@Column((type) => PhotoMetadataEntity)
|
||||
@Column(() => PhotoMetadataEntity)
|
||||
metadata: PhotoMetadataEntity;
|
||||
}
|
||||
|
@ -38,6 +38,6 @@ export class SharingEntity implements SharingDTO {
|
||||
@Column()
|
||||
includeSubfolders: boolean;
|
||||
|
||||
@ManyToOne((type) => UserEntity, { onDelete: 'CASCADE', nullable: false })
|
||||
@ManyToOne(() => UserEntity, {onDelete: 'CASCADE', nullable: false})
|
||||
creator: UserDTO;
|
||||
}
|
||||
|
@ -1,14 +1,10 @@
|
||||
import {ChildEntity, Column} from 'typeorm';
|
||||
import {MediaEntity, MediaMetadataEntity} from './MediaEntity';
|
||||
import {
|
||||
VideoDTO,
|
||||
VideoMetadata,
|
||||
} from '../../../../common/entities/VideoDTO';
|
||||
import {VideoDTO, VideoMetadata,} from '../../../../common/entities/VideoDTO';
|
||||
|
||||
export class VideoMetadataEntity
|
||||
extends MediaMetadataEntity
|
||||
implements VideoMetadata
|
||||
{
|
||||
implements VideoMetadata {
|
||||
@Column('int')
|
||||
bitRate: number;
|
||||
|
||||
@ -28,6 +24,6 @@ export class VideoMetadataEntity
|
||||
|
||||
@ChildEntity()
|
||||
export class VideoEntity extends MediaEntity implements VideoDTO {
|
||||
@Column((type) => VideoMetadataEntity)
|
||||
@Column(() => VideoMetadataEntity)
|
||||
metadata: VideoMetadataEntity;
|
||||
}
|
||||
|
@ -23,6 +23,6 @@ export class AlbumBaseEntity implements AlbumBaseDTO {
|
||||
@Column('int', {unsigned: true, default: 0})
|
||||
count: number;
|
||||
|
||||
@ManyToOne((type) => MediaEntity, {onDelete: 'SET NULL', nullable: true})
|
||||
@ManyToOne(() => MediaEntity, {onDelete: 'SET NULL', nullable: true})
|
||||
public cover: MediaEntity;
|
||||
}
|
||||
|
@ -6,8 +6,7 @@ import { SearchQueryDTO } from '../../../../../common/entities/SearchQueryDTO';
|
||||
@ChildEntity()
|
||||
export class SavedSearchEntity
|
||||
extends AlbumBaseEntity
|
||||
implements SavedSearchDTO
|
||||
{
|
||||
implements SavedSearchDTO {
|
||||
@Column({
|
||||
type: 'text',
|
||||
nullable: false,
|
||||
|
@ -31,7 +31,9 @@ const LOG_TAG = '[ConfigDiagnostics]';
|
||||
|
||||
export class ConfigDiagnostics {
|
||||
static testAlbumsConfig(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
albumConfig: ClientAlbumConfig,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
original: PrivateConfigClass
|
||||
): void {
|
||||
Logger.debug(LOG_TAG, 'Testing album config');
|
||||
@ -182,7 +184,9 @@ export class ConfigDiagnostics {
|
||||
}
|
||||
|
||||
static async testTasksConfig(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
task: ServerJobConfig,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
config: PrivateConfigClass
|
||||
): Promise<void> {
|
||||
Logger.debug(LOG_TAG, 'Testing tasks config');
|
||||
@ -202,7 +206,9 @@ export class ConfigDiagnostics {
|
||||
}
|
||||
|
||||
static async testSearchConfig(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
search: ClientSearchConfig,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
config: PrivateConfigClass
|
||||
): Promise<void> {
|
||||
Logger.debug(LOG_TAG, 'Testing search config');
|
||||
@ -223,7 +229,9 @@ export class ConfigDiagnostics {
|
||||
}
|
||||
|
||||
static async testRandomPhotoConfig(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
sharing: ClientRandomPhotoConfig,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
config: PrivateConfigClass
|
||||
): Promise<void> {
|
||||
Logger.debug(LOG_TAG, 'Testing random photo config');
|
||||
|
@ -76,7 +76,7 @@ export class JobManager implements IJobListener {
|
||||
};
|
||||
|
||||
onJobFinished = async (
|
||||
job: IJob<any>,
|
||||
job: IJob<unknown>,
|
||||
state: JobProgressStates,
|
||||
soloRun: boolean
|
||||
): Promise<void> => {
|
||||
@ -111,7 +111,7 @@ export class JobManager implements IJobListener {
|
||||
}
|
||||
};
|
||||
|
||||
getAvailableJobs(): IJob<any>[] {
|
||||
getAvailableJobs(): IJob<unknown>[] {
|
||||
return JobRepository.Instance.getAvailableJobs();
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ export class JobManager implements IJobListener {
|
||||
Config.Jobs.scheduled.forEach((s): void => this.runSchedule(s));
|
||||
}
|
||||
|
||||
protected findJob<T = any>(jobName: string): IJob<T> {
|
||||
protected findJob<T = unknown>(jobName: string): IJob<T> {
|
||||
return this.getAvailableJobs().find((t): boolean => t.Name === jobName);
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,7 @@ import { promises as fsp } from 'fs';
|
||||
import * as path from 'path';
|
||||
import {ProjectPath} from '../../ProjectPath';
|
||||
import {Config} from '../../../common/config/private/Config';
|
||||
import {
|
||||
JobProgressDTO,
|
||||
JobProgressStates,
|
||||
} from '../../../common/entities/job/JobProgressDTO';
|
||||
import {JobProgressDTO, JobProgressStates,} from '../../../common/entities/job/JobProgressDTO';
|
||||
|
||||
export class JobProgressManager {
|
||||
private static readonly VERSION = 3;
|
||||
|
@ -14,7 +14,7 @@ import {AlbumCoverRestJob} from './jobs/AlbumCoverResetJob';
|
||||
|
||||
export class JobRepository {
|
||||
private static instance: JobRepository = null;
|
||||
availableJobs: { [key: string]: IJob<any> } = {};
|
||||
availableJobs: { [key: string]: IJob<unknown> } = {};
|
||||
|
||||
public static get Instance(): JobRepository {
|
||||
if (JobRepository.instance == null) {
|
||||
@ -23,11 +23,11 @@ export class JobRepository {
|
||||
return JobRepository.instance;
|
||||
}
|
||||
|
||||
getAvailableJobs(): IJob<any>[] {
|
||||
getAvailableJobs(): IJob<unknown>[] {
|
||||
return Object.values(this.availableJobs).filter((t) => t.Supported);
|
||||
}
|
||||
|
||||
register(job: IJob<any>): void {
|
||||
register(job: IJob<unknown>): void {
|
||||
if (typeof this.availableJobs[job.Name] !== 'undefined') {
|
||||
throw new Error('Job already exist:' + job.Name);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { JobProgressStates } from '../../../../common/entities/job/JobProgressDT
|
||||
|
||||
export interface IJobListener {
|
||||
onJobFinished(
|
||||
job: IJob<any>,
|
||||
job: IJob<unknown>,
|
||||
state: JobProgressStates,
|
||||
soloRun: boolean
|
||||
): void;
|
||||
|
@ -10,7 +10,7 @@ declare const global: any;
|
||||
|
||||
const LOG_TAG = '[JOB]';
|
||||
|
||||
export abstract class Job<T extends Record<string, any> = Record<string, any>> implements IJob<T> {
|
||||
export abstract class Job<T extends Record<string, unknown> = Record<string, unknown>> implements IJob<T> {
|
||||
public allowParallelRun: boolean = null;
|
||||
protected progress: JobProgress = null;
|
||||
protected config: T;
|
||||
@ -55,11 +55,11 @@ export abstract class Job<T extends Record<string, any> = Record<string, any>> i
|
||||
this.allowParallelRun = allowParallelRun;
|
||||
this.config = {} as T;
|
||||
if (this.ConfigTemplate) {
|
||||
this.ConfigTemplate.forEach(ct => (this.config as any)[ct.id] = ct.defaultValue);
|
||||
this.ConfigTemplate.forEach(ct => (this.config as Record<string, unknown>)[ct.id] = ct.defaultValue);
|
||||
}
|
||||
if (config) {
|
||||
for (const key of Object.keys(config)) {
|
||||
(this.config as any)[key] = config[key];
|
||||
(this.config as Record<string, unknown>)[key] = config[key];
|
||||
}
|
||||
}
|
||||
this.progress = new JobProgress(
|
||||
|
@ -1,8 +1,4 @@
|
||||
import {
|
||||
JobProgressDTO,
|
||||
JobProgressLogDTO,
|
||||
JobProgressStates,
|
||||
} from '../../../../common/entities/job/JobProgressDTO';
|
||||
import {JobProgressDTO, JobProgressLogDTO, JobProgressStates,} from '../../../../common/entities/job/JobProgressDTO';
|
||||
import {Config} from '../../../../common/config/private/Config';
|
||||
|
||||
export class JobProgress {
|
||||
@ -22,7 +18,8 @@ export class JobProgress {
|
||||
constructor(
|
||||
public readonly jobName: string,
|
||||
public readonly HashName: string
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
set OnChange(val: (progress: JobProgress) => void) {
|
||||
this.onChange = val;
|
||||
|
@ -23,7 +23,8 @@ export class TaskExecuter<I, O> implements ITaskExecuter<I, O> {
|
||||
process.nextTick(this.run);
|
||||
};
|
||||
|
||||
constructor(private size: number, private worker: (input: I) => Promise<O>) {}
|
||||
constructor(private size: number, private worker: (input: I) => Promise<O>) {
|
||||
}
|
||||
|
||||
execute(input: I): Promise<O> {
|
||||
const promise = this.taskQue.add(input).promise.obj;
|
||||
|
@ -21,7 +21,7 @@ import {Event} from '../common/event/Event';
|
||||
import {QueryParams} from '../common/QueryParams';
|
||||
import {ConfigClassBuilder} from 'typeconfig/node';
|
||||
import {ConfigClassOptions} from 'typeconfig/src/decorators/class/IConfigClass';
|
||||
import {DatabaseType, ServerConfig} from '../common/config/private/PrivateConfig';
|
||||
import {ServerConfig} from '../common/config/private/PrivateConfig';
|
||||
import {unless} from 'express-unless';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
|
@ -2,7 +2,6 @@
|
||||
import {SubConfigClass} from '../../../../node_modules/typeconfig/src/decorators/class/SubConfigClass';
|
||||
import {ConfigPriority, TAGS} from '../public/ClientConfig';
|
||||
import {ConfigProperty} from '../../../../node_modules/typeconfig/src/decorators/property/ConfigPropoerty';
|
||||
import {ServerConfig} from './PrivateConfig';
|
||||
|
||||
declare let $localize: (s: TemplateStringsArray) => string;
|
||||
|
||||
|
@ -6,7 +6,8 @@ export interface IAutoCompleteItem {
|
||||
}
|
||||
|
||||
export class AutoCompleteItem implements IAutoCompleteItem {
|
||||
constructor(public text: string, public type: SearchQueryTypes = null) {}
|
||||
constructor(public text: string, public type: SearchQueryTypes = null) {
|
||||
}
|
||||
|
||||
equals(other: AutoCompleteItem): boolean {
|
||||
return this.text === other.text && this.type === other.type;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { MediaDTO, MediaDTOUtils } from './MediaDTO';
|
||||
import {MediaDTO} from './MediaDTO';
|
||||
import {FileDTO} from './FileDTO';
|
||||
import { PhotoDTO, CoverPhotoDTO } from './PhotoDTO';
|
||||
import {CoverPhotoDTO} from './PhotoDTO';
|
||||
import {Utils} from '../Utils';
|
||||
|
||||
export interface DirectoryPathDTO {
|
||||
@ -9,7 +9,6 @@ export interface DirectoryPathDTO {
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface DirectoryBaseDTO<S extends FileDTO = MediaDTO>
|
||||
extends DirectoryPathDTO {
|
||||
id: number;
|
||||
|
@ -3,5 +3,6 @@ export class LoginCredential {
|
||||
public username: string = '',
|
||||
public password: string = '',
|
||||
public rememberMe: boolean = true
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
export class UserModificationRequest {
|
||||
constructor(public id: number) {}
|
||||
constructor(public id: number) {
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ export class EventLimit<T> {
|
||||
class EventLimitHandler<T> {
|
||||
public lastTriggerValue: T = null;
|
||||
|
||||
constructor(public limit: T, public handler: (data?: T) => void) {}
|
||||
constructor(public limit: T, public handler: (data?: T) => void) {
|
||||
}
|
||||
|
||||
public fire(data?: T): void {
|
||||
this.handler(data);
|
||||
|
@ -1,9 +1,5 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
ActivatedRouteSnapshot,
|
||||
CanActivate,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
import {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot,} from '@angular/router';
|
||||
import {AuthenticationService} from '../authentication.service';
|
||||
import {NavigationService} from '../../navigation.service';
|
||||
|
||||
@ -12,7 +8,8 @@ export class AuthGuard implements CanActivate {
|
||||
constructor(
|
||||
private authenticationService: AuthenticationService,
|
||||
private navigationService: NavigationService
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
canActivate(
|
||||
route: ActivatedRouteSnapshot,
|
||||
|
@ -1,16 +1,12 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
HttpEvent,
|
||||
HttpHandler,
|
||||
HttpInterceptor,
|
||||
HttpRequest,
|
||||
} from '@angular/common/http';
|
||||
import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest,} from '@angular/common/http';
|
||||
import {Observable} from 'rxjs';
|
||||
import {AuthenticationService} from '../authentication.service';
|
||||
|
||||
@Injectable()
|
||||
export class CSRFInterceptor implements HttpInterceptor {
|
||||
constructor(private authenticationService: AuthenticationService) {}
|
||||
constructor(private authenticationService: AuthenticationService) {
|
||||
}
|
||||
|
||||
intercept(
|
||||
request: HttpRequest<any>,
|
||||
|
@ -1,17 +1,13 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
HttpEvent,
|
||||
HttpHandler,
|
||||
HttpInterceptor,
|
||||
HttpRequest,
|
||||
} from '@angular/common/http';
|
||||
import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest,} from '@angular/common/http';
|
||||
import {Observable, throwError} from 'rxjs';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {AuthenticationService} from '../authentication.service';
|
||||
|
||||
@Injectable()
|
||||
export class ErrorInterceptor implements HttpInterceptor {
|
||||
constructor(private authenticationService: AuthenticationService) {}
|
||||
constructor(private authenticationService: AuthenticationService) {
|
||||
}
|
||||
|
||||
intercept(
|
||||
request: HttpRequest<any>,
|
||||
|
@ -1,8 +1,5 @@
|
||||
import {getTestBed, inject, TestBed} from '@angular/core/testing';
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
} from '@angular/common/http/testing';
|
||||
import {HttpClientTestingModule, HttpTestingController,} from '@angular/common/http/testing';
|
||||
import {NetworkService} from './network.service';
|
||||
import {Message} from '../../../../common/entities/Message';
|
||||
import {LoadingBarService} from '@ngx-loading-bar/core';
|
||||
|
@ -2,10 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import {ToastrService} from 'ngx-toastr';
|
||||
import {NetworkService} from './network/network.service';
|
||||
import {AuthenticationService} from './network/authentication.service';
|
||||
import {
|
||||
NotificationDTO,
|
||||
NotificationType,
|
||||
} from '../../../common/entities/NotificationDTO';
|
||||
import {NotificationDTO, NotificationType,} from '../../../common/entities/NotificationDTO';
|
||||
import {UserDTO, UserRoles} from '../../../common/entities/UserDTO';
|
||||
|
||||
export interface CountedNotificationDTO extends NotificationDTO {
|
||||
|
@ -13,7 +13,7 @@ export class PhotoFilterPipe implements PipeTransform {
|
||||
for (let i = 0; i < mediaGroups.length; ++i) {
|
||||
ret.push(...mediaGroups[i].media.filter((m: MediaDTO): boolean =>
|
||||
MediaDTOUtils.isPhoto(m)
|
||||
) as PhotoDTO[])
|
||||
) as PhotoDTO[]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Pipe, PipeTransform, SecurityContext} from '@angular/core';
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
import {DomSanitizer} from '@angular/platform-browser';
|
||||
|
||||
@Pipe({name: 'safeHtml'})
|
||||
|
@ -4,7 +4,8 @@ import { SearchQueryParserService } from '../ui/gallery/search/search-query-pars
|
||||
|
||||
@Pipe({name: 'searchQuery'})
|
||||
export class StringifySearchQuery implements PipeTransform {
|
||||
constructor(private searchQueryParserService: SearchQueryParserService) {}
|
||||
constructor(private searchQueryParserService: SearchQueryParserService) {
|
||||
}
|
||||
|
||||
transform(query: SearchQueryDTO): string {
|
||||
return this.searchQueryParserService.stringify(query);
|
||||
|
@ -3,7 +3,7 @@ import {ConfigPriority, MapProviders, NavigationLinkTypes, ScrollUpModes} from '
|
||||
import {ReIndexingSensitivity} from '../../../common/config/private/PrivateConfig';
|
||||
import {SearchQueryTypes} from '../../../common/entities/SearchQueryDTO';
|
||||
import {ConfigStyle} from './settings/settings.service';
|
||||
import {SortByTypes,GroupByTypes} from '../../../common/entities/SortingMethods';
|
||||
import {GroupByTypes, SortByTypes} from '../../../common/entities/SortingMethods';
|
||||
import {GridSizes} from '../../../common/entities/GridSizes';
|
||||
|
||||
export const EnumTranslations: Record<string, string> = {};
|
||||
|
@ -1,10 +1,7 @@
|
||||
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import {RouterLink} from '@angular/router';
|
||||
import {DomSanitizer, SafeStyle} from '@angular/platform-browser';
|
||||
import {
|
||||
Thumbnail,
|
||||
ThumbnailManagerService,
|
||||
} from '../../gallery/thumbnailManager.service';
|
||||
import {Thumbnail, ThumbnailManagerService,} from '../../gallery/thumbnailManager.service';
|
||||
import {AuthenticationService} from '../../../model/network/authentication.service';
|
||||
import {AlbumsService} from '../albums.service';
|
||||
import {AlbumBaseDTO} from '../../../../../common/entities/album/AlbumBaseDTO';
|
||||
@ -31,7 +28,8 @@ export class AlbumComponent implements OnInit, OnDestroy {
|
||||
private sanitizer: DomSanitizer,
|
||||
private albumService: AlbumsService,
|
||||
public authenticationService: AuthenticationService
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
get IsSavedSearch(): boolean {
|
||||
return this.album && !!this.AsSavedSearch.searchQuery;
|
||||
|
@ -13,7 +13,8 @@ export class SavedSearchPopupComponent {
|
||||
@Input() savedSearchDTO: { name: string; searchQuery: SearchQueryDTO };
|
||||
private modalRef: BsModalRef;
|
||||
|
||||
constructor(private modalService: BsModalService) {}
|
||||
constructor(private modalService: BsModalService) {
|
||||
}
|
||||
|
||||
public async openModal(template: TemplateRef<any>): Promise<void> {
|
||||
this.modalRef = this.modalService.show(template, {class: 'modal-lg'});
|
||||
|
@ -1,9 +1,6 @@
|
||||
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import {MediaDTO} from '../../../../../common/entities/MediaDTO';
|
||||
import {
|
||||
IconThumbnail,
|
||||
ThumbnailManagerService,
|
||||
} from '../../gallery/thumbnailManager.service';
|
||||
import {IconThumbnail, ThumbnailManagerService,} from '../../gallery/thumbnailManager.service';
|
||||
import {MediaIcon} from '../../gallery/MediaIcon';
|
||||
|
||||
@Component({
|
||||
@ -16,7 +13,8 @@ export class DuplicatesPhotoComponent implements OnInit, OnDestroy {
|
||||
|
||||
thumbnail: IconThumbnail;
|
||||
|
||||
constructor(private thumbnailService: ThumbnailManagerService) {}
|
||||
constructor(private thumbnailService: ThumbnailManagerService) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.thumbnail = this.thumbnailService.getIcon(new MediaIcon(this.media));
|
||||
|
@ -2,18 +2,11 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import {RouterLink} from '@angular/router';
|
||||
import {PersonDTO} from '../../../../../common/entities/PersonDTO';
|
||||
import {DomSanitizer, SafeStyle} from '@angular/platform-browser';
|
||||
import {
|
||||
PersonThumbnail,
|
||||
ThumbnailManagerService,
|
||||
} from '../../gallery/thumbnailManager.service';
|
||||
import {PersonThumbnail, ThumbnailManagerService,} from '../../gallery/thumbnailManager.service';
|
||||
import {FacesService} from '../faces.service';
|
||||
import {AuthenticationService} from '../../../model/network/authentication.service';
|
||||
import {Config} from '../../../../../common/config/public/Config';
|
||||
import {
|
||||
SearchQueryTypes,
|
||||
TextSearch,
|
||||
TextSearchQueryMatchTypes,
|
||||
} from '../../../../../common/entities/SearchQueryDTO';
|
||||
import {SearchQueryTypes, TextSearch, TextSearchQueryMatchTypes,} from '../../../../../common/entities/SearchQueryDTO';
|
||||
|
||||
@Component({
|
||||
selector: 'app-face',
|
||||
@ -33,7 +26,8 @@ export class FaceComponent implements OnInit, OnDestroy {
|
||||
private sanitizer: DomSanitizer,
|
||||
private faceService: FacesService,
|
||||
public authenticationService: AuthenticationService
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
get CanUpdate(): boolean {
|
||||
return (
|
||||
|
@ -1,7 +1,6 @@
|
||||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||
import {BlogService, GroupedMarkdown} from './blog.service';
|
||||
import {OnChanges} from '../../../../../../node_modules/@angular/core';
|
||||
import {Utils} from '../../../../../common/Utils';
|
||||
import {map, Observable} from 'rxjs';
|
||||
|
||||
@Component({
|
||||
|
@ -7,7 +7,6 @@ import {Media} from '../../Media';
|
||||
import {Thumbnail, ThumbnailManagerService,} from '../../thumbnailManager.service';
|
||||
import {QueryService} from '../../../../model/query.service';
|
||||
import {CoverPhotoDTO} from '../../../../../../common/entities/PhotoDTO';
|
||||
import {Config} from '../../../../../../common/config/public/Config';
|
||||
|
||||
@Component({
|
||||
selector: 'app-gallery-directory',
|
||||
|
@ -1,12 +1,4 @@
|
||||
import {
|
||||
Component,
|
||||
ElementRef,
|
||||
EventEmitter,
|
||||
Input,
|
||||
OnChanges,
|
||||
Output,
|
||||
ViewChild,
|
||||
} from '@angular/core';
|
||||
import {Component, ElementRef, EventEmitter, Input, OnChanges, Output, ViewChild,} from '@angular/core';
|
||||
import {GridMedia} from '../../grid/GridMedia';
|
||||
import {MediaDTOUtils} from '../../../../../../common/entities/MediaDTO';
|
||||
import {DomSanitizer, SafeStyle} from '@angular/platform-browser';
|
||||
|
@ -169,7 +169,7 @@ export class GalleryMapLightboxComponent implements OnChanges, OnDestroy {
|
||||
setUpPathLayers() {
|
||||
|
||||
|
||||
Config.Map.MapPathGroupConfig.forEach((conf, i) => {
|
||||
Config.Map.MapPathGroupConfig.forEach((conf) => {
|
||||
let nameI18n = conf.name;
|
||||
switch (conf.name) {
|
||||
case 'Sport':
|
||||
@ -587,7 +587,6 @@ export class GalleryMapLightboxComponent implements OnChanges, OnDestroy {
|
||||
|
||||
const mkr = marker(mc);
|
||||
mkr.setIcon(MarkerFactory.defIconSmall);
|
||||
// pathLayer.layer.addLayer(mkr);
|
||||
});
|
||||
|
||||
path.splice(i + 1, 0, ...newPoints);
|
||||
|
@ -70,7 +70,7 @@ export class GallerySortingService {
|
||||
if (cw.directory && cw.directory.metaFile) {
|
||||
for (const file in PG2ConfMap.sorting) {
|
||||
if (cw.directory.metaFile.some((f) => f.name === file)) {
|
||||
return (PG2ConfMap.sorting as any)[file];
|
||||
return (PG2ConfMap.sorting)[file];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ export class GallerySortingService {
|
||||
return (m: MediaDTO) => ((m as PhotoDTO).metadata.faces || []).length.toString();
|
||||
|
||||
}
|
||||
return (m: MediaDTO) => '';
|
||||
return () => '';
|
||||
}
|
||||
|
||||
public applySorting(
|
||||
|
@ -23,7 +23,7 @@ export class OverlayService {
|
||||
const outer = document.createElement('div');
|
||||
outer.style.visibility = 'hidden';
|
||||
outer.style.width = '100px';
|
||||
(outer.style as any).msOverflowStyle = 'scrollbar'; // needed for WinJS apps
|
||||
(outer.style as unknown as Record<string, string>).msOverflowStyle = 'scrollbar'; // needed for WinJS apps
|
||||
|
||||
document.body.appendChild(outer);
|
||||
|
||||
|
@ -82,7 +82,7 @@ export class RandomQueryBuilderGalleryComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
openModal(template: TemplateRef<any>): boolean {
|
||||
openModal(template: TemplateRef<unknown>): boolean {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {Component, EventEmitter, forwardRef, Input, Output,} from '@angular/core';
|
||||
import {SearchQueryDTO, SearchQueryTypes, TextSearch,} from '../../../../../../common/entities/SearchQueryDTO';
|
||||
import {ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, UntypedFormControl, ValidationErrors, Validator,} from '@angular/forms';
|
||||
import {ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator,} from '@angular/forms';
|
||||
import {SearchQueryParserService} from '../search-query-parser.service';
|
||||
import {Utils} from '../../../../../../common/Utils';
|
||||
|
||||
@ -58,7 +58,7 @@ export class GallerySearchQueryBuilderComponent
|
||||
this.onChange();
|
||||
}
|
||||
|
||||
validate(control: UntypedFormControl): ValidationErrors {
|
||||
validate(): ValidationErrors {
|
||||
return {required: true};
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ export class GallerySearchQueryBuilderComponent
|
||||
public onTouched(): void {
|
||||
}
|
||||
|
||||
public writeValue(obj: any): void {
|
||||
public writeValue(obj: SearchQueryDTO): void {
|
||||
try {
|
||||
// do not trigger change if nothing changed
|
||||
if (Utils.equalsFilter(this.searchQueryDTO, obj) &&
|
||||
@ -84,7 +84,7 @@ export class GallerySearchQueryBuilderComponent
|
||||
);
|
||||
}
|
||||
|
||||
registerOnChange(fn: (_: any) => void): void {
|
||||
registerOnChange(fn: (_: SearchQueryDTO) => void): void {
|
||||
this.propagateChange = fn;
|
||||
}
|
||||
|
||||
@ -107,11 +107,12 @@ export class GallerySearchQueryBuilderComponent
|
||||
this.propagateChange(this.searchQueryDTO);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
private propagateChange = (_: unknown): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
private propagateChange = (_: SearchQueryDTO): void => {
|
||||
// ignoring
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
private propagateTouch = (_: unknown): void => {
|
||||
private propagateTouch = (): void => {
|
||||
// ignoring
|
||||
};
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
<input type="text"
|
||||
class="form-control search-text"
|
||||
[placeholder]="placeholder"
|
||||
(keyup)="onSearchChange($event)"
|
||||
(keyup)="onSearchChange()"
|
||||
(blur)="onFocusLost()"
|
||||
(focus)="onFocus()"
|
||||
[(ngModel)]="rawSearchText"
|
||||
(ngModelChange)="onChange()"
|
||||
(keydown.enter)="OnEnter($event)"
|
||||
(keydown.enter)="OnEnter()"
|
||||
(keydown.arrowRight)="applyHint($event)"
|
||||
(keydown.arrowUp)="selectAutocompleteUp()"
|
||||
(keydown.arrowDown)="selectAutocompleteDown()"
|
||||
|
@ -4,7 +4,7 @@ import {BehaviorSubject, Subscription} from 'rxjs';
|
||||
import {AutoCompleteService, RenderableAutoCompleteItem,} from '../autocomplete.service';
|
||||
import {MetadataSearchQueryTypes, SearchQueryTypes,} from '../../../../../../common/entities/SearchQueryDTO';
|
||||
import {Config} from '../../../../../../common/config/public/Config';
|
||||
import {ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, UntypedFormControl, ValidationErrors, Validator,} from '@angular/forms';
|
||||
import {ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator,} from '@angular/forms';
|
||||
import {AutoCompleteRenderItem} from '../AutoCompleteRenderItem';
|
||||
|
||||
@Component({
|
||||
@ -117,7 +117,7 @@ export class GallerySearchFieldBaseComponent
|
||||
};
|
||||
}
|
||||
|
||||
onSearchChange(event: KeyboardEvent): void {
|
||||
onSearchChange(): void {
|
||||
const searchText = this.getAutocompleteToken();
|
||||
if (
|
||||
Config.Search.AutoComplete.enabled &&
|
||||
@ -143,8 +143,8 @@ export class GallerySearchFieldBaseComponent
|
||||
}
|
||||
}
|
||||
|
||||
applyHint($event: any): void {
|
||||
if ($event.target.selectionStart !== this.rawSearchText.length) {
|
||||
applyHint($event: Event): void {
|
||||
if (($event.target as HTMLInputElement).selectionStart !== this.rawSearchText.length) {
|
||||
return;
|
||||
}
|
||||
// if no item selected, apply hint
|
||||
@ -199,7 +199,7 @@ export class GallerySearchFieldBaseComponent
|
||||
}
|
||||
}
|
||||
|
||||
OnEnter($event: any): boolean {
|
||||
OnEnter(): boolean {
|
||||
// no autocomplete shown, just search whatever is there.
|
||||
if (
|
||||
this.autoCompleteRenders.length === 0 ||
|
||||
@ -235,7 +235,7 @@ export class GallerySearchFieldBaseComponent
|
||||
this.propagateChange(this.rawSearchText);
|
||||
}
|
||||
|
||||
validate(control: UntypedFormControl): ValidationErrors {
|
||||
validate(): ValidationErrors {
|
||||
return {required: true};
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ import {Component, EventEmitter, forwardRef, Input, Output, TemplateRef} from '@
|
||||
import {Router, RouterLink} from '@angular/router';
|
||||
import {AutoCompleteService} from '../autocomplete.service';
|
||||
import {SearchQueryDTO} from '../../../../../../common/entities/SearchQueryDTO';
|
||||
import {ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, UntypedFormControl, ValidationErrors, Validator,} from '@angular/forms';
|
||||
import {ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator,} from '@angular/forms';
|
||||
import {SearchQueryParserService} from '../search-query-parser.service';
|
||||
import {BsModalRef, BsModalService,} from '../../../../../../../node_modules/ngx-bootstrap/modal';
|
||||
import {Utils} from '../../../../../../common/Utils';
|
||||
@ -42,7 +42,7 @@ export class GallerySearchFieldComponent
|
||||
) {
|
||||
}
|
||||
|
||||
public async openSearchModal(template: TemplateRef<any>): Promise<void> {
|
||||
public async openSearchModal(template: TemplateRef<unknown>): Promise<void> {
|
||||
this.searchModalRef = this.modalService.show(template, {
|
||||
class: 'modal-lg',
|
||||
});
|
||||
@ -87,7 +87,7 @@ export class GallerySearchFieldComponent
|
||||
this.propagateChange(this.searchQueryDTO);
|
||||
}
|
||||
|
||||
validate(control: UntypedFormControl): ValidationErrors {
|
||||
validate(): ValidationErrors {
|
||||
return {required: true};
|
||||
}
|
||||
|
||||
@ -118,11 +118,12 @@ export class GallerySearchFieldComponent
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
private propagateChange = (_: SearchQueryDTO): void => {
|
||||
//ignoring
|
||||
};
|
||||
|
||||
private propagateTouch = (_: never): void => {
|
||||
private propagateTouch = (): void => {
|
||||
//ignoring
|
||||
};
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
QueryKeywords,
|
||||
SearchQueryParser,
|
||||
} from '../../../../../common/SearchQueryParser';
|
||||
import {QueryKeywords, SearchQueryParser,} from '../../../../../common/SearchQueryParser';
|
||||
import {SearchQueryDTO} from '../../../../../common/entities/SearchQueryDTO';
|
||||
|
||||
@Injectable()
|
||||
|
@ -150,7 +150,6 @@ export class ShareService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public getSharingList(): Promise<SharingDTO[]> {
|
||||
if (!Config.Sharing.enabled) {
|
||||
return Promise.resolve([]);
|
||||
|
@ -1,10 +1,5 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
ThumbnailLoaderService,
|
||||
ThumbnailLoadingListener,
|
||||
ThumbnailLoadingPriority,
|
||||
ThumbnailTaskEntity,
|
||||
} from './thumbnailLoader.service';
|
||||
import {ThumbnailLoaderService, ThumbnailLoadingListener, ThumbnailLoadingPriority, ThumbnailTaskEntity,} from './thumbnailLoader.service';
|
||||
import {Media} from './Media';
|
||||
import {MediaIcon} from './MediaIcon';
|
||||
import {PersonDTO} from '../../../../common/entities/PersonDTO';
|
||||
@ -12,7 +7,8 @@ import { Person } from '../faces/Person';
|
||||
|
||||
@Injectable()
|
||||
export class ThumbnailManagerService {
|
||||
constructor(private thumbnailLoader: ThumbnailLoaderService) {}
|
||||
constructor(private thumbnailLoader: ThumbnailLoaderService) {
|
||||
}
|
||||
|
||||
public getThumbnail(photo: Media): Thumbnail {
|
||||
return new Thumbnail(photo, this.thumbnailLoader);
|
||||
@ -39,7 +35,8 @@ export abstract class ThumbnailBase {
|
||||
protected onLoad: () => void = null;
|
||||
protected thumbnailTask: ThumbnailTaskEntity = null;
|
||||
|
||||
protected constructor(protected thumbnailService: ThumbnailLoaderService) {}
|
||||
protected constructor(protected thumbnailService: ThumbnailLoaderService) {
|
||||
}
|
||||
|
||||
abstract set Visible(visible: boolean);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Component, Input, ViewChild} from '@angular/core';
|
||||
import {Component, ViewChild} from '@angular/core';
|
||||
import {Config} from '../../../../common/config/public/Config';
|
||||
import {CookieNames} from '../../../../common/CookieNames';
|
||||
import {CookieService} from 'ngx-cookie-service';
|
||||
|
@ -11,9 +11,6 @@ import {DefaultsJobs} from '../../../../common/entities/job/JobDTO';
|
||||
import {StatisticDTO} from '../../../../common/entities/settings/StatisticDTO';
|
||||
import {ScheduledJobsService} from './scheduled-jobs.service';
|
||||
import {IWebConfigClassPrivate} from '../../../../../node_modules/typeconfig/src/decorators/class/IWebConfigClass';
|
||||
import {SharingDTO} from '../../../../common/entities/SharingDTO';
|
||||
import {Utils} from '../../../../common/Utils';
|
||||
import {Config} from '../../../../common/config/public/Config';
|
||||
|
||||
|
||||
export enum ConfigStyle {
|
||||
|
@ -2,8 +2,6 @@ import {Component, OnInit} from '@angular/core';
|
||||
import {SharingDTO} from '../../../../../common/entities/SharingDTO';
|
||||
import {SettingsService} from '../settings.service';
|
||||
import {ShareService} from '../../gallery/share.service';
|
||||
import {AuthenticationService} from '../../../model/network/authentication.service';
|
||||
import {UserRoles} from '../../../../../common/entities/UserDTO';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settigns-sharings-list',
|
||||
|
@ -17,7 +17,6 @@ import {WebConfig} from '../../../../../../common/config/private/WebConfig';
|
||||
import {JobScheduleConfig, UserConfig} from '../../../../../../common/config/private/PrivateConfig';
|
||||
import {enumToTranslatedArray} from '../../../EnumTranslations';
|
||||
import {BsModalService} from '../../../../../../../node_modules/ngx-bootstrap/modal';
|
||||
import {Config} from '../../../../../../common/config/public/Config';
|
||||
import {CustomSettingsEntries} from '../CustomSettingsEntries';
|
||||
import {GroupByTypes, SortByTypes} from '../../../../../../common/entities/SortingMethods';
|
||||
|
||||
|
@ -3,7 +3,6 @@ import {
|
||||
ControlValueAccessor,
|
||||
NG_VALIDATORS,
|
||||
NG_VALUE_ACCESSOR,
|
||||
UntypedFormControl,
|
||||
ValidationErrors,
|
||||
Validator
|
||||
} from '../../../../../../../../node_modules/@angular/forms';
|
||||
@ -65,16 +64,17 @@ export class SortingMethodSettingsEntryComponent
|
||||
this.propagateChange(this.sortingMethod);
|
||||
}
|
||||
|
||||
validate(control: UntypedFormControl): ValidationErrors {
|
||||
validate(): ValidationErrors {
|
||||
return {required: true};
|
||||
}
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
private propagateChange = (_: SortingMethod): void => {
|
||||
//ignoring
|
||||
};
|
||||
|
||||
private propagateTouch = (_: never): void => {
|
||||
private propagateTouch = (): void => {
|
||||
//ignoring
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,6 @@ export class UsersComponent implements OnInit {
|
||||
Changed = false;
|
||||
|
||||
|
||||
|
||||
constructor(
|
||||
private authService: AuthenticationService,
|
||||
private navigation: NavigationService,
|
||||
|
@ -1,14 +1,5 @@
|
||||
import {
|
||||
Component,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
TemplateRef,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
JobProgressDTO,
|
||||
JobProgressStates,
|
||||
} from '../../../../../../common/entities/job/JobProgressDTO';
|
||||
import {Component, Input, OnChanges, OnDestroy, TemplateRef,} from '@angular/core';
|
||||
import {JobProgressDTO, JobProgressStates,} from '../../../../../../common/entities/job/JobProgressDTO';
|
||||
import {Subscription, timer} from 'rxjs';
|
||||
import {BsModalRef, BsModalService} from 'ngx-bootstrap/modal';
|
||||
import {BackendtextService} from '../../../../model/backendtext.service';
|
||||
@ -28,7 +19,8 @@ export class JobProgressComponent implements OnDestroy, OnChanges {
|
||||
constructor(
|
||||
private modalService: BsModalService,
|
||||
public backendTextService: BackendtextService
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
get ProgressTitle(): string {
|
||||
if (!this.progress) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user