Feature/improve usability to delete currency asset profile (#3541)
* Improve usability * Update changelog
This commit is contained in:
parent
9cd37f8de0
commit
fad1adb91b
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Improved the allocations by ETF holding on the allocations page for the impersonation mode (experimental)
|
- Improved the allocations by ETF holding on the allocations page for the impersonation mode (experimental)
|
||||||
- Improved the detection of REST APIs (`JSON`) used via the scraper configuration
|
- Improved the detection of REST APIs (`JSON`) used via the scraper configuration
|
||||||
|
- Improved the usability to delete an asset profile of type currency in the historical market data table and the asset profile details dialog of the admin control
|
||||||
- Refreshed the cryptocurrencies list
|
- Refreshed the cryptocurrencies list
|
||||||
- Refactored the thresholds of the rules in the _X-ray_ section
|
- Refactored the thresholds of the rules in the _X-ray_ section
|
||||||
- Removed the obsolete `version` from the `docker-compose` files
|
- Removed the obsolete `version` from the `docker-compose` files
|
||||||
|
@ -124,7 +124,7 @@ export class AdminMarketDataComponent
|
|||||||
private unsubscribeSubject = new Subject<void>();
|
private unsubscribeSubject = new Subject<void>();
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private adminMarketDataService: AdminMarketDataService,
|
public adminMarketDataService: AdminMarketDataService,
|
||||||
private adminService: AdminService,
|
private adminService: AdminService,
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
private changeDetectorRef: ChangeDetectorRef,
|
||||||
private dataService: DataService,
|
private dataService: DataService,
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
<th *matHeaderCellDef class="px-1" mat-header-cell></th>
|
<th *matHeaderCellDef class="px-1" mat-header-cell></th>
|
||||||
<td *matCellDef="let element" class="px-1" mat-cell>
|
<td *matCellDef="let element" class="px-1" mat-cell>
|
||||||
@if (
|
@if (
|
||||||
!(
|
adminMarketDataService.hasPermissionToDeleteAssetProfile({
|
||||||
element.activitiesCount !== 0 ||
|
activitiesCount: element.activitiesCount,
|
||||||
element.isBenchmark ||
|
isBenchmark: element.isBenchmark,
|
||||||
element.symbol.startsWith(ghostfolioScraperApiSymbolPrefix)
|
symbol: element.symbol
|
||||||
)
|
})
|
||||||
) {
|
) {
|
||||||
<mat-checkbox
|
<mat-checkbox
|
||||||
color="primary"
|
color="primary"
|
||||||
@ -209,9 +209,11 @@
|
|||||||
<button
|
<button
|
||||||
mat-menu-item
|
mat-menu-item
|
||||||
[disabled]="
|
[disabled]="
|
||||||
element.activitiesCount !== 0 ||
|
!adminMarketDataService.hasPermissionToDeleteAssetProfile({
|
||||||
element.isBenchmark ||
|
activitiesCount: element.activitiesCount,
|
||||||
element.symbol.startsWith(ghostfolioScraperApiSymbolPrefix)
|
isBenchmark: element.isBenchmark,
|
||||||
|
symbol: element.symbol
|
||||||
|
})
|
||||||
"
|
"
|
||||||
(click)="
|
(click)="
|
||||||
onDeleteAssetProfile({
|
onDeleteAssetProfile({
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
import { AdminService } from '@ghostfolio/client/services/admin.service';
|
import { AdminService } from '@ghostfolio/client/services/admin.service';
|
||||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
import { ghostfolioScraperApiSymbolPrefix } from '@ghostfolio/common/config';
|
||||||
|
import { getCurrencyFromSymbol, isCurrency } from '@ghostfolio/common/helper';
|
||||||
|
import {
|
||||||
|
AdminMarketDataItem,
|
||||||
|
UniqueAsset
|
||||||
|
} from '@ghostfolio/common/interfaces';
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { EMPTY, catchError, finalize, forkJoin, takeUntil } from 'rxjs';
|
import { EMPTY, catchError, finalize, forkJoin, takeUntil } from 'rxjs';
|
||||||
@ -50,4 +55,17 @@ export class AdminMarketDataService {
|
|||||||
.subscribe(() => {});
|
.subscribe(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public hasPermissionToDeleteAssetProfile({
|
||||||
|
activitiesCount,
|
||||||
|
isBenchmark,
|
||||||
|
symbol
|
||||||
|
}: Pick<AdminMarketDataItem, 'activitiesCount' | 'isBenchmark' | 'symbol'>) {
|
||||||
|
return (
|
||||||
|
activitiesCount === 0 &&
|
||||||
|
!isBenchmark &&
|
||||||
|
!isCurrency(getCurrencyFromSymbol(symbol)) &&
|
||||||
|
!symbol.startsWith(ghostfolioScraperApiSymbolPrefix)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
|
|||||||
private unsubscribeSubject = new Subject<void>();
|
private unsubscribeSubject = new Subject<void>();
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private adminMarketDataService: AdminMarketDataService,
|
public adminMarketDataService: AdminMarketDataService,
|
||||||
private adminService: AdminService,
|
private adminService: AdminService,
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
private changeDetectorRef: ChangeDetectorRef,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: AssetProfileDialogParams,
|
@Inject(MAT_DIALOG_DATA) public data: AssetProfileDialogParams,
|
||||||
|
@ -48,9 +48,11 @@
|
|||||||
mat-menu-item
|
mat-menu-item
|
||||||
type="button"
|
type="button"
|
||||||
[disabled]="
|
[disabled]="
|
||||||
assetProfile?.activitiesCount !== 0 ||
|
!adminMarketDataService.hasPermissionToDeleteAssetProfile({
|
||||||
isBenchmark ||
|
activitiesCount: assetProfile?.activitiesCount,
|
||||||
data.symbol.startsWith(ghostfolioScraperApiSymbolPrefix)
|
isBenchmark: isBenchmark,
|
||||||
|
symbol: data.symbol
|
||||||
|
})
|
||||||
"
|
"
|
||||||
(click)="
|
(click)="
|
||||||
onDeleteProfileData({
|
onDeleteProfileData({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user