Feature/disable delete all activities if filters are active (#3389)
* Disable delete all activities button if filters are active * Update changelog
This commit is contained in:
parent
80464c7846
commit
61f0da35bc
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Changed
|
||||
|
||||
- Disabled the button to delete all activities on the portfolio activities page if there are active filters
|
||||
|
||||
## 2.80.0 - 2024-05-08
|
||||
|
||||
### Added
|
||||
|
@ -94,6 +94,7 @@
|
||||
[dataSource]="dataSource"
|
||||
[deviceType]="data.deviceType"
|
||||
[hasPermissionToCreateActivity]="false"
|
||||
[hasPermissionToDeleteActivity]="false"
|
||||
[hasPermissionToExportActivities]="
|
||||
!data.hasImpersonationId && !user.settings.isRestrictedView
|
||||
"
|
||||
|
@ -335,6 +335,7 @@
|
||||
[dataSource]="dataSource"
|
||||
[deviceType]="data.deviceType"
|
||||
[hasPermissionToCreateActivity]="false"
|
||||
[hasPermissionToDeleteActivity]="false"
|
||||
[hasPermissionToExportActivities]="
|
||||
!data.hasImpersonationId && !user?.settings?.isRestrictedView
|
||||
"
|
||||
|
@ -155,7 +155,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||
|
||||
public onDeleteActivity(aId: string) {
|
||||
this.dataService
|
||||
.deleteOrder(aId)
|
||||
.deleteActivity(aId)
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe({
|
||||
next: () => {
|
||||
@ -171,7 +171,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||
|
||||
if (confirmation) {
|
||||
this.dataService
|
||||
.deleteAllOrders()
|
||||
.deleteAllActivities()
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe({
|
||||
next: () => {
|
||||
@ -400,6 +400,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||
hasPermission(this.user.permissions, permissions.createOrder);
|
||||
this.hasPermissionToDeleteActivity =
|
||||
!this.hasImpersonationId &&
|
||||
hasPermission(this.user.permissions, permissions.deleteOrder);
|
||||
hasPermission(this.user.permissions, permissions.deleteOrder) &&
|
||||
!this.userService.hasFilters();
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
[dataSource]="dataSource"
|
||||
[deviceType]="deviceType"
|
||||
[hasPermissionToCreateActivity]="hasPermissionToCreateActivity"
|
||||
[hasPermissionToDeleteActivity]="hasPermissionToDeleteActivity"
|
||||
[hasPermissionToExportActivities]="!hasImpersonationId"
|
||||
[locale]="user?.settings?.locale"
|
||||
[pageIndex]="pageIndex"
|
||||
|
@ -126,6 +126,7 @@
|
||||
[dataSource]="dataSource"
|
||||
[deviceType]="data?.deviceType"
|
||||
[hasPermissionToCreateActivity]="false"
|
||||
[hasPermissionToDeleteActivity]="false"
|
||||
[hasPermissionToExportActivities]="false"
|
||||
[hasPermissionToFilter]="false"
|
||||
[hasPermissionToOpenDetails]="false"
|
||||
|
@ -256,18 +256,18 @@ export class DataService {
|
||||
return this.http.delete<any>(`/api/v1/account-balance/${aId}`);
|
||||
}
|
||||
|
||||
public deleteAllOrders() {
|
||||
return this.http.delete<any>(`/api/v1/order/`);
|
||||
public deleteActivity(aId: string) {
|
||||
return this.http.delete<any>(`/api/v1/order/${aId}`);
|
||||
}
|
||||
|
||||
public deleteAllActivities() {
|
||||
return this.http.delete<any>(`/api/v1/order`);
|
||||
}
|
||||
|
||||
public deleteBenchmark({ dataSource, symbol }: UniqueAsset) {
|
||||
return this.http.delete<any>(`/api/v1/benchmark/${dataSource}/${symbol}`);
|
||||
}
|
||||
|
||||
public deleteOrder(aId: string) {
|
||||
return this.http.delete<any>(`/api/v1/order/${aId}`);
|
||||
}
|
||||
|
||||
public deleteUser(aId: string) {
|
||||
return this.http.delete<any>(`/api/v1/user/${aId}`);
|
||||
}
|
||||
|
@ -75,6 +75,10 @@ export class UserService extends ObservableStore<UserStoreState> {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public hasFilters() {
|
||||
return this.getFilters().length > 0;
|
||||
}
|
||||
|
||||
public remove() {
|
||||
this.setState({ user: null }, UserStoreActions.RemoveUser);
|
||||
}
|
||||
|
@ -58,6 +58,7 @@
|
||||
<button
|
||||
class="align-items-center d-flex"
|
||||
mat-menu-item
|
||||
[disabled]="!hasPermissionToDeleteActivity"
|
||||
(click)="onDeleteAllActivities()"
|
||||
>
|
||||
<span class="align-items-center d-flex">
|
||||
@ -444,7 +445,11 @@
|
||||
<span i18n>Export Draft as ICS</span>
|
||||
</span>
|
||||
</button>
|
||||
<button mat-menu-item (click)="onDeleteActivity(element.id)">
|
||||
<button
|
||||
mat-menu-item
|
||||
[disabled]="!hasPermissionToDeleteActivity"
|
||||
(click)="onDeleteActivity(element.id)"
|
||||
>
|
||||
<span class="align-items-center d-flex">
|
||||
<ion-icon class="mr-2" name="trash-outline" />
|
||||
<span i18n>Delete</span>
|
||||
|
@ -78,6 +78,7 @@ export class GfActivitiesTableComponent
|
||||
@Input() dataSource: MatTableDataSource<Activity>;
|
||||
@Input() deviceType: string;
|
||||
@Input() hasPermissionToCreateActivity: boolean;
|
||||
@Input() hasPermissionToDeleteActivity: boolean;
|
||||
@Input() hasPermissionToExportActivities: boolean;
|
||||
@Input() hasPermissionToOpenDetails = true;
|
||||
@Input() locale = getLocale();
|
||||
|
Loading…
x
Reference in New Issue
Block a user