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/),
|
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).
|
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
|
## 2.80.0 - 2024-05-08
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -94,6 +94,7 @@
|
|||||||
[dataSource]="dataSource"
|
[dataSource]="dataSource"
|
||||||
[deviceType]="data.deviceType"
|
[deviceType]="data.deviceType"
|
||||||
[hasPermissionToCreateActivity]="false"
|
[hasPermissionToCreateActivity]="false"
|
||||||
|
[hasPermissionToDeleteActivity]="false"
|
||||||
[hasPermissionToExportActivities]="
|
[hasPermissionToExportActivities]="
|
||||||
!data.hasImpersonationId && !user.settings.isRestrictedView
|
!data.hasImpersonationId && !user.settings.isRestrictedView
|
||||||
"
|
"
|
||||||
|
@ -335,6 +335,7 @@
|
|||||||
[dataSource]="dataSource"
|
[dataSource]="dataSource"
|
||||||
[deviceType]="data.deviceType"
|
[deviceType]="data.deviceType"
|
||||||
[hasPermissionToCreateActivity]="false"
|
[hasPermissionToCreateActivity]="false"
|
||||||
|
[hasPermissionToDeleteActivity]="false"
|
||||||
[hasPermissionToExportActivities]="
|
[hasPermissionToExportActivities]="
|
||||||
!data.hasImpersonationId && !user?.settings?.isRestrictedView
|
!data.hasImpersonationId && !user?.settings?.isRestrictedView
|
||||||
"
|
"
|
||||||
|
@ -155,7 +155,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
public onDeleteActivity(aId: string) {
|
public onDeleteActivity(aId: string) {
|
||||||
this.dataService
|
this.dataService
|
||||||
.deleteOrder(aId)
|
.deleteActivity(aId)
|
||||||
.pipe(takeUntil(this.unsubscribeSubject))
|
.pipe(takeUntil(this.unsubscribeSubject))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
@ -171,7 +171,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
if (confirmation) {
|
if (confirmation) {
|
||||||
this.dataService
|
this.dataService
|
||||||
.deleteAllOrders()
|
.deleteAllActivities()
|
||||||
.pipe(takeUntil(this.unsubscribeSubject))
|
.pipe(takeUntil(this.unsubscribeSubject))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
@ -400,6 +400,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
|||||||
hasPermission(this.user.permissions, permissions.createOrder);
|
hasPermission(this.user.permissions, permissions.createOrder);
|
||||||
this.hasPermissionToDeleteActivity =
|
this.hasPermissionToDeleteActivity =
|
||||||
!this.hasImpersonationId &&
|
!this.hasImpersonationId &&
|
||||||
hasPermission(this.user.permissions, permissions.deleteOrder);
|
hasPermission(this.user.permissions, permissions.deleteOrder) &&
|
||||||
|
!this.userService.hasFilters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
[dataSource]="dataSource"
|
[dataSource]="dataSource"
|
||||||
[deviceType]="deviceType"
|
[deviceType]="deviceType"
|
||||||
[hasPermissionToCreateActivity]="hasPermissionToCreateActivity"
|
[hasPermissionToCreateActivity]="hasPermissionToCreateActivity"
|
||||||
|
[hasPermissionToDeleteActivity]="hasPermissionToDeleteActivity"
|
||||||
[hasPermissionToExportActivities]="!hasImpersonationId"
|
[hasPermissionToExportActivities]="!hasImpersonationId"
|
||||||
[locale]="user?.settings?.locale"
|
[locale]="user?.settings?.locale"
|
||||||
[pageIndex]="pageIndex"
|
[pageIndex]="pageIndex"
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
[dataSource]="dataSource"
|
[dataSource]="dataSource"
|
||||||
[deviceType]="data?.deviceType"
|
[deviceType]="data?.deviceType"
|
||||||
[hasPermissionToCreateActivity]="false"
|
[hasPermissionToCreateActivity]="false"
|
||||||
|
[hasPermissionToDeleteActivity]="false"
|
||||||
[hasPermissionToExportActivities]="false"
|
[hasPermissionToExportActivities]="false"
|
||||||
[hasPermissionToFilter]="false"
|
[hasPermissionToFilter]="false"
|
||||||
[hasPermissionToOpenDetails]="false"
|
[hasPermissionToOpenDetails]="false"
|
||||||
|
@ -256,18 +256,18 @@ export class DataService {
|
|||||||
return this.http.delete<any>(`/api/v1/account-balance/${aId}`);
|
return this.http.delete<any>(`/api/v1/account-balance/${aId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteAllOrders() {
|
public deleteActivity(aId: string) {
|
||||||
return this.http.delete<any>(`/api/v1/order/`);
|
return this.http.delete<any>(`/api/v1/order/${aId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteAllActivities() {
|
||||||
|
return this.http.delete<any>(`/api/v1/order`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteBenchmark({ dataSource, symbol }: UniqueAsset) {
|
public deleteBenchmark({ dataSource, symbol }: UniqueAsset) {
|
||||||
return this.http.delete<any>(`/api/v1/benchmark/${dataSource}/${symbol}`);
|
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) {
|
public deleteUser(aId: string) {
|
||||||
return this.http.delete<any>(`/api/v1/user/${aId}`);
|
return this.http.delete<any>(`/api/v1/user/${aId}`);
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,10 @@ export class UserService extends ObservableStore<UserStoreState> {
|
|||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public hasFilters() {
|
||||||
|
return this.getFilters().length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public remove() {
|
public remove() {
|
||||||
this.setState({ user: null }, UserStoreActions.RemoveUser);
|
this.setState({ user: null }, UserStoreActions.RemoveUser);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
<button
|
<button
|
||||||
class="align-items-center d-flex"
|
class="align-items-center d-flex"
|
||||||
mat-menu-item
|
mat-menu-item
|
||||||
|
[disabled]="!hasPermissionToDeleteActivity"
|
||||||
(click)="onDeleteAllActivities()"
|
(click)="onDeleteAllActivities()"
|
||||||
>
|
>
|
||||||
<span class="align-items-center d-flex">
|
<span class="align-items-center d-flex">
|
||||||
@ -444,7 +445,11 @@
|
|||||||
<span i18n>Export Draft as ICS</span>
|
<span i18n>Export Draft as ICS</span>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</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">
|
<span class="align-items-center d-flex">
|
||||||
<ion-icon class="mr-2" name="trash-outline" />
|
<ion-icon class="mr-2" name="trash-outline" />
|
||||||
<span i18n>Delete</span>
|
<span i18n>Delete</span>
|
||||||
|
@ -78,6 +78,7 @@ export class GfActivitiesTableComponent
|
|||||||
@Input() dataSource: MatTableDataSource<Activity>;
|
@Input() dataSource: MatTableDataSource<Activity>;
|
||||||
@Input() deviceType: string;
|
@Input() deviceType: string;
|
||||||
@Input() hasPermissionToCreateActivity: boolean;
|
@Input() hasPermissionToCreateActivity: boolean;
|
||||||
|
@Input() hasPermissionToDeleteActivity: boolean;
|
||||||
@Input() hasPermissionToExportActivities: boolean;
|
@Input() hasPermissionToExportActivities: boolean;
|
||||||
@Input() hasPermissionToOpenDetails = true;
|
@Input() hasPermissionToOpenDetails = true;
|
||||||
@Input() locale = getLocale();
|
@Input() locale = getLocale();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user