diff --git a/frontend/src/app/components/connections-list/connections-list.component.css b/frontend/src/app/components/connections-list/connections-list.component.css index bc3253c96..08220e887 100644 --- a/frontend/src/app/components/connections-list/connections-list.component.css +++ b/frontend/src/app/components/connections-list/connections-list.component.css @@ -87,7 +87,7 @@ .connections-divider { position: relative; - margin: 44px auto 52px; + margin: 24px auto 32px; width: calc(100% - 16px); } diff --git a/frontend/src/app/components/connections-list/connections-list.component.html b/frontend/src/app/components/connections-list/connections-list.component.html index 2a6becd5e..7faf5a90c 100644 --- a/frontend/src/app/components/connections-list/connections-list.component.html +++ b/frontend/src/app/components/connections-list/connections-list.component.html @@ -22,7 +22,8 @@
Invited to a company but don't see your admin panel?
diff --git a/frontend/src/app/components/connections-list/own-connections/own-connections.component.ts b/frontend/src/app/components/connections-list/own-connections/own-connections.component.ts index c28891e22..9e81f927b 100644 --- a/frontend/src/app/components/connections-list/own-connections/own-connections.component.ts +++ b/frontend/src/app/components/connections-list/own-connections/own-connections.component.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { Component, Input } from '@angular/core'; +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { RouterModule } from '@angular/router'; @@ -8,6 +8,7 @@ import posthog from 'posthog-js'; import { supportedDatabasesTitles, supportedOrderedDatabases } from 'src/app/consts/databases'; import { ConnectionItem } from 'src/app/models/connection'; import { UiSettings } from 'src/app/models/ui-settings'; +import { CompanyService } from 'src/app/services/company.service'; import { UiSettingsService } from 'src/app/services/ui-settings.service'; @Component({ @@ -16,18 +17,24 @@ import { UiSettingsService } from 'src/app/services/ui-settings.service'; templateUrl: './own-connections.component.html', styleUrl: './own-connections.component.css', }) -export class OwnConnectionsComponent { + +export class OwnConnectionsComponent implements OnInit, OnChanges { protected posthog = posthog; @Input() currentUser: User; @Input() connections: ConnectionItem[] = null; @Input() isDemo: boolean = false; + @Input() companyId: string; public displayedCardCount: number = 3; public connectionsListCollapsed: boolean; public supportedDatabasesTitles = supportedDatabasesTitles; public supportedOrderedDatabases = supportedOrderedDatabases; + public hasMultipleMembers: boolean = false; - constructor(private _uiSettings: UiSettingsService) {} + constructor( + private _uiSettings: UiSettingsService, + private _companyService: CompanyService + ) {} ngOnInit() { this._uiSettings.getUiSettings().subscribe((settings: UiSettings) => { @@ -36,6 +43,14 @@ export class OwnConnectionsComponent { }); } + ngOnChanges(changes: SimpleChanges) { + if (changes['companyId'] && this.companyId) { + this._companyService.fetchCompanyMembers(this.companyId).subscribe((members: any[]) => { + this.hasMultipleMembers = members && members.length > 1; + }); + } + } + showMore() { this.displayedCardCount = this.connections.length; this._uiSettings.updateGlobalSetting('connectionsListCollapsed', false); @@ -45,4 +60,16 @@ export class OwnConnectionsComponent { this.displayedCardCount = 3; this._uiSettings.updateGlobalSetting('connectionsListCollapsed', true); } + + getMainTitle(database: string): string { + const title = this.supportedDatabasesTitles[database] || database; + const match = title.match(/^([^(]+)/); + return match ? match[1].trim() : title; + } + + getSubTitle(database: string): string { + const title = this.supportedDatabasesTitles[database] || database; + const match = title.match(/(\([^)]+\))/); + return match ? match[1] : ''; + } }