Fixes bug on editor in case of dataset is finalized but dmp not

This commit is contained in:
apapachristou 2020-08-06 13:50:28 +03:00
parent 9708a0c82d
commit 5e31820e49
12 changed files with 125 additions and 49 deletions

View File

@ -13,20 +13,22 @@
width: 2.5em;
height: 2.5em;
color: #212121;
background-color: #F7DD72;
background-color: #f7dd72;
}
.mat-mini-fab-icon, .status-icon {
.mat-mini-fab-icon,
.status-icon {
font-size: 1.2em;
}
.actions-btn:hover {
background-color: #129D99;
color: #FFFFFF;
.actions-btn:hover,
.finalize-btn:hover {
background-color: #129d99;
color: #ffffff;
}
.status-icon {
color: #A7A7A7;
color: #a7a7a7;
}
.check-icon {
@ -48,7 +50,7 @@
}
.id-btn {
background: url('../../../../assets/images/NoPath.png') no-repeat center;
background: url("../../../../assets/images/NoPath.png") no-repeat center;
width: 1em;
margin-right: 0.3em;
align-self: center;
@ -57,14 +59,15 @@
.dmp-btn {
width: 35em;
min-height: 2.3em;
background-color: #129D99;
background-color: #129d99;
border-radius: 4px;
flex-direction: row;
justify-content: space-between;
border: none;
}
.dmp-btn, .dmp-btn > mat-icon {
.dmp-btn,
.dmp-btn > mat-icon {
color: #ffffff;
opacity: 0.8;
}
@ -73,22 +76,23 @@
width: 31.6em;
padding: 0 1em;
background-color: #ffffff00;
color: #129D99;
color: #129d99;
font-weight: 700;
}
.frame-btn {
border: 1px solid #212121;
color: black;
background: #FFFFFF;
background: #ffffff;
}
.finalize-btn {
border: 1px solid #F7DD72;
background: #F5DB71;
// border: 1px solid #F7DD72;
background: #f5db71;
}
.frame-btn, .finalize-btn {
.frame-btn,
.finalize-btn {
box-shadow: 0px 2px 6px #00000029;
}
@ -100,18 +104,18 @@
margin-left: auto;
}
.invite-btn{
.invite-btn {
width: 9.4em;
height: 2.9em;
background: #FFFFFF;
box-shadow: 0px 3px 6px #1E202029;
background: #ffffff;
box-shadow: 0px 3px 6px #1e202029;
border: 2px solid #212121;
border-radius: 30px;
}
.account_btn {
background: white;
color: #D5D5D5;
color: #d5d5d5;
border: none;
height: 2.9em;
}
@ -121,7 +125,7 @@
.dataset-logo {
width: 6em;
height: 2.6em;
background: #F7DD72;
background: #f7dd72;
border-radius: 4px;
font-size: 0.875em;
// color: #212121;
@ -137,7 +141,8 @@
font-size: 1em;
}
.label-txt, .label2-txt {
.label-txt,
.label2-txt {
color: #848484;
font-weight: 400;
}
@ -155,7 +160,7 @@
font-size: 0.875em;
color: #008887;
padding-right: 0.5em;
align-self: center;;
align-self: center;
}
.header {
@ -164,7 +169,8 @@
margin-bottom: 0.5em;
}
.dataset-label, .header {
.dataset-label,
.header {
font-size: 1.25em;
color: #212121;
}
@ -179,7 +185,7 @@
.dmp-btn-label {
margin-right: 1em;
overflow: hidden;
color: #FFFFFF;
color: #ffffff;
opacity: 0.8;
text-align: left;
}
@ -194,7 +200,7 @@
.doi-txt {
font-size: 0.8em;
letter-spacing: 0.009em;
color: #7D7D7D;
color: #7d7d7d;
width: 12em;
height: 1em;
overflow: hidden;
@ -204,8 +210,8 @@
.doi-panel {
height: 3.5em;
background: #FAFAFA;
border: 1px solid #D1D1D1;
background: #fafafa;
border: 1px solid #d1d1d1;
border-radius: 4px;
flex-direction: row;
justify-content: space-between;
@ -216,7 +222,7 @@
}
.frame {
background: #FFFFFF;
background: #ffffff;
box-shadow: 0px 1px 5px #00000026;
border-radius: 4px;
overflow: hidden;
@ -226,7 +232,8 @@
color: #000000;
}
.frame-txt, .finalize-txt {
.frame-txt,
.finalize-txt {
font-size: 0.75em;
font-weight: bold;
letter-spacing: 0px;
@ -235,7 +242,7 @@
}
.hr-line {
border: 1px solid #DBDBDB;
border: 1px solid #dbdbdb;
// width: 274px;
// width: 17em;
width: 100%;
@ -257,22 +264,29 @@
.authors-role {
font-size: 0.875em;
color: #A8A8A8;
color: #a8a8a8;
height: 1.4em;
margin-bottom: 0px;
}
// ********CENTER ELEMENTS********
.mat-mini-fab, .mat-mini-fab-icon, .actions-btn,
.status-icon, .dataset-logo, .frame-btn, .finalize-btn {
.mat-mini-fab,
.mat-mini-fab-icon,
.actions-btn,
.status-icon,
.dataset-logo,
.frame-btn,
.finalize-btn {
display: flex;
justify-content: center;
align-items: center;
}
.dataset-label, .dmp-btn,
.doi-panel, .researcher {
.dataset-label,
.dmp-btn,
.doi-panel,
.researcher {
display: flex;
align-items: center;
}

View File

@ -52,8 +52,7 @@
</div>
</div>
<app-dataset-external-references-editor-component [formGroup]="formGroup" [viewOnly]="viewOnly"></app-dataset-external-references-editor-component>
<app-dataset-description [form]="formGroup.get('datasetProfileDefinition')" [datasetProfileId]="formGroup.get('profile').value">
</app-dataset-description>
<app-dataset-description [form]="formGroup.get('datasetProfileDefinition')" [datasetProfileId]="formGroup.get('profile').value"></app-dataset-description>
<!-- <app-dataset-description [form]="formGroup.get('datasetProfileDefinition')" [visibilityRules]="formGroup.get('datasetProfileDefinition').get('rules')" [datasetProfileId]="formGroup.get('profile').value">
</app-dataset-description> -->

View File

@ -89,7 +89,10 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
}
ngOnInit() {
if (this.datasetId) {
if (this.formGroup.get('status').value === 1) {
this.formGroup.disable();
}
if (this.datasetId) { // never gets in here
this.datasetWizardService.getSingle(this.datasetId)
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
@ -141,7 +144,7 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
tourId: 'only-dmp-tour',
useOrb: true,
steps: [
{
{
title: this.dmpText,
content: 'Step 1',
orientation: Orientation.Bottom,
@ -168,7 +171,7 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
this.setDashboardTourDmp(label);
console.log(this.dashboardTourDmp.steps[0].selector);
this.guidedTourService.startTour(this.dashboardTourDmp);
}
registerFormListeners() {

View File

@ -79,7 +79,9 @@
<li *ngIf="!isNewDataset" (click)="changeStep(2)" [ngClass]="{'active': this.step === 2}">{{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}}</li>
<li *ngFor="let dataset of datasets.controls; let i = index" (click)="changeStep(i + stepsBeforeDatasets, dataset)" [ngClass]="{'active-dataset': this.step === i + stepsBeforeDatasets}">
<div>{{'DMP-EDITOR.STEPPER.DATASET' | translate}}</div>
<div>{{'DMP-EDITOR.STEPPER.DATASET' | translate}}
<span *ngIf="dataset.value.status === 1"><mat-icon class="status-icon check-icon">check</mat-icon>{{'TYPES.DATASET-STATUS.FINALISED' | translate}}</span>
</div>
<ul class="dataset-list">
<li [ngClass]="{'active': this.step === i + stepsBeforeDatasets}">{{ dataset.get('label').value }} (8)</li>
</ul>
@ -108,6 +110,7 @@
<dataset-info *ngIf="!isNewDataset" [hidden]="this.step !== 2" [formGroup]="formGroup" [dmp]="dmp" [isPublic]="isPublic" [isFinalized]="isFinalized || lockStatus" [isUserOwner]="isUserOwner" [isNewDataset]="isNewDataset" (onFormChanged)="formChanged()"></dataset-info>
<dataset-info *ngIf="isNewDataset" [hidden]="this.step !== 1" [formGroup]="formGroup" [dmp]="dmp" [isPublic]="isPublic" [isFinalized]="isFinalized || lockStatus" [isUserOwner]="isUserOwner" [isNewDataset]="isNewDataset" (onFormChanged)="formChanged()"></dataset-info>
<div *ngFor="let dataset of datasets.controls; let i = index" [hidden]="this.step !== i + stepsBeforeDatasets">
<dataset-editor-details [formGroup]="dataset" [dmpId]="formGroup.get('id').value" (formChanged)="datasetFormChanged($event)"></dataset-editor-details>
</div>

View File

@ -376,6 +376,11 @@ a:hover {
white-space: nowrap;
}
.status-icon {
font-size: 1.2em;
color: #a7a7a7;
}
// ::ng-deep .mat-tab-labels {
// justify-content: space-between;
// }

View File

@ -9,30 +9,35 @@
<div class="heading">1.1 {{'DMP-EDITOR.FIELDS.NAME' | translate}}*</div>
<div class="hint">{{'DMP-EDITOR.MAIN-INFO.HINT' | translate}}</div>
<div class="title-form">
<mat-form-field appearance="outline">
<mat-form-field *ngIf="!isNewDataset">
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" required>
<mat-error *ngIf="formGroup.get('label').hasError('backendError')">
{{formGroup.get('label').getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.get('label').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field *ngIf="isNewDataset">
<app-single-auto-complete [required]="true" placeholder="{{'DATASET-EDITOR.FIELDS.SELECT-DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration"></app-single-auto-complete>
<!-- <app-single-auto-complete [required]="true" [formControl]="formGroup" placeholder="{{'DATASET-EDITOR.FIELDS.SELECT-DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration">
</app-single-auto-complete> -->
</mat-form-field>
</div>
</div>
</div>
<!-- Description field -->
<div class="row">
<div class="row" *ngIf="!isNewDataset">
<div class="col-12">
<div class="heading">1.2 {{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}</div>
<div class="hint">{{'DMP-EDITOR.MAIN-INFO.HINT' | translate}}</div>
<div class="description-form">
<mat-form-field appearance="outline">
<mat-form-field>
<textarea rows="3" matInput class="description-area" placeholder="{{'DMP-EDITOR.PLACEHOLDER.DESCRIPTION' | translate}}" formControlName="description"></textarea>
</mat-form-field>
</div>
</div>
</div>
<!-- Researchers field-->
<div class="row">
<div class="row" *ngIf="!isNewDataset">
<div class="col-12">
<div class="heading">1.3 {{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}</div>
<div class="hint">
@ -40,7 +45,7 @@
<div><span class="material-icons-outlined align-bottom">info</span> {{'DMP-EDITOR.MAIN-INFO.TYPING' | translate}}</div>
</div>
<div class="author-form">
<mat-form-field appearance="outline">
<mat-form-field>
<app-multiple-auto-complete [formControl]="formGroup.get('researchers')" placeholder="{{'DMP-EDITOR.PLACEHOLDER.RESEARCHERS' | translate}}" [configuration]="researchersAutoCompleteConfiguration">
</app-multiple-auto-complete>
<mat-error *ngIf="formGroup.get('researchers').hasError('backendError')">
@ -55,7 +60,7 @@
</div>
</div>
<!-- Organizations Field -->
<div class="row">
<div class="row" *ngIf="!isNewDataset">
<div class="col-12">
<div class="heading">1.4 {{'DMP-EDITOR.FIELDS.ORGANISATIONS' | translate}}</div>
<div class="hint">
@ -63,7 +68,7 @@
<div><span class="material-icons-outlined align-bottom">info</span> {{'DMP-EDITOR.MAIN-INFO.TYPING' | translate}}</div>
</div>
<div class="organizations-form">
<mat-form-field appearance="outline">
<mat-form-field>
<app-multiple-auto-complete [formControl]="formGroup.get('organisations')" placeholder="{{'DMP-EDITOR.PLACEHOLDER.ORGANIZATION' | translate}}" [configuration]="organisationsAutoCompleteConfiguration">
</app-multiple-auto-complete>
<mat-error *ngIf="formGroup.get('organisations').hasError('backendError')">

View File

@ -12,6 +12,12 @@ import { isNullOrUndefined } from 'util';
import { MatDialog } from '@angular/material';
import { AddOrganizationComponent } from '../add-organization/add-organization.component';
import { AddResearcherComponent } from '../add-researcher/add-researcher.component';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { DmpListingModel } from '@app/core/model/dmp/dmp-listing';
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DmpService } from '@app/core/services/dmp/dmp.service';
@Component({
selector: 'main-info',
@ -22,6 +28,7 @@ export class MainInfoComponent extends BaseComponent implements OnInit {
@Input() formGroup: FormGroup = null;
@Input() isNewVersion: boolean;
@Input() isNewDataset: boolean;
@Input() isUserOwner: boolean;
@Input() isClone: boolean;
@Output() onFormChanged: EventEmitter<any> = new EventEmitter();
@ -41,10 +48,19 @@ export class MainInfoComponent extends BaseComponent implements OnInit {
subtitleFn: (item) => item['tag'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE'))
};
dmpAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
filterFn: this.searchDmp.bind(this),
initialItems: (extraData) => this.searchDmp(''),
displayFn: (item) => this.getDatasetDisplay(item),
titleFn: (item) => item['label'],
subtitleFn: (item) => this.language.instant('DATASET-WIZARD.FIRST-STEP.SUB-TITLE') + new Date(item['creationTime']).toISOString()
};
constructor(
private language: TranslateService,
private configurationService: ConfigurationService,
private externalSourcesService: ExternalSourcesService,
private dmpService: DmpService,
private dialog: MatDialog
) {
super();
@ -136,4 +152,22 @@ export class MainInfoComponent extends BaseComponent implements OnInit {
}
});
}
searchDmp(query: string): Observable<DmpListingModel[]> {
const fields: Array<string> = new Array<string>();
fields.push('-created');
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
dmpDataTableRequest.criteria = new DmpCriteria();
dmpDataTableRequest.criteria.like = query;
dmpDataTableRequest.criteria.status = DmpStatus.Draft;
return this.dmpService.getPaged(dmpDataTableRequest, "autocomplete").pipe(map(x => x.data));
}
getDatasetDisplay(item: any): string {
// if (!this.isPublic) {
// return (item['status'] ? this.language.instant('TYPES.DATASET-STATUS.FINALISED').toUpperCase() : this.language.instant('TYPES.DATASET-STATUS.DRAFT').toUpperCase()) + ': ' + item['label'];
// }
// else { return item['label']; }
return item['label'] ? item['label'] : null;
}
}

View File

@ -689,7 +689,9 @@
"TITLE": {
"NEW": "Neuer Datenmanagementplan",
"EDIT": "Bearbeiten",
"SUBTITLE": "DOI"
"SUBTITLE": "DOI",
"EDIT-DATASET": "Editing Dataset",
"CREATE-DATASET": "Creating Dataset Description"
},
"FIELDS": {
"NAME": "Titel",
@ -822,6 +824,7 @@
"PROFILE": "Vorlage",
"URI": "URI",
"DMP": "DMP",
"SELECT-DMP": "Select DMP",
"DATAREPOSITORIES": "Datenrepositorien",
"REGISTRIES": "Verzeichnisse",
"SERVICES": "Dienste",

View File

@ -760,6 +760,7 @@
"EDIT": "Edit",
"EDIT-DMP": "Editing DMP",
"EDIT-DATASET": "Editing Dataset",
"CREATE-DATASET": "Creating Dataset Description",
"SUBTITLE": "DOI"
},
"FIELDS": {
@ -944,6 +945,7 @@
"PROFILE": "Template",
"URI": "Uri",
"DMP": "DMP",
"SELECT-DMP": "Select DMP",
"DATAREPOSITORIES": "Data Repositories",
"REGISTRIES": "Registries",
"SERVICES": "Services",

View File

@ -754,6 +754,7 @@
"EDIT": "Editar",
"EDIT-DMP": "Editing DMP",
"EDIT-DATASET": "Editing Dataset",
"CREATE-DATASET": "Creating Dataset Description",
"SUBTITLE": "DOI"
},
"FIELDS": {
@ -936,6 +937,7 @@
"PROFILE": "Plantilla",
"URI": "Uri",
"DMP": "PGD",
"SELECT-DMP": "Select DMP",
"DATAREPOSITORIES": "Repositorios de Datos",
"REGISTRIES": "Registros",
"SERVICES": "Servicios",

View File

@ -928,6 +928,8 @@
"TITLE": {
"NEW": "Νέο Σχέδιο Διαχείρισης Δεδομένων",
"EDIT": "Επεξεργασία",
"EDIT-DATASET": "Editing Dataset",
"CREATE-DATASET": "Creating Dataset Description",
"INTRO": "A Data Management Plan (DMP) consist of your Data Management Plans closer to where they are generated, analysed and stored. argos is an open, extensible, collaborative tool supporting Open and FAIR Data Management Plans."
},
"FIELDS": {
@ -937,6 +939,7 @@
"PROFILE": "Template",
"URI": "Uri",
"DMP": "Σχέδιο Διαχείρισης Δεδομένων",
"SELECT-DMP": "Select DMP",
"DATAREPOSITORIES": "Αποθετήρια Δεδομένων",
"REGISTRIES": "Κατάλογοι",
"SERVICES": "Υπηρεσίες",

View File

@ -813,7 +813,9 @@
"DATASET-EDITOR": {
"TITLE": {
"NEW": "Yeni Veri Yönetim Planı",
"EDIT": "Düzenle"
"EDIT": "Düzenle",
"EDIT-DATASET": "Editing Dataset",
"CREATE-DATASET": "Creating Dataset Description"
},
"FIELDS": {
"NAME": "Veriseti Tanımının Adı",
@ -821,6 +823,7 @@
"PROFILE": "Şablon",
"URI": "Uri",
"DMP": "VYP",
"SELECT-DMP": "Select DMP",
"DATAREPOSITORIES": "Veri Deposu",
"REGISTRIES": "Kayıılar",
"SERVICES": "Hizmetler",