From af5a9c269ed035d97943a1822d5c941bd2437c48 Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Mon, 15 Apr 2024 10:47:30 +0300 Subject: [PATCH] minor ui fixes --- .../ui/dashboard/drafts/drafts.component.ts | 29 +++++++++---------- .../recent-edited-activity.component.ts | 22 +++++++------- ...t-edited-description-activity.component.ts | 27 +++++++++-------- .../recent-edited-dmp-activity.component.ts | 27 ++++++++--------- dmp-frontend/src/assets/i18n/en.json | 2 +- 5 files changed, 50 insertions(+), 57 deletions(-) diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts index 496612988..a6e84ee54 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts @@ -34,7 +34,7 @@ export class DraftsComponent extends BaseComponent implements OnInit { lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); pageSize: number = 5; - pageLessSize= this.pageSize; + pageLessSize = this.pageSize; listingItems: RecentActivityItem[] = []; public formGroup = new UntypedFormBuilder().group({ @@ -96,6 +96,13 @@ export class DraftsComponent extends BaseComponent implements OnInit { } }); + this.formGroup.get('like').valueChanges + .pipe(takeUntil(this._destroyed), debounceTime(500)) + .subscribe(x => this.refresh()); + this.formGroup.get('order').valueChanges + .pipe(takeUntil(this._destroyed)) + .subscribe(x => this.refresh()); + this.refresh(); } @@ -119,12 +126,9 @@ export class DraftsComponent extends BaseComponent implements OnInit { } refresh(): void { - if (!this.formGroup.get('order').value) { - this.formGroup.get('order').setValue(this.order.UpdatedAt); - } this.lookup.onlyDraft = true; this.lookup.page = { size: this.pageSize, offset: 0 }; - this.lookup.orderField = this.formGroup.get('order').value; + this.lookup.orderField = this.formGroup.get('order').value ?? this.order.UpdatedAt; this.lookup.like = this.formGroup.get('like').value; this.lookup.project = { @@ -195,13 +199,6 @@ export class DraftsComponent extends BaseComponent implements OnInit { }; this.getItems(); - - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => this.refresh()); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); } loadMore() { @@ -216,7 +213,7 @@ export class DraftsComponent extends BaseComponent implements OnInit { this.getItems(); } - private getItems(){ + private getItems() { this.listingItems = []; this.dashboardService @@ -224,7 +221,7 @@ export class DraftsComponent extends BaseComponent implements OnInit { .pipe(takeUntil(this._destroyed)) .subscribe(response => { response.forEach(item => { - if (item.dmp){ + if (item.dmp) { if (item.dmp.descriptions) { if (item.dmp.status == DmpStatus.Finalized) { item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); @@ -232,10 +229,10 @@ export class DraftsComponent extends BaseComponent implements OnInit { item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status != DescriptionStatus.Canceled); } } - item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x=> x.isActive === IsActive.Active); + item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active); this.listingItems.push(item); } - if (item.description){ + if (item.description) { if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item); } }) diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts index 240bed9d1..5ab6fb99c 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts @@ -96,6 +96,16 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn } }); + this.formGroup.get('like').valueChanges + .pipe(takeUntil(this._destroyed), debounceTime(500)) + .subscribe(x => { + console.log('valueChanges'); + this.refresh() + }); + this.formGroup.get('order').valueChanges + .pipe(takeUntil(this._destroyed)) + .subscribe(x => this.refresh()); + this.refresh(); } @@ -119,11 +129,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn } refresh(): void { - if (!this.formGroup.get('order').value) { - this.formGroup.get('order').setValue(this.order.UpdatedAt); - } this.lookup.page = { size: this.pageSize, offset: 0 }; - this.lookup.orderField = this.formGroup.get('order').value; + this.lookup.orderField = this.formGroup.get('order').value ?? this.order.UpdatedAt; this.lookup.like = this.formGroup.get('like').value; this.lookup.project = { @@ -193,13 +200,6 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn }; this.getItems(); - - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => this.refresh()); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); } loadMore() { diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts index f1f569041..6b95c224c 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts @@ -92,9 +92,18 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl this.updateUrl(); } }); - if (this.isAuthenticated()) { - this.refresh(); - } + + this.formGroup.get('like').valueChanges + .pipe(takeUntil(this._destroyed), debounceTime(500)) + .subscribe(x => { + console.log('valueChanges'); + this.refresh() + }); + this.formGroup.get('order').valueChanges + .pipe(takeUntil(this._destroyed)) + .subscribe(x => this.refresh()); + + this.refresh(); } ngOnChanges() { @@ -117,12 +126,9 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl } refresh(): void { - if (!this.formGroup.get('order').value) { - this.formGroup.get('order').setValue(this.order.UpdatedAt); - } this.lookup.page = { size: this.pageSize, offset: 0 }; this.lookup.onlyDescription = true; - this.lookup.orderField = this.formGroup.get('order').value; + this.lookup.orderField = this.formGroup.get('order').value ??this.order.UpdatedAt; this.lookup.like = this.formGroup.get('like').value; this.lookup.project = { @@ -157,13 +163,6 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl }; this.getItems(); - - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => this.refresh()); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); } loadMore() { diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts index 39a8a9a52..598819d86 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts @@ -32,13 +32,13 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); pageSize: number = 5; - pageLessSize= this.pageSize; + pageLessSize = this.pageSize; @Output() totalCountDmps: EventEmitter = new EventEmitter(); @ViewChild("dmps") resultsContainer; - listingItems: Dmp[]= []; + listingItems: Dmp[] = []; isDraft: boolean; totalCount: number; @@ -101,6 +101,13 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O } }); + this.formGroup.get('like').valueChanges + .pipe(takeUntil(this._destroyed), debounceTime(500)) + .subscribe(x => this.refresh()); + this.formGroup.get('order').valueChanges + .pipe(takeUntil(this._destroyed)) + .subscribe(x => this.refresh()); + this.refresh(); } @@ -124,12 +131,9 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O } refresh(): void { - if (!this.formGroup.get('order').value) { - this.formGroup.get('order').setValue(this.order.UpdatedAt); - } this.lookup.page = { size: this.pageSize, offset: 0 }; this.lookup.onlyDmp = true; - this.lookup.orderField = this.formGroup.get('order').value; + this.lookup.orderField = this.formGroup.get('order').value ?? this.order.UpdatedAt; this.lookup.like = this.formGroup.get('like').value; this.lookup.project = { fields: [ @@ -169,13 +173,6 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O }; this.getItems(); - - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => this.refresh()); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); } loadMore() { @@ -190,7 +187,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O this.getItems(); } - private getItems(){ + private getItems() { this.listingItems = []; this.dashboardService @@ -198,7 +195,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O .pipe(takeUntil(this._destroyed)) .subscribe(response => { response.forEach(item => { - if (item.dmp){ + if (item.dmp) { item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active); if (item.dmp.descriptions) { if (item.dmp.status == DmpStatus.Finalized) { diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 164d11e80..21437a610 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -1712,7 +1712,7 @@ "INTERNAL": "Internal", "EXTERNAL": "External" }, - "NOTIFICATION-TEMPLATE-KIND - HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!": { + "NOTIFICATION-TEMPLATE-KIND": { "DRAFT": "Draft", "SECONDARY": "Secondary", "PRIMARY": "Primary",