From 95fbfb79df1dce94aede8afa545c07de2a0f818a Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 1 Sep 2026 21:03:36 +0200 Subject: [PATCH] Move details of granted access --- .../access-table/access-table.component.html | 16 ------------- .../access-table/access-table.component.ts | 20 +++++++--------- ...reate-or-update-access-dialog.component.ts | 24 ++++++++++++++++++- .../create-or-update-access-dialog.html | 15 ++++++++++++ 4 files changed, 47 insertions(+), 28 deletions(-) diff --git a/apps/client/src/app/components/access-table/access-table.component.html b/apps/client/src/app/components/access-table/access-table.component.html index fc324fb872..528fd336b1 100644 --- a/apps/client/src/app/components/access-table/access-table.component.html +++ b/apps/client/src/app/components/access-table/access-table.component.html @@ -55,22 +55,6 @@ getPublicUrl(element.id) }} - @if (user()?.settings?.isExperimentalFeatures) { -
- GET {{ baseUrl }}/api/v1/public/{{ - element.id - }}/portfolio -
- } - } @else if (element.type === 'MCP' && hasPermissionToEnableMcp) { -
- {{ baseUrl }}{{ mcpEndpoint }} -
-
- Authorization: Bearer {{ element.id }} -
} diff --git a/apps/client/src/app/components/access-table/access-table.component.ts b/apps/client/src/app/components/access-table/access-table.component.ts index baf4247e3c..cc25f01435 100644 --- a/apps/client/src/app/components/access-table/access-table.component.ts +++ b/apps/client/src/app/components/access-table/access-table.component.ts @@ -1,4 +1,3 @@ -import { MCP_ENDPOINT } from '@ghostfolio/common/config'; import { ConfirmationDialogType } from '@ghostfolio/common/enums'; import { getDateFormatString } from '@ghostfolio/common/helper'; import { Access, User } from '@ghostfolio/common/interfaces'; @@ -81,14 +80,15 @@ export class GfAccessTableComponent { protected readonly dataSource = new MatTableDataSource(); protected readonly displayedColumns = computed(() => { - const columns = [ - 'alias', - 'grantee', - 'type', - 'lastUsedAt', - 'expiresAt', - 'details' - ]; + const columns = ['alias', 'grantee', 'type', 'lastUsedAt', 'expiresAt']; + + if ( + this.accesses()?.some(({ type }) => { + return type === 'PUBLIC'; + }) + ) { + columns.push('details'); + } if (this.showActions()) { columns.push('actions'); @@ -109,8 +109,6 @@ export class GfAccessTableComponent { return !this.accesses(); }); - protected readonly mcpEndpoint = MCP_ENDPOINT; - private readonly clipboard = inject(Clipboard); private readonly dataService = inject(DataService); private readonly notificationService = inject(NotificationService); diff --git a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts index 8c2bb0353a..ed4b201101 100644 --- a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts +++ b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts @@ -1,5 +1,5 @@ import { UserService } from '@ghostfolio/client/services/user/user.service'; -import { DEFAULT_LOCALE } from '@ghostfolio/common/config'; +import { DEFAULT_LOCALE, MCP_ENDPOINT } from '@ghostfolio/common/config'; import { CreateAccessDto, UpdateAccessDto } from '@ghostfolio/common/dtos'; import { canApplyFiltersToAccess } from '@ghostfolio/common/helper'; import { Filter, PortfolioPosition } from '@ghostfolio/common/interfaces'; @@ -88,6 +88,8 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit { public tags: Filter[] = []; protected accessForm: FormGroup; + protected readonly baseUrl = window.location.origin; + protected readonly mcpEndpoint = MCP_ENDPOINT; protected minExpiresAt: Date; protected readonly mode: 'create' | 'update'; protected readonly today = startOfDay(new Date()); @@ -222,6 +224,10 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit { this.loadHoldings(); } + protected get accessId() { + return this.data.access?.id; + } + protected get accessLevel(): AccessLevel { return this.accessForm?.get('accessLevel')?.value as AccessLevel; } @@ -238,6 +244,22 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit { return this.accessForm?.get('expiresAt')?.invalid === true; } + protected get showMcpDetails() { + return ( + this.accessType === 'MCP' && + this.hasPermissionToEnableMcp && + this.mode === 'update' + ); + } + + protected get showPublicDetails() { + return ( + this.hasExperimentalFeatures && + this.isPublicAccess && + this.mode === 'update' + ); + } + protected onCancel() { this.dialogRef.close(); } diff --git a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html index 21c0cd3a8b..0fd6bf8a56 100644 --- a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html +++ b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html @@ -133,6 +133,21 @@ [tags]="tags" /> } + @if (showMcpDetails || showPublicDetails) { +

Details

+ @if (showMcpDetails) { +
+ {{ baseUrl }}{{ mcpEndpoint }} +
+
+ Authorization: Bearer {{ accessId }} +
+ } @else if (showPublicDetails) { +
+ GET {{ baseUrl }}/api/v1/public/{{ accessId }}/portfolio +
+ } + }