From 81db3852e6063866b94b9a2880b37759b17ce436 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 19 Nov 2022 09:57:28 +0100 Subject: [PATCH 1/2] Feature/add sorting to accounts table (#1459) * Add sorting * Update changelog --- CHANGELOG.md | 4 ++++ .../accounts-table/accounts-table.component.html | 16 ++++++++++++---- .../accounts-table/accounts-table.component.ts | 7 ++++++- .../accounts-table/accounts-table.module.ts | 2 ++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ec7fb10d..9d3905111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Added support for sorting in the accounts table + ### Changed - Improved the _Activities_ tab icon diff --git a/apps/client/src/app/components/accounts-table/accounts-table.component.html b/apps/client/src/app/components/accounts-table/accounts-table.component.html index 3be8520dd..a1df7e2d5 100644 --- a/apps/client/src/app/components/accounts-table/accounts-table.component.html +++ b/apps/client/src/app/components/accounts-table/accounts-table.component.html @@ -1,4 +1,4 @@ - +
@@ -122,8 +128,9 @@ @@ -158,6 +165,7 @@ *matHeaderCellDef class="d-lg-none d-xl-none px-1 text-right" mat-header-cell + mat-sort-header > Value diff --git a/apps/client/src/app/components/accounts-table/accounts-table.component.ts b/apps/client/src/app/components/accounts-table/accounts-table.component.ts index 5e2e4886b..df5a1c589 100644 --- a/apps/client/src/app/components/accounts-table/accounts-table.component.ts +++ b/apps/client/src/app/components/accounts-table/accounts-table.component.ts @@ -6,8 +6,10 @@ import { OnChanges, OnDestroy, OnInit, - Output + Output, + ViewChild } from '@angular/core'; +import { MatSort } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; import { Router } from '@angular/router'; import { Account as AccountModel } from '@prisma/client'; @@ -32,6 +34,8 @@ export class AccountsTableComponent implements OnChanges, OnDestroy, OnInit { @Output() accountDeleted = new EventEmitter(); @Output() accountToUpdate = new EventEmitter(); + @ViewChild(MatSort) sort: MatSort; + public dataSource: MatTableDataSource = new MatTableDataSource(); public displayedColumns = []; @@ -64,6 +68,7 @@ export class AccountsTableComponent implements OnChanges, OnDestroy, OnInit { if (this.accounts) { this.dataSource = new MatTableDataSource(this.accounts); + this.dataSource.sort = this.sort; this.isLoading = false; } diff --git a/apps/client/src/app/components/accounts-table/accounts-table.module.ts b/apps/client/src/app/components/accounts-table/accounts-table.module.ts index b88ea7d56..4f09935f7 100644 --- a/apps/client/src/app/components/accounts-table/accounts-table.module.ts +++ b/apps/client/src/app/components/accounts-table/accounts-table.module.ts @@ -3,6 +3,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatInputModule } from '@angular/material/input'; import { MatMenuModule } from '@angular/material/menu'; +import { MatSortModule } from '@angular/material/sort'; import { MatTableModule } from '@angular/material/table'; import { RouterModule } from '@angular/router'; import { GfSymbolIconModule } from '@ghostfolio/client/components/symbol-icon/symbol-icon.module'; @@ -21,6 +22,7 @@ import { AccountsTableComponent } from './accounts-table.component'; MatButtonModule, MatInputModule, MatMenuModule, + MatSortModule, MatTableModule, NgxSkeletonLoaderModule, RouterModule From 18638dd1b7928e40d9f8f609a168d270380c0e5f Mon Sep 17 00:00:00 2001 From: Yash Solanki Date: Sat, 19 Nov 2022 14:32:36 +0530 Subject: [PATCH 2/2] Bugfix/Fix matsort not working in position detail dialog (#1457) * Fix matsort in position detail dialog * Update changelog Co-authored-by: Thomas <4159106+dtslvr@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ apps/client/src/app/app.module.ts | 2 ++ .../position-detail-dialog/position-detail-dialog.html | 4 ++-- .../pages/portfolio/allocations/allocations-page.module.ts | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d3905111..64a2e28c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgraded `prisma` from version `4.4.0` to `4.6.1` - Upgraded `yahoo-finance2` from version `2.3.6` to `2.3.10` +### Fixed + +- Fixed the activities sorting in the position detail dialog + ## 1.213.0 - 14.11.2022 ### Added diff --git a/apps/client/src/app/app.module.ts b/apps/client/src/app/app.module.ts index b17a59437..b805a458f 100644 --- a/apps/client/src/app/app.module.ts +++ b/apps/client/src/app/app.module.ts @@ -10,6 +10,7 @@ import { MatNativeDateModule } from '@angular/material/core'; import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { MatTooltipModule } from '@angular/material/tooltip'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MaterialCssVarsModule } from 'angular-material-css-vars'; @@ -50,6 +51,7 @@ export function NgxStripeFactory(): string { }), MatNativeDateModule, MatSnackBarModule, + MatTooltipModule, NgxSkeletonLoaderModule, NgxStripeModule.forRoot(environment.stripePublicKey), ServiceWorkerModule.register('ngsw-worker.js', { diff --git a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html index e0cc957e1..52b0e1858 100644 --- a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html +++ b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html @@ -213,7 +213,7 @@ -
+
Activities
- + Currency @@ -88,8 +93,9 @@ Cash Balance Value