minor changes in dmp-overview, dataset-overview & user-dialog components

This commit is contained in:
gpapavgeri 2020-07-15 18:18:16 +03:00
parent bac925a6b6
commit 3a2dcca4d3
9 changed files with 143 additions and 55 deletions

View File

@ -5,7 +5,7 @@ import { DmpOverviewModel } from '../dmp/dmp-overview';
export interface DatasetOverviewModel {
id: string;
label: string;
status: any;
status: number;
datasetTemplate: DatasetProfileModel;
users: any[];

View File

@ -12,8 +12,8 @@
<p class="col dataset-label p-0 ml-3 mb-0">{{ dataset.label }}</p>
</div>
<div class="row d-flex align-items-center mt-3 mb-4 label-txt">
<div *ngIf="isUserDatasetRelated()" class="d-flex">
<p class="ml-0 mr-3 mb-0 label2-txt">
<div *ngIf="isUserDatasetRelated()" class="d-flex mr-2">
<p class="ml-0 mb-0 label2-txt">
{{ roleDisplayFromList(dataset.users) }}
</p>
</div>
@ -33,12 +33,12 @@
<mat-icon class="status-icon">lock_outline</mat-icon>
{{'DMP-OVERVIEW.LOCKED' | translate}}
</div>
<div class="d-flex ml-2 mr-3">{{'GENERAL.STATUSES.EDIT' | translate}} :
<div class="d-flex ml-2 mr-2">{{'GENERAL.STATUSES.EDIT' | translate}} :
{{dataset.modified | date:"longDate"}}
</div>
<div class="d-flex ml-2 mr-4">
<div *ngIf="dataset.status" class="d-flex flex-row uppercase">
<mat-icon class="status-icon">check</mat-icon>
<mat-icon class="status-icon check-icon">check</mat-icon>
{{'TYPES.DATASET-STATUS.FINALISED' | translate}}
</div>
</div>
@ -49,12 +49,12 @@
matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button>
<button *ngIf="isDraftDataset(dataset) && isUserOwner" (click)="editClicked(dataset)"
<button *ngIf="isDraftDataset(dataset) && isUserOwner && !lockStatus" (click)="editClicked(dataset)"
mat-mini-fab class="mr-3 actions-btn"
matTooltip="{{'DMP-LISTING.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
<button *ngIf="isDraftDataset(dataset) && isUserOwner" (click)="deleteClicked()" mat-mini-fab
<button *ngIf="isUserOwner && !lockStatus" (click)="deleteClicked()" mat-mini-fab
class="mr-3 actions-btn" matTooltip="{{'DMP-LISTING.ACTIONS.DELETE' | translate}}"
matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">delete</mat-icon>
@ -91,17 +91,17 @@
</div>
<div class="col-md-4 col-lg-4 p-0">
<div class="frame mb-3 pt-4 pl-3 pr-5 pb-1">
<!-- <div *ngIf="!dataset.status && isDraftDataset(dataset) && isUserOwner">
<div *ngIf="!dataset.status && isDraftDataset(dataset) && isUserOwner && !lockStatus">
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dataset)">
<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-icon">check</mat-icon>
</button>
<p class="mb-0 pl-2 finalize-txt">{{ 'DMP-LISTING.ACTIONS.FINALIZE' | translate }}</p>
<p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.FINALIZE' | translate }}</p>
</div>
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center">
<hr class="hr-line">
</div>
</div> -->
</div>
<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">
<mat-icon class="mat-mini-fab-icon">open_in_new</mat-icon>
@ -109,6 +109,12 @@
<p class="mb-0 mr-0 pl-2 frame-txt" [matMenuTriggerFor]="exportMenu">
{{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}</p>
</div>
<div *ngIf="!dataset.public && showPublishButton(dataset) && isUserOwner && dataset.dmp.isPublic" 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">
<mat-icon class="mat-mini-fab-icon">public</mat-icon>
</button>
<p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.MAKE-PUBLIC' | translate }}</p>
</div>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(dataset.id)">
<i class="fa fa-file-pdf-o pr-2"></i>

View File

@ -29,6 +29,10 @@
color: #A7A7A7;
}
.check-icon {
font-weight: bold;
}
.account-icon {
font-size: 2.5em;
}
@ -52,7 +56,7 @@
.dmp-btn {
width: 35em;
height: 2.3em;
min-height: 2.3em;
background-color: #129D99;
border-radius: 4px;
flex-direction: row;
@ -76,15 +80,15 @@
.frame-btn {
border: 1px solid #212121;
color: black;
background: #FFFFFF;
}
.finalize-btn {
border: 1px solid #129D99;
color: #129D99;
border: 1px solid #F7DD72;
background: #F5DB71;
}
.frame-btn, .finalize-btn {
background: #FFFFFF;
box-shadow: 0px 2px 6px #00000029;
}
@ -177,6 +181,7 @@
overflow: hidden;
color: #FFFFFF;
opacity: 0.8;
text-align: left;
}
.doi-label {
@ -221,10 +226,6 @@
color: #000000;
}
.finalize-txt {
color: #129D99;
}
.frame-txt, .finalize-txt {
font-size: 0.75em;
font-weight: bold;

View File

@ -28,6 +28,9 @@ import { DatasetCopyDialogueComponent } from '../dataset-wizard/dataset-copy-dia
import { DmpService } from '@app/core/services/dmp/dmp.service';
import { ResearcherModel } from '@app/core/model/researcher/researcher';
import { LockService } from '@app/core/services/lock/lock.service';
import { DatasetsToBeFinalized } from '@app/core/model/dataset/datasets-toBeFinalized';
import { DatasetModel } from '@app/core/model/dataset/dataset';
import { DatasetWizardModel } from '@app/core/model/dataset/dataset-wizard';
@Component({
@ -38,7 +41,8 @@ import { LockService } from '@app/core/services/lock/lock.service';
export class DatasetOverviewComponent extends BaseComponent implements OnInit {
dataset: DatasetOverviewModel;
datasetWizardModel: DatasetWizardEditorModel;
datasetWizardEditorModel: DatasetWizardEditorModel;
datasetWizardModel: DatasetWizardModel;
isNew = true;
isFinalized = false;
isPublicView = true;
@ -87,10 +91,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
this.dataset = data;
this.getDmpResearchers();
this.getDmpUsers();
this.datasetWizardService.getSingle(this.dataset.id).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
});
this.getDatasetWizardModel(this.dataset.id);
this.checkLockStatus(this.dataset.id);
this.setIsUserOwner();
const breadCrumbs = [];
@ -116,10 +117,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
this.dataset = data;
this.getDmpResearchers();
this.getDmpUsers();
this.datasetWizardService.getSingle(this.dataset.id).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
});
this.getDatasetWizardModel(this.dataset.id);
this.checkLockStatus(this.dataset.id);
this.setIsUserOwner();
const breadCrumbs = [];
@ -138,6 +136,14 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
});
}
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);
@ -278,8 +284,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.onCallbackSuccess();
this.router.navigate(['/datasets']);
this.onDeleteCallbackSuccess();
},
error => this.onDeleteCallbackError(error)
);
@ -291,23 +296,33 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
this.router.navigate(['/plans/overview/' + dmpId]);
}
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);
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/datasets']);
}
onUpdateCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), 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;
}
getOrcidPathForResearcher(reference: string): string {
const path = this.getOrcidPath();
const userId = reference.split(':')[1];
return path + userId;
}
const path = this.getOrcidPath();
const userId = reference.split(':')[1];
return path + userId;
}
downloadPDF(id: string) {
this.datasetService.downloadPDF(id)
@ -378,7 +393,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
data: {
formControl: formControl,
datasetId: this.dataset.id,
datasetProfileId: this.datasetWizardModel.profile,
datasetProfileId: this.datasetWizardEditorModel.profile,
datasetProfileExist: false,
confirmButton: this.language.instant('DATASET-WIZARD.DIALOGUE.COPY'),
cancelButton: this.language.instant('DATASET-WIZARD.DIALOGUE.CANCEL')
@ -398,10 +413,9 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
return this.dmpService.updateUsers(this.dataset.dmp.id, this.users).pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.onCallbackSuccess();
this.reloadPage();
this.onUpdateCallbackSuccess();
},
error => this.onDeleteCallbackError(error)
error => this.onUpdateCallbackError(error)
);
}
@ -418,12 +432,65 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
if (result) {
const index = this.users.findIndex(x => x.id === user.id);
if (index > -1) {
this.users.splice(index, 1);
this.users.splice(index, 1);
}
this.updateUsers();
}
});
}
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();
});
}
});
}
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)
);
}
});
}
}

