Feature/consider availability of date range selector and filters in assistant per view (#3824)
* Consider availability of date range selector and filters in assistant per view * Update changelog
This commit is contained in:
parent
33de8a10bb
commit
e8f0d2bb14
@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Changed
|
||||
|
||||
- Considered the availability of the date range selector in the assistant per view
|
||||
- Considered the availability of the filters in the assistant per view
|
||||
- Optimized the portfolio calculations with smarter cloning of activities
|
||||
- Integrated the add currency functionality into the market data section of the admin control panel
|
||||
- Improved the language localization for German (`de`)
|
||||
|
@ -31,6 +31,8 @@
|
||||
class="position-fixed w-100"
|
||||
[currentRoute]="currentRoute"
|
||||
[deviceType]="deviceType"
|
||||
[hasPermissionToChangeDateRange]="hasPermissionToChangeDateRange"
|
||||
[hasPermissionToChangeFilters]="hasPermissionToChangeFilters"
|
||||
[hasTabs]="hasTabs"
|
||||
[info]="info"
|
||||
[pageTitle]="pageTitle"
|
||||
|
@ -47,6 +47,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
|
||||
public canCreateAccount: boolean;
|
||||
public currentRoute: string;
|
||||
public currentSubRoute: string;
|
||||
public currentYear = new Date().getFullYear();
|
||||
public deviceType: string;
|
||||
public hasImpersonationId: boolean;
|
||||
@ -54,6 +55,8 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
public hasPermissionForStatistics: boolean;
|
||||
public hasPermissionForSubscription: boolean;
|
||||
public hasPermissionToAccessFearAndGreedIndex: boolean;
|
||||
public hasPermissionToChangeDateRange: boolean;
|
||||
public hasPermissionToChangeFilters: boolean;
|
||||
public hasTabs = false;
|
||||
public info: InfoItem;
|
||||
public pageTitle: string;
|
||||
@ -147,6 +150,35 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
||||
const urlSegments = urlSegmentGroup.segments;
|
||||
this.currentRoute = urlSegments[0].path;
|
||||
this.currentSubRoute = urlSegments[1]?.path;
|
||||
|
||||
if (
|
||||
(this.currentRoute === 'home' && !this.currentSubRoute) ||
|
||||
(this.currentRoute === 'home' &&
|
||||
this.currentSubRoute === 'holdings') ||
|
||||
(this.currentRoute === 'portfolio' && !this.currentSubRoute) ||
|
||||
(this.currentRoute === 'zen' && !this.currentSubRoute) ||
|
||||
(this.currentRoute === 'zen' && this.currentSubRoute === 'holdings')
|
||||
) {
|
||||
this.hasPermissionToChangeDateRange = true;
|
||||
} else {
|
||||
this.hasPermissionToChangeDateRange = false;
|
||||
}
|
||||
|
||||
if (
|
||||
(this.currentRoute === 'home' &&
|
||||
this.currentSubRoute === 'holdings') ||
|
||||
(this.currentRoute === 'portfolio' && !this.currentSubRoute) ||
|
||||
(this.currentRoute === 'portfolio' &&
|
||||
this.currentSubRoute === 'activities') ||
|
||||
(this.currentRoute === 'portfolio' &&
|
||||
this.currentSubRoute === 'allocations') ||
|
||||
(this.currentRoute === 'zen' && this.currentSubRoute === 'holdings')
|
||||
) {
|
||||
this.hasPermissionToChangeFilters = true;
|
||||
} else {
|
||||
this.hasPermissionToChangeFilters = false;
|
||||
}
|
||||
|
||||
this.hasTabs =
|
||||
(this.currentRoute === this.routerLinkAbout[0].slice(1) ||
|
||||
@ -182,6 +214,8 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
this.changeDetectorRef.markForCheck();
|
||||
});
|
||||
}
|
||||
|
||||
this.changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
this.userService.stateChanged
|
||||
|
@ -121,7 +121,7 @@
|
||||
matBadge="✓"
|
||||
matBadgeSize="small"
|
||||
[mat-menu-trigger-for]="assistantMenu"
|
||||
[matBadgeHidden]="!hasFilters"
|
||||
[matBadgeHidden]="!hasFilters || !hasPermissionToChangeFilters"
|
||||
[matMenuTriggerRestoreFocus]="false"
|
||||
(menuOpened)="onOpenAssistant()"
|
||||
>
|
||||
@ -140,6 +140,8 @@
|
||||
[hasPermissionToAccessAdminControl]="
|
||||
hasPermissionToAccessAdminControl
|
||||
"
|
||||
[hasPermissionToChangeDateRange]="hasPermissionToChangeDateRange"
|
||||
[hasPermissionToChangeFilters]="hasPermissionToChangeFilters"
|
||||
[user]="user"
|
||||
(closed)="closeAssistant()"
|
||||
(dateRangeChanged)="onDateRangeChange($event)"
|
||||
|
@ -56,6 +56,8 @@ export class HeaderComponent implements OnChanges {
|
||||
|
||||
@Input() currentRoute: string;
|
||||
@Input() deviceType: string;
|
||||
@Input() hasPermissionToChangeDateRange: boolean;
|
||||
@Input() hasPermissionToChangeFilters: boolean;
|
||||
@Input() hasTabs: boolean;
|
||||
@Input() info: InfoItem;
|
||||
@Input() pageTitle: string;
|
||||
@ -197,7 +199,7 @@ export class HeaderComponent implements OnChanges {
|
||||
}
|
||||
|
||||
public onLogoClick() {
|
||||
if (this.currentRoute === 'home' || this.currentRoute === 'zen') {
|
||||
if (['home', 'zen'].includes(this.currentRoute)) {
|
||||
this.layoutService.getShouldReloadSubject().next();
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,8 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
|
||||
|
||||
@Input() deviceType: string;
|
||||
@Input() hasPermissionToAccessAdminControl: boolean;
|
||||
@Input() hasPermissionToChangeDateRange: boolean;
|
||||
@Input() hasPermissionToChangeFilters: boolean;
|
||||
@Input() user: User;
|
||||
|
||||
@Output() closed = new EventEmitter<void>();
|
||||
@ -254,8 +256,20 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
|
||||
{ label: $localize`Max`, value: 'max' }
|
||||
]);
|
||||
|
||||
this.dateRangeFormControl.disable({ emitEvent: false });
|
||||
|
||||
if (this.hasPermissionToChangeDateRange) {
|
||||
this.dateRangeFormControl.enable({ emitEvent: false });
|
||||
}
|
||||
|
||||
this.dateRangeFormControl.setValue(this.user?.settings?.dateRange ?? null);
|
||||
|
||||
this.filterForm.disable({ emitEvent: false });
|
||||
|
||||
if (this.hasPermissionToChangeFilters) {
|
||||
this.filterForm.enable({ emitEvent: false });
|
||||
}
|
||||
|
||||
this.filterForm.setValue(
|
||||
{
|
||||
account: this.user?.settings?.['filters.accounts']?.[0] ?? null,
|
||||
|
@ -150,7 +150,9 @@
|
||||
<button
|
||||
i18n
|
||||
mat-button
|
||||
[disabled]="!hasFilter(filterForm.value)"
|
||||
[disabled]="
|
||||
!hasFilter(filterForm.value) || !hasPermissionToChangeFilters
|
||||
"
|
||||
(click)="onResetFilters()"
|
||||
>
|
||||
Reset Filters
|
||||
@ -160,7 +162,7 @@
|
||||
color="primary"
|
||||
i18n
|
||||
mat-flat-button
|
||||
[disabled]="!filterForm.dirty"
|
||||
[disabled]="!filterForm.dirty || !hasPermissionToChangeFilters"
|
||||
(click)="onApplyFilters()"
|
||||
>
|
||||
Apply Filters
|
||||
|
Loading…
x
Reference in New Issue
Block a user