argos/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.comp...

42 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-04-24 11:26:53 +02:00
import { Component, OnInit } from '@angular/core';
2019-04-25 11:03:22 +02:00
import { DmpListingModel } from '../../../core/model/dmp/dmp-listing';
import { EnumUtils } from '../../../core/services/utilities/enum-utils.service';
import { AuthService } from '../../../core/services/auth/auth.service';
import { DataTableRequest } from '../../../core/model/data-table/data-table-request';
import { DmpCriteria } from '../../../core/query/dmp/dmp-criteria';
import { DmpService } from '../../../core/services/dmp/dmp.service';
2019-04-24 11:26:53 +02:00
@Component({
2019-04-25 11:03:22 +02:00
selector: 'app-recent-edited-activity',
templateUrl: './recent-edited-activity.component.html',
styleUrls: ['./recent-edited-activity.component.css']
2019-04-24 11:26:53 +02:00
})
export class RecentEditedActivityComponent implements OnInit {
2019-04-25 11:03:22 +02:00
dmpActivities: DmpListingModel[];
2019-04-24 11:26:53 +02:00
2019-04-25 11:03:22 +02:00
constructor(
public enumUtils: EnumUtils,
private authentication: AuthService,
private dmpService: DmpService
) { }
2019-04-24 11:26:53 +02:00
2019-04-25 11:03:22 +02:00
ngOnInit() {
if (this.isAuthenticated()) {
const fields: Array<string> = ["-created"];
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
dmpDataTableRequest.criteria = new DmpCriteria();
dmpDataTableRequest.criteria.like = "";
this.dmpService
.getPaged(dmpDataTableRequest, "listing")
.subscribe(response => {
this.dmpActivities = response.data;
});
}
}
public isAuthenticated(): boolean {
return !!this.authentication.current();
}
2019-04-24 11:26:53 +02:00
}