2018-03-21 14:15:06 +01:00
|
|
|
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
|
|
|
|
import { UserErrorModel } from '../../models/users/UserErrorModel';
|
|
|
|
import { UserReferenceService } from '../../services/user-reference/user-reference-data.service';
|
|
|
|
import { UserListingModel } from '../../models/users/UserListingModel';
|
|
|
|
import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
|
|
|
|
import { UserCriteria } from '../../models/criteria/users/UserCriteria';
|
|
|
|
import { UserCriteriaErrorModel } from '../../models/criteria/users/UserCriteriaErrorModel';
|
|
|
|
import { Observable } from 'rxjs/Rx';
|
|
|
|
import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
|
|
|
|
import { UsersCriteriaComponent } from '../../shared/components/criteria/users/users-criteria.component';
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
import { Principal } from '../../models/login/Principal';
|
|
|
|
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
|
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
|
|
import { DataSource } from '@angular/cdk/table';
|
2018-05-14 08:44:35 +02:00
|
|
|
import { RecentActivityTypes } from '../../users/activity/RecentActivityTypes';
|
2018-03-21 14:15:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-recent-activity',
|
|
|
|
templateUrl: './recent-activity.component.html',
|
|
|
|
styleUrls: ['./recent-activity.component.scss'],
|
|
|
|
providers: [
|
|
|
|
UserReferenceService
|
|
|
|
]
|
|
|
|
})
|
|
|
|
export class RecentActivityComponent implements OnInit {
|
2018-05-14 08:44:35 +02:00
|
|
|
|
2018-03-21 14:15:06 +01:00
|
|
|
activities: any[];
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private router: Router,
|
|
|
|
private userReferenceService: UserReferenceService
|
|
|
|
) { }
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.userReferenceService.getRecentActivity().subscribe(response => {
|
|
|
|
this.activities = response["recentActivities"];
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
redirect(id: string, type: RecentActivityTypes) {
|
|
|
|
switch (type) {
|
|
|
|
case RecentActivityTypes.PROJECT: {
|
|
|
|
this.router.navigate(["projects/edit/" + id]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case RecentActivityTypes.DATASET: {
|
|
|
|
this.router.navigate(["datasets/edit/" + id]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case RecentActivityTypes.DMP: {
|
|
|
|
this.router.navigate(["dmps/edit/" + id]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
default: throw new Error("Unsupported Activity Type ")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|