Browse Source
Feature/disable delete all activities if filters are active (#3389)
* Disable delete all activities button if filters are active
* Update changelog
pull/3391/head^2
Thomas Kaul
10 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with
31 additions and
10 deletions
-
CHANGELOG.md
-
apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html
-
apps/client/src/app/components/position-detail-dialog/position-detail-dialog.html
-
apps/client/src/app/pages/portfolio/activities/activities-page.component.ts
-
apps/client/src/app/pages/portfolio/activities/activities-page.html
-
apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.html
-
apps/client/src/app/services/data.service.ts
-
apps/client/src/app/services/user/user.service.ts
-
libs/ui/src/lib/activities-table/activities-table.component.html
-
libs/ui/src/lib/activities-table/activities-table.component.ts
|
|
@ -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,16 +256,16 @@ 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 deleteBenchmark({ dataSource, symbol }: UniqueAsset) { |
|
|
|
return this.http.delete<any>(`/api/v1/benchmark/${dataSource}/${symbol}`); |
|
|
|
public deleteAllActivities() { |
|
|
|
return this.http.delete<any>(`/api/v1/order`); |
|
|
|
} |
|
|
|
|
|
|
|
public deleteOrder(aId: string) { |
|
|
|
return this.http.delete<any>(`/api/v1/order/${aId}`); |
|
|
|
public deleteBenchmark({ dataSource, symbol }: UniqueAsset) { |
|
|
|
return this.http.delete<any>(`/api/v1/benchmark/${dataSource}/${symbol}`); |
|
|
|
} |
|
|
|
|
|
|
|
public deleteUser(aId: string) { |
|
|
|
|
|
@ -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(); |
|
|
|