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
pull/3837/head
Thomas Kaul 3 months ago committed by GitHub
parent 33de8a10bb
commit e8f0d2bb14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### 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 - Optimized the portfolio calculations with smarter cloning of activities
- Integrated the add currency functionality into the market data section of the admin control panel - Integrated the add currency functionality into the market data section of the admin control panel
- Improved the language localization for German (`de`) - Improved the language localization for German (`de`)

@ -31,6 +31,8 @@
class="position-fixed w-100" class="position-fixed w-100"
[currentRoute]="currentRoute" [currentRoute]="currentRoute"
[deviceType]="deviceType" [deviceType]="deviceType"
[hasPermissionToChangeDateRange]="hasPermissionToChangeDateRange"
[hasPermissionToChangeFilters]="hasPermissionToChangeFilters"
[hasTabs]="hasTabs" [hasTabs]="hasTabs"
[info]="info" [info]="info"
[pageTitle]="pageTitle" [pageTitle]="pageTitle"

@ -47,6 +47,7 @@ export class AppComponent implements OnDestroy, OnInit {
public canCreateAccount: boolean; public canCreateAccount: boolean;
public currentRoute: string; public currentRoute: string;
public currentSubRoute: string;
public currentYear = new Date().getFullYear(); public currentYear = new Date().getFullYear();
public deviceType: string; public deviceType: string;
public hasImpersonationId: boolean; public hasImpersonationId: boolean;
@ -54,6 +55,8 @@ export class AppComponent implements OnDestroy, OnInit {
public hasPermissionForStatistics: boolean; public hasPermissionForStatistics: boolean;
public hasPermissionForSubscription: boolean; public hasPermissionForSubscription: boolean;
public hasPermissionToAccessFearAndGreedIndex: boolean; public hasPermissionToAccessFearAndGreedIndex: boolean;
public hasPermissionToChangeDateRange: boolean;
public hasPermissionToChangeFilters: boolean;
public hasTabs = false; public hasTabs = false;
public info: InfoItem; public info: InfoItem;
public pageTitle: string; public pageTitle: string;
@ -147,6 +150,35 @@ export class AppComponent implements OnDestroy, OnInit {
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET]; const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
const urlSegments = urlSegmentGroup.segments; const urlSegments = urlSegmentGroup.segments;
this.currentRoute = urlSegments[0].path; 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.hasTabs =
(this.currentRoute === this.routerLinkAbout[0].slice(1) || (this.currentRoute === this.routerLinkAbout[0].slice(1) ||
@ -182,6 +214,8 @@ export class AppComponent implements OnDestroy, OnInit {
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
}); });
} }
this.changeDetectorRef.markForCheck();
}); });
this.userService.stateChanged this.userService.stateChanged

@ -121,7 +121,7 @@
matBadge="✓" matBadge="✓"
matBadgeSize="small" matBadgeSize="small"
[mat-menu-trigger-for]="assistantMenu" [mat-menu-trigger-for]="assistantMenu"
[matBadgeHidden]="!hasFilters" [matBadgeHidden]="!hasFilters || !hasPermissionToChangeFilters"
[matMenuTriggerRestoreFocus]="false" [matMenuTriggerRestoreFocus]="false"
(menuOpened)="onOpenAssistant()" (menuOpened)="onOpenAssistant()"
> >
@ -140,6 +140,8 @@
[hasPermissionToAccessAdminControl]=" [hasPermissionToAccessAdminControl]="
hasPermissionToAccessAdminControl hasPermissionToAccessAdminControl
" "
[hasPermissionToChangeDateRange]="hasPermissionToChangeDateRange"
[hasPermissionToChangeFilters]="hasPermissionToChangeFilters"
[user]="user" [user]="user"
(closed)="closeAssistant()" (closed)="closeAssistant()"
(dateRangeChanged)="onDateRangeChange($event)" (dateRangeChanged)="onDateRangeChange($event)"

@ -56,6 +56,8 @@ export class HeaderComponent implements OnChanges {
@Input() currentRoute: string; @Input() currentRoute: string;
@Input() deviceType: string; @Input() deviceType: string;
@Input() hasPermissionToChangeDateRange: boolean;
@Input() hasPermissionToChangeFilters: boolean;
@Input() hasTabs: boolean; @Input() hasTabs: boolean;
@Input() info: InfoItem; @Input() info: InfoItem;
@Input() pageTitle: string; @Input() pageTitle: string;
@ -197,7 +199,7 @@ export class HeaderComponent implements OnChanges {
} }
public onLogoClick() { public onLogoClick() {
if (this.currentRoute === 'home' || this.currentRoute === 'zen') { if (['home', 'zen'].includes(this.currentRoute)) {
this.layoutService.getShouldReloadSubject().next(); this.layoutService.getShouldReloadSubject().next();
} }
} }

@ -110,6 +110,8 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
@Input() deviceType: string; @Input() deviceType: string;
@Input() hasPermissionToAccessAdminControl: boolean; @Input() hasPermissionToAccessAdminControl: boolean;
@Input() hasPermissionToChangeDateRange: boolean;
@Input() hasPermissionToChangeFilters: boolean;
@Input() user: User; @Input() user: User;
@Output() closed = new EventEmitter<void>(); @Output() closed = new EventEmitter<void>();
@ -254,8 +256,20 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
{ label: $localize`Max`, value: 'max' } { 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.dateRangeFormControl.setValue(this.user?.settings?.dateRange ?? null);
this.filterForm.disable({ emitEvent: false });
if (this.hasPermissionToChangeFilters) {
this.filterForm.enable({ emitEvent: false });
}
this.filterForm.setValue( this.filterForm.setValue(
{ {
account: this.user?.settings?.['filters.accounts']?.[0] ?? null, account: this.user?.settings?.['filters.accounts']?.[0] ?? null,

@ -150,7 +150,9 @@
<button <button
i18n i18n
mat-button mat-button
[disabled]="!hasFilter(filterForm.value)" [disabled]="
!hasFilter(filterForm.value) || !hasPermissionToChangeFilters
"
(click)="onResetFilters()" (click)="onResetFilters()"
> >
Reset Filters Reset Filters
@ -160,7 +162,7 @@
color="primary" color="primary"
i18n i18n
mat-flat-button mat-flat-button
[disabled]="!filterForm.dirty" [disabled]="!filterForm.dirty || !hasPermissionToChangeFilters"
(click)="onApplyFilters()" (click)="onApplyFilters()"
> >
Apply Filters Apply Filters

Loading…
Cancel
Save