dataset-overview_update v3

This commit is contained in:
gpapavgeri 2020-07-06 13:21:11 +03:00
parent a8528ee5b1
commit 75be44ee60
10 changed files with 252 additions and 59 deletions

View File

@ -11,7 +11,7 @@ import { BaseHttpService } from '../http/base-http.service';
import { DatasetProfileCriteria } from '../../query/dataset-profile/dataset-profile-criteria'; import { DatasetProfileCriteria } from '../../query/dataset-profile/dataset-profile-criteria';
import { ConfigurationService } from '../configuration/configuration.service'; import { ConfigurationService } from '../configuration/configuration.service';
import { DatasetOverviewModel } from '@app/core/model/dataset/dataset-overview'; import { DatasetOverviewModel } from '@app/core/model/dataset/dataset-overview';
import { HttpHeaders } from '@angular/common/http'; import { HttpHeaders, HttpResponse, HttpClient } from '@angular/common/http';
import { DatasetModel } from '@app/core/model/dataset/dataset'; import { DatasetModel } from '@app/core/model/dataset/dataset';
@Injectable() @Injectable()
@ -22,7 +22,8 @@ export class DatasetService {
constructor( constructor(
private http: BaseHttpService, private http: BaseHttpService,
private configurationSevice: ConfigurationService) { private configurationSevice: ConfigurationService,
private httpClient: HttpClient) {
this.actionUrl = configurationSevice.server + 'datasets/'; this.actionUrl = configurationSevice.server + 'datasets/';
} }
@ -69,4 +70,27 @@ export class DatasetService {
delete(id: String): Observable<DatasetModel> { delete(id: String): Observable<DatasetModel> {
return this.http.delete<DatasetModel>(this.actionUrl + 'delete/' + id, { headers: this.headers }); // + 'delete/' return this.http.delete<DatasetModel>(this.actionUrl + 'delete/' + id, { headers: this.headers }); // + 'delete/'
} }
publish(id: String): Observable<DatasetModel> {
return this.http.get<DatasetModel>(this.actionUrl + 'makepublic/' + id, { headers: this.headers });
}
public downloadXML(id: string): Observable<HttpResponse<Blob>> {
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml')
return this.httpClient.get(this.actionUrl + id, { responseType: 'blob', observe: 'response', headers: headerXml }); //+ "/getXml/"
}
public downloadDocx(id: string): Observable<HttpResponse<Blob>> {
let headerDoc: HttpHeaders = this.headers.set('Content-Type', 'application/msword')
return this.httpClient.get(this.actionUrl + id, { responseType: 'blob', observe: 'response', headers: headerDoc });
}
public downloadPDF(id: string): Observable<HttpResponse<Blob>> {
let headerPdf: HttpHeaders = this.headers.set('Content-Type', 'application/pdf')
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response', headers: headerPdf });
}
public downloadJson(id: string): Observable<HttpResponse<Blob>> {
return this.httpClient.get(this.actionUrl + 'rda/' + id, { responseType: 'blob', observe: 'response' });
}
} }

View File

