2020-07-02 18:34:27 +02:00
|
|
|
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
|
2019-12-11 15:51:03 +01:00
|
|
|
import { MatDialog } from '@angular/material';
|
2019-04-26 18:08:51 +02:00
|
|
|
import { Router } from '@angular/router';
|
2019-12-11 15:51:03 +01:00
|
|
|
import { RecentActivityType } from '@app/core/common/enum/recent-activity-type';
|
2020-04-27 15:21:03 +02:00
|
|
|
import { Principal } from '@app/core/model/auth/principal';
|
2019-12-11 15:51:03 +01:00
|
|
|
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
|
|
|
import { DmpListingModel } from '@app/core/model/dmp/dmp-listing';
|
|
|
|
import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria';
|
|
|
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
|
|
|
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
|
|
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
|
|
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
2020-04-27 15:21:03 +02:00
|
|
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
2019-12-11 15:51:03 +01:00
|
|
|
import { BaseComponent } from '@common/base/base.component';
|
2019-05-17 10:42:30 +02:00
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
2019-06-04 13:34:30 +02:00
|
|
|
import * as FileSaver from 'file-saver';
|
|
|
|
import { takeUntil } from 'rxjs/operators';
|
2020-06-30 18:40:01 +02:00
|
|
|
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation.component';
|
|
|
|
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
|
|
|
import { DatasetService } from '@app/core/services/dataset/dataset.service';
|
|
|
|
import { DatasetListingModel } from '@app/core/model/dataset/dataset-listing';
|
|
|
|
import { Role } from '@app/core/common/enum/role';
|
2020-07-02 18:34:27 +02:00
|
|
|
import { RecentActivityModel } from '@app/core/model/recent-activity/recent-activity.model';
|
|
|
|
import { DashboardService } from '@app/core/services/dashboard/dashboard.service';
|
|
|
|
import { RecentActivityCriteria } from '@app/core/query/recent-activity/recent-activity-criteria';
|
|
|
|
import { RecentDmpModel } from '@app/core/model/recent-activity/recent-dmp-activity.model';
|
|
|
|
import { RecentDatasetModel } from '@app/core/model/recent-activity/recent-dataset-activity.model';
|
|
|
|
import { UserInfoListingModel } from '@app/core/model/user/user-info-listing';
|
|
|
|
import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service';
|
2020-07-10 15:52:35 +02:00
|
|
|
import { FormControl, FormBuilder } from '@angular/forms';
|
2020-07-02 18:34:27 +02:00
|
|
|
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
|
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
|
|
|
})
|
2019-06-04 13:34:30 +02:00
|
|
|
export class RecentEditedActivityComponent extends BaseComponent implements OnInit {
|
2020-07-02 18:34:27 +02:00
|
|
|
|
|
|
|
@Output() totalCountRecentEdited: EventEmitter<any> = new EventEmitter();
|
|
|
|
|
2020-07-10 15:52:35 +02:00
|
|
|
allRecentActivities: RecentActivityModel[];
|
2019-04-26 18:08:51 +02:00
|
|
|
recentActivityTypeEnum = RecentActivityType;
|
2020-06-26 11:08:51 +02:00
|
|
|
isDraft: boolean;
|
2020-07-02 18:34:27 +02:00
|
|
|
totalCount: number;
|
2020-07-10 15:52:35 +02:00
|
|
|
startIndex: number = 0;
|
2020-07-02 18:34:27 +02:00
|
|
|
pageSize: number = 5;
|
2020-07-10 15:52:35 +02:00
|
|
|
public formGroup = new FormBuilder().group({
|
|
|
|
like: new FormControl()
|
|
|
|
});
|
2019-04-24 11:26:53 +02:00
|
|
|
|
2019-04-25 11:03:22 +02:00
|
|
|
constructor(
|
2019-04-26 18:08:51 +02:00
|
|
|
private router: Router,
|
2019-04-25 11:03:22 +02:00
|
|
|
public enumUtils: EnumUtils,
|
|
|
|
private authentication: AuthService,
|
2019-05-17 10:42:30 +02:00
|
|
|
private dmpService: DmpService,
|
2020-07-02 18:34:27 +02:00
|
|
|
private dashboardService: DashboardService,
|
2019-06-04 13:34:30 +02:00
|
|
|
private language: TranslateService,
|
|
|
|
private dialog: MatDialog,
|
2020-07-02 18:34:27 +02:00
|
|
|
private uiNotificationService: UiNotificationService,
|
|
|
|
private datasetWizardService: DatasetWizardService
|
2019-06-04 13:34:30 +02:00
|
|
|
) {
|
|
|
|
super();
|
|
|
|
}
|
2019-04-24 11:26:53 +02:00
|
|
|
|
2019-04-25 11:03:22 +02:00
|
|
|
ngOnInit() {
|
|
|
|
if (this.isAuthenticated()) {
|
2019-05-06 12:50:48 +02:00
|
|
|
const fields: Array<string> = ["-modified"];
|
2020-07-02 18:34:27 +02:00
|
|
|
const allDataTableRequest: DataTableRequest<RecentActivityCriteria> = new DataTableRequest(0, 5, { fields: fields });
|
|
|
|
allDataTableRequest.criteria = new RecentActivityCriteria();
|
|
|
|
allDataTableRequest.criteria.like = "";
|
|
|
|
this.dashboardService
|
2020-07-03 13:00:23 +02:00
|
|
|
.getRecentActivity(allDataTableRequest)
|
2019-04-25 11:03:22 +02:00
|
|
|
.subscribe(response => {
|
2020-07-03 09:47:04 +02:00
|
|
|
this.allRecentActivities = response;
|
2020-07-03 12:55:25 +02:00
|
|
|
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
|
2019-04-25 11:03:22 +02:00
|
|
|
});
|
2020-07-10 15:52:35 +02:00
|
|
|
this.formGroup.get('like').valueChanges
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(x => this.refresh());
|
|
|
|
}
|
2019-04-25 11:03:22 +02:00
|
|
|
}
|
|
|
|
|
2020-07-02 18:34:27 +02:00
|
|
|
getDatasets(activity: RecentDmpModel): RecentDatasetModel[] {
|
|
|
|
return activity.datasets;
|
|
|
|
}
|
|
|
|
|
|
|
|
getGroupId(activity: RecentDmpModel): string {
|
|
|
|
return activity.groupId;
|
|
|
|
}
|
|
|
|
|
|
|
|
getDmp(activity: RecentDatasetModel): String {
|
|
|
|
return activity.dmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
getDmpId(activity: RecentDatasetModel): String {
|
|
|
|
return activity.dmpId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// getPublic(activity: RecentDmpModel): boolean {
|
|
|
|
// return activity.isPublic;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// getUsers(activity: RecentDmpModel): UserInfoListingModel[] {
|
|
|
|
// return activity.users;
|
|
|
|
// }
|
|
|
|
|
2019-04-25 11:03:22 +02:00
|
|
|
public isAuthenticated(): boolean {
|
|
|
|
return !!this.authentication.current();
|
|
|
|
}
|
2019-04-24 11:26:53 +02:00
|
|
|
|
2020-06-30 18:40:01 +02:00
|
|
|
isUserOwner(activity: DmpListingModel): boolean {
|
|
|
|
const principal: Principal = this.authentication.current();
|
|
|
|
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
|
|
|
|
}
|
|
|
|
|
2019-06-04 13:34:30 +02:00
|
|
|
editClicked(dmp: DmpListingModel) {
|
|
|
|
this.router.navigate(['/plans/edit/' + dmp.id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
cloneClicked(dmp: DmpListingModel) {
|
|
|
|
this.router.navigate(['/plans/clone/' + dmp.id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
deleteClicked(dmp: DmpListingModel) {
|
|
|
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
|
|
maxWidth: '300px',
|
2019-09-27 10:09:29 +02:00
|
|
|
restoreFocus: false,
|
2019-06-04 13:34:30 +02:00
|
|
|
data: {
|
|
|
|
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
|
|
|
|
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
|
2019-06-26 11:24:06 +02:00
|
|
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
|
|
|
isDeleteConfirmation: true
|
2019-06-04 13:34:30 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
if (result) {
|
|
|
|
this.dmpService.delete(dmp.id)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(
|
2019-12-11 15:51:03 +01:00
|
|
|
complete => { this.onCallbackSuccess() },
|
|
|
|
error => this.onDeleteCallbackError(error)
|
2019-06-04 13:34:30 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-06-30 18:40:01 +02:00
|
|
|
openShareDialog(rowId: any, rowName: any) {
|
|
|
|
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
|
|
|
|
// height: '250px',
|
|
|
|
// width: '700px',
|
|
|
|
restoreFocus: false,
|
|
|
|
data: {
|
|
|
|
dmpId: rowId,
|
|
|
|
dmpName: rowName
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
isDraftDmp(activity: DmpListingModel) {
|
|
|
|
return activity.status == DmpStatus.Draft;
|
|
|
|
}
|
|
|
|
|
2019-06-04 13:34:30 +02:00
|
|
|
onCallbackSuccess(): void {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
|
|
|
this.router.navigate(['/plans']);
|
|
|
|
}
|
|
|
|
|
|
|
|
onDeleteCallbackError(error) {
|
|
|
|
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
|
|
|
|
}
|
|
|
|
|
2019-04-26 18:08:51 +02:00
|
|
|
redirect(id: string, type: RecentActivityType) {
|
|
|
|
switch (type) {
|
2019-08-01 09:54:40 +02:00
|
|
|
case RecentActivityType.Grant: {
|
|
|
|
this.router.navigate(["grants/edit/" + id]);
|
2019-04-26 18:08:51 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
case RecentActivityType.Dataset: {
|
|
|
|
this.router.navigate(["datasets/edit/" + id]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case RecentActivityType.Dmp: {
|
2019-06-13 13:38:33 +02:00
|
|
|
this.router.navigate(["plans/overview/" + id]);
|
2019-04-26 18:08:51 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
throw new Error("Unsupported Activity Type ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 13:54:12 +02:00
|
|
|
// navigateToUrl() {
|
|
|
|
// this.router.navigate(["plans/"]);
|
|
|
|
// }
|
2019-05-17 10:42:30 +02:00
|
|
|
|
|
|
|
roleDisplay(value: any) {
|
|
|
|
const principal: Principal = this.authentication.current();
|
|
|
|
let role: number;
|
|
|
|
if (principal) {
|
|
|
|
value.forEach(element => {
|
|
|
|
if (principal.id === element.id) {
|
|
|
|
role = element.role;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (role === 0) {
|
|
|
|
return this.language.instant('DMP-LISTING.OWNER');
|
|
|
|
}
|
|
|
|
else if (role === 1) {
|
|
|
|
return this.language.instant('DMP-LISTING.MEMBER');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return this.language.instant('DMP-LISTING.OWNER');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-23 15:39:13 +02:00
|
|
|
// dmpProfileDisplay(value: any) {
|
|
|
|
// if (value != null) {
|
|
|
|
// return value;
|
|
|
|
// }
|
|
|
|
// else {
|
|
|
|
// return "--";
|
|
|
|
// }
|
|
|
|
// }
|
2019-06-04 13:34:30 +02:00
|
|
|
|
|
|
|
downloadXml(id: string) {
|
|
|
|
this.dmpService.downloadXML(id)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
|
|
|
const blob = new Blob([response.body], { type: 'application/xml' });
|
|
|
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
|
|
|
|
|
|
|
FileSaver.saveAs(blob, filename);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
downloadDocx(id: string) {
|
|
|
|
this.dmpService.downloadDocx(id)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
|
|
|
const blob = new Blob([response.body], { type: 'application/msword' });
|
|
|
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
|
|
|
|
|
|
|
FileSaver.saveAs(blob, filename);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-07-03 16:17:23 +02:00
|
|
|
downloadPdf(id: string) {
|
2019-06-04 13:34:30 +02:00
|
|
|
this.dmpService.downloadPDF(id)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
|
|
|
const blob = new Blob([response.body], { type: 'application/pdf' });
|
|
|
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
|
|
|
|
|
|
|
FileSaver.saveAs(blob, filename);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-04 16:55:23 +02:00
|
|
|
downloadJson(id: string) {
|
|
|
|
this.dmpService.downloadJson(id)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
|
|
|
const blob = new Blob([response.body], { type: 'application/json' });
|
|
|
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
|
|
|
FileSaver.saveAs(blob, filename);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-07-03 16:17:23 +02:00
|
|
|
downloadPDF(dataset: DatasetListingModel): void {
|
|
|
|
this.datasetWizardService.downloadPDF(dataset.id as string)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
|
|
|
const blob = new Blob([response.body], { type: 'application/pdf' });
|
|
|
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
|
|
|
|
|
|
|
FileSaver.saveAs(blob, filename);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
downloadDOCX(dataset: DatasetListingModel): void {
|
|
|
|
this.datasetWizardService.downloadDOCX(dataset.id as string)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
|
|
|
const blob = new Blob([response.body], { type: 'application/msword' });
|
|
|
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
|
|
|
|
|
|
|
FileSaver.saveAs(blob, filename);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
downloadXML(dataset: DatasetListingModel): void {
|
|
|
|
this.datasetWizardService.downloadXML(dataset.id as string)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
|
|
|
const blob = new Blob([response.body], { type: 'application/xml' });
|
|
|
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
|
|
|
|
|
|
|
FileSaver.saveAs(blob, filename);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-04 13:34:30 +02:00
|
|
|
getFilenameFromContentDispositionHeader(header: string): string {
|
|
|
|
const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g);
|
|
|
|
|
|
|
|
const matches = header.match(regex);
|
|
|
|
let filename: string;
|
|
|
|
for (let i = 0; i < matches.length; i++) {
|
|
|
|
const match = matches[i];
|
|
|
|
if (match.includes('filename="')) {
|
|
|
|
filename = match.substring(10, match.length - 1);
|
|
|
|
break;
|
|
|
|
} else if (match.includes('filename=')) {
|
|
|
|
filename = match.substring(9);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return filename;
|
|
|
|
}
|
2019-09-25 11:44:22 +02:00
|
|
|
|
2020-06-30 18:40:01 +02:00
|
|
|
addDataset(activityId: String) {
|
|
|
|
this.router.navigate(['/datasets/new/' + activityId]);
|
|
|
|
}
|
|
|
|
|
|
|
|
newVersion(id: String, label: String) {
|
|
|
|
this.router.navigate(['/plans/new_version/' + id, { dmpLabel: label }]);
|
|
|
|
}
|
|
|
|
|
|
|
|
viewVersions(rowId: String, rowLabel: String, activity: DmpListingModel) {
|
|
|
|
if (activity.public && !this.isUserOwner) {
|
|
|
|
this.router.navigate(['/explore-plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
|
|
|
} else {
|
|
|
|
this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-02 18:34:27 +02:00
|
|
|
openDmpSearchDialogue(dataset: RecentDatasetModel) {
|
|
|
|
const formControl = new FormControl();
|
|
|
|
const dialogRef = this.dialog.open(DatasetCopyDialogueComponent, {
|
|
|
|
width: '500px',
|
|
|
|
restoreFocus: false,
|
|
|
|
data: {
|
|
|
|
formControl: formControl,
|
|
|
|
datasetId: dataset.id,
|
|
|
|
datasetProfileId: dataset.profile,
|
|
|
|
datasetProfileExist: false,
|
|
|
|
confirmButton: this.language.instant('DATASET-WIZARD.DIALOGUE.COPY'),
|
|
|
|
cancelButton: this.language.instant('DATASET-WIZARD.DIALOGUE.CANCEL')
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(result => {
|
|
|
|
if (result && result.datasetProfileExist) {
|
|
|
|
const newDmpId = result.formControl.value.id
|
|
|
|
this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
openConfirm(id: string): void {
|
|
|
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
|
|
maxWidth: '300px',
|
|
|
|
restoreFocus: false,
|
|
|
|
data: {
|
|
|
|
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
|
|
|
|
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
|
|
|
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
|
|
|
isDeleteConfirmation: true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
if (result) {
|
|
|
|
this.datasetWizardService.delete(id)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(
|
|
|
|
complete => this.onCallbackSuccess(),
|
|
|
|
// error => this.onCallbackError(error)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-07-10 15:52:35 +02:00
|
|
|
refresh(): void {
|
|
|
|
const fields: Array<string> = ["-modified"];
|
|
|
|
this.startIndex = 0;
|
2020-07-10 16:07:03 +02:00
|
|
|
const allDataTableRequest: DataTableRequest<RecentActivityCriteria> = new DataTableRequest(0, this.pageSize, { fields: fields });
|
2020-07-10 15:52:35 +02:00
|
|
|
allDataTableRequest.criteria = new RecentActivityCriteria();
|
|
|
|
allDataTableRequest.criteria.like = this.formGroup.get("like").value;
|
|
|
|
this.dashboardService
|
|
|
|
.getRecentActivity(allDataTableRequest)
|
|
|
|
.subscribe(response => {
|
|
|
|
this.allRecentActivities = response;
|
|
|
|
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-07-02 18:34:27 +02:00
|
|
|
public loadMore() {
|
2020-07-10 15:52:35 +02:00
|
|
|
this.startIndex = this.startIndex + this.pageSize;
|
2020-07-02 18:34:27 +02:00
|
|
|
const fields: Array<string> = ["-modified"];
|
|
|
|
const request = new DataTableRequest<RecentActivityCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
|
|
|
request.criteria = new RecentActivityCriteria();
|
2020-07-10 15:52:35 +02:00
|
|
|
request.criteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
|
2020-07-02 18:34:27 +02:00
|
|
|
|
2020-07-03 13:00:23 +02:00
|
|
|
this.dashboardService.getRecentActivity(request).pipe(takeUntil(this._destroyed)).subscribe(result => {
|
2020-07-02 18:34:27 +02:00
|
|
|
if (!result) { return []; }
|
2020-07-03 09:47:04 +02:00
|
|
|
this.allRecentActivities = this.allRecentActivities.concat(result);
|
2020-07-10 15:52:35 +02:00
|
|
|
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
|
2020-07-02 18:34:27 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-09-25 11:44:22 +02:00
|
|
|
// advancedClicked(dmp: DmpListingModel) {
|
|
|
|
// const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
|
|
|
|
// maxWidth: '500px',
|
|
|
|
// data: {
|
|
|
|
// message: "Download as:",
|
|
|
|
// XMLButton: "XML",
|
|
|
|
// documentButton: "Document",
|
|
|
|
// pdfButton: "PDF",
|
|
|
|
// jsonButton: "JSON"
|
|
|
|
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
// if (result == "pdf") {
|
|
|
|
// this.downloadPDF(dmp.id);
|
|
|
|
// } else if (result == "xml") {
|
|
|
|
// this.downloadXml(dmp.id);
|
|
|
|
// } else if (result == "doc") {
|
|
|
|
// this.downloadDocx(dmp.id);
|
|
|
|
// } else if (result == "json") {
|
|
|
|
// this.downloadJson(dmp.id)
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }
|
2019-04-24 11:26:53 +02:00
|
|
|
}
|