Adds public home page: /home

This commit is contained in:
apapachristou 2020-08-03 11:40:38 +03:00
parent 3baf20f4ec
commit fd84ed317c
20 changed files with 837 additions and 535 deletions

View File

@ -1,9 +1,6 @@
<div class="main-content dashboard-main-container h-100" [class.non-auth-main-container]="!this.isAuthenticated()">
<div *ngIf="this.isAuthenticated()" class="container-fluid">
<div *ngIf="dashboardStatisticsData?.totalDataManagementPlanCount === 0
&& dashboardStatisticsData?.totalDataSetCount === 0
&& dashboardStatisticsData?.totalGrantCount === 0
&& dashboardStatisticsData?.totalOrganisationCount === 0">
<div *ngIf="!this.hasDmps()">
<div class="main-content">
<div class="col-auto">
<div class="card" [style.display]="isVisible ? 'block' : 'none'">
@ -32,10 +29,7 @@
</div>
</div>
</div>
<div *ngIf="dashboardStatisticsData?.totalDataManagementPlanCount !== 0
|| dashboardStatisticsData?.totalDataSetCount !== 0
|| dashboardStatisticsData?.totalGrantCount !== 0
|| dashboardStatisticsData?.totalOrganisationCount !== 0">
<div *ngIf="this.hasDmps()">
<div class="main-content">
<div class="col">
<div class="card col-auto mt-0" [style.display]="isVisible ? 'block' : 'none'">
@ -92,15 +86,87 @@
</div>
</div>
<!-- Home screen on log out -->
<div class="col p-0" *ngIf="!this.isAuthenticated()">
<div class="col-auto">
<div class="row">
<div class="col header-text-container">
<h3>{{ 'ABOUT.WELCOME' | translate }}</h3>
<h4>{{ 'ABOUT.WELCOME-MESSAGE' | translate }}</h4>
</div>
</div>
<div class="main-content">
<div class="col">
<div class="row">
<div class="col d-flex flex-column">
<div class="card non-auth-card" [style.display]="isVisible ? 'block' : 'none'">
<a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a>
<div class="d-flex flex-column align-items-center non-auth-title-container">
<h4 class="pt-4">{{'DASHBOARD.TITLE' | translate}}</h4>
<p class="col-auto app-info">{{'DASHBOARD.INFO-TEXT' | translate}}</p>
</div>
</div>
<div *ngIf="hasDmps()" class="col activity">
<div class="latest-activity-title">{{'DASHBOARD.LATEST-ACTIVITY' | translate}}</div>
<mat-tab-group mat-align-tabs="start" class="remove-border-bottom">
<mat-tab label="{{'DASHBOARD.ALL' | translate}} ({{totalRecents}})">
<app-recent-edited-activity (totalCountRecentEdited)="onCountAllRecent($event)"></app-recent-edited-activity>
<div *ngIf="totalRecents === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
</mat-tab>
<mat-tab label="{{'DASHBOARD.PUBLIC-DMPS' | translate}} ({{totalDmps}})">
<app-recent-edited-dmp-activity (totalCountDmps)="onCountDmps($event)"></app-recent-edited-dmp-activity>
<div *ngIf="totalDmps === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
</mat-tab>
<mat-tab label="{{'DASHBOARD.PUBLIC-DATASETS' | translate}} ({{totalDatasets}})">
<app-recent-edited-dataset-activity (totalCountDatasets)="onCountDatasets($event)"></app-recent-edited-dataset-activity>
<div *ngIf="totalDatasets === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
<!-- <div *ngIf="totalDatasets === 0" class="col-auto d-flex justify-content-center">
<button mat-raised-button class="add-dataset" [routerLink]="['/datasets/new']">
<mat-icon>add</mat-icon> {{'DASHBOARD.ACTIONS.ADD-DATASET' | translate}}
</button>
</div> -->
</mat-tab>
</mat-tab-group>
</div>
</div>
<div class="col-auto">
<div *ngIf="!hasDmps()" class="ml-auto pl-4 personal-usage-block">
<div class="personal-usage">{{'DASHBOARD.PERSONAL-USAGE' | translate}}</div>
<div class="counter-zero">0</div>
<a>{{'DASHBOARD.PUBLIC-DMPS' | translate}}</a>
<div class="counter-zero">0</div>
<a>{{'DASHBOARD.PUBLIC-DATASETS' | translate}}</a>
<div class="counter-zero">0</div>
<a class="link-disabled">{{'DASHBOARD.GRANTS' | translate}}</a>
<div class="counter-zero">0</div>
<a class="link-disabled">{{'DASHBOARD.RELATED-ORGANISATIONS' | translate}}</a>
</div>
<div *ngIf="hasDmps()" class="ml-auto stats">
<div class="personal-usage">{{'DASHBOARD.PERSONAL-USAGE' | translate}}</div>
<div [ngClass]="{'counter': dashboardStatisticsData?.totalDataManagementPlanCount != 0, 'counter-zero': dashboardStatisticsData?.totalDataManagementPlanCount == 0}">
{{dashboardStatisticsData?.totalDataManagementPlanCount}}</div>
<a [routerLink]="['/plans']" class="link">{{'DASHBOARD.PUBLIC-DMPS' | translate}}</a>
<div [ngClass]="{'counter': dashboardStatisticsData?.totalDataSetCount != 0, 'counter-zero': dashboardStatisticsData?.totalDataSetCount == 0}">
{{dashboardStatisticsData?.totalDataSetCount}}</div>
<a [routerLink]="['/datasets']" class="link">{{'DASHBOARD.PUBLIC-DATASETS' | translate}}</a>
<div [ngClass]="{'counter': dashboardStatisticsData?.totalGrantCount != 0, 'counter-zero': dashboardStatisticsData?.totalGrantCount == 0}">
{{dashboardStatisticsData?.totalGrantCount}}</div>
<a href="#" class="link-disabled">{{'DASHBOARD.GRANTS' | translate}}</a>
<div [ngClass]="{'counter': dashboardStatisticsData?.totalOrganisationCount != 0, 'counter-zero': dashboardStatisticsData?.totalOrganisationCount == 0}">
{{dashboardStatisticsData?.totalOrganisationCount}}</div>
<a href="#" class="link-disabled">{{'DASHBOARD.RELATED-ORGANISATIONS' | translate}}</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="header-image">
<div class="header-text-container">
<h3>{{ 'ABOUT.WELCOME' | translate }}</h3>

View File