@ -9,7 +9,7 @@
<div class="col-md-8 col-lg-8 pl-4"> <div class="col-md-8 col-lg-8 pl-4">
<div class="row"> <div class="row">
<span class="dataset-logo">{{ 'NAV-BAR.DATASET' | translate }}</span> <span class="dataset-logo">{{ 'NAV-BAR.DATASET' | translate }}</span>
<p class="dataset-label ml-2 mb-0">{{ dataset.label }}</p> <p class="dataset-label ml-3 mb-0">{{ dataset.label }}</p>
</div> </div>
<div class="row d-flex align-items-center mt-3 mb-4 label-txt"> <div class="row d-flex align-items-center mt-3 mb-4 label-txt">
<div *ngIf="isUserDatasetRelated()" class="d-flex"> <div *ngIf="isUserDatasetRelated()" class="d-flex">
@ -41,34 +41,38 @@
(click)="viewVersions(dmp.groupId, dmp.label)"> (click)="viewVersions(dmp.groupId, dmp.label)">
{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}} {{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button> --> </button> -->
<div class="d-flex mr-4">{{'GENERAL.STATUSES.EDIT' | translate}} : <div class="d-flex mr-3">{{'GENERAL.STATUSES.EDIT' | translate}} :
{{dataset.modified | date:"longDate"}} {{dataset.modified | date:"longDate"}}
</div> </div>
<!-- <div class="d-flex mr-4"> <div class="d-flex mr-4">
<div *ngIf="dmp.status" class="d-flex flex-row uppercase"> <div *ngIf="dataset.status" class="d-flex flex-row uppercase">
<mat-icon class="status-icon">check</mat-icon> <mat-icon class="status-icon">check</mat-icon>
{{'DATASET-LISTING.COLUMNS.FINALIZED' | translate}} {{'TYPES.DATASET-STATUS.FINALISED' | translate}}
</div> </div>
</div> --> <div *ngIf="!dataset.status" class="d-flex flex-row uppercase">
<mat-icon class="status-icon">create</mat-icon>
{{'TYPES.DATASET-STATUS.DRAFT' | translate}}
</div>
</div>
</div> </div>
<div class="row mb-4 pb-3"> <div class="row mb-4 pb-3">
<button *ngIf="isAuthenticated()" (click)="cloneClicked(dataset)" mat-mini-fab <button *ngIf="isAuthenticated()" (click)="openDmpSearchDialogue()" mat-mini-fab
class="mr-3 d-flex justify-content-center align-items-center" class="mr-3 actions-btn" matTooltip="{{'DMP-LISTING.ACTIONS.CLONE' | translate}}"
matTooltip="{{'DMP-LISTING.ACTIONS.CLONE' | translate}}" matTooltipPosition="above"> matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon> <mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button> </button>
<button *ngIf="isDraftDataset(dataset) && isUserOwner" (click)="editClicked(dataset)" <button *ngIf="isDraftDataset(dataset) && isUserOwner" (click)="editClicked(dataset)"
mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" mat-mini-fab class="mr-3 actions-btn"
matTooltip="{{'DMP-LISTING.ACTIONS.EDIT' | translate}}" matTooltipPosition="above"> matTooltip="{{'DMP-LISTING.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon> <mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button> </button>
<button *ngIf="isDraftDataset(dataset) && isUserOwner" (click)="deleteClicked()" mat-mini-fab <button *ngIf="isDraftDataset(dataset) && isUserOwner" (click)="deleteClicked()" mat-mini-fab
class="mr-3 d-flex justify-content-center align-items-center" class="mr-3 actions-btn" matTooltip="{{'DMP-LISTING.ACTIONS.DELETE' | translate}}"
matTooltip="{{'DMP-LISTING.ACTIONS.DELETE' | translate}}" matTooltipPosition="above"> matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">delete</mat-icon> <mat-icon class="mat-mini-fab-icon">delete</mat-icon>
</button> </button>
<!-- <button *ngIf="isDraftDmp(dmp) && isUserOwner && !lockStatus" mat-mini-fab (click)="createOrUpdate(dmp.id)" <!-- <button *ngIf="isDraftDmp(dmp) && isUserOwner && !lockStatus" mat-mini-fab (click)="createOrUpdate(dmp.id)"
class="mr-3 d-flex justify-content-center align-items-center"> class="mr-3 actions-btn">
<mat-icon class="mat-mini-fab-icon" matTooltip="{{'DMP-OVERVIEW.LOCK' | translate}}" <mat-icon class="mat-mini-fab-icon" matTooltip="{{'DMP-OVERVIEW.LOCK' | translate}}"
matTooltipPosition="above">lock_outline matTooltipPosition="above">lock_outline
</mat-icon> </mat-icon>
@ -76,7 +80,8 @@
</div> </div>
<div class="row header">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}</div> <div class="row header">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}</div>
<div class="row "> <div class="row ">
<button class="dmp-btn"> <button class="dmp-btn">
<!-- <button class="dmp-btn" (click)="dmpClicked(dataset.dmp.id)"> -->
<div class="dmp-btn-label"> <div class="dmp-btn-label">
{{ 'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate }}: {{ dataset.datasetTemplate.label }} {{ 'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate }}: {{ dataset.datasetTemplate.label }}
</div> </div>
@ -85,7 +90,7 @@
</div> </div>
<div class="row header">{{'DMP-OVERVIEW.GRANT' | translate}}</div> <div class="row header">{{'DMP-OVERVIEW.GRANT' | translate}}</div>
<div class="row dmp-label">Grant label</div> <div class="row dataset-label">Grant label</div>
<!-- <div class="row dmp-label">{{ dataset.grant.label }}</div> --> <!-- <div class="row dmp-label">{{ dataset.grant.label }}</div> -->
<div class="row header">{{'DMP-OVERVIEW.RESEARCHERS' | translate}}</div> <div class="row header">{{'DMP-OVERVIEW.RESEARCHERS' | translate}}</div>
<div class="row"> <div class="row">
@ -127,8 +132,8 @@
</div> </div>
</div> --> </div> -->
<div class="frame mb-3 pt-4 pl-3 pr-5 pb-1"> <div class="frame mb-3 pt-4 pl-3 pr-5 pb-1">
<!-- <div *ngIf="!dmp.status && isDraftDmp(dmp) && isUserOwner"> <!-- <div *ngIf="!dataset.status && isDraftDataset(dataset) && isUserOwner">
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dmp)"> <div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dataset)">
<button mat-mini-fab class="finalize-btn"> <button mat-mini-fab class="finalize-btn">
<mat-icon class="mat-mini-fab-icon">check</mat-icon> <mat-icon class="mat-mini-fab-icon">check</mat-icon>
</button> </button>
@ -145,13 +150,13 @@
</button> </button>
<p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.DEPOSIT' | translate }}</p> <p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.DEPOSIT' | translate }}</p>
</div> --> </div> -->
<!-- <div class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center"> <div class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<button mat-mini-fab class="frame-btn" [matMenuTriggerFor]="exportMenu"> <button mat-mini-fab class="frame-btn" [matMenuTriggerFor]="exportMenu">
<mat-icon class="mat-mini-fab-icon">open_in_new</mat-icon> <mat-icon class="mat-mini-fab-icon">open_in_new</mat-icon>
</button> </button>
<p class="mb-0 mr-0 pl-2 frame-txt" [matMenuTriggerFor]="exportMenu"> <p class="mb-0 mr-0 pl-2 frame-txt" [matMenuTriggerFor]="exportMenu">
{{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}</p> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}</p>
</div> --> </div>
<!-- <div class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" *ngIf="isUserOwner" <!-- <div class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" *ngIf="isUserOwner"
(click)="newVersion(dmp.id, dmp.label)"> (click)="newVersion(dmp.id, dmp.label)">
<button mat-mini-fab class="frame-btn"> <button mat-mini-fab class="frame-btn">
@ -160,38 +165,38 @@
<p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.START-NEW-VERSION' | translate }} <p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.START-NEW-VERSION' | translate }}
</p> </p>
</div> --> </div> -->
<!-- <div *ngIf="!dataset.public && showPublishButton(dmp) && isUserOwner" <div *ngIf="!dataset.public && showPublishButton(dataset) && isUserOwner"
class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="publish(dmp.id)"> class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="publish(dataset.id)">
<button mat-mini-fab class="frame-btn"> <button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">public</mat-icon> <mat-icon class="mat-mini-fab-icon">public</mat-icon>
</button> </button>
<p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.MAKE-PUBLIC' | translate }}</p> <p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.MAKE-PUBLIC' | translate }}</p>
</div> </div>
<mat-menu #exportMenu="matMenu" xPosition="before"> <mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(dmp.id)"> <button mat-menu-item (click)="downloadPDF(dataset.id)">
<i class="fa fa-file-pdf-o pr-2"></i> <i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span> <span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
</button> </button>
<button mat-menu-item (click)="downloadDocx(dmp.id)"> <button mat-menu-item (click)="downloadDocx(dataset.id)">
<i class="fa fa-file-word-o pr-2"></i> <i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span> <span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
</button> </button>
<button mat-menu-item (click)="downloadXml(dmp.id)"> <button mat-menu-item (click)="downloadXml(dataset.id)">
<i class="fa fa-file-code-o pr-2"></i> <i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span> <span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button> </button>
<button mat-menu-item (click)="downloadJson(dmp.id)"> <button mat-menu-item (click)="downloadJson(dataset.id)">
<i class="fa fa-file-o pr-2"></i> <i class="fa fa-file-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span> <span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
</button> </button>
</mat-menu> </mat-menu>
</div> --> </div>
<!-- <div class="frame mb-3 pt-4 pl-3 pr-3 pb-1"> <div class="frame mb-3 pt-4 pl-3 pr-3 pb-1">
<div class="row ml-0 mr-0 pl-4 pb-3"> <div class="row ml-0 mr-0 pl-4 pb-3">
<p class="header">{{ 'DATASET-OVERVIEW.DATASET-AUTHORS' | translate }}</p> <p class="header">{{ 'DATASET-OVERVIEW.DATASET-AUTHORS' | translate }}</p>
</div> </div>
<div class="row ml-0 mr-0 pl-4 ml-2 pb-3 d-flex align-items-center"> <div class="row ml-0 mr-0 pl-4 ml-2 pb-3 d-flex align-items-center">
<div *ngFor="let user of dmp.users" class="row authors"> <div *ngFor="let user of dataset.users" class="row authors">
<div class="d-flex flex-row"> <div class="d-flex flex-row">
<button class="account_btn mr-3 pl-0"> <button class="account_btn mr-3 pl-0">
<mat-icon class="account-icon">account_circle</mat-icon> <mat-icon class="account-icon">account_circle</mat-icon>
@ -204,19 +209,18 @@
<p class="authors-role">{{ roleDisplay(user) }}</p> <p class="authors-role">{{ roleDisplay(user) }}</p>
</div> </div>
</div> </div>
<button *ngIf="isUserOwner && !dmp.status && user.role" <button *ngIf="isUserOwner && !dataset.status && user.role"
(click)="removeCollaborator(user.id)"
class="remove-btn">{{ 'GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE' | translate}}</button> class="remove-btn">{{ 'GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE' | translate}}</button>
</div> </div>
</div> </div>
<div *ngIf="isUserOwner" (click)="openShareDialog(dmp.id,dmp.label)" <div *ngIf="isUserOwner" (click)="openShareDialog(dataset.id, dataset.label)"
class="row mt-3 mb-3 d-flex align-items-center justify-content-center"> class="row mt-3 mb-3 d-flex align-items-center justify-content-center">
<button mat-raised-button class="invite-btn"> <button mat-raised-button class="invite-btn">
<mat-icon>group_add</mat-icon> <mat-icon>group_add</mat-icon>
{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} {{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}
</button> </button>
</div> </div>
</div> --> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -20,7 +20,7 @@
font-size: 1.2em; font-size: 1.2em;
} }
.mat-mini-fab:hover { .actions-btn:hover {
background-color: #129D99; background-color: #129D99;
color: #FFFFFF; color: #FFFFFF;
} }
@ -150,13 +150,12 @@
color: #008887; color: #008887;
padding-right: 0.5em; padding-right: 0.5em;
align-self: center; align-self: center;
} }
.header { .header {
opacity: 0.6; opacity: 0.6;
margin-top: 1em; margin-top: 1em;
margin-bottom: 0.25em; margin-bottom: 0.5em;
} }
.dataset-label, .header { .dataset-label, .header {
@ -262,7 +261,7 @@
// ********CENTER ELEMENTS******** // ********CENTER ELEMENTS********
.mat-mini-fab, .mat-mini-fab-icon, .mat-mini-fab, .mat-mini-fab-icon, .actions-btn,
.status-icon, .dataset-logo, .frame-btn, .finalize-btn { .status-icon, .dataset-logo, .frame-btn, .finalize-btn {
display: flex; display: flex;
justify-content: center; justify-content: center;

View File

@ -19,6 +19,12 @@ import { Location } from '@angular/common';
import { UserInfoListingModel } from '@app/core/model/user/user-info-listing'; import { UserInfoListingModel } from '@app/core/model/user/user-info-listing';
import { DatasetStatus } from '@app/core/common/enum/dataset-status'; import { DatasetStatus } from '@app/core/common/enum/dataset-status';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import * as FileSaver from 'file-saver';
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation.component';
import { DatasetWizardEditorModel } from '../dataset-wizard/dataset-wizard-editor.model';
import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service';
import { FormControl } from '@angular/forms';
import { DatasetCopyDialogueComponent } from '../dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
@Component({ @Component({
@ -29,6 +35,7 @@ import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog
export class DatasetOverviewComponent extends BaseComponent implements OnInit { export class DatasetOverviewComponent extends BaseComponent implements OnInit {
dataset: DatasetOverviewModel; dataset: DatasetOverviewModel;
datasetWizardModel: DatasetWizardEditorModel;
isNew = true; isNew = true;
isFinalized = false; isFinalized = false;
isPublicView = true; isPublicView = true;
@ -50,7 +57,8 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
private configurationService: ConfigurationService, private configurationService: ConfigurationService,
private oauth2DialogService: Oauth2DialogService, private oauth2DialogService: Oauth2DialogService,
private userService: UserService, private userService: UserService,
private location: Location private location: Location,
private datasetWizardService: DatasetWizardService
) { ) {
super(); super();
} }
@ -69,6 +77,10 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
this.dataset = data; this.dataset = data;
this.datasetWizardService.getSingle(this.dataset.id).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
});
// this.checkLockStatus(this.dataset.id); // this.checkLockStatus(this.dataset.id);
this.setIsUserOwner(); this.setIsUserOwner();
const breadCrumbs = []; const breadCrumbs = [];
@ -92,6 +104,10 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
this.dataset = data; this.dataset = data;
this.datasetWizardService.getSingle(this.dataset.id).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
});
// this.checkLockStatus(this.dataset.id); // this.checkLockStatus(this.dataset.id);
this.setIsUserOwner(); this.setIsUserOwner();
const breadCrumbs = []; const breadCrumbs = [];
@ -130,7 +146,12 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
if (principal) this.isUserOwner = principal.id === this.dataset.users.find(x => x.role === Role.Owner).id; 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;
}
isUserDatasetRelated() { isUserDatasetRelated() {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
let isRelated: boolean = false; let isRelated: boolean = false;
@ -143,6 +164,17 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
} }
return isRelated; 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');
}
}
roleDisplayFromList(value: UserInfoListingModel[]) { roleDisplayFromList(value: UserInfoListingModel[]) {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
@ -162,21 +194,37 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
return this.translate.instant('DMP-LISTING.OWNER'); return this.translate.instant('DMP-LISTING.OWNER');
} }
} }
openShareDialog(rowId: any, rowName: any) {
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
// height: '250px',
// width: '700px',
restoreFocus: false,
data: {
dmpId: rowId,
dmpName: rowName
}
});
}
public isAuthenticated(): boolean { public isAuthenticated(): boolean {
return !(!this.authentication.current()); return !(!this.authentication.current());
} }
cloneClicked(dataset: DatasetOverviewModel) {
this.router.navigate(['/datasets/clone/' + dataset.id]);
}
isDraftDataset(dataset: DatasetOverviewModel) { isDraftDataset(dataset: DatasetOverviewModel) {
return dataset.status == DatasetStatus.Draft; return dataset.status == DatasetStatus.Draft;
} }
isFinalizedDataset(dataset: DatasetOverviewModel) {
return dataset.status == DatasetStatus.Finalized;
}
editClicked(dataset: DatasetOverviewModel) { editClicked(dataset: DatasetOverviewModel) {
this.router.navigate(['/datasets/edit/' + dataset.id]); if (dataset.public) {
this.router.navigate(['/datasets/publicEdit/' + dataset.id]);
} else {
this.router.navigate(['/datasets/edit/' + dataset.id]);
}
} }
deleteClicked() { deleteClicked() {
@ -200,6 +248,10 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
} }
}); });
} }
dmpClicked(dmpId: String) {
this.router.navigate(['/plans/overview/' + dmpId]);
}
onCallbackSuccess(): void { onCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
@ -213,9 +265,116 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
public getOrcidPath(): string { public getOrcidPath(): string {
return this.configurationService.orcidPath; return this.configurationService.orcidPath;
} }
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);
});
}
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);
});
}
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);
});
}
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);
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;
}
showPublishButton(dataset: DatasetOverviewModel) {
return this.isFinalizedDataset(dataset) && !dataset.public && this.hasPublishButton;
}
publish(datasetId: 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(datasetId)
.pipe(takeUntil(this._destroyed))
.subscribe(() => { this.hasPublishButton = false });
}
});
}
openDmpSearchDialogue() {
const formControl = new FormControl();
const dialogRef = this.dialog.open(DatasetCopyDialogueComponent, {
width: '500px',
restoreFocus: false,
data: {
formControl: formControl,
datasetId: this.dataset.id,
datasetProfileId: this.datasetWizardModel.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 } });
}
});
}
// showPublishButton(dataset: DatasetOverviewModel) {
// return this.isFinalizedDmp(dmp) && !dmp.isPublic && this.hasPublishButton;
// }
} }