View File

@ -54,7 +54,7 @@
<button *ngIf="isDraftDmp(dmp) && isUserOwner && !lockStatus" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-LISTING.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
<button *ngIf="isDraftDmp(dmp) && isUserOwner && !lockStatus" (click)="deleteClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-LISTING.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<button *ngIf="isUserOwner && !lockStatus" (click)="deleteClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-LISTING.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">delete</mat-icon>
</button>
</div>
@ -132,7 +132,7 @@
<hr class="hr-line">
</div>
</div>
<div *ngIf="hasDoi(dmp) && isFinalizedDmp(dmp) && !this.isPublicView && isUserOwner" (click)="getDoi(dmp)" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<div *ngIf="isFinalizedDmp(dmp) && !this.isPublicView && isUserOwner" (click)="getDoi(dmp)" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">archive</mat-icon>
</button>
@ -145,7 +145,7 @@
<p class="mb-0 mr-0 pl-2 frame-txt" [matMenuTriggerFor]="exportMenu">
{{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}</p>
</div>
<div class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" *ngIf="isUserOwner && !lockStatus" (click)="newVersion(dmp.id, dmp.label)">
<div *ngIf="isUserOwner" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="newVersion(dmp.id, dmp.label)">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">add_to_photos</mat-icon>
</button>

View File

@ -30,14 +30,6 @@
// ********BUTTONS********
.version-btn {
// width: 6.7em;
height: 1.8em;
border: 1px solid #707070;
border-radius: 4px;
background-color: transparent;
}
.id-btn {
background: url("../../../../assets/images/NoPath.png") no-repeat center;
width: 1em;
@ -194,7 +186,7 @@
}
.doi-txt {
font-size: 0.8em;
font-size: 1em;
letter-spacing: 0.009em;
color: #7d7d7d;
width: 12em;
@ -202,6 +194,7 @@
overflow: hidden;
border: none;
padding: 0px;
background-color: transparent;
}
.doi-panel {
@ -303,6 +296,17 @@
::ng-deep .versions-select .mat-form-field-wrapper {
background-color: transparent !important;
padding-bottom: 0 !important;
width: 6.5rem;
}
::ng-deep .versions-select .mat-form-field-wrapper .mat-form-field-flex {
padding: 0 0.5rem 0 0.625rem;
margin-bottom: 0.2rem;
font-weight: 500;
}
::ng-deep mat-select .mat-select-arrow-wrapper {
vertical-align: bottom;
}
::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {

View File

@ -478,7 +478,10 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
if (result) {
this.dmpService.publish(dmpId)
.pipe(takeUntil(this._destroyed))
.subscribe(() => { this.hasPublishButton = false });
.subscribe(() => {
this.hasPublishButton = false;
this.reloadPage();
});
}
});
}

View File

@ -3,7 +3,7 @@
<div class="dropdown-options">
<mat-divider class="col-12 top-divider"></mat-divider>
<div class="col-12 pl-2">
<a mat-button class="profile mt-2 mb-2 pl-0">
<a class="profile email-btn mt-2 mb-2 pl-0">
<mat-icon class="check-icon">check</mat-icon>{{ data.user.email }}
</a>
</div>

View File

@ -19,6 +19,13 @@ $mat-card-header-size: 40px !default;
text-align: left;
}
.email-btn {
cursor: auto;
display: inline-block;
line-height: 2.25rem;
font-size: 0.875rem;
}
.dropdown-top {
width: 0rem;
border-bottom: 0.625rem solid #FFFFFF;