From d8d4d8f001740bece2fc45a3153069bd9c499ca0 Mon Sep 17 00:00:00 2001 From: Basim Mohammed <107759928+Basimohd@users.noreply.github.com> Date: Mon, 9 Oct 2023 23:08:33 +0530 Subject: [PATCH] Change jobs table in admin control to mat-table (#2444) * Change jobs table in admin control to mat-table * Update changelog --- CHANGELOG.md | 4 + .../admin-jobs/admin-jobs.component.ts | 17 +- .../app/components/admin-jobs/admin-jobs.html | 267 ++++++++++-------- .../admin-jobs/admin-jobs.module.ts | 2 + 4 files changed, 175 insertions(+), 115 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9acc0e009..9ff26a060 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Supported enter key press to submit the form of the create or update access dialog +### Changed + +- Changed the queue jobs view in the admin control panel to an `@angular/material` data table + ## 2.9.0 - 2023-10-08 ### Added diff --git a/apps/client/src/app/components/admin-jobs/admin-jobs.component.ts b/apps/client/src/app/components/admin-jobs/admin-jobs.component.ts index 91988eb4d..9c5e8e62a 100644 --- a/apps/client/src/app/components/admin-jobs/admin-jobs.component.ts +++ b/apps/client/src/app/components/admin-jobs/admin-jobs.component.ts @@ -6,6 +6,7 @@ import { OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; +import { MatTableDataSource } from '@angular/material/table'; import { AdminService } from '@ghostfolio/client/services/admin.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { QUEUE_JOB_STATUS_LIST } from '@ghostfolio/common/config'; @@ -24,7 +25,19 @@ import { takeUntil } from 'rxjs/operators'; export class AdminJobsComponent implements OnDestroy, OnInit { public defaultDateTimeFormat: string; public filterForm: FormGroup; - public jobs: AdminJobs['jobs'] = []; + public dataSource: MatTableDataSource = + new MatTableDataSource(); + public displayedColumns = [ + 'index', + 'type', + 'symbol', + 'dataSource', + 'attempts', + 'created', + 'finished', + 'status', + 'actions' + ]; public statusFilterOptions = QUEUE_JOB_STATUS_LIST; public user: User; @@ -102,7 +115,7 @@ export class AdminJobsComponent implements OnDestroy, OnInit { .fetchJobs({ status: aStatus }) .pipe(takeUntil(this.unsubscribeSubject)) .subscribe(({ jobs }) => { - this.jobs = jobs; + this.dataSource = new MatTableDataSource(jobs); this.changeDetectorRef.markForCheck(); }); diff --git a/apps/client/src/app/components/admin-jobs/admin-jobs.html b/apps/client/src/app/components/admin-jobs/admin-jobs.html index acb868979..0fb95a26a 100644 --- a/apps/client/src/app/components/admin-jobs/admin-jobs.html +++ b/apps/client/src/app/components/admin-jobs/admin-jobs.html @@ -13,122 +13,163 @@ - - - - - - - - - - - -
#TypeSymbolData SourceAttemptsCreatedFinishedStatus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + +
+ # + + {{ element.id }} + + Type + + + + + Asset Profile + + + Historical Market Data + + + + Symbol + + {{ element.data?.symbol }} + + Data Source + + {{ element.data?.dataSource }} + + Attempts + + {{ element.attemptsMade }} + + Created + + {{ element.timestamp | date: defaultDateTimeFormat }} + + Finished + + {{ element.finishedOn | date: defaultDateTimeFormat }} + + Status + + + + + + + + + + + + + + + + + - - - - -
{{ job.id }} - - - - Asset Profile - - - Historical Market Data - - - {{ job.data?.symbol }}{{ job.data?.dataSource }} - {{ job.attemptsMade }} - - {{ job.timestamp | date: defaultDateTimeFormat }} - - {{ job.finishedOn | date: defaultDateTimeFormat }} - - - - - - - - - - - - - - -
diff --git a/apps/client/src/app/components/admin-jobs/admin-jobs.module.ts b/apps/client/src/app/components/admin-jobs/admin-jobs.module.ts index 93e668097..fe717b904 100644 --- a/apps/client/src/app/components/admin-jobs/admin-jobs.module.ts +++ b/apps/client/src/app/components/admin-jobs/admin-jobs.module.ts @@ -4,6 +4,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatMenuModule } from '@angular/material/menu'; import { MatSelectModule } from '@angular/material/select'; +import { MatTableModule } from '@angular/material/table'; import { AdminJobsComponent } from './admin-jobs.component'; @@ -15,6 +16,7 @@ import { AdminJobsComponent } from './admin-jobs.component'; MatButtonModule, MatMenuModule, MatSelectModule, + MatTableModule, ReactiveFormsModule ], schemas: [CUSTOM_ELEMENTS_SCHEMA]