Browse Source
Feature/include admin control panel in quick links of assistant (#4955)
* Include admin control panel in quick links of assistant
* Update changelog
pull/4963/head
Hash Palak
2 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
18 additions and
2 deletions
-
CHANGELOG.md
-
libs/common/src/lib/routes/interfaces/interfaces.ts
-
libs/common/src/lib/routes/routes.ts
-
libs/ui/src/lib/assistant/assistant.component.ts
|
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
## Unreleased |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
|
|
- Included the admin control panel in the quick links of the assistant |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Adapted the options of the date range selector in the assistant dynamically based on the user’s first activity |
|
|
|
|
|
@ -1,5 +1,7 @@ |
|
|
|
import { User } from '@ghostfolio/common/interfaces'; |
|
|
|
|
|
|
|
export interface IRoute { |
|
|
|
excludeFromAssistant?: boolean; |
|
|
|
excludeFromAssistant?: boolean | ((aUser: User) => boolean); |
|
|
|
path: string; |
|
|
|
routerLink: string[]; |
|
|
|
subRoutes?: Record<string, IRoute>; |
|
|
|
|
|
@ -1,3 +1,6 @@ |
|
|
|
import { User } from '@ghostfolio/common/interfaces'; |
|
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; |
|
|
|
|
|
|
|
import '@angular/localize/init'; |
|
|
|
|
|
|
|
import { IRoute } from './interfaces/interfaces'; |
|
|
@ -21,7 +24,9 @@ export const internalRoutes: Record<string, IRoute> = { |
|
|
|
title: $localize`Settings` |
|
|
|
}, |
|
|
|
adminControl: { |
|
|
|
excludeFromAssistant: true, |
|
|
|
excludeFromAssistant: (aUser: User) => { |
|
|
|
return hasPermission(aUser?.permissions, permissions.accessAdminControl); |
|
|
|
}, |
|
|
|
path: 'admin', |
|
|
|
routerLink: ['/admin'], |
|
|
|
subRoutes: { |
|
|
|
|
|
@ -41,6 +41,7 @@ import { MatSelectModule } from '@angular/material/select'; |
|
|
|
import { RouterModule } from '@angular/router'; |
|
|
|
import { Account, AssetClass, DataSource } from '@prisma/client'; |
|
|
|
import { differenceInYears } from 'date-fns'; |
|
|
|
import { isFunction } from 'lodash'; |
|
|
|
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; |
|
|
|
import { EMPTY, Observable, Subject, merge, of } from 'rxjs'; |
|
|
|
import { |
|
|
@ -627,6 +628,10 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
|
|
|
|
|
const allRoutes = Object.values(internalRoutes) |
|
|
|
.filter(({ excludeFromAssistant }) => { |
|
|
|
if (isFunction(excludeFromAssistant)) { |
|
|
|
return excludeFromAssistant(this.user); |
|
|
|
} |
|
|
|
|
|
|
|
return !excludeFromAssistant; |
|
|
|
}) |
|
|
|
.reduce((acc, route) => { |
|
|
|