Merge remote-tracking branch 'origin/ui-redesign' into ui-redesign

This commit is contained in:
George Kalampokis 2020-08-03 17:01:27 +03:00
commit 58b193ff20
8 changed files with 61 additions and 60 deletions

View File

@ -23,7 +23,8 @@
<div *ngFor="let activity of allRecentActivities"> <div *ngFor="let activity of allRecentActivities">
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dmp.valueOf()"> <div *ngIf="activity && activity.type === recentActivityTypeEnum.Dmp.valueOf()">
<div class="dmp-card"> <div class="dmp-card">
<a (click)="goToDMPOverview(activity.id)" class="pointer"> <!-- <a (click)="redirect(activity.id, activity.type)" class="pointer"> -->
<a [routerLink]="navigateToUrl(activity.id, activity.type)" class="pointer">
<div class="d-flex flex-direction-row"> <div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div> <div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div *ngIf="!publicMode" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modified | date: "longDate" }}</div> <div *ngIf="!publicMode" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modified | date: "longDate" }}</div>
@ -49,7 +50,8 @@
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.label}}</div> <div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.label}}</div>
</div> </div>
</div> </div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="getDatasets(activity).length > 3" (click)="goToDMPOverview(activity.id)"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a> <!-- <a class="d-flex justify-content-center pb-3 show-more" *ngIf="getDatasets(activity).length > 3" (click)="redirect(activity.id, activity.type)"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a> -->
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="getDatasets(activity).length > 3" [routerLink]="navigateToUrl(activity.id, activity.type)"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</a> </a>
<div class="dmp-card-actions"> <div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a> <a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
@ -92,7 +94,8 @@
</div> </div>
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dataset.valueOf()"> <div *ngIf="activity && activity.type === recentActivityTypeEnum.Dataset.valueOf()">
<div class="dataset-card"> <div class="dataset-card">
<a (click)="goToDatasetOverview(activity.id)" class="pointer"> <!-- <a (click)="redirect(activity.id, activity.type)" class="pointer"> -->
<a [routerLink]="navigateToUrl(activity.id, activity.type)" class="pointer">
<div class="d-flex flex-direction-row"> <div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div> <div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div *ngIf="!publicMode" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div> <div *ngIf="!publicMode" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div>

View File

@ -264,11 +264,19 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
return; return;
} }
case RecentActivityType.Dataset: { case RecentActivityType.Dataset: {
this.router.navigate(["datasets/edit/" + id]); if (this.isAuthenticated()) {
this.router.navigate(['../datasets/overview/' + id]);
} else {
this.router.navigate(['../explore/publicOverview', id]);
}
return; return;
} }
case RecentActivityType.Dmp: { case RecentActivityType.Dmp: {
this.router.navigate(["plans/overview/" + id]); if (this.isAuthenticated()) {
this.router.navigate(['../plans/overview/' + id]);
} else {
this.router.navigate(['../explore-plans/publicOverview', id]);
}
return; return;
} }
default: default:
@ -276,9 +284,29 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
} }
} }
// navigateToUrl() { navigateToUrl(id: string, type: RecentActivityType): string[] {
// this.router.navigate(["plans/"]); switch (type) {
// } case RecentActivityType.Grant: {
return ["grants/edit/" + id];
}
case RecentActivityType.Dataset: {
if (this.isAuthenticated()) {
return ['../datasets/overview/' + id];
} else {
return ['../explore/publicOverview', id];
}
}
case RecentActivityType.Dmp: {
if (this.isAuthenticated()) {
return ['../plans/overview/' + id];
} else {
return ['../explore-plans/publicOverview', id];
}
}
default:
throw new Error("Unsupported Activity Type ");
}
}
roleDisplay(value: any) { roleDisplay(value: any) {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
@ -492,22 +520,6 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
}); });
} }
goToDMPOverview(id: string) {
if (this.isAuthenticated()) {
this.router.navigate(['../plans/overview/' + id]);
} else {
this.router.navigate(['../explore-plans/publicOverview', id]);
}
}
goToDatasetOverview(id: string) {
if (this.isAuthenticated()) {
this.router.navigate(['../datasets/overview/' + id]);
} else {
this.router.navigate(['../explore/publicOverview', id]);
}
}
refresh(): void { refresh(): void {
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value]; const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
// const fields: Array<string> = ["-modified"]; // const fields: Array<string> = ["-modified"];

View File

@ -22,7 +22,7 @@
</div> </div>
<div *ngFor="let activity of datasetActivities"> <div *ngFor="let activity of datasetActivities">
<div class="dataset-card"> <div class="dataset-card">
<a (click)="goToOverview(activity.id)" class="pointer"> <a [routerLink]="goToOverview(activity.id)" class="pointer">
<div class="d-flex flex-direction-row"> <div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div> <div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div *ngIf="!publicMode" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div> <div *ngIf="!publicMode" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div>

View File

@ -159,11 +159,11 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id; if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
} }
goToOverview(id: string) { goToOverview(id: string): string[] {
if (this.isAuthenticated()) { if (this.isAuthenticated()) {
this.router.navigate(['../datasets/overview/' + id]); return ['../datasets/overview/' + id];
} else { } else {
this.router.navigate(['../explore/publicOverview', id]); return ['../explore/publicOverview', id];
} }
} }

