|
|
|
@ -12,7 +12,12 @@ import {
|
|
|
|
|
PROPERTY_SYSTEM_MESSAGE,
|
|
|
|
|
ghostfolioPrefix
|
|
|
|
|
} from '@ghostfolio/common/config';
|
|
|
|
|
import { Coupon, InfoItem, User } from '@ghostfolio/common/interfaces';
|
|
|
|
|
import {
|
|
|
|
|
Coupon,
|
|
|
|
|
InfoItem,
|
|
|
|
|
SystemMessage,
|
|
|
|
|
User
|
|
|
|
|
} from '@ghostfolio/common/interfaces';
|
|
|
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
|
|
|
|
import {
|
|
|
|
|
differenceInSeconds,
|
|
|
|
@ -39,6 +44,7 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|
|
|
|
public hasPermissionToToggleReadOnlyMode: boolean;
|
|
|
|
|
public info: InfoItem;
|
|
|
|
|
public permissions = permissions;
|
|
|
|
|
public systemMessage: SystemMessage;
|
|
|
|
|
public transactionCount: number;
|
|
|
|
|
public userCount: number;
|
|
|
|
|
public user: User;
|
|
|
|
@ -149,8 +155,14 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public onDeleteSystemMessage() {
|
|
|
|
|
const confirmation = confirm(
|
|
|
|
|
$localize`Do you really want to delete this system message?`
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (confirmation === true) {
|
|
|
|
|
this.putAdminSetting({ key: PROPERTY_SYSTEM_MESSAGE, value: undefined });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public onFlushCache() {
|
|
|
|
|
const confirmation = confirm(
|
|
|
|
@ -184,12 +196,21 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public onSetSystemMessage() {
|
|
|
|
|
const systemMessage = prompt($localize`Please set your system message:`);
|
|
|
|
|
const systemMessage = prompt(
|
|
|
|
|
$localize`Please set your system message:`,
|
|
|
|
|
JSON.stringify(
|
|
|
|
|
this.systemMessage ??
|
|
|
|
|
<SystemMessage>{
|
|
|
|
|
message: '⚒️ Scheduled maintenance in progress...',
|
|
|
|
|
targetGroups: ['Basic', 'Premium']
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (systemMessage) {
|
|
|
|
|
this.putAdminSetting({
|
|
|
|
|
key: PROPERTY_SYSTEM_MESSAGE,
|
|
|
|
|
value: systemMessage
|
|
|
|
|
value: JSON.parse(systemMessage)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -208,6 +229,9 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|
|
|
|
this.coupons = (settings[PROPERTY_COUPONS] as Coupon[]) ?? [];
|
|
|
|
|
this.customCurrencies = settings[PROPERTY_CURRENCIES] as string[];
|
|
|
|
|
this.exchangeRates = exchangeRates;
|
|
|
|
|
this.systemMessage = settings[
|
|
|
|
|
PROPERTY_SYSTEM_MESSAGE
|
|
|
|
|
] as SystemMessage;
|
|
|
|
|
this.transactionCount = transactionCount;
|
|
|
|
|
this.userCount = userCount;
|
|
|
|
|
this.version = version;
|
|
|
|
|