@ -3,6 +3,7 @@
padding-top: 4.68rem;
padding-bottom: 3rem;
// padding-left: 3.31rem;
// padding-left: 0rem;
padding-left: 1rem;
margin: 0;
display: flex;
@ -15,7 +16,10 @@
border-radius: 4px;
max-width: 712px;
min-width: 17.5rem;
margin-top: 0rem;
margin-bottom: 3.75rem;
// margin-left: 3rem;
// min-height: 40vh;
/* height: 407px; */
opacity: 1;
}
@ -107,7 +111,7 @@
letter-spacing: 0px;
color: #212121;
opacity: 0.85;
padding-top: 2rem;
padding-top: 2.5rem;
padding-bottom: 0.5rem;
}
@ -143,6 +147,10 @@
padding-bottom: 1.2rem;
}
.activity {
padding-left: 3rem;
}
.dmp-card,
.dataset-card {
min-width: 712px;
@ -333,6 +341,33 @@ input[type="text"] {
margin-bottom: 1.5rem;
}
.header-text-container {
background: linear-gradient(90deg, rgba(2, 0, 36, 1) 0%, rgba(35, 188, 186, 1) 100%, rgba(0, 212, 255, 1) 100%);
color: white;
height: fit-content;
padding-left: 5.8em;
padding-right: 10em;
padding-top: 2em;
padding-bottom: 2em;
}
.personal-usage-block {
padding: 0rem 7em 0rem 3rem;
}
.non-auth-main-container {
padding-left: 0;
}
.non-auth-card {
margin-left: 3rem;
}
.app-info {
font-size: 1rem;
padding: 1rem 2rem;
}
::ng-deep .mat-tab-group.mat-primary .mat-ink-bar,
.mat-tab-nav-bar.mat-primary .mat-ink-bar {
background: #129d99;
@ -350,6 +385,15 @@ input[type="text"] {
font-weight: 700;
}
::ng-deep .mat-form-field-wrapper {
background-color: white !important;
padding-bottom: 0 !important;
}
::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {
padding: 0.3rem 0rem 0.6rem 0rem !important;
}
/* ::ng-deep .mat-tab-group {
height: 100%;
}

View File

@ -82,7 +82,6 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC
ngOnInit() {
// if (this.isAuthenticated()) {
// this.userService.getRecentActivity()
// .pipe(takeUntil(this._destroyed))
@ -111,8 +110,8 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC
//let data = results['payload'];
this.dashboardStatisticsData = results;
});
this.getPublicDmps();
this.getPublicDatasets();
// this.getPublicDmps();
// this.getPublicDatasets();
} else {
this.dashboardService.getUserStatistics()
.pipe(takeUntil(this._destroyed))
@ -224,6 +223,17 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC
}
}
public hasDmps(): boolean {
if (this.dashboardStatisticsData) {
return this.dashboardStatisticsData.totalDataManagementPlanCount !== 0
|| this.dashboardStatisticsData.totalDataSetCount !== 0
|| this.dashboardStatisticsData.totalGrantCount !== 0
|| this.dashboardStatisticsData.totalOrganisationCount !== 0;
} else {
return false;
}
}
// viewAllPublicDmpsClicked() {
// this.router.navigate(['/explore-plans']);
// }

View File

@ -4,9 +4,10 @@
<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
<mat-form-field appearance="outline" class="sort-form col-auto">
<mat-select placeholder="{{'CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')">
<mat-option [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="publicMode" [value]="order.PUBLISHED">{{enumUtils.toRecentActivityOrderString(order.PUBLISHED)}}</mat-option>
<mat-option [value]="order.LABEL">{{enumUtils.toRecentActivityOrderString(order.LABEL)}}</mat-option>
<mat-option [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option [value]="order.CREATED">{{enumUtils.toRecentActivityOrderString(order.CREATED)}}</mat-option>
</mat-select>
</mat-form-field>
@ -22,10 +23,11 @@
<div *ngFor="let activity of allRecentActivities">
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dmp.valueOf()">
<div class="dmp-card">
<a [routerLink]="['../plans/overview/' + activity.id]" class="pointer">
<a (click)="goToDMPOverview(activity.id)" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div 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>
<div *ngIf="publicMode" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.PUBLISHED' | translate }}: {{ activity.publishedAt | date: "longDate" }}</div>
</div>
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{activity.title}}</div>
<div class="dmp-subtitle">
@ -47,7 +49,7 @@
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.label}}</div>
</div>
</div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="getDatasets(activity).length > 3" [routerLink]="['../plans/overview/' + 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)="goToDMPOverview(activity.id)"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</a>
<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>
@ -90,10 +92,11 @@
</div>
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dataset.valueOf()">
<div class="dataset-card">
<a [routerLink]="['../datasets/overview/' + activity.id]" class="pointer">
<a (click)="goToDatasetOverview(activity.id)" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div 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>
<div *ngIf="publicMode" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.PUBLISHED' | translate}}: {{activity.publishedAt | date:"longDate"}}</div>
</div>
<div class="col-auto dataset-title">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}: {{activity.title}}</div>
<div class="dataset-subtitle">

View File

@ -54,6 +54,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
like: new FormControl(),
order: new FormControl()
});
publicMode = false;
order = RecentActivityOrder;
@ -77,7 +78,6 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
if (this.isAuthenticated()) {
this.formGroup.get('order').setValue(this.order.MODIFIED);
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 allDataTableRequest: DataTableMultiTypeRequest<RecentActivityCriteria> = new DataTableMultiTypeRequest(0, 0, 5, { fields: fields });
allDataTableRequest.criteria = new RecentActivityCriteria();
allDataTableRequest.criteria.like = "";
@ -101,6 +101,29 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh());
} else {
this.publicMode = true;
this.formGroup.get('order').setValue(this.order.PUBLISHED);
const allDataTableRequest = this.setPublicDataTableRequest();
this.dashboardService
.getRecentActivity(allDataTableRequest)
.subscribe(response => {
this.allRecentActivities = response;
this.allRecentActivities.forEach(recentActivity => {
if (recentActivity.type === RecentActivityType.Dataset) {
this.datasetOffset = this.datasetOffset + 1;
} else if (recentActivity.type === RecentActivityType.Dmp) {
this.dmpOffset = this.dmpOffset + 1;
}
});
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh());
}
}
@ -120,6 +143,17 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
return activity.dmpId;
}
private setPublicDataTableRequest(fields?: Array<string>): DataTableMultiTypeRequest<RecentActivityCriteria> {
const criteria = new RecentActivityCriteria();
criteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
if (!fields) {
fields = new Array<string>('-publishedAt');
}
const dataTableRequest: DataTableMultiTypeRequest<RecentActivityCriteria> = new DataTableMultiTypeRequest(this.dmpOffset, this.datasetOffset, this.pageSize, { fields: fields });
dataTableRequest.criteria = criteria;
return dataTableRequest;
}
// getPublic(activity: RecentDmpModel): boolean {
// return activity.isPublic;
// }
@ -457,6 +491,22 @@ 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 {
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"];
@ -547,6 +597,14 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
merged[current] = arr2[index2];
index2++;
}
} else if (order === "publishedAt") {
if (!isArr1Depleted && (isArr2Depleted || (new Date(arr1[index1].publishedAt) > new Date(arr2[index2].publishedAt)))) {
merged[current] = arr1[index1];
index1++;
} else {
merged[current] = arr2[index2];
index2++;
}
}
current++;
}

View File

@ -4,9 +4,10 @@
<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
<mat-form-field appearance="outline" class="sort-form col-auto">
<mat-select placeholder="{{'CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')">
<mat-option [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="publicMode" [value]="order.DATASETPUBLISHED">{{enumUtils.toRecentActivityOrderString(order.DATASETPUBLISHED)}}</mat-option>
<mat-option [value]="order.LABEL">{{enumUtils.toRecentActivityOrderString(order.LABEL)}}</mat-option>
<mat-option [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option [value]="order.CREATED">{{enumUtils.toRecentActivityOrderString(order.CREATED)}}</mat-option>
</mat-select>
</mat-form-field>
@ -21,10 +22,11 @@
</div>
<div *ngFor="let activity of datasetActivities">
<div class="dataset-card">
<a [routerLink]="['../datasets/overview/' + activity.id]" class="pointer">
<a (click)="goToOverview(activity.id)" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div 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>
<div *ngIf="publicMode" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.PUBLISHED' | translate}}: {{activity.dmpPublishedAt | date:"longDate"}}</div>
</div>
<div class="col-auto dataset-title">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}: {{activity.label}}</div>
<div class="dataset-subtitle">

View File

@ -43,7 +43,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
like: new FormControl(),
order: new FormControl()
});
// publicMode = false;
publicMode = false;
order = RecentActivityOrder;
@ -77,6 +77,21 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
this.totalCount = response.totalCount;
this.totalCountDatasets.emit(this.datasetActivities.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh());
} else {
this.publicMode = true;
this.formGroup.get('order').setValue(this.order.DATASETPUBLISHED);
const dataTableRequest = this.setPublicDataTableRequest();
this.datasetService.getPaged(dataTableRequest).pipe(takeUntil(this._destroyed)).subscribe(response => {
this.datasetActivities = response.data;
this.totalCount = response.totalCount;
this.totalCountDatasets.emit(this.datasetActivities.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh());
@ -86,13 +101,28 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
}
}
setPublicDataTableRequest(fields?: Array<string>): DataTableRequest<DatasetCriteria> {
const datasetCriteria = new DatasetCriteria();
datasetCriteria.allVersions = false;
datasetCriteria.isPublic = true;
datasetCriteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
if (!fields) {
fields = new Array<string>('-dmp:publishedAt|join|');
}
const dataTableRequest: DataTableRequest<DatasetCriteria> = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields });
dataTableRequest.criteria = datasetCriteria;
return dataTableRequest;
}
refresh(): void {
// const fields: Array<string> = ["-modified"];
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
this.startIndex = 0;
const datasetDataTableRequest: DataTableRequest<DatasetCriteria> = new DataTableRequest(0, this.pageSize, { fields: fields });
datasetDataTableRequest.criteria = new DatasetCriteria();
datasetDataTableRequest.criteria.like = this.formGroup.get("like").value;
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
const datasetDataTableRequest = this.isAuthenticated() ? new DataTableRequest<DatasetCriteria>(this.startIndex, this.pageSize, { fields: fields }) : this.setPublicDataTableRequest(fields);
if (this.isAuthenticated()) {
datasetDataTableRequest.criteria = new DatasetCriteria();
datasetDataTableRequest.criteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
}
this.datasetService
.getPaged(datasetDataTableRequest)
.subscribe(response => {
@ -104,12 +134,13 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
public loadMore() {
this.startIndex = this.startIndex + this.pageSize;
// const fields: Array<string> = ["-modified"];
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
const request = new DataTableRequest<DatasetCriteria>(this.startIndex, this.pageSize, { fields: fields });
request.criteria = new DatasetCriteria();
request.criteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
const request = this.isAuthenticated() ? new DataTableRequest<DatasetCriteria>(this.startIndex, this.pageSize, { fields: fields }) : this.setPublicDataTableRequest(fields);
if (this.isAuthenticated()) {
request.criteria = new DatasetCriteria();
request.criteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
}
this.datasetService.getPaged(request).pipe(takeUntil(this._destroyed)).subscribe(result => {
if (!result) { return []; }
@ -128,6 +159,14 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
}
goToOverview(id: string) {
if (this.isAuthenticated()) {
this.router.navigate(['../datasets/overview/' + id]);
} else {
this.router.navigate(['../explore/publicOverview', id]);
}
}
roleDisplay(value: any) {
const principal: Principal = this.authentication.current();
let role: number;
@ -168,8 +207,8 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
.subscribe(result => {
if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id;
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId } ]);
window.open(url.toString(), '_blank');
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId }]);
window.open(url.toString(), '_blank');
}
});
}
@ -345,10 +384,8 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
let current = 0;
while (current < (arr1.length + arr2.length)) {
let isArr1Depleted = index1 >= arr1.length;
let isArr2Depleted = index2 >= arr2.length;
if (order === 'modified') {
if (!isArr1Depleted && (isArr2Depleted || (new Date(arr1[index1].modified) > new Date(arr2[index2].modified)))) {
merged[current] = arr1[index1];
@ -381,6 +418,14 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
merged[current] = arr2[index2];
index2++;
}
} else if (order === 'dmp:publishedAt|join|') {
if (!isArr1Depleted && (isArr2Depleted || (new Date(arr1[index1].dmpPublishedAt) > new Date(arr2[index2].dmpPublishedAt)))) {
merged[current] = arr1[index1];
index1++;
} else {
merged[current] = arr2[index2];
index2++;
}
}
current++;
}

View File

@ -4,9 +4,10 @@
<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
<mat-form-field appearance="outline" class="sort-form col-auto">
<mat-select placeholder="{{'CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')">
<mat-option [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="publicMode" [value]="order.PUBLISHED">{{enumUtils.toRecentActivityOrderString(order.PUBLISHED)}}</mat-option>
<mat-option [value]="order.LABEL">{{enumUtils.toRecentActivityOrderString(order.LABEL)}}</mat-option>
<mat-option [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option [value]="order.CREATED">{{enumUtils.toRecentActivityOrderString(order.CREATED)}}</mat-option>
</mat-select>
</mat-form-field>
@ -21,10 +22,11 @@
</div>
<div *ngFor="let activity of dmpActivities">
<div class="dmp-card">
<a [routerLink]="['../plans/overview/' + activity.id]" class="pointer">
<a (click)="goToOverview(activity.id)" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div 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>
<div *ngIf="publicMode" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.PUBLISHED' | translate }}: {{ activity.publishedAt | date: "longDate" }}</div>
</div>
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{activity.label}}</div>
<div class="dmp-subtitle">
@ -46,7 +48,7 @@
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.label}}</div>
</div>
</div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="activity.datasets.length > 3" [routerLink]="['../plans/overview/' + 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" (click)="goToOverview(activity.id)"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</a>
<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>

View File

@ -24,6 +24,7 @@ import { FormBuilder, FormControl } from '@angular/forms';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Location } from '@angular/common';
import { LockService } from '@app/core/services/lock/lock.service';
import { ExploreDmpCriteriaModel } from '@app/core/query/explore-dmp/explore-dmp-criteria';
@Component({
selector: 'app-recent-edited-dmp-activity',
@ -46,6 +47,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
like: new FormControl(),
order: new FormControl()
});
publicMode = false;
order = RecentActivityOrder;
@ -93,8 +95,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh());
.subscribe(x => this.refresh());
// const datasetDataTableRequest: DataTableRequest<DatasetCriteria> = new DataTableRequest(0, 5, { fields: fields });
// datasetDataTableRequest.criteria = new DatasetCriteria();
// datasetDataTableRequest.criteria.like = "";
@ -110,6 +111,22 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
// this.allRecentActivities.push(recentActivity)
// })
// });
} else {
this.publicMode = true;
this.formGroup.get('order').setValue(this.order.PUBLISHED);
const dataTableRequest = this.setPublicDataTableRequest();
this.dmpService.getPaged(dataTableRequest, "listing").pipe(takeUntil(this._destroyed)).subscribe(response => {
if (!response) { return []; }
this.dmpActivities = response.data;
this.totalCount = response.totalCount;
this.totalCountDmps.emit(this.dmpActivities.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.refresh());
}
}
@ -117,6 +134,20 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
return !!this.authentication.current();
}
private setPublicDataTableRequest(fields?: Array<string>): DataTableRequest<DmpCriteria> {
const dmpCriteria = new DmpCriteria();
dmpCriteria.allVersions = false;
dmpCriteria.isPublic = true;
dmpCriteria.onlyPublic = true;
dmpCriteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
if (!fields) {
fields = new Array<string>('-publishedAt');
}
const dataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields });
dataTableRequest.criteria = dmpCriteria;
return dataTableRequest;
}
isUserOwner(activity: DmpListingModel): boolean {
const principal: Principal = this.authentication.current();
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
@ -142,6 +173,14 @@ 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) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
@ -344,12 +383,13 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
}
refresh(): void {
// const fields: Array<string> = ["-modified"];
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
this.startIndex = 0;
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields });
dmpDataTableRequest.criteria = new DmpCriteria();
dmpDataTableRequest.criteria.like = this.formGroup.get("like").value;
const dmpDataTableRequest = this.isAuthenticated() ? new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields }) : this.setPublicDataTableRequest(fields);
if (this.isAuthenticated()) {
dmpDataTableRequest.criteria = new DmpCriteria();
dmpDataTableRequest.criteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
}
this.dmpService
.getPaged(dmpDataTableRequest, "listing")
.subscribe(response => {
@ -361,12 +401,13 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
public loadMore() {
this.startIndex = this.startIndex + this.pageSize;
// const fields: Array<string> = ["-modified"];
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
const request = new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields });
request.criteria = new DmpCriteria();
request.criteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
const request = this.isAuthenticated() ? new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields }) : this.setPublicDataTableRequest(fields);
if (this.isAuthenticated()) {
request.criteria = new DmpCriteria();
request.criteria.like = this.formGroup.get("like").value ? this.formGroup.get("like").value : "";
}
this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => {
if (!result) { return []; }
@ -420,6 +461,14 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
merged[current] = arr2[index2];
index2++;
}
} else if (order === "publishedAt") {
if (!isArr1Depleted && (isArr2Depleted || (new Date(arr1[index1].publishedAt) > new Date(arr2[index2].publishedAt)))) {
merged[current] = arr1[index1];
index1++;
} else {
merged[current] = arr2[index2];
index2++;
}
}
current++;
}

View File

@ -27,9 +27,10 @@
<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
<mat-form-field appearance="outline" class="sort-form col-auto pr-0">
<mat-select placeholder="{{'CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')">
<mat-option [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="!isPublic" [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="isPublic" [value]="order.DATASETPUBLISHED">{{enumUtils.toRecentActivityOrderString(order.DATASETPUBLISHED)}}</mat-option>
<mat-option [value]="order.LABEL">{{enumUtils.toRecentActivityOrderString(order.LABEL)}}</mat-option>
<mat-option [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option *ngIf="!isPublic" [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option [value]="order.CREATED">{{enumUtils.toRecentActivityOrderString(order.CREATED)}}</mat-option>
</mat-select>
</mat-form-field>

View File

@ -81,7 +81,11 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
ngOnInit() {
this.isPublic = this.router.url === '/explore';
this.formGroup.get('order').setValue(this.order.MODIFIED);
if (this.isPublic) {
this.formGroup.get('order').setValue(this.order.DATASETPUBLISHED);
} else {
this.formGroup.get('order').setValue(this.order.MODIFIED);
}
if (!this.isPublic && isNullOrUndefined(this.authService.current())) {
this.router.navigateByUrl("/explore");
}
@ -155,7 +159,7 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
}
]
};
public isAuthenticated(): boolean {
return !(!this.authentication.current());
}
@ -348,6 +352,14 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
merged[current] = arr2[index2];
index2++;
}
} else if (order === 'dmp:publishedAt|join|') {
if (!isArr1Depleted && (isArr2Depleted || (new Date(arr1[index1].dmpPublishedAt) > new Date(arr2[index2].dmpPublishedAt)))) {
merged[current] = arr1[index1];
index1++;
} else {
merged[current] = arr2[index2];
index2++;
}
}
current++;
}

View File

@ -2,7 +2,8 @@
<a [routerLink]="isPublic ? ['/datasets/publicOverview/' + dataset.id] : ['/datasets/overview/' + dataset.id]" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div 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>
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.PUBLISHED' | translate}}: {{dataset.dmpPublishedAt | date:"longDate"}}</div>
</div>
<div class="col-auto dataset-title">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}: {{dataset.label}}</div>
<div class="dataset-subtitle">

View File

@ -35,493 +35,494 @@ import { DmpStatus } from '@app/core/common/enum/dmp-status';
@Component({
selector: 'app-dataset-overview',
templateUrl: './dataset-overview.component.html',
styleUrls: ['./dataset-overview.component.scss']
selector: 'app-dataset-overview',
templateUrl: './dataset-overview.component.html',
styleUrls: ['./dataset-overview.component.scss']
})
export class DatasetOverviewComponent extends BaseComponent implements OnInit {
dataset: DatasetOverviewModel;
datasetWizardEditorModel: DatasetWizardEditorModel;
datasetWizardModel: DatasetWizardModel;
isNew = true;
isFinalized = false;
isPublicView = true;
hasPublishButton: boolean = true;
breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
isUserOwner: boolean;
expand = false;
hasDOIToken = false;
researchers: ResearcherModel[];
users: UserInfoListingModel[];
lockStatus: Boolean;
dataset: DatasetOverviewModel;
datasetWizardEditorModel: DatasetWizardEditorModel;
datasetWizardModel: DatasetWizardModel;
isNew = true;
isFinalized = false;
isPublicView = true;
hasPublishButton: boolean = true;
breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
isUserOwner: boolean;
expand = false;
hasDOIToken = false;
researchers: ResearcherModel[];
users: UserInfoListingModel[];
lockStatus: Boolean;
constructor(
private route: ActivatedRoute,
private router: Router,
private datasetService: DatasetService,
private translate: TranslateService,
private authentication: AuthService,
private dialog: MatDialog,
private language: TranslateService,
private uiNotificationService: UiNotificationService,
private configurationService: ConfigurationService,
private oauth2DialogService: Oauth2DialogService,
private userService: UserService,
private dmpService: DmpService,
private location: Location,
private datasetWizardService: DatasetWizardService,
private lockService: LockService
) {
super();
}
constructor(
private route: ActivatedRoute,
private router: Router,
private datasetService: DatasetService,
private translate: TranslateService,
private authentication: AuthService,
private dialog: MatDialog,
private language: TranslateService,
private uiNotificationService: UiNotificationService,
private configurationService: ConfigurationService,
private oauth2DialogService: Oauth2DialogService,
private userService: UserService,
private dmpService: DmpService,
private location: Location,
private datasetWizardService: DatasetWizardService,
private lockService: LockService
) {
super();
}
ngOnInit() {
// Gets dataset data using parameter id
this.route.params
.pipe(takeUntil(this._destroyed))
.subscribe((params: Params) => {
const itemId = params['id'];
const publicId = params['publicId'];
if (itemId != null) {
this.isNew = false;
this.isPublicView = false;
this.datasetService.getOverviewSingle(itemId)
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.dataset = data;
this.getDmpResearchers();
this.getDmpUsers();
this.getDatasetWizardModel(this.dataset.id);
this.checkLockStatus(this.dataset.id);
this.setIsUserOwner();
const breadCrumbs = [];
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS'), url: "/datasets" });
breadCrumbs.push({ parentComponentName: 'DatasetListingComponent', label: this.dataset.label, url: '/datasets/overview/' + this.dataset.id });
this.breadCrumbs = observableOf(breadCrumbs);
}, (error: any) => {
if (error.status === 404) {
return this.onFetchingDeletedCallbackError('/datasets/');
}
if (error.status === 403) {
return this.onFetchingForbiddenCallbackError('/datasets/');
}
});
}
else if (publicId != null) {
this.isNew = false;
this.isFinalized = true;
this.isPublicView = true;
this.datasetService.getOverviewSinglePublic(publicId)
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.dataset = data;
this.getDmpResearchers();
this.getDmpUsers();
this.getDatasetWizardModel(this.dataset.id);
this.checkLockStatus(this.dataset.id);
this.setIsUserOwner();
const breadCrumbs = [];
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC DATASETS'), url: "/explore" });
breadCrumbs.push({ parentComponentName: 'DatasetListingComponent', label: this.dataset.label, url: '/datasets/publicOverview/' + this.dataset.id });
this.breadCrumbs = observableOf(breadCrumbs);
}, (error: any) => {
if (error.status === 404) {
return this.onFetchingDeletedCallbackError('/explore');
}
if (error.status === 403) {
return this.onFetchingForbiddenCallbackError('/explore');
}
});
}
});
}
ngOnInit() {
// Gets dataset data using parameter id
this.route.params
.pipe(takeUntil(this._destroyed))
.subscribe((params: Params) => {
const itemId = params['id'];
const publicId = params['publicId'];
if (itemId != null) {
this.isNew = false;
this.isPublicView = false;
this.datasetService.getOverviewSingle(itemId)
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.dataset = data;
this.getDmpResearchers();
this.getDmpUsers();
this.getDatasetWizardModel(this.dataset.id);
this.checkLockStatus(this.dataset.id);
this.setIsUserOwner();
const breadCrumbs = [];
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS'), url: "/datasets" });
breadCrumbs.push({ parentComponentName: 'DatasetListingComponent', label: this.dataset.label, url: '/datasets/overview/' + this.dataset.id });
this.breadCrumbs = observableOf(breadCrumbs);
}, (error: any) => {
if (error.status === 404) {
return this.onFetchingDeletedCallbackError('/datasets/');
}
if (error.status === 403) {
return this.onFetchingForbiddenCallbackError('/datasets/');
}
});
}
else if (publicId != null) {
this.isNew = false;
this.isFinalized = true;
this.isPublicView = true;
this.datasetService.getOverviewSinglePublic(publicId)
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.dataset = data;
this.getDmpResearchers();
this.getDmpUsers();
this.getDatasetWizardModel(this.dataset.id);
// this.checkLockStatus(this.dataset.id);
const breadCrumbs = [];
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC DATASETS'), url: "/explore" });
breadCrumbs.push({ parentComponentName: 'DatasetListingComponent', label: this.dataset.label, url: '/datasets/publicOverview/' + this.dataset.id });
this.breadCrumbs = observableOf(breadCrumbs);
}, (error: any) => {
if (error.status === 404) {
return this.onFetchingDeletedCallbackError('/explore');
}
if (error.status === 403) {
return this.onFetchingForbiddenCallbackError('/explore');
}
});
}
});
}
getDatasetWizardModel(id: string) {
this.datasetWizardService.getSingle(id)
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.datasetWizardEditorModel = new DatasetWizardEditorModel().fromModel(data);
this.datasetWizardModel = data;
});
}
getDatasetWizardModel(id: string) {
this.datasetWizardService.getSingle(id)
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.datasetWizardEditorModel = new DatasetWizardEditorModel().fromModel(data);
this.datasetWizardModel = data;
});
}
checkLockStatus(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => this.lockStatus = lockStatus);
}
checkLockStatus(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => this.lockStatus = lockStatus);
}
onFetchingDeletedCallbackError(redirectRoot: string) {
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-OVERVIEW.ERROR.DELETED-DATASET'), SnackBarNotificationLevel.Error);
this.router.navigate([redirectRoot]);
}
onFetchingDeletedCallbackError(redirectRoot: string) {
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-OVERVIEW.ERROR.DELETED-DATASET'), SnackBarNotificationLevel.Error);
this.router.navigate([redirectRoot]);
}
onFetchingForbiddenCallbackError(redirectRoot: string) {
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-OVERVIEW.ERROR.FORBIDEN-DATASET'), SnackBarNotificationLevel.Error);
this.router.navigate([redirectRoot]);
}
onFetchingForbiddenCallbackError(redirectRoot: string) {
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-OVERVIEW.ERROR.FORBIDEN-DATASET'), SnackBarNotificationLevel.Error);
this.router.navigate([redirectRoot]);
}
goBack(): void {
this.location.back();
}
goBack(): void {
this.location.back();
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => this.router.navigate([path]));
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => this.router.navigate([path]));
}
getDmpResearchers() {
this.dmpService.getSingle(this.dataset.dmp.id).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.researchers = data.researchers;
});
}
getDmpResearchers() {
this.dmpService.getSingle(this.dataset.dmp.id).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.researchers = data.researchers;
});
}
getDmpUsers() {
this.dmpService.getSingle(this.dataset.dmp.id).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.users = data.users;
});
}
getDmpUsers() {
this.dmpService.getSingle(this.dataset.dmp.id).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.users = data.users;
});
}
setIsUserOwner() {
if (this.dataset) {
const principal: Principal = this.authentication.current();
if (principal) this.isUserOwner = principal.id === this.dataset.users.find(x => x.role === Role.Owner).id;
}
}
setIsUserOwner() {
if (this.dataset) {
const principal: Principal = this.authentication.current();
if (principal) this.isUserOwner = principal.id === this.dataset.users.find(x => x.role === Role.Owner).id;
}
}
isUserAuthor(userId: string): boolean {
const principal: Principal = this.authentication.current();
return userId === principal.id;
}
isUserAuthor(userId: string): boolean {
if (this.isAuthenticated()) {
const principal: Principal = this.authentication.current();
return userId === principal.id;
} else return false;
}
isUserDatasetRelated() {
const principal: Principal = this.authentication.current();
let isRelated: boolean = false;
if (this.dataset && principal) {
this.dataset.users.forEach(element => {
if (element.id === principal.id) {
isRelated = true;
}
})
}
return isRelated;
}
isUserDatasetRelated() {
const principal: Principal = this.authentication.current();
let isRelated: boolean = false;
if (this.dataset && principal) {
this.dataset.users.forEach(element => {
if (element.id === principal.id) {
isRelated = true;
}
})
}
return isRelated;
}
roleDisplay(value: UserInfoListingModel) {
if (value.role === Role.Owner) {
return this.translate.instant('DMP-LISTING.OWNER');
} else if (value.role === Role.Member) {
return this.translate.instant('DMP-LISTING.MEMBER');
} else {
return this.translate.instant('DMP-LISTING.OWNER');
}
}
roleDisplay(value: UserInfoListingModel) {
if (value.role === Role.Owner) {
return this.translate.instant('DMP-LISTING.OWNER');
} else if (value.role === Role.Member) {
return this.translate.instant('DMP-LISTING.MEMBER');
} else {
return this.translate.instant('DMP-LISTING.OWNER');
}
}
roleDisplayFromList(value: UserInfoListingModel[]) {
const principal: Principal = this.authentication.current();
let role: number;
if (principal) {
value.forEach(element => {
if (principal.id === element.id) {
role = element.role;
}
});
}
if (role === Role.Owner) {
return this.translate.instant('DMP-LISTING.OWNER');
} else if (role === Role.Member) {
return this.translate.instant('DMP-LISTING.MEMBER');
} else {
return this.translate.instant('DMP-LISTING.OWNER');
}
}
roleDisplayFromList(value: UserInfoListingModel[]) {
const principal: Principal = this.authentication.current();
let role: number;
if (principal) {
value.forEach(element => {
if (principal.id === element.id) {
role = element.role;
}
});
}
if (role === Role.Owner) {
return this.translate.instant('DMP-LISTING.OWNER');
} else if (role === Role.Member) {
return this.translate.instant('DMP-LISTING.MEMBER');
} else {
return this.translate.instant('DMP-LISTING.OWNER');
}
}
openShareDialog(rowId: any, rowName: any) {
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
restoreFocus: false,
data: {
dmpId: rowId,
dmpName: rowName
}
});
}
openShareDialog(rowId: any, rowName: any) {
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
restoreFocus: false,
data: {
dmpId: rowId,
dmpName: rowName
}
});
}
public isAuthenticated(): boolean {
return !(!this.authentication.current());
}
public isAuthenticated(): boolean {
return !(!this.authentication.current());
}
isDraftDataset(dataset: DatasetOverviewModel) {
return dataset.status == DatasetStatus.Draft;
}
isDraftDataset(dataset: DatasetOverviewModel) {
return dataset.status == DatasetStatus.Draft;
}
isFinalizedDataset(dataset: DatasetOverviewModel) {
return dataset.status == DatasetStatus.Finalized;
}
isFinalizedDataset(dataset: DatasetOverviewModel) {
return dataset.status == DatasetStatus.Finalized;
}
editClicked(dataset: DatasetOverviewModel) {
if (dataset.public) {
let url = this.router.createUrlTree(['/datasets/publicEdit/', dataset.id])
window.open(url.toString(), '_blank')
} else {
let url = this.router.createUrlTree(['/datasets/edit/', dataset.id])
window.open(url.toString(), '_blank')
}
}
editClicked(dataset: DatasetOverviewModel) {
if (dataset.public) {
let url = this.router.createUrlTree(['/datasets/publicEdit/', dataset.id])
window.open(url.toString(), '_blank')
} else {
let url = this.router.createUrlTree(['/datasets/edit/', dataset.id])
window.open(url.toString(), '_blank')
}
}
deleteClicked() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
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.datasetService.delete(this.dataset.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.onDeleteCallbackSuccess();
},
error => this.onDeleteCallbackError(error)
);
}
});
}
deleteClicked() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
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.datasetService.delete(this.dataset.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.onDeleteCallbackSuccess();
},
error => this.onDeleteCallbackError(error)
);
}
});
}
dmpClicked(dmpId: String) {
this.router.navigate(['/plans/overview/' + dmpId]);
}
dmpClicked(dmpId: String) {
this.router.navigate(['/plans/overview/' + dmpId]);
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/datasets']);
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/datasets']);
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
onUpdateCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onUpdateCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onUpdateCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Error);
}
onUpdateCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Error);
}
public getOrcidPath(): string {
return this.configurationService.orcidPath;
}
public getOrcidPath(): string {
return this.configurationService.orcidPath;
}
getOrcidPathForResearcher(reference: string): string {
const path = this.getOrcidPath();
const userId = reference.split(':')[1];
return path + userId;
}
getOrcidPathForResearcher(reference: string): string {
const path = this.getOrcidPath();
const userId = reference.split(':')[1];
return path + userId;
}
downloadPDF(id: string) {
this.datasetService.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'));
downloadPDF(id: string) {
this.datasetService.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);
});
}
FileSaver.saveAs(blob, filename);
});
}
downloadDocx(id: string) {
this.datasetService.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'));
downloadDocx(id: string) {
this.datasetService.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);
});
}
FileSaver.saveAs(blob, filename);
});
}
downloadXml(id: string) {
this.datasetService.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'));
downloadXml(id: string) {
this.datasetService.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);
});
}
FileSaver.saveAs(blob, filename);
});
}
//GK: NO
// downloadJson(id: string) {
// this.datasetService.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);
// })
// }
//GK: NO
// downloadJson(id: string) {
// this.datasetService.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);
// })
// }
getFilenameFromContentDispositionHeader(header: string): string {
const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g);
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;
}
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;
}
openDmpSearchDialogue() {
const formControl = new FormControl();
const dialogRef = this.dialog.open(DatasetCopyDialogueComponent, {
width: '500px',
restoreFocus: false,
data: {
formControl: formControl,
datasetId: this.dataset.id,
datasetProfileId: this.datasetWizardEditorModel.profile,
datasetProfileExist: false,
confirmButton: this.language.instant('DATASET-WIZARD.DIALOGUE.COPY'),
cancelButton: this.language.instant('DATASET-WIZARD.DIALOGUE.CANCEL')
}
});
openDmpSearchDialogue() {
const formControl = new FormControl();
const dialogRef = this.dialog.open(DatasetCopyDialogueComponent, {
width: '500px',
restoreFocus: false,
data: {
formControl: formControl,
datasetId: this.dataset.id,
datasetProfileId: this.datasetWizardEditorModel.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
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId }])
window.open(url.toString(), '_blank')
}
});
}
dialogRef.afterClosed().pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId }])
window.open(url.toString(), '_blank')
}
});
}
updateUsers() {
return this.dmpService.updateUsers(this.dataset.dmp.id, this.users).pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.onUpdateCallbackSuccess();
},
error => this.onUpdateCallbackError(error)
);
}
updateUsers() {
return this.dmpService.updateUsers(this.dataset.dmp.id, this.users).pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.onUpdateCallbackSuccess();
},
error => this.onUpdateCallbackError(error)
);
}
removeUserFromDmp(user: UserInfoListingModel) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-USER'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
const index = this.users.findIndex(x => x.id === user.id);
if (index > -1) {
this.users.splice(index, 1);
}
this.updateUsers();
}
});
}
removeUserFromDmp(user: UserInfoListingModel) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-USER'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
const index = this.users.findIndex(x => x.id === user.id);
if (index > -1) {
this.users.splice(index, 1);
}
this.updateUsers();
}
});
}
showPublishButton(dataset: DatasetOverviewModel) {
return this.isFinalizedDataset(dataset) && !dataset.public && this.hasPublishButton;
}
showPublishButton(dataset: DatasetOverviewModel) {
return this.isFinalizedDataset(dataset) && !dataset.public && this.hasPublishButton;
}
// publish(id: String) {
// const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
// maxWidth: '500px',
// restoreFocus: false,
// data: {
// message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.PUBLISH-ITEM'),
// privacyPolicyNames: this.language.instant('GENERAL.CONFIRMATION-DIALOG.PRIVACY-POLICY-NAMES'),
// confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
// cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
// isDeleteConfirmation: false
// }
// });
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
// if (result) {
// this.datasetService.publish(id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(() => {
// this.hasPublishButton = false;
// this.reloadPage();
// });
// }
// });
// }
// publish(id: String) {
// const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
// maxWidth: '500px',
// restoreFocus: false,
// data: {
// message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.PUBLISH-ITEM'),
// privacyPolicyNames: this.language.instant('GENERAL.CONFIRMATION-DIALOG.PRIVACY-POLICY-NAMES'),
// confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
// cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
// isDeleteConfirmation: false
// }
// });
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
// if (result) {
// this.datasetService.publish(id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(() => {
// this.hasPublishButton = false;
// this.reloadPage();
// });
// }
// });
// }
finalize(dataset: DatasetOverviewModel) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'),
confirmButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.AFFIRMATIVE'),
cancelButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.NEGATIVE'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.getDatasetWizardModel(this.dataset.id);
this.datasetWizardModel.status = DatasetStatus.Finalized;
this.datasetWizardService.createDataset(this.datasetWizardModel)
.pipe(takeUntil(this._destroyed))
.subscribe(
data => this.onUpdateCallbackSuccess(),
error => this.onUpdateCallbackError(error)
);
}
});
}
finalize(dataset: DatasetOverviewModel) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'),
confirmButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.AFFIRMATIVE'),
cancelButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.NEGATIVE'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.getDatasetWizardModel(this.dataset.id);
this.datasetWizardModel.status = DatasetStatus.Finalized;
this.datasetWizardService.createDataset(this.datasetWizardModel)
.pipe(takeUntil(this._destroyed))
.subscribe(
data => this.onUpdateCallbackSuccess(),
error => this.onUpdateCallbackError(error)
);
}
});
}
hasReversableStatus(dataset: DatasetOverviewModel): boolean {
return dataset.dmp.status == DmpStatus.Draft && dataset.status == DatasetStatus.Finalized
}
hasReversableStatus(dataset: DatasetOverviewModel): boolean {
return dataset.dmp.status == DmpStatus.Draft && dataset.status == DatasetStatus.Finalized
}
reverse(dataset: DatasetOverviewModel) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.UNFINALIZE-ITEM'),
confirmButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.AFFIRMATIVE'),
cancelButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.NEGATIVE'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.getDatasetWizardModel(this.dataset.id);
this.datasetWizardModel.status = DatasetStatus.Draft;
this.datasetWizardService.createDataset(this.datasetWizardModel)
.pipe(takeUntil(this._destroyed))
.subscribe(
data => this.onUpdateCallbackSuccess(),
error => this.onUpdateCallbackError(error)
);
}
});
}
reverse(dataset: DatasetOverviewModel) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.UNFINALIZE-ITEM'),
confirmButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.AFFIRMATIVE'),
cancelButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.NEGATIVE'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.getDatasetWizardModel(this.dataset.id);
this.datasetWizardModel.status = DatasetStatus.Draft;
this.datasetWizardService.createDataset(this.datasetWizardModel)
.pipe(takeUntil(this._destroyed))
.subscribe(
data => this.onUpdateCallbackSuccess(),
error => this.onUpdateCallbackError(error)
);
}
});
}
}

View File

@ -22,9 +22,10 @@
<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
<mat-form-field appearance="outline" class="sort-form col-auto">
<mat-select placeholder="{{'CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')">
<mat-option [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="!isPublic" [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="isPublic" [value]="order.PUBLISHED">{{enumUtils.toRecentActivityOrderString(order.PUBLISHED)}}</mat-option>
<mat-option [value]="order.LABEL">{{enumUtils.toRecentActivityOrderString(order.LABEL)}}</mat-option>
<mat-option [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option *ngIf="!isPublic" [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option [value]="order.CREATED">{{enumUtils.toRecentActivityOrderString(order.CREATED)}}</mat-option>
</mat-select>
</mat-form-field>

View File

@ -84,7 +84,11 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
ngOnInit() {
this.isPublic = this.router.url.startsWith('/explore-plans');
this.formGroup.get('order').setValue(this.order.MODIFIED);
if (this.isPublic) {
this.formGroup.get('order').setValue(this.order.PUBLISHED);
} else {
this.formGroup.get('order').setValue(this.order.MODIFIED);
}
if (!this.isPublic && isNullOrUndefined(this.authService.current())) {
this.router.navigateByUrl("/explore-plans");
}
@ -181,19 +185,19 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
tourId: 'dmp-dataset-tour',
useOrb: true,
steps: [
{
{
selector: '.dmp-tour',
content: 'Step 1',
orientation: Orientation.Right
},
{
{
selector: '.dataset-tour',
content: 'Step 2',
orientation: Orientation.Right
}
]
};
public isAuthenticated(): boolean {
return !(!this.authService.current());
}
@ -210,6 +214,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
// if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
// fields.push('-modified');
const fields: Array<string> = [((this.formGroup.get('order').value === 'status') || (this.formGroup.get('order').value === 'label') ? '+' : "-") + this.formGroup.get('order').value];
this.startIndex = 0;
const request = new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields });
this.setPublicCriteria();
@ -445,6 +450,14 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
merged[current] = arr2[index2];
index2++;
}
} else if (order === "publishedAt") {
if (!isArr1Depleted && (isArr2Depleted || (new Date(arr1[index1].publishedAt) > new Date(arr2[index2].publishedAt)))) {
merged[current] = arr1[index1];
index1++;
} else {
merged[current] = arr2[index2];
index2++;
}
}
current++;
}

View File

@ -2,7 +2,8 @@
<a [routerLink]="isPublic ? ['/explore-plans/publicOverview/' + dmp.id] : ['/plans/overview/' + dmp.id]" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ dmp.modifiedTime | date: "longDate" }}</div>
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ dmp.modifiedTime | date: "longDate" }}</div>
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.PUBLISHED' | translate }}: {{ dmp.publishedAt | date: "longDate" }}</div>
</div>
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{dmp.label}}</div>
<div class="dmp-subtitle">

View File

@ -52,7 +52,7 @@
</div>
</div>
<div class="row">
<button *ngIf="isAuthenticated()" (click)="cloneClicked(dmp)" mat-mini-fab
<button *ngIf="isAuthenticated()" (click)="cloneClicked(dmp)" mat-mini-fab
class="mr-3 d-flex justify-content-center align-items-center"
matTooltip="{{'DMP-LISTING.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
@ -435,4 +435,4 @@
</div>
</div>
</div>
-->
-->

View File

@ -119,8 +119,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.dmp = data;
this.checkLockStatus(this.dmp.id);
this.setIsUserOwner();
// this.checkLockStatus(this.dmp.id);
this.getAllVersions(this.dmp);
const breadCrumbs = [];
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC-DMPS'), url: "/explore-plans" });
@ -156,8 +155,10 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
}
isUserAuthor(userId: string): boolean {
const principal: Principal = this.authentication.current();
return userId === principal.id;
if (this.isAuthenticated()) {
const principal: Principal = this.authentication.current();
return userId === principal.id;
} else return false;
}
editClicked(dmp: DmpOverviewModel) {

View File

@ -19,8 +19,7 @@
<a class="ml-4 mr-4 faq-title" (click)="openFaqDialog()"><b>{{ 'FAQ.TITLE' | translate }}</b></a>
<!-- <button mat-icon-button class="lang" [matMenuTriggerFor]="languageMenu"></button> -->
<button mat-button [matMenuTriggerFor]="languageMenu" class="p-0 lang">
<mat-icon class="mr-2">language</mat-icon><span
class="text-uppercase">{{selectedLanguage}}</span>
<mat-icon class="mr-2">language</mat-icon><span class="text-uppercase">{{selectedLanguage}}</span>
<mat-icon>arrow_drop_down</mat-icon>
</button>
<mat-menu #languageMenu="matMenu" class="lang-parent">
@ -33,9 +32,7 @@
<ul class="navbar-nav">
<!-- Login -->
<li class="nav-item" *ngIf="isAuthenticated();else loginoption">
<img mat-card-avatar class="my-mat-card-avatar" [src]="this.getPrincipalAvatar()"
(error)="this.applyFallbackAvatar($event)" (click)="openProfile()"
[matTooltip]="this.getPrincipalName()">
<img mat-card-avatar class="my-mat-card-avatar" [src]="this.getPrincipalAvatar()" (error)="this.applyFallbackAvatar($event)" (click)="openProfile()" [matTooltip]="this.getPrincipalName()">
<!--<img mat-card-avatar class="my-mat-card-avatar" *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()" (click)="openProfile()"> -->
</li>
<ng-template #loginoption>
@ -50,9 +47,7 @@
<div *ngIf="!(isAuthenticated() && onInvalidUrl())">
<ul class="list m-2">
<li *ngIf="isAuthenticated();else loginoption" class="d-flex justify-content-center avatar">
<img mat-card-avatar class="my-mat-card-avatar" [src]="this.getPrincipalAvatar()"
(error)="this.applyFallbackAvatar($event)" (click)="openProfile()"
[matTooltip]="this.getPrincipalName()">
<img mat-card-avatar class="my-mat-card-avatar" [src]="this.getPrincipalAvatar()" (error)="this.applyFallbackAvatar($event)" (click)="openProfile()" [matTooltip]="this.getPrincipalName()">
<!--<img mat-card-avatar class="my-mat-card-avatar" *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()" (click)="openProfile()"> -->
</li>
<ng-template #loginoption>
@ -65,8 +60,7 @@
<li class="ml-3 d-flex justify-content-around align-items-center" (click)="$event.stopPropagation()">
<a class="faq-title" (click)="openFaqDialog()"><b>{{ 'FAQ.TITLE' | translate }}</b></a>
<button mat-button [matMenuTriggerFor]="languageMenu" class="ml-3 p-0 lang">
<mat-icon class="mr-2">language</mat-icon><span
class="text-uppercase">{{selectedLanguage}}</span>
<mat-icon class="mr-2">language</mat-icon><span class="text-uppercase">{{selectedLanguage}}</span>
<mat-icon>arrow_drop_down</mat-icon>
</button>
<mat-menu #languageMenu="matMenu" class="lang-parent">

View File

@ -171,13 +171,11 @@
flex-grow: 1;
}
::ng-deep .mat-form-field-wrapper {
background-color: white !important;
padding-bottom: 0 !important;
}
// ::ng-deep .mat-form-field-flex > .mat-form-field-infix { padding: 0.4em 0px !important; }
// ::ng-deep .mat-form-field-label-wrapper { top: -1.5em; }
// ::ng-deep .mat-form-field-appearance-outline.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label {
// transform: translateY(-1.1em) scale(.75);
// width: 133.33333%;
// }
// ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline {background: #fafafa !important;}
::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {
padding: 0.3rem 0rem 0.6rem 0rem !important;
}