View File

@ -22,7 +22,7 @@
</div> </div>
<div *ngFor="let activity of dmpActivities"> <div *ngFor="let activity of dmpActivities">
<div class="dmp-card"> <div class="dmp-card">
<a (click)="goToOverview(activity.id)" class="pointer"> <a [routerLink]="navigateToUrl(activity.id)" class="pointer">
<div class="d-flex flex-direction-row"> <div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div> <div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div *ngIf="!publicMode" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modifiedTime | date: "longDate" }}</div> <div *ngIf="!publicMode" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modifiedTime | date: "longDate" }}</div>
@ -48,7 +48,7 @@
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.label}}</div> <div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.label}}</div>
</div> </div>
</div> </div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="activity.datasets.length > 3" (click)="goToOverview(activity.id)"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a> <a class="d-flex justify-content-center pb-3 show-more" *ngIf="activity.datasets.length > 3" [routerLink]="navigateToUrl(activity.id)"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</a> </a>
<div class="dmp-card-actions"> <div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a> <a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>

View File

@ -95,7 +95,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
.subscribe(x => this.refresh()); .subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh()); .subscribe(x => this.refresh());
// const datasetDataTableRequest: DataTableRequest<DatasetCriteria> = new DataTableRequest(0, 5, { fields: fields }); // const datasetDataTableRequest: DataTableRequest<DatasetCriteria> = new DataTableRequest(0, 5, { fields: fields });
// datasetDataTableRequest.criteria = new DatasetCriteria(); // datasetDataTableRequest.criteria = new DatasetCriteria();
// datasetDataTableRequest.criteria.like = ""; // datasetDataTableRequest.criteria.like = "";
@ -173,14 +173,6 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
}); });
} }
goToOverview(id: string) {
if (this.isAuthenticated()) {
this.router.navigate(['../plans/overview/' + id]);
} else {
this.router.navigate(['../explore-plans/publicOverview', id]);
}
}
openDeleteDialog(id: string) { openDeleteDialog(id: string) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, { const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px', maxWidth: '300px',
@ -251,28 +243,21 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error); this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
} }
redirect(id: string, type: RecentActivityType) { redirect(id: string) {
switch (type) { if (this.isAuthenticated()) {
case RecentActivityType.Grant: { this.router.navigate(['../plans/overview/' + id]);
this.router.navigate(["grants/edit/" + id]); } else {
return; this.router.navigate(['../explore-plans/publicOverview', id]);
}
case RecentActivityType.Dataset: {
this.router.navigate(["datasets/edit/" + id]);
return;
}
case RecentActivityType.Dmp: {
this.router.navigate(["plans/overview/" + id]);
return;
}
default:
throw new Error("Unsupported Activity Type ");
} }
} }
// navigateToUrl() { navigateToUrl(id: string): string[] {
// this.router.navigate(["plans/"]); if (this.isAuthenticated()) {
// } return ['../plans/overview/' + id];
} else {
return ['../explore-plans/publicOverview', id];
}
}
roleDisplay(value: any) { roleDisplay(value: any) {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();

View File

@ -1,5 +1,5 @@
<div class="dataset-card"> <div class="dataset-card">
<a [routerLink]="isPublic ? ['/datasets/publicOverview/' + dataset.id] : ['/datasets/overview/' + dataset.id]" class="pointer"> <a [routerLink]="getItemLink()" class="pointer">
<div class="d-flex flex-direction-row"> <div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div> <div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{dataset.modified | date:"longDate"}}</div> <div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{dataset.modified | date:"longDate"}}</div>

View File

@ -78,7 +78,8 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
} }
getItemLink(): string[] { getItemLink(): string[] {
return this.isPublic ? [`/datasets/publicEdit/${this.dataset.id}`] : [`/datasets/edit/${this.dataset.id}`]; // return this.isPublic ? [`/datasets/publicEdit/${this.dataset.id}`] : [`/datasets/edit/${this.dataset.id}`];
return this.isPublic ? ['/datasets/publicOverview/' + this.dataset.id] : ['/datasets/overview/' + this.dataset.id];
} }
getDmpLink(): string[] { getDmpLink(): string[] {