minor ui fixes

This commit is contained in:
Diamantis Tziotzios 2024-04-15 10:47:30 +03:00
parent 5118e696d0
commit af5a9c269e
5 changed files with 50 additions and 57 deletions

View File

@ -34,7 +34,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); lookup: RecentActivityItemLookup = new RecentActivityItemLookup();
pageSize: number = 5; pageSize: number = 5;
pageLessSize= this.pageSize; pageLessSize = this.pageSize;
listingItems: RecentActivityItem[] = []; listingItems: RecentActivityItem[] = [];
public formGroup = new UntypedFormBuilder().group({ 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(); this.refresh();
} }
@ -119,12 +126,9 @@ export class DraftsComponent extends BaseComponent implements OnInit {
} }
refresh(): void { refresh(): void {
if (!this.formGroup.get('order').value) {
this.formGroup.get('order').setValue(this.order.UpdatedAt);
}
this.lookup.onlyDraft = true; this.lookup.onlyDraft = true;
this.lookup.page = { size: this.pageSize, offset: 0 }; 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.like = this.formGroup.get('like').value;
this.lookup.project = { this.lookup.project = {
@ -195,13 +199,6 @@ export class DraftsComponent extends BaseComponent implements OnInit {
}; };
this.getItems(); 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() { loadMore() {
@ -216,7 +213,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
this.getItems(); this.getItems();
} }
private getItems(){ private getItems() {
this.listingItems = []; this.listingItems = [];
this.dashboardService this.dashboardService
@ -224,7 +221,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(response => { .subscribe(response => {
response.forEach(item => { response.forEach(item => {
if (item.dmp){ if (item.dmp) {
if (item.dmp.descriptions) { if (item.dmp.descriptions) {
if (item.dmp.status == DmpStatus.Finalized) { if (item.dmp.status == DmpStatus.Finalized) {
item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.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.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); this.listingItems.push(item);
} }
if (item.description){ if (item.description) {
if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item); if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item);
} }
}) })

View File

@ -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(); this.refresh();
} }
@ -119,11 +129,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
} }
refresh(): void { 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.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.like = this.formGroup.get('like').value;
this.lookup.project = { this.lookup.project = {
@ -193,13 +200,6 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
}; };
this.getItems(); 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() { loadMore() {

View File

@ -92,9 +92,18 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl
this.updateUrl(); 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() { ngOnChanges() {
@ -117,12 +126,9 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl
} }
refresh(): void { 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.page = { size: this.pageSize, offset: 0 };
this.lookup.onlyDescription = true; 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.like = this.formGroup.get('like').value;
this.lookup.project = { this.lookup.project = {
@ -157,13 +163,6 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl
}; };
this.getItems(); 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() { loadMore() {

View File

@ -32,13 +32,13 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); lookup: RecentActivityItemLookup = new RecentActivityItemLookup();
pageSize: number = 5; pageSize: number = 5;
pageLessSize= this.pageSize; pageLessSize = this.pageSize;
@Output() totalCountDmps: EventEmitter<any> = new EventEmitter(); @Output() totalCountDmps: EventEmitter<any> = new EventEmitter();
@ViewChild("dmps") resultsContainer; @ViewChild("dmps") resultsContainer;
listingItems: Dmp[]= []; listingItems: Dmp[] = [];
isDraft: boolean; isDraft: boolean;
totalCount: number; 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(); this.refresh();
} }
@ -124,12 +131,9 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
} }
refresh(): void { 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.page = { size: this.pageSize, offset: 0 };
this.lookup.onlyDmp = true; 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.like = this.formGroup.get('like').value;
this.lookup.project = { this.lookup.project = {
fields: [ fields: [
@ -169,13 +173,6 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
}; };
this.getItems(); 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() { loadMore() {
@ -190,7 +187,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
this.getItems(); this.getItems();
} }
private getItems(){ private getItems() {
this.listingItems = []; this.listingItems = [];
this.dashboardService this.dashboardService
@ -198,7 +195,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(response => { .subscribe(response => {
response.forEach(item => { response.forEach(item => {
if (item.dmp){ if (item.dmp) {
item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active); item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active);
if (item.dmp.descriptions) { if (item.dmp.descriptions) {
if (item.dmp.status == DmpStatus.Finalized) { if (item.dmp.status == DmpStatus.Finalized) {

View File

@ -1712,7 +1712,7 @@
"INTERNAL": "Internal", "INTERNAL": "Internal",
"EXTERNAL": "External" "EXTERNAL": "External"
}, },
"NOTIFICATION-TEMPLATE-KIND - HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!": { "NOTIFICATION-TEMPLATE-KIND": {
"DRAFT": "Draft", "DRAFT": "Draft",
"SECONDARY": "Secondary", "SECONDARY": "Secondary",
"PRIMARY": "Primary", "PRIMARY": "Primary",