mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
improving notifications
This commit is contained in:
parent
238e6cf070
commit
88d86f4a7a
@ -44,9 +44,9 @@ export class ConfigDiagnostics {
|
|||||||
static async testThumbnailFolder(folder: string) {
|
static async testThumbnailFolder(folder: string) {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
if (!fs.existsSync(folder)) {
|
if (!fs.existsSync(folder)) {
|
||||||
reject("Thumbnail folder not exists: " + folder);
|
reject("Thumbnail folder not exists: '" + folder + "'");
|
||||||
}
|
}
|
||||||
fs.access(folder, fs.constants.W_OK, function (err) {
|
fs.access(folder, fs.constants.W_OK, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject({message: "Error during getting write access to temp folder", error: err});
|
reject({message: "Error during getting write access to temp folder", error: err});
|
||||||
}
|
}
|
||||||
@ -58,9 +58,9 @@ export class ConfigDiagnostics {
|
|||||||
static async testImageFolder(folder: string) {
|
static async testImageFolder(folder: string) {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
if (!fs.existsSync(folder)) {
|
if (!fs.existsSync(folder)) {
|
||||||
reject("Images folder not exists: " + folder);
|
reject("Images folder not exists: '" + folder + "'");
|
||||||
}
|
}
|
||||||
fs.access(folder, fs.constants.R_OK, function (err) {
|
fs.access(folder, fs.constants.R_OK, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject({message: "Error during getting read access to images folder", error: err});
|
reject({message: "Error during getting read access to images folder", error: err});
|
||||||
}
|
}
|
||||||
@ -103,8 +103,8 @@ export class ConfigDiagnostics {
|
|||||||
await ConfigDiagnostics.testDatabase(Config.Server.database);
|
await ConfigDiagnostics.testDatabase(Config.Server.database);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Logger.warn(LOG_TAG, "[MYSQL error]", err);
|
Logger.warn(LOG_TAG, "[MYSQL error]", err);
|
||||||
Logger.warn(LOG_TAG, "Error during initializing mysql falling back to memory DB");
|
Logger.warn(LOG_TAG, "Error during initializing mysql falling back temporally to memory DB");
|
||||||
NotificationManager.warning("Error during initializing mysql falling back to memory DB", err);
|
NotificationManager.warning("Error during initializing mysql falling back temporally to memory DB", err);
|
||||||
Config.setDatabaseType(DatabaseType.memory);
|
Config.setDatabaseType(DatabaseType.memory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,11 +115,11 @@ export class ConfigDiagnostics {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
NotificationManager.warning("Thumbnail hardware acceleration is not possible." +
|
NotificationManager.warning("Thumbnail hardware acceleration is not possible." +
|
||||||
" '" + ThumbnailProcessingLib[Config.Server.thumbnail.processingLibrary] + "' node module is not found." +
|
" '" + ThumbnailProcessingLib[Config.Server.thumbnail.processingLibrary] + "' node module is not found." +
|
||||||
" Falling back to JS based thumbnail generation", err);
|
" Falling back temporally to JS based thumbnail generation", err);
|
||||||
Logger.warn(LOG_TAG, "[Thumbnail hardware acceleration] module error: ", err);
|
Logger.warn(LOG_TAG, "[Thumbnail hardware acceleration] module error: ", err);
|
||||||
Logger.warn(LOG_TAG, "Thumbnail hardware acceleration is not possible." +
|
Logger.warn(LOG_TAG, "Thumbnail hardware acceleration is not possible." +
|
||||||
" '" + ThumbnailProcessingLib[Config.Server.thumbnail.processingLibrary] + "' node module is not found." +
|
" '" + ThumbnailProcessingLib[Config.Server.thumbnail.processingLibrary] + "' node module is not found." +
|
||||||
" Falling back to JS based thumbnail generation");
|
" Falling back temporally to JS based thumbnail generation");
|
||||||
Config.Server.thumbnail.processingLibrary = ThumbnailProcessingLib.Jimp;
|
Config.Server.thumbnail.processingLibrary = ThumbnailProcessingLib.Jimp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ export class ConfigDiagnostics {
|
|||||||
try {
|
try {
|
||||||
await ConfigDiagnostics.testSearchConfig(Config.Client.Search);
|
await ConfigDiagnostics.testSearchConfig(Config.Client.Search);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
NotificationManager.warning("Search is not supported with these settings, switching off..", err);
|
NotificationManager.warning("Search is not supported with these settings. Disabling temporally. Please adjust the config properly.", err);
|
||||||
Logger.warn(LOG_TAG, "Search is not supported with these settings, switching off..", err);
|
Logger.warn(LOG_TAG, "Search is not supported with these settings, switching off..", err);
|
||||||
Config.Client.Search.enabled = false;
|
Config.Client.Search.enabled = false;
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ export class ConfigDiagnostics {
|
|||||||
try {
|
try {
|
||||||
await ConfigDiagnostics.testSharingConfig(Config.Client.Sharing);
|
await ConfigDiagnostics.testSharingConfig(Config.Client.Sharing);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
NotificationManager.warning("Sharing is not supported with these settings, switching off..", err);
|
NotificationManager.warning("Sharing is not supported with these settings. Disabling temporally. Please adjust the config properly.", err);
|
||||||
Logger.warn(LOG_TAG, "Sharing is not supported with these settings, switching off..", err);
|
Logger.warn(LOG_TAG, "Sharing is not supported with these settings, switching off..", err);
|
||||||
Config.Client.Sharing.enabled = false;
|
Config.Client.Sharing.enabled = false;
|
||||||
}
|
}
|
||||||
@ -159,8 +159,8 @@ export class ConfigDiagnostics {
|
|||||||
try {
|
try {
|
||||||
await ConfigDiagnostics.testMapConfig(Config.Client.Map);
|
await ConfigDiagnostics.testMapConfig(Config.Client.Map);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
NotificationManager.warning("Maps is not supported with these settings, switching off..", err);
|
NotificationManager.warning("Maps is not supported with these settings. Disabling temporally. Please adjust the config properly.", err);
|
||||||
Logger.warn(LOG_TAG, "Maps is not supported with these settings, switching off..", err);
|
Logger.warn(LOG_TAG, "Maps is not supported with these settings. Disabling temporally. Please adjust the config properly.", err);
|
||||||
Config.Client.Map.enabled = false;
|
Config.Client.Map.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<ng-container *ngFor="let notification of notificationService.notifications">
|
<ng-container *ngFor="let notification of notificationService.notifications">
|
||||||
|
|
||||||
<div class="alert alert-{{NotificationType[notification.type]}}" role="alert">
|
<div class="alert alert-{{getCss(notification.type)}}" role="alert">
|
||||||
{{notification.message}}
|
{{notification.message}}
|
||||||
<br *ngIf="notification.details"/>
|
<br *ngIf="notification.details"/>
|
||||||
{{notification.details | json}}
|
{{notification.details | json}}
|
||||||
|
@ -13,13 +13,10 @@ import {NotificationType} from "../../../common/entities/NotificationDTO";
|
|||||||
export class AdminComponent implements OnInit {
|
export class AdminComponent implements OnInit {
|
||||||
userManagementEnable: boolean = false;
|
userManagementEnable: boolean = false;
|
||||||
|
|
||||||
NotificationType: any;
|
|
||||||
|
|
||||||
constructor(private _authService: AuthenticationService,
|
constructor(private _authService: AuthenticationService,
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
public notificationService: NotificationService) {
|
public notificationService: NotificationService) {
|
||||||
this.userManagementEnable = Config.Client.authenticationRequired;
|
this.userManagementEnable = Config.Client.authenticationRequired;
|
||||||
this.NotificationType = NotificationType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -30,6 +27,18 @@ export class AdminComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getCss(type: NotificationType) {
|
||||||
|
switch (type) {
|
||||||
|
case NotificationType.error:
|
||||||
|
return "danger";
|
||||||
|
case NotificationType.warning:
|
||||||
|
return "warning";
|
||||||
|
case NotificationType.info:
|
||||||
|
return "info";
|
||||||
|
}
|
||||||
|
return "info";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user