Feature/remove exchange rates from admin control overview (#4439)
* Remove exchange rates * Update changelog
This commit is contained in:
parent
6319661b0c
commit
b90e3076d0
CHANGELOG.md
apps
api/src/app/admin
client/src/app/components/admin-overview
libs/common/src/lib/interfaces
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Improved the usability of the user account registration
|
- Improved the usability of the user account registration
|
||||||
- Improved the usability of the _Copy AI prompt to clipboard_ actions on the analysis page (experimental)
|
- Improved the usability of the _Copy AI prompt to clipboard_ actions on the analysis page (experimental)
|
||||||
|
- Removed the exchange rates from the overview of the admin control panel
|
||||||
- Improved the language localization for German (`de`)
|
- Improved the language localization for German (`de`)
|
||||||
- Upgraded `angular` from version `19.0.5` to `19.2.1`
|
- Upgraded `angular` from version `19.0.5` to `19.2.1`
|
||||||
- Upgraded `Nx` from version `20.3.2` to `20.5.0`
|
- Upgraded `Nx` from version `20.3.2` to `20.5.0`
|
||||||
|
@ -10,7 +10,6 @@ import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service';
|
|||||||
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
|
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
|
||||||
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
|
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
|
||||||
import {
|
import {
|
||||||
DEFAULT_CURRENCY,
|
|
||||||
PROPERTY_CURRENCIES,
|
PROPERTY_CURRENCIES,
|
||||||
PROPERTY_IS_READ_ONLY_MODE,
|
PROPERTY_IS_READ_ONLY_MODE,
|
||||||
PROPERTY_IS_USER_SIGNUP_ENABLED
|
PROPERTY_IS_USER_SIGNUP_ENABLED
|
||||||
@ -37,7 +36,6 @@ import { BadRequestException, Injectable, Logger } from '@nestjs/common';
|
|||||||
import {
|
import {
|
||||||
AssetClass,
|
AssetClass,
|
||||||
AssetSubClass,
|
AssetSubClass,
|
||||||
DataSource,
|
|
||||||
Prisma,
|
Prisma,
|
||||||
PrismaClient,
|
PrismaClient,
|
||||||
Property,
|
Property,
|
||||||
@ -132,31 +130,6 @@ export class AdminService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async get(): Promise<AdminData> {
|
public async get(): Promise<AdminData> {
|
||||||
const exchangeRates = this.exchangeRateDataService
|
|
||||||
.getCurrencies()
|
|
||||||
.filter((currency) => {
|
|
||||||
return currency !== DEFAULT_CURRENCY;
|
|
||||||
})
|
|
||||||
.map((currency) => {
|
|
||||||
const label1 = DEFAULT_CURRENCY;
|
|
||||||
const label2 = currency;
|
|
||||||
|
|
||||||
return {
|
|
||||||
label1,
|
|
||||||
label2,
|
|
||||||
dataSource:
|
|
||||||
DataSource[
|
|
||||||
this.configurationService.get('DATA_SOURCE_EXCHANGE_RATES')
|
|
||||||
],
|
|
||||||
symbol: `${label1}${label2}`,
|
|
||||||
value: this.exchangeRateDataService.toCurrency(
|
|
||||||
1,
|
|
||||||
DEFAULT_CURRENCY,
|
|
||||||
currency
|
|
||||||
)
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const [settings, transactionCount, userCount] = await Promise.all([
|
const [settings, transactionCount, userCount] = await Promise.all([
|
||||||
this.propertyService.get(),
|
this.propertyService.get(),
|
||||||
this.prismaService.order.count(),
|
this.prismaService.order.count(),
|
||||||
@ -164,7 +137,6 @@ export class AdminService {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
exchangeRates,
|
|
||||||
settings,
|
settings,
|
||||||
transactionCount,
|
transactionCount,
|
||||||
userCount,
|
userCount,
|
||||||
|
@ -6,7 +6,6 @@ import { DataService } from '@ghostfolio/client/services/data.service';
|
|||||||
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
||||||
import {
|
import {
|
||||||
PROPERTY_COUPONS,
|
PROPERTY_COUPONS,
|
||||||
PROPERTY_CURRENCIES,
|
|
||||||
PROPERTY_IS_DATA_GATHERING_ENABLED,
|
PROPERTY_IS_DATA_GATHERING_ENABLED,
|
||||||
PROPERTY_IS_READ_ONLY_MODE,
|
PROPERTY_IS_READ_ONLY_MODE,
|
||||||
PROPERTY_IS_USER_SIGNUP_ENABLED,
|
PROPERTY_IS_USER_SIGNUP_ENABLED,
|
||||||
@ -41,8 +40,6 @@ import { takeUntil } from 'rxjs/operators';
|
|||||||
export class AdminOverviewComponent implements OnDestroy, OnInit {
|
export class AdminOverviewComponent implements OnDestroy, OnInit {
|
||||||
public couponDuration: StringValue = '14 days';
|
public couponDuration: StringValue = '14 days';
|
||||||
public coupons: Coupon[];
|
public coupons: Coupon[];
|
||||||
public customCurrencies: string[];
|
|
||||||
public exchangeRates: { label1: string; label2: string; value: number }[];
|
|
||||||
public hasPermissionForSubscription: boolean;
|
public hasPermissionForSubscription: boolean;
|
||||||
public hasPermissionForSystemMessage: boolean;
|
public hasPermissionForSystemMessage: boolean;
|
||||||
public hasPermissionToToggleReadOnlyMode: boolean;
|
public hasPermissionToToggleReadOnlyMode: boolean;
|
||||||
@ -138,19 +135,6 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public onDeleteCurrency(aCurrency: string) {
|
|
||||||
this.notificationService.confirm({
|
|
||||||
confirmFn: () => {
|
|
||||||
const currencies = this.customCurrencies.filter((currency) => {
|
|
||||||
return currency !== aCurrency;
|
|
||||||
});
|
|
||||||
this.putAdminSetting({ key: PROPERTY_CURRENCIES, value: currencies });
|
|
||||||
},
|
|
||||||
confirmType: ConfirmationDialogType.Warn,
|
|
||||||
title: $localize`Do you really want to delete this currency?`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public onDeleteSystemMessage() {
|
public onDeleteSystemMessage() {
|
||||||
this.notificationService.confirm({
|
this.notificationService.confirm({
|
||||||
confirmFn: () => {
|
confirmFn: () => {
|
||||||
@ -231,25 +215,17 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|||||||
this.adminService
|
this.adminService
|
||||||
.fetchAdminData()
|
.fetchAdminData()
|
||||||
.pipe(takeUntil(this.unsubscribeSubject))
|
.pipe(takeUntil(this.unsubscribeSubject))
|
||||||
.subscribe(
|
.subscribe(({ settings, transactionCount, userCount, version }) => {
|
||||||
({ exchangeRates, settings, transactionCount, userCount, version }) => {
|
this.coupons = (settings[PROPERTY_COUPONS] as Coupon[]) ?? [];
|
||||||
this.coupons = (settings[PROPERTY_COUPONS] as Coupon[]) ?? [];
|
this.isDataGatheringEnabled =
|
||||||
this.customCurrencies = settings[PROPERTY_CURRENCIES] as string[];
|
settings[PROPERTY_IS_DATA_GATHERING_ENABLED] === false ? false : true;
|
||||||
this.exchangeRates = exchangeRates;
|
this.systemMessage = settings[PROPERTY_SYSTEM_MESSAGE] as SystemMessage;
|
||||||
this.isDataGatheringEnabled =
|
this.transactionCount = transactionCount;
|
||||||
settings[PROPERTY_IS_DATA_GATHERING_ENABLED] === false
|
this.userCount = userCount;
|
||||||
? false
|
this.version = version;
|
||||||
: true;
|
|
||||||
this.systemMessage = settings[
|
|
||||||
PROPERTY_SYSTEM_MESSAGE
|
|
||||||
] as SystemMessage;
|
|
||||||
this.transactionCount = transactionCount;
|
|
||||||
this.userCount = userCount;
|
|
||||||
this.version = version;
|
|
||||||
|
|
||||||
this.changeDetectorRef.markForCheck();
|
this.changeDetectorRef.markForCheck();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private generateCouponCode(aLength: number) {
|
private generateCouponCode(aLength: number) {
|
||||||
|
@ -30,73 +30,6 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="align-items-start d-flex my-3">
|
|
||||||
<div class="w-50" i18n>Exchange Rates</div>
|
|
||||||
<div class="w-50">
|
|
||||||
<table>
|
|
||||||
@for (exchangeRate of exchangeRates; track exchangeRate) {
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<gf-value [locale]="user?.settings?.locale" [value]="1" />
|
|
||||||
</td>
|
|
||||||
<td class="pl-1">{{ exchangeRate.label1 }}</td>
|
|
||||||
<td class="px-1">=</td>
|
|
||||||
<td align="right">
|
|
||||||
<gf-value
|
|
||||||
class="d-inline-block"
|
|
||||||
[locale]="user?.settings?.locale"
|
|
||||||
[precision]="4"
|
|
||||||
[value]="exchangeRate.value"
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td class="pl-1">{{ exchangeRate.label2 }}</td>
|
|
||||||
<td>
|
|
||||||
<button
|
|
||||||
class="mx-1 no-min-width px-2"
|
|
||||||
mat-button
|
|
||||||
[matMenuTriggerFor]="exchangeRateActionsMenu"
|
|
||||||
(click)="$event.stopPropagation()"
|
|
||||||
>
|
|
||||||
<ion-icon name="ellipsis-horizontal" />
|
|
||||||
</button>
|
|
||||||
<mat-menu
|
|
||||||
#exchangeRateActionsMenu="matMenu"
|
|
||||||
class="h-100 mx-1 no-min-width px-2"
|
|
||||||
xPosition="before"
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
mat-menu-item
|
|
||||||
[queryParams]="{
|
|
||||||
assetProfileDialog: true,
|
|
||||||
dataSource: exchangeRate.dataSource,
|
|
||||||
symbol: exchangeRate.symbol
|
|
||||||
}"
|
|
||||||
[routerLink]="['/admin', 'market-data']"
|
|
||||||
>
|
|
||||||
<span class="align-items-center d-flex">
|
|
||||||
<ion-icon class="mr-2" name="create-outline" />
|
|
||||||
<span i18n>Edit</span>
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
@if (customCurrencies.includes(exchangeRate.label2)) {
|
|
||||||
<hr class="m-0" />
|
|
||||||
<button
|
|
||||||
mat-menu-item
|
|
||||||
(click)="onDeleteCurrency(exchangeRate.label2)"
|
|
||||||
>
|
|
||||||
<span class="align-items-center d-flex">
|
|
||||||
<ion-icon class="mr-2" name="trash-outline" />
|
|
||||||
<span i18n>Delete</span>
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</mat-menu>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex my-3">
|
<div class="d-flex my-3">
|
||||||
<div class="w-50" i18n>User Signup</div>
|
<div class="w-50" i18n>User Signup</div>
|
||||||
<div class="w-50">
|
<div class="w-50">
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
|
||||||
|
|
||||||
export interface AdminData {
|
export interface AdminData {
|
||||||
exchangeRates: ({
|
|
||||||
label1: string;
|
|
||||||
label2: string;
|
|
||||||
value: number;
|
|
||||||
} & AssetProfileIdentifier)[];
|
|
||||||
settings: { [key: string]: boolean | object | string | string[] };
|
settings: { [key: string]: boolean | object | string | string[] };
|
||||||
transactionCount: number;
|
transactionCount: number;
|
||||||
userCount: number;
|
userCount: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user