diff --git a/backend/middlewares/AdminMWs.ts b/backend/middlewares/AdminMWs.ts
index 6e4ed263..1cadb8d0 100644
--- a/backend/middlewares/AdminMWs.ts
+++ b/backend/middlewares/AdminMWs.ts
@@ -32,6 +32,10 @@ export class AdminMWs {
//only updating explicitly set config (not saving config set by the diagnostics)
const original = Config.original();
original.Server.database = databaseSettings;
+ if (databaseSettings.type == DatabaseType.memory) {
+ original.Client.Sharing.enabled = false;
+ original.Client.Search.enabled = false;
+ }
original.save();
await ConfigDiagnostics.runDiagnostics();
Logger.info(LOG_TAG, "new config:");
@@ -46,7 +50,10 @@ export class AdminMWs {
return next();
} catch (err) {
- return next(new ErrorDTO(ErrorCodes.SETTINGS_ERROR, "ErrorDTO saving database settings", err));
+ if (err instanceof Error) {
+ return next(new ErrorDTO(ErrorCodes.SETTINGS_ERROR, "Error while saving database settings: " + err.toString(), err));
+ }
+ return next(new ErrorDTO(ErrorCodes.SETTINGS_ERROR, "Error while saving database settings", err));
}
}
diff --git a/backend/middlewares/GalleryMWs.ts b/backend/middlewares/GalleryMWs.ts
index 952960e7..cbd5c7bd 100644
--- a/backend/middlewares/GalleryMWs.ts
+++ b/backend/middlewares/GalleryMWs.ts
@@ -37,7 +37,7 @@ export class GalleryMWs {
return next();
} catch (err) {
- return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "ErrorDTO during listing the directory", err));
+ return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "Error during listing the directory", err));
}
}
@@ -108,7 +108,7 @@ export class GalleryMWs {
req.resultPipe = new ContentWrapper(null, result);
return next();
} catch (err) {
- return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "ErrorDTO during searching", err));
+ return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "Error during searching", err));
}
}
@@ -128,7 +128,7 @@ export class GalleryMWs {
req.resultPipe = new ContentWrapper(null, result);
return next();
} catch (err) {
- return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "ErrorDTO during searching", err));
+ return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "Error during searching", err));
}
}
@@ -144,7 +144,7 @@ export class GalleryMWs {
req.resultPipe = await ObjectManagerRepository.getInstance().SearchManager.autocomplete(req.params.text);
return next();
} catch (err) {
- return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "ErrorDTO during searching", err));
+ return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "Error during searching", err));
}
}
diff --git a/backend/middlewares/SharingMWs.ts b/backend/middlewares/SharingMWs.ts
index 67e1b123..b4f40706 100644
--- a/backend/middlewares/SharingMWs.ts
+++ b/backend/middlewares/SharingMWs.ts
@@ -26,7 +26,7 @@ export class SharingMWs {
return next();
} catch (err) {
- return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "ErrorDTO during retrieving sharing link", err));
+ return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "Error during retrieving sharing link", err));
}
}
@@ -68,7 +68,7 @@ export class SharingMWs {
return next();
} catch (err) {
- return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "ErrorDTO during creating sharing link", err));
+ return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "Error during creating sharing link", err));
}
}
@@ -95,7 +95,7 @@ export class SharingMWs {
return next();
} catch (err) {
- return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "ErrorDTO during creating sharing link", err));
+ return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, "Error during creating sharing link", err));
}
}
diff --git a/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts b/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts
index 0dbe000e..4de320ea 100644
--- a/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts
+++ b/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts
@@ -162,7 +162,7 @@ export class ThumbnailGeneratorMWs {
return next();
}
} catch (error) {
- return next(new ErrorDTO(ErrorCodes.THUMBNAIL_GENERATION_ERROR, "ErrorDTO during generating thumbnail", error));
+ return next(new ErrorDTO(ErrorCodes.THUMBNAIL_GENERATION_ERROR, "Error during generating thumbnail", error));
}
}
diff --git a/backend/model/ConfigDiagnostics.ts b/backend/model/ConfigDiagnostics.ts
index 5e7cfc8e..40d33d02 100644
--- a/backend/model/ConfigDiagnostics.ts
+++ b/backend/model/ConfigDiagnostics.ts
@@ -47,7 +47,7 @@ export class ConfigDiagnostics {
await new Promise((resolve, reject) => {
fs.access(folder, fs.constants.W_OK, (err) => {
if (err) {
- reject({message: "ErrorDTO during getting write access to temp folder", error: err.toString()});
+ reject({message: "Error during getting write access to temp folder", error: err.toString()});
}
});
resolve();
@@ -61,7 +61,7 @@ export class ConfigDiagnostics {
}
fs.access(folder, fs.constants.R_OK, (err) => {
if (err) {
- reject({message: "ErrorDTO during getting read access to images folder", error: err.toString()});
+ reject({message: "Error during getting read access to images folder", error: err.toString()});
}
});
resolve();
@@ -117,8 +117,8 @@ export class ConfigDiagnostics {
await ConfigDiagnostics.testDatabase(Config.Server.database);
} catch (err) {
Logger.warn(LOG_TAG, "[MYSQL error]", err);
- Logger.warn(LOG_TAG, "ErrorDTO during initializing mysql falling back temporally to memory DB");
- NotificationManager.warning("ErrorDTO during initializing mysql falling back temporally to memory DB", err);
+ Logger.warn(LOG_TAG, "Error during initializing mysql falling back temporally to memory DB");
+ NotificationManager.warning("Error during initializing mysql falling back temporally to memory DB", err);
Config.setDatabaseType(DatabaseType.memory);
}
}
diff --git a/common/config/private/PrivateConfigClass.ts b/common/config/private/PrivateConfigClass.ts
index 6897ef45..ee577f45 100644
--- a/common/config/private/PrivateConfigClass.ts
+++ b/common/config/private/PrivateConfigClass.ts
@@ -37,8 +37,6 @@ export class PrivateConfigClass extends PublicConfigClass implements IPrivateCon
this.Server.database.type = type;
if (type === DatabaseType.memory) {
this.Client.Search.enabled = false;
- this.Client.Search.instantSearchEnabled = false;
- this.Client.Search.autocompleteEnabled = false;
this.Client.Sharing.enabled = false;
}
}
diff --git a/frontend/app/admin/admin.component.html b/frontend/app/admin/admin.component.html
index d976fcf0..a59ab382 100644
--- a/frontend/app/admin/admin.component.html
+++ b/frontend/app/admin/admin.component.html
@@ -20,14 +20,35 @@
To dismiss these notifications, restart the server.
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/frontend/app/admin/admin.component.ts b/frontend/app/admin/admin.component.ts
index 5c678925..a1e7b40d 100644
--- a/frontend/app/admin/admin.component.ts
+++ b/frontend/app/admin/admin.component.ts
@@ -11,6 +11,8 @@ import {NavigationService} from "../model/navigation.service";
})
export class AdminComponent implements OnInit {
+ simplifiedMode = true;
+
constructor(private _authService: AuthenticationService,
private _navigation: NavigationService,
public notificationService: NotificationService) {
diff --git a/frontend/app/settings/_abstract/abstract.settings.component.ts b/frontend/app/settings/_abstract/abstract.settings.component.ts
index abcee424..0b273ae2 100644
--- a/frontend/app/settings/_abstract/abstract.settings.component.ts
+++ b/frontend/app/settings/_abstract/abstract.settings.component.ts
@@ -1,4 +1,4 @@
-import {OnDestroy, OnInit, ViewChild} from "@angular/core";
+import {Input, OnChanges, OnDestroy, OnInit, Output, ViewChild} from "@angular/core";
import {AuthenticationService} from "../../model/network/authentication.service";
import {UserRoles} from "../../../../common/entities/UserDTO";
import {Utils} from "../../../../common/Utils";
@@ -6,23 +6,44 @@ import {ErrorDTO} from "../../../../common/entities/Error";
import {NotificationService} from "../../model/notification.service";
import {NavigationService} from "../../model/navigation.service";
import {AbstractSettingsService} from "./abstract.settings.service";
+import {IPrivateConfig} from "../../../../common/config/private/IPrivateConfig";
-export abstract class SettingsComponent implements OnInit, OnDestroy {
+export abstract class SettingsComponent implements OnInit, OnDestroy, OnChanges {
+
+ @Input()
+ public simplifiedMode: boolean = true;
+
+ @ViewChild('settingsForm')
+ form: HTMLFormElement;
+
+ @Output('hasAvailableSettings')
+ hasAvailableSettings: boolean = true;
- @ViewChild('settingsForm') form;
public inProgress = false;
public error: string = null;
public changed: boolean = false;
private subscription = null;
+ public settings: T = {};
+ public original: T = {};
+
constructor(private name,
private _authService: AuthenticationService,
private _navigation: NavigationService,
public _settingsService: AbstractSettingsService,
- protected notification: NotificationService) {
+ protected notification: NotificationService,
+ private sliceFN: (s: IPrivateConfig) => T) {
+ this._settingsService.Settings.subscribe(this.onNewSettings);
+ this.onNewSettings(this._settingsService._settingsService.settings.value);
}
+ onNewSettings = (s) => {
+ this.settings = Utils.clone(this.sliceFN(s));
+ this.original = Utils.clone(this.settings);
+ this.ngOnChanges();
+ };
+
ngOnInit() {
if (!this._authService.isAuthenticated() ||
this._authService.user.value.role < UserRoles.Admin) {
@@ -32,10 +53,16 @@ export abstract class SettingsComponent implements OnInit, OnDestroy {
this.getSettings();
this.subscription = this.form.valueChanges.subscribe((data) => {
- this.changed = !Utils.equalsFilter(this._settingsService.settings, this._settingsService.original);
+ this.changed = !Utils.equalsFilter(this.settings, this.original);
});
+
}
+ ngOnChanges(): void {
+ this.hasAvailableSettings = (this._settingsService.isSupported() || !this.simplifiedMode);
+ }
+
+
ngOnDestroy() {
if (this.subscription != null) {
this.subscription.unsubscribe();
@@ -56,7 +83,7 @@ export abstract class SettingsComponent implements OnInit, OnDestroy {
this.inProgress = true;
this.error = "";
try {
- await this._settingsService.updateSettings(this._settingsService.settings);
+ await this._settingsService.updateSettings(this.settings);
await this.getSettings();
this.notification.success(this.name + ' settings saved', "Success");
this.inProgress = false;
diff --git a/frontend/app/settings/_abstract/abstract.settings.service.ts b/frontend/app/settings/_abstract/abstract.settings.service.ts
index bec2cfa7..129e5684 100644
--- a/frontend/app/settings/_abstract/abstract.settings.service.ts
+++ b/frontend/app/settings/_abstract/abstract.settings.service.ts
@@ -1,20 +1,13 @@
-import {Utils} from "../../../../common/Utils";
import {SettingsService} from "../settings.service";
-import {IPrivateConfig} from "../../../../common/config/private/IPrivateConfig";
export abstract class AbstractSettingsService {
- public settings: T = {};
- public original: T = {};
- constructor(protected _settingsService: SettingsService, private sliceFN: (s: IPrivateConfig) => T) {
- this.original = Utils.clone(this.settings);
- this._settingsService.settings.subscribe(this.onNewSettings);
- this.onNewSettings(this._settingsService.settings.value);
+ constructor(public _settingsService: SettingsService) {
+
}
- onNewSettings = (s) => {
- this.settings = Utils.clone(this.sliceFN(s));
- this.original = Utils.clone(this.settings);
- };
+ get Settings() {
+ return this._settingsService.settings;
+ }
public getSettings(): Promise {
diff --git a/frontend/app/settings/basic/basic.settings.component.html b/frontend/app/settings/basic/basic.settings.component.html
index 2fc600a5..25bcb2dd 100644
--- a/frontend/app/settings/basic/basic.settings.component.html
+++ b/frontend/app/settings/basic/basic.settings.component.html
@@ -7,16 +7,16 @@
Error: {{error}}
-
@@ -59,7 +59,7 @@
[switch-on-text]="'Enabled'"
[switch-handle-width]="'100'"
[switch-label-width]="'20'"
- [(ngModel)]="_settingsService.settings.enableOnScrollRendering">
+ [(ngModel)]="settings.enableOnScrollRendering">
Shows only the required amount of photos at once. Renders more if page bottom is reached
@@ -79,7 +79,7 @@
[switch-on-text]="'Enabled'"
[switch-handle-width]="'100'"
[switch-label-width]="'20'"
- [(ngModel)]="_settingsService.settings.enableCache">
+ [(ngModel)]="settings.enableCache">
Caches directory contents and search results for better performance
diff --git a/frontend/app/settings/other/other.settings.component.ts b/frontend/app/settings/other/other.settings.component.ts
index 0baa89e8..b9de4c7a 100644
--- a/frontend/app/settings/other/other.settings.component.ts
+++ b/frontend/app/settings/other/other.settings.component.ts
@@ -1,4 +1,4 @@
-import {Component} from "@angular/core";
+import {Component, OnChanges} from "@angular/core";
import {SettingsComponent} from "../_abstract/abstract.settings.component";
import {AuthenticationService} from "../../model/network/authentication.service";
import {NavigationService} from "../../model/navigation.service";
@@ -13,13 +13,22 @@ import {OtherConfigDTO} from "../../../../common/entities/settings/OtherConfigDT
'./../_abstract/abstract.settings.component.css'],
providers: [OtherSettingsService],
})
-export class OtherSettingsComponent extends SettingsComponent {
+export class OtherSettingsComponent extends SettingsComponent implements OnChanges {
constructor(_authService: AuthenticationService,
_navigation: NavigationService,
_settingsService: OtherSettingsService,
notification: NotificationService) {
- super("Other", _authService, _navigation, _settingsService, notification);
+ super("Other", _authService, _navigation, _settingsService, notification, s => ({
+ enableThreading: s.Server.enableThreading,
+ enableOnScrollThumbnailPrioritising: s.Client.enableOnScrollThumbnailPrioritising,
+ enableOnScrollRendering: s.Client.enableOnScrollRendering,
+ enableCache: s.Client.enableCache
+ }));
+ }
+
+ ngOnChanges(): void {
+ this.hasAvailableSettings = !this.simplifiedMode;
}
diff --git a/frontend/app/settings/other/other.settings.service.ts b/frontend/app/settings/other/other.settings.service.ts
index 12c0feee..f0b3462a 100644
--- a/frontend/app/settings/other/other.settings.service.ts
+++ b/frontend/app/settings/other/other.settings.service.ts
@@ -8,12 +8,7 @@ import {OtherConfigDTO} from "../../../../common/entities/settings/OtherConfigDT
export class OtherSettingsService extends AbstractSettingsService {
constructor(private _networkService: NetworkService,
_settingsService: SettingsService) {
- super(_settingsService, s => ({
- enableThreading: s.Server.enableThreading,
- enableOnScrollThumbnailPrioritising: s.Client.enableOnScrollThumbnailPrioritising,
- enableOnScrollRendering: s.Client.enableOnScrollRendering,
- enableCache: s.Client.enableCache
- }));
+ super(_settingsService);
}
diff --git a/frontend/app/settings/search/search.settings.component.html b/frontend/app/settings/search/search.settings.component.html
index 8707b824..3a1959d8 100644
--- a/frontend/app/settings/search/search.settings.component.html
+++ b/frontend/app/settings/search/search.settings.component.html
@@ -1,6 +1,6 @@