dmp finalizatiion popup
This commit is contained in:
parent
ea3b1b1558
commit
dfd2f3eeff
|
@ -1,6 +1,6 @@
|
|||
deposit:
|
||||
sources:
|
||||
- url: http://localhost:8082
|
||||
- url: http://dev04.local.cite.gr:55330/zenodo
|
||||
repositoryId: zenodo
|
||||
pdfTransformerId: docx-file-transformer
|
||||
rdaTransformerId: rda-file-transformer
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
transformer:
|
||||
sources:
|
||||
- url: http://localhost:8084
|
||||
- url: http://dev04.local.cite.gr:55330/file/docx
|
||||
transformerId: docx-file-transformer
|
||||
codes: [ docx, pdf ]
|
||||
issuer-url: ${IDP_ISSUER_URI_TOKEN:}
|
||||
client-id: ${IDP_APIKEY_CLIENT_ID:}
|
||||
client-secret: ${IDP_APIKEY_CLIENT_SECRET:}
|
||||
scope: ${IDP_APIKEY_SCOPE:}
|
||||
- url: http://localhost:8086
|
||||
- url: http://dev04.local.cite.gr:55330/file/rdajson
|
||||
transformerId: rda-file-transformer
|
||||
codes: [ json ]
|
||||
issuer-url: ${IDP_ISSUER_URI_TOKEN:}
|
||||
|
|
|
@ -8,7 +8,7 @@ import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/sing
|
|||
import { QueryResult } from '@common/model/query-result';
|
||||
import { FilterService } from '@common/modules/text-filter/filter-service';
|
||||
import { Guid } from '@common/types/guid';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { Observable, of, throwError } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { nameof } from 'ts-simple-nameof';
|
||||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
|
@ -16,6 +16,7 @@ import { BaseHttpV2Service } from '../http/base-http-v2.service';
|
|||
import { FileFormat } from '@app/core/model/file/file-format.model';
|
||||
import { BaseHttpParams } from '@common/http/base-http-params';
|
||||
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
||||
import { DescriptionValidationResult } from '@app/ui/dmp/dmp-finalize-dialog/dmp-finalize-dialog.component';
|
||||
|
||||
@Injectable()
|
||||
export class DescriptionService {
|
||||
|
@ -90,6 +91,10 @@ export class DescriptionService {
|
|||
catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
public validate(descriptionIds: Guid[]): Observable<DescriptionValidationResult[]> {
|
||||
return of(new Array<DescriptionValidationResult>());
|
||||
}
|
||||
|
||||
// public downloadPDF(id: string): Observable<HttpResponse<Blob>> {
|
||||
// return this.httpClient.get(`${this.apiBase}/${id}/export/Pdf`, { responseType: 'blob', observe: 'response', headers: this.headers });
|
||||
// }
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
<div class="row d-flex flex-row">
|
||||
<div mat-dialog-title class="col-auto">{{ 'DMP-FINALISE-DIALOG.TITLE' | translate }}</div>
|
||||
<div class="col-auto close-btn ml-auto" (click)="close()">
|
||||
<mat-icon>close</mat-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div mat-dialog-content class="pt-2 pb-2">
|
||||
<div class="container">
|
||||
<mat-accordion [multi]="true">
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'DMP-FINALISE-DIALOG.DMP' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="dmp-title">
|
||||
{{ dmp.label }}
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
{{ dmp.description }}
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel [expanded]="true">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'DMP-FINALISE-DIALOG.DESCRPIPTIONS' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description></mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="dmp.descriptions.length > 0">
|
||||
<div *ngFor="let description of dmp.descriptions" class="row pl-3 descriptions">
|
||||
<mat-icon *ngIf="description.status == descriptionStatusEnum.Draft" class="col-1 draft-bookmark">bookmark</mat-icon>
|
||||
<mat-icon *ngIf="description.status == descriptionStatusEnum.Finalized" class="col-1 finalized-bookmark">bookmark</mat-icon>
|
||||
<h4 *ngIf="description.status == descriptionStatusEnum.Draft" class="col-11 ml-auto mt-1 mb-4">
|
||||
<span>{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}
|
||||
<ng-container *ngIf="!isDescriptionValid(description.id)">
|
||||
({{'DMP-FINALISE-DIALOG.INVALID' | translate}})
|
||||
</ng-container>
|
||||
:</span>
|
||||
{{ description.label }}
|
||||
<i *ngIf="isDescriptionValid(description.id)" class="fa fa-spinner fa-spin" ></i>
|
||||
</h4>
|
||||
<h4 *ngIf="description.status == descriptionStatusEnum.Finalized" class="col-11 ml-auto mt-1 mb-4">{{ description.label }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="dmp.descriptions.length === 0" class="emptyList">{{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }} </div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
<div *ngIf="validDraftDescriptions.length > 0" class="pt-4 pb-2">
|
||||
<h4 class="pl-2">{{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}</h4>
|
||||
<mat-selection-list [(ngModel)]="descriptionsToBeFinalized">
|
||||
<div class="styleBorder" *ngFor="let description of validDraftDescriptions">
|
||||
<mat-list-option [value]='description.id' [disabled]="!isDescriptionValid(description.id)">
|
||||
<span class="text-truncate" [matTooltip]="description.label">{{ description.label }}</span>
|
||||
</mat-list-option>
|
||||
</div>
|
||||
</mat-selection-list>
|
||||
</div>
|
||||
<mat-error *ngIf="getFinalizedDescriptions().length === 0 && descriptionsToBeFinalized.length === 0">
|
||||
{{'DMP-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DESCRPIPTION-FINALISED' | translate}}
|
||||
</mat-error>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="getFinalizedDescriptions().length != 0">
|
||||
<div class="row pt-2 pb-2 pl-4 pr-4">
|
||||
{{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }}
|
||||
</div>
|
||||
<div *ngIf="dmp.accessType == dmpAccessTypeEnum.Public" class="row pl-4 pr-4">
|
||||
{{ 'DMP-FINALISE-DIALOG.PUBLIC-DMP-MESSAGE' | translate }}
|
||||
</div>
|
||||
<div *ngIf="dmp.accessType == dmpAccessTypeEnum.Restricted" class="row pl-4 pr-4">
|
||||
{{ 'DMP-FINALISE-DIALOG.RESTRICTED-DMP-MESSAGE' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions class="d-flex justify-content-end mb-1">
|
||||
<div class="col-auto">
|
||||
<button mat-raised-button cdkFocusInitial (click)="close()" class="cancel-btn">{{ 'DMP-FINALISE-DIALOG.ACTIONS.CANCEL' | translate }}</button>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button mat-raised-button [disabled]="getFinalizedDescriptions().length === 0 && descriptionsToBeFinalized.length === 0" class="submit-btn" (click)="onSubmit()">{{ 'DMP-FINALISE-DIALOG.ACTIONS.SUBMIT' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
|
@ -25,7 +25,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.dataset-card {
|
||||
.description-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
|
@ -65,7 +65,7 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
.datasets span {
|
||||
.descriptions span {
|
||||
color: var(--primary-color-3);
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Router } from '@angular/router';
|
||||
import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
||||
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
||||
import { Dmp } from '@app/core/model/dmp/dmp';
|
||||
import { DescriptionService } from '@app/core/services/description/description.service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { Guid } from '@common/types/guid';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-finalize-dialog-component',
|
||||
templateUrl: 'dmp-finalize-dialog.component.html',
|
||||
styleUrls: ['./dmp-finalize-dialog.component.scss']
|
||||
})
|
||||
export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit {
|
||||
|
||||
dmp: Dmp;
|
||||
dmpAccessTypeEnum = DmpAccessType;
|
||||
descriptionStatusEnum = DescriptionStatus;
|
||||
descriptionValidationOutputEnum = DescriptionValidationOutput;
|
||||
validationResults: DescriptionValidationResult[] = [];
|
||||
descriptionsToBeFinalized: Guid[] = [];
|
||||
|
||||
constructor(
|
||||
public router: Router,
|
||||
public dialogRef: MatDialogRef<DmpFinalizeDialogComponent>,
|
||||
public descriptionService: DescriptionService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {
|
||||
super();
|
||||
this.dmp = data.dmp;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.validateDescriptions(this.dmp);
|
||||
}
|
||||
|
||||
isDescriptionValid(descriptionId: Guid): boolean {
|
||||
return this.validationResults.find(x => x.descriptionId == descriptionId)?.result === DescriptionValidationOutput.Valid;
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.dialogRef.close(this.descriptionsToBeFinalized);
|
||||
}
|
||||
|
||||
getFinalizedDescriptions() {
|
||||
return this.dmp.descriptions.filter(x => x.status === DescriptionStatus.Finalized);
|
||||
}
|
||||
|
||||
close() {
|
||||
this.dialogRef.close(null);
|
||||
}
|
||||
|
||||
validateDescriptions(dmp: Dmp) {
|
||||
if (!dmp.descriptions.some(x => x.status == DescriptionStatus.Draft)) return;
|
||||
this.descriptionService.validate(dmp.descriptions.filter(x => x.status == DescriptionStatus.Draft).map(x => x.id)).pipe(takeUntil(this._destroyed),
|
||||
).subscribe(result => {
|
||||
this.validationResults = result;
|
||||
});
|
||||
}
|
||||
|
||||
get validDraftDescriptions() {
|
||||
return this.dmp.descriptions.filter(x => this.validationResults.some(y => y.descriptionId == x.id && y.result == DescriptionValidationOutput.Valid));
|
||||
}
|
||||
}
|
||||
|
||||
export interface DescriptionValidationResult {
|
||||
descriptionId: Guid;
|
||||
result: DescriptionValidationOutput;
|
||||
}
|
||||
|
||||
export enum DescriptionValidationOutput {
|
||||
Valid = 1,
|
||||
Invalid = 2
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module';
|
||||
import { RichTextEditorModule } from "@app/library/rich-text-editor/rich-text-editor.module";
|
||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
||||
import { DmpFinalizeDialogComponent } from './dmp-finalize-dialog.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonUiModule, FormsModule, ReactiveFormsModule, AutoCompleteModule, RichTextEditorModule],
|
||||
declarations: [DmpFinalizeDialogComponent],
|
||||
exports: [DmpFinalizeDialogComponent]
|
||||
})
|
||||
export class DmpFinalizeDialogModule {
|
||||
constructor() { }
|
||||
}
|
|
@ -1,188 +0,0 @@
|
|||
<div class="row d-flex flex-row">
|
||||
<div mat-dialog-title class="col-auto">{{ data.message }}</div>
|
||||
<div class="col-auto close-btn ml-auto" (click)="close()">
|
||||
<mat-icon>close</mat-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div mat-dialog-content class="pt-2 pb-2">
|
||||
<div class="container">
|
||||
<mat-accordion [multi]="true">
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'DMP-FINALISE-DIALOG.DMP' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="dmp-title">
|
||||
{{ inputModel.dmpLabel }}
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
{{ inputModel.dmpDescription }}
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel [expanded]="true">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'DMP-FINALISE-DIALOG.DATASETS' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description></mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="inputModel.datasets.length > 0">
|
||||
<div *ngFor="let dataset of inputModel.datasets" class="row pl-3 datasets">
|
||||
<mat-icon *ngIf="dataset.status == 0" class="col-1 draft-bookmark">bookmark</mat-icon>
|
||||
<mat-icon *ngIf="dataset.status != 0" class="col-1 finalized-bookmark">bookmark</mat-icon>
|
||||
<h4 *ngIf="dataset.status == 0" class="col-11 ml-auto mt-1 mb-4">
|
||||
<span>{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}
|
||||
<ng-container *ngIf="datasetLookupStatus[dataset.id] && (datasetLookupStatus[dataset.id] === datasetLookupStatusEnum.INVALID)">
|
||||
({{'DMP-FINALISE-DIALOG.INVALID' | translate}})
|
||||
</ng-container>
|
||||
:</span>
|
||||
{{ dataset.label }}
|
||||
<i *ngIf="(datasetLookupStatus[dataset.id] != datasetLookupStatusEnum.INVALID) && (datasetLookupStatus[dataset.id] != datasetLookupStatusEnum.VALID) " class="fa fa-spinner fa-spin" ></i>
|
||||
</h4>
|
||||
<h4 *ngIf="dataset.status != 0" class="col-11 ml-auto mt-1 mb-4">{{ dataset.label }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="inputModel.datasets.length === 0" class="emptyList">{{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }} </div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
<div *ngIf="validDrafts.length > 0" class="pt-4 pb-2">
|
||||
<h4 class="pl-2">{{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}</h4>
|
||||
<mat-selection-list #datasetsDraftSelectionList [(ngModel)]="outputModel.datasetsToBeFinalized">
|
||||
<div class="styleBorder" *ngFor="let dataset of validDrafts">
|
||||
<mat-list-option [value]='dataset.id' [disabled]="!datasetLookupStatus[dataset.id] || (datasetLookupStatus[dataset.id] != datasetLookupStatusEnum.VALID)">
|
||||
<span class="text-truncate" [matTooltip]="dataset.label">{{ dataset.label }}</span>
|
||||
</mat-list-option>
|
||||
</div>
|
||||
</mat-selection-list>
|
||||
</div>
|
||||
<mat-error *ngIf="getFinalizedDatasets().length === 0 && outputModel.datasetsToBeFinalized.length === 0">
|
||||
{{'DMP-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DATASET-FINALISED' | translate}}
|
||||
</mat-error>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="getFinalizedDatasets().length != 0">
|
||||
<div class="row pt-2 pb-2 pl-4 pr-4">
|
||||
{{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }}
|
||||
</div>
|
||||
<div *ngIf="inputModel.accessRights" class="row pl-4 pr-4">
|
||||
{{ 'DMP-FINALISE-DIALOG.AFTER-FINALIZATION-PUBLISH' | translate }}
|
||||
</div>
|
||||
<div *ngIf="!inputModel.accessRights" class="row pl-4 pr-4">
|
||||
{{ 'DMP-FINALISE-DIALOG.AFTER-FINALIZATION-RESTRICT-ACCESS' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions class="d-flex justify-content-end mb-1">
|
||||
<div class="col-auto">
|
||||
<button mat-raised-button cdkFocusInitial (click)="close()" class="cancel-btn">{{ data.cancelButton }}</button>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button mat-raised-button [disabled]="getFinalizedDatasets().length === 0 && outputModel.datasetsToBeFinalized.length === 0" class="submit-btn" (click)="onSubmit()">{{ data.confirmButton }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <form *ngIf="formGroup" (ngSubmit)="onSubmit()">
|
||||
<div class="row d-flex flex-row">
|
||||
<div mat-dialog-title class="col-auto">{{ data.message }}</div>
|
||||
<div class="col-auto close-btn ml-auto" (click)="close()">
|
||||
<mat-icon>close</mat-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div mat-dialog-content *ngIf="datasetsFinalized && datasetsDraft" class="pt-2 pb-2">
|
||||
<mat-accordion [multi]="true">
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'DMP-FINALISE-DIALOG.DMP' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="dmp-title">
|
||||
{{ formGroup.get('label').value }}
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
{{ formGroup.get('description').value }}
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel [expanded]="true">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'DMP-FINALISE-DIALOG.DATASETS' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description></mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="allDatasets.length > 0">
|
||||
<div *ngFor="let dataset of allDatasets" class="row pl-3 datasets">
|
||||
<mat-icon *ngIf="isDraft(dataset)" class="col-1 draft-bookmark">bookmark</mat-icon>
|
||||
<mat-icon *ngIf="!isDraft(dataset)" class="col-1 finalized-bookmark">bookmark</mat-icon>
|
||||
<h4 *ngIf="isDraft(dataset)" class="col-11 ml-auto mt-1 mb-4">
|
||||
<span>{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}:</span>
|
||||
{{ dataset.label }}</h4>
|
||||
<h4 *ngIf="!isDraft(dataset)" class="col-11 ml-auto mt-1 mb-4">{{ dataset.label }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="allDatasets.length === 0" class="emptyList">{{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }} </div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
<div *ngIf="datasetsDraft.length > 0" class="pt-4 pb-2">
|
||||
<h4 class="pl-2">{{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}</h4>
|
||||
<mat-selection-list #datasetsDraftSelectionList [ngModel]="outputModel.datasetToBeFinalized">
|
||||
<div class="styleBorder" *ngFor="let dataset of datasetsDraft">
|
||||
<mat-list-option [value]='dataset.id'>
|
||||
{{ dataset.label }}
|
||||
</mat-list-option>
|
||||
</div>
|
||||
</mat-selection-list>
|
||||
</div>
|
||||
<mat-error *ngIf="datasetsFinalized.length == 0">{{'DMP-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DATASET-FINALISED'
|
||||
| translate}}</mat-error>
|
||||
</div>
|
||||
|
||||
<div mat-dialog-content *ngIf="isWizard" class="pt-2 pb-2">
|
||||
<mat-accordion [multi]="true">
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'DMP-FINALISE-DIALOG.DMP' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="dmp-title">
|
||||
{{ formGroup.get('dmp')?.get('label')?.value }}
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
{{ formGroup.get('dmp')?.get('description')?.value }}
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel [expanded]="true">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'DMP-FINALISE-DIALOG.DATASETS' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description></mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="allDatasetLabels.length > 0">
|
||||
<div *ngFor="let label of allDatasetLabels" class="row pl-3 datasets">
|
||||
<mat-icon class="col-1 finalized-bookmark">bookmark</mat-icon>
|
||||
<h4 class="col-11 ml-auto mt-1 mb-4">{{ label }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="allDatasetLabels.length === 0" class="emptyList"> {{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }}
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
</div>
|
||||
|
||||
<div *ngIf="datasetsFinalized && datasetsFinalized.length != 0">
|
||||
<div class="row pt-2 pb-2 pl-4 pr-4">
|
||||
{{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }}
|
||||
</div>
|
||||
<div class="row pl-4 pr-4">
|
||||
{{ 'DMP-FINALISE-DIALOG.AFTER-FINALIZATION' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions class="d-flex justify-content-end">
|
||||
<div class="col-auto">
|
||||
<button mat-raised-button class="confirm" (click)="onSubmit()">{{ data.confirmButton }}</button>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button mat-raised-button cdkFocusInitial (click)="close()" class="cancel">{{ data.cancelButton }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form> -->
|
|
@ -1,113 +0,0 @@
|
|||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Router } from '@angular/router';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { catchError, map, takeUntil } from 'rxjs/operators';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-finalize-dialog-component',
|
||||
templateUrl: 'dmp-finalize-dialog.component.html',
|
||||
styleUrls: ['./dmp-finalize-dialog.component.scss']
|
||||
})
|
||||
export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit {
|
||||
|
||||
inputModel: DmpFinalizeDialogInput;
|
||||
outputModel: DmpFinalizeDialogOutput;
|
||||
|
||||
protected datasetLookupStatus:DatasetStatusLookup[] = [];
|
||||
protected datasetLookupStatusEnum = DatasetStatusLookup;
|
||||
constructor(
|
||||
public router: Router,
|
||||
public dialogRef: MatDialogRef<DmpFinalizeDialogComponent>,
|
||||
public datasetService: DatasetService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {
|
||||
super();
|
||||
this.inputModel = data['dialogInputModel'];
|
||||
this.outputModel = { datasetsToBeFinalized: [] };
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.inputModel.datasets.forEach(ds=>{
|
||||
|
||||
this.validateDataset(ds.id).subscribe(_=>{
|
||||
console.log('response', _);
|
||||
});
|
||||
})
|
||||
|
||||
const drafts = this.getDraftDatasets();
|
||||
|
||||
drafts.forEach(draft=>{
|
||||
this.datasetLookupStatus[draft.id] == DatasetStatusLookup.PENDING_VALIDATION;
|
||||
this.validateDataset(draft.id)
|
||||
.subscribe(isValid=>{
|
||||
if(isValid){
|
||||
this.datasetLookupStatus[draft.id] = DatasetStatusLookup.VALID;
|
||||
}else{
|
||||
this.datasetLookupStatus[draft.id] = DatasetStatusLookup.INVALID;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.dialogRef.close(this.outputModel);
|
||||
}
|
||||
|
||||
getFinalizedDatasets() {
|
||||
return this.inputModel.datasets.filter(x => x.status === DatasetStatus.Finalized);
|
||||
}
|
||||
|
||||
getDraftDatasets() {
|
||||
return this.inputModel.datasets.filter(x => x.status === DatasetStatus.Draft);
|
||||
}
|
||||
|
||||
close() {
|
||||
this.dialogRef.close({ cancelled: true } as DmpFinalizeDialogOutput);
|
||||
}
|
||||
|
||||
validateDataset(datasetId: string) : Observable<boolean>{
|
||||
return this.datasetService
|
||||
.validateDataset(datasetId)
|
||||
.pipe(
|
||||
takeUntil(this._destroyed),
|
||||
map(_=>{
|
||||
return true
|
||||
}),
|
||||
catchError(error=>{
|
||||
return of(false);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
get validDrafts(){
|
||||
return this.getDraftDatasets().filter(x=> this.datasetLookupStatus[x.id] && (this.datasetLookupStatus[x.id] == DatasetStatusLookup.VALID));
|
||||
}
|
||||
}
|
||||
|
||||
export interface DmpFinalizeDialogInput {
|
||||
dmpLabel: string;
|
||||
dmpDescription: string;
|
||||
datasets: DmpFinalizeDialogDataset[];
|
||||
accessRights: boolean;
|
||||
}
|
||||
|
||||
export interface DmpFinalizeDialogDataset {
|
||||
label: string;
|
||||
id?: string;
|
||||
status: DatasetStatus;
|
||||
}
|
||||
|
||||
export interface DmpFinalizeDialogOutput {
|
||||
cancelled?: boolean;
|
||||
datasetsToBeFinalized?: string[];
|
||||
}
|
||||
enum DatasetStatusLookup{
|
||||
VALID = "VALID",
|
||||
INVALID = "INVALID",
|
||||
PENDING_VALIDATION = "PENDING"
|
||||
}
|
|
@ -44,6 +44,7 @@ import { NewVersionDmpDialogComponent } from '../new-version-dialog/dmp-new-vers
|
|||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { DmpFinalizeDialogComponent } from '../dmp-finalize-dialog/dmp-finalize-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-overview',
|
||||
|
@ -493,69 +494,27 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
finalize() {
|
||||
//TODO: add this
|
||||
// const extraProperties = new ExtraPropertiesFormModel();
|
||||
// this.dmpService.getSingle(this.dmp.id).pipe(map(data => data as Dmp))
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(data => {
|
||||
const dialogRef = this.dialog.open(DmpFinalizeDialogComponent, {
|
||||
maxWidth: '500px',
|
||||
restoreFocus: false,
|
||||
autoFocus: false,
|
||||
data: {
|
||||
dmp: this.dmp
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((descriptionsToBeFinalized: Guid[]) => {
|
||||
if (descriptionsToBeFinalized && descriptionsToBeFinalized.length > 0) {
|
||||
|
||||
// if (!isNullOrUndefined(data.extraProperties)) {
|
||||
// extraProperties.fromModel(data.extraProperties);
|
||||
// }
|
||||
// const dialogInputModel: DmpFinalizeDialogInput = {
|
||||
// dmpLabel: this.dmp.label,
|
||||
// dmpDescription: this.dmp.description,
|
||||
// descriptions: this.dmp.descriptions.map(x => {
|
||||
// return { label: x.label, id: x.id, status: x.status }
|
||||
// }),
|
||||
// accessRights: extraProperties.visible
|
||||
// }
|
||||
|
||||
// const dialogRef = this.dialog.open(DmpFinalizeDialogComponent, {
|
||||
// maxWidth: '500px',
|
||||
// restoreFocus: false,
|
||||
// autoFocus: false,
|
||||
// data: {
|
||||
// dialogInputModel: dialogInputModel,
|
||||
// message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'),
|
||||
// confirmButton: this.language.instant('DMP-FINALISE-DIALOG.SUBMIT'),
|
||||
// cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
||||
// }
|
||||
// });
|
||||
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: DmpFinalizeDialogOutput) => {
|
||||
// if (result && !result.cancelled) {
|
||||
// this.checkIfAnyProfileIsUsedLessThanMin(data).subscribe(checked => {
|
||||
// if (!checked) {
|
||||
// var descriptionsToBeFinalized: DescriptionsToBeFinalized = {
|
||||
// uuids: result.descriptionsToBeFinalized
|
||||
// };
|
||||
// this.dmpService.finalize(descriptionsToBeFinalized, this.dmp.id)
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(
|
||||
// complete => {
|
||||
// if (extraProperties.visible) {
|
||||
// //this.publish(this.dmp.id);
|
||||
// this.dmpService.publish(this.dmp.id)
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(() => {
|
||||
// //this.hasPublishButton = false;
|
||||
// this.dmp.status = DmpStatus.Finalized;
|
||||
// this.onUpdateCallbackSuccess();
|
||||
// });
|
||||
// }
|
||||
// else {
|
||||
// this.dmp.status = DmpStatus.Finalized;
|
||||
// this.onUpdateCallbackSuccess();
|
||||
// }
|
||||
|
||||
// },
|
||||
// error => this.onUpdateCallbackError(error)
|
||||
// );
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// });
|
||||
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import { CommonFormsModule } from '@common/forms/common-forms.module';
|
|||
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
|
||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
||||
import { NgDialogAnimationService } from 'ng-dialog-animation';
|
||||
import { DmpFinalizeDialogModule } from '../dmp-finalize-dialog/dmp-finalize-dialog.module';
|
||||
import { DmpOverviewRoutingModule } from './dmp-overview.routing';
|
||||
|
||||
@NgModule({
|
||||
|
@ -16,7 +17,8 @@ import { DmpOverviewRoutingModule } from './dmp-overview.routing';
|
|||
ConfirmationDialogModule,
|
||||
FormattingModule,
|
||||
AutoCompleteModule,
|
||||
DmpOverviewRoutingModule
|
||||
DmpOverviewRoutingModule,
|
||||
DmpFinalizeDialogModule
|
||||
],
|
||||
declarations: [
|
||||
DmpOverviewComponent,
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormArray, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
|
||||
import { DmpUserType } from '@app/core/common/enum/dmp-user-type';
|
||||
import { DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { UserService } from '@app/core/services/user/user.service';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { DmpEditorModel, DmpUserEditorModel } from '../dmp-editor-blueprint/dmp-editor.model';
|
||||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
import { DmpUserType } from '@app/core/common/enum/dmp-user-type';
|
||||
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
|
||||
import { UserService } from '@app/core/services/user/user.service';
|
||||
import { DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { DmpEditorModel, DmpUserEditorModel } from '../dmp-editor-blueprint/dmp-editor.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-field-component',
|
||||
|
|
|
@ -63,13 +63,13 @@
|
|||
</div>
|
||||
</mat-menu>
|
||||
|
||||
<button mat-icon-button (click)="toggleMode()" *ngIf="(listItemTemplate || cardItemTemplate) && !hideModeSelection" >
|
||||
<!-- <button mat-icon-button (click)="toggleMode()" *ngIf="(listItemTemplate || cardItemTemplate) && !hideModeSelection" >
|
||||
<ng-container [ngSwitch]="mode">
|
||||
<mat-icon *ngSwitchCase="HybridListingMode.List">table_view</mat-icon>
|
||||
<mat-icon *ngSwitchCase="HybridListingMode.Table">list</mat-icon>
|
||||
<mat-icon *ngSwitchCase="HybridListingMode.Card">table_view</mat-icon>
|
||||
</ng-container>
|
||||
</button>
|
||||
</button> -->
|
||||
|
||||
<ng-content select="[download-listing-report]" />
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<button mat-button [matMenuTriggerFor]="settingsMenu">
|
||||
<!-- <button mat-button [matMenuTriggerFor]="settingsMenu">
|
||||
|
||||
|
||||
<ng-container *ngIf="currentUserSetting">
|
||||
|
@ -40,4 +40,4 @@
|
|||
</button>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</mat-menu>
|
||||
</mat-menu> -->
|
||||
|
|
Loading…
Reference in New Issue