View File

@ -46,7 +46,11 @@
<div class="d-flex mr-4"> <div class="d-flex mr-4">
<div *ngIf="dmp.status" class="d-flex flex-row uppercase"> <div *ngIf="dmp.status" class="d-flex flex-row uppercase">
<mat-icon class="status-icon">check</mat-icon> <mat-icon class="status-icon">check</mat-icon>
{{'DATASET-LISTING.COLUMNS.FINALIZED' | translate}} {{'TYPES.DMP.FINALISED' | translate}}
</div>
<div *ngIf="!dmp.status" class="d-flex flex-row uppercase">
<mat-icon class="status-icon">create</mat-icon>
{{'TYPES.DMP.DRAFT' | translate}}
</div> </div>
</div> </div>
</div> </div>

View File

@ -161,7 +161,7 @@
.header { .header {
opacity: 0.6; opacity: 0.6;
margin-top: 1em; margin-top: 1em;
margin-bottom: 0.25em; margin-bottom: 0.5em;
} }
.dmp-label, .header { .dmp-label, .header {

View File

@ -183,12 +183,12 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
} }
datasetClicked(datasetId: String) { datasetClicked(datasetId: String) {
if (this.isPublicView) { // if (this.isPublicView) {
this.router.navigate(['/datasets/publicEdit/' + datasetId]); // this.router.navigate(['/datasets/publicEdit/' + datasetId]);
} else { // } else {
this.router.navigate(['/datasets/edit/' + datasetId]); // this.router.navigate(['/datasets/edit/' + datasetId]);
console.log('inhere') // }
} this.router.navigate(['/datasets/overview/' + datasetId]);
} }
datasetsClicked(dmpId: String) { datasetsClicked(dmpId: String) {

View File

@ -106,6 +106,7 @@
"LOGIN": "Login", "LOGIN": "Login",
"DMP-OVERVIEW": "DMP Overview", "DMP-OVERVIEW": "DMP Overview",
"DMP-EDIT": "Edit DMP", "DMP-EDIT": "Edit DMP",
"DATASET-OVERVIEW": "Dataset Overview",
"DATASET-EDIT": "Dataset View/Edit", "DATASET-EDIT": "Dataset View/Edit",
"DMP-NEW-VERSION": "DMP New Version", "DMP-NEW-VERSION": "DMP New Version",
"DMP-CLONE": "Clone DMP", "DMP-CLONE": "Clone DMP",
@ -567,7 +568,7 @@
} }
}, },
"DATASET-OVERVIEW": { "DATASET-OVERVIEW": {
"DATASET-AUTHORS": "Dataset description Authors", "DATASET-AUTHORS": "Dataset description authors",
"ERROR": { "ERROR": {
"DELETED-DATASET": "The requested dataset is deleted", "DELETED-DATASET": "The requested dataset is deleted",
"FORBIDEN-DATASET": "You are not allowed to access this dataset" "FORBIDEN-DATASET": "You are not allowed to access this dataset"

View File

@ -105,6 +105,7 @@
"LOGIN": "Iniciar sesión", "LOGIN": "Iniciar sesión",
"DMP-OVERVIEW": "Resumen del PGD", "DMP-OVERVIEW": "Resumen del PGD",
"DMP-EDIT": "Editar el PGD", "DMP-EDIT": "Editar el PGD",
"DATASET-OVERVIEW": "Resumen del Dataset",
"DATASET-EDIT": "Ver/Editar el Dataset", "DATASET-EDIT": "Ver/Editar el Dataset",
"DMP-NEW-VERSION": "Nueva versiónd del PGD", "DMP-NEW-VERSION": "Nueva versiónd del PGD",
"DMP-CLONE": "Clonar el PGD", "DMP-CLONE": "Clonar el PGD",
@ -565,7 +566,7 @@
} }
}, },
"DATASET-OVERVIEW": { "DATASET-OVERVIEW": {
"DATASET-AUTHORS": "Descripciones del Dataset Autores", "DATASET-AUTHORS": "Descripciones del dataset autores",
"ERROR": { "ERROR": {
"DELETED-DATASET": "El Dataset solicitado está borrado", "DELETED-DATASET": "El Dataset solicitado está borrado",
"FORBIDEN-DATASET": "No tiene permiso para acceder a esto Dataset" "FORBIDEN-DATASET": "No tiene permiso para acceder a esto Dataset"

View File

@ -105,6 +105,7 @@
"LOGIN": "Σύνδεση", "LOGIN": "Σύνδεση",
"DMP-OVERVIEW": "Επισκόπηση Σχεδίου Διαχείρισης Δεδομένων", "DMP-OVERVIEW": "Επισκόπηση Σχεδίου Διαχείρισης Δεδομένων",
"DMP-EDIT": "Επεξεργασία Σχεδίου Διαχείρισης Δεδομένων", "DMP-EDIT": "Επεξεργασία Σχεδίου Διαχείρισης Δεδομένων",
"DATASET-OVERVIEW": "Επισκόπηση Συνόλου Δεδομένων",
"DATASET-EDIT": "Προβολή / Επεξεργασία Συνόλου Δεδομένων", "DATASET-EDIT": "Προβολή / Επεξεργασία Συνόλου Δεδομένων",
"DMP-NEW-VERSION": "Νέα έκδοση Σχεδίου Διαχείρισης Δεδομένων", "DMP-NEW-VERSION": "Νέα έκδοση Σχεδίου Διαχείρισης Δεδομένων",
"DMP-CLONE": "Κλωνοποίηση Σχεδίου Διαχείρισης Δεδομένων", "DMP-CLONE": "Κλωνοποίηση Σχεδίου Διαχείρισης Δεδομένων",
@ -566,7 +567,7 @@
} }
}, },
"DATASET-OVERVIEW": { "DATASET-OVERVIEW": {
"DATASET-AUTHORS": "Συγγραφείς Περιγραφής Δεδομένων", "DATASET-AUTHORS": "Συγγραφείς περιγραφής δεδομένων",
"ERROR": { "ERROR": {
"DELETED-DATASET": "H επιλεγμένη Περιγραφή Δεδομένων θα διαγραφεί", "DELETED-DATASET": "H επιλεγμένη Περιγραφή Δεδομένων θα διαγραφεί",
"FORBIDEN-DATASET": "Δεν επιτρέπεται η πρόσβαση σε αυτή την Περιγραφή Δεδομένων" "FORBIDEN-DATASET": "Δεν επιτρέπεται η πρόσβαση σε αυτή την Περιγραφή Δεδομένων"