rename dmp to plan frontend changes
This commit is contained in:
parent
d0fccbfcd2
commit
fe26af8055
|
@ -252,7 +252,7 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||
return this.authentication.currentAccountIsAuthenticated();
|
||||
}
|
||||
|
||||
goToDMPs() { //not used
|
||||
goToPlans() { //not used
|
||||
this.router.navigate(['/plans'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@ export enum ResponseErrorCode {
|
|||
DescriptionTemplateNewVersionConflict = 113,
|
||||
DescriptionTemplateIsNotFinalized = 114,
|
||||
MultipleDescriptionTemplateVersionsNotSupported = 115,
|
||||
DmpNewVersionConflict = 116,
|
||||
DmpIsNotFinalized = 117,
|
||||
MultipleDmpVersionsNotSupported = 118,
|
||||
DmpIsFinalized = 119,
|
||||
DmpCanNotChange = 120,
|
||||
PlanNewVersionConflict = 116,
|
||||
PlanIsNotFinalized = 117,
|
||||
MultiplePlanVersionsNotSupported = 118,
|
||||
PlanIsFinalized = 119,
|
||||
PlanCanNotChange = 120,
|
||||
PlanDescriptionTemplateCanNotChange = 121,
|
||||
InvalidDescriptionTemplate = 122,
|
||||
DescriptionIsFinalized = 123,
|
||||
|
@ -28,11 +28,11 @@ export enum ResponseErrorCode {
|
|||
TenantConfigurationTypeCanNotChange = 128,
|
||||
MultipleTenantConfigurationTypeNotAllowed = 129,
|
||||
TenantCodeExists = 130,
|
||||
DmpNewVersionAlreadyCreatedDraft = 131,
|
||||
PlanNewVersionAlreadyCreatedDraft = 131,
|
||||
DescriptionTemplateInactiveUser = 132,
|
||||
DescriptionTemplateMissingUserContactInfo = 133,
|
||||
DmpInactiveUser = 134,
|
||||
DmpMissingUserContactInfo = 135,
|
||||
PlanInactiveUser = 134,
|
||||
PlanMissingUserContactInfo = 135,
|
||||
ImportDescriptionWithoutPlanDescriptionTemplate = 136,
|
||||
DuplicatePlanUser = 137,
|
||||
DescriptionTemplateNewVersionAlreadyCreatedDraft = 138,
|
||||
|
@ -79,15 +79,15 @@ export class ResponseErrorCodeHelper {
|
|||
return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED");
|
||||
case ResponseErrorCode.MultipleDescriptionTemplateVersionsNotSupported:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED");
|
||||
case ResponseErrorCode.DmpNewVersionConflict:
|
||||
case ResponseErrorCode.PlanNewVersionConflict:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-NEW-VERSION-CONFLICT");
|
||||
case ResponseErrorCode.DmpIsNotFinalized:
|
||||
case ResponseErrorCode.PlanIsNotFinalized:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-IS-NOT-FINALIZED");
|
||||
case ResponseErrorCode.MultipleDmpVersionsNotSupported:
|
||||
case ResponseErrorCode.MultiplePlanVersionsNotSupported:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED");
|
||||
case ResponseErrorCode.DmpIsFinalized:
|
||||
case ResponseErrorCode.PlanIsFinalized:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-IS-FINALIZED");
|
||||
case ResponseErrorCode.DmpCanNotChange:
|
||||
case ResponseErrorCode.PlanCanNotChange:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-CAN-NOT-CHANGE");
|
||||
case ResponseErrorCode.PlanDescriptionTemplateCanNotChange:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE");
|
||||
|
@ -109,15 +109,15 @@ export class ResponseErrorCodeHelper {
|
|||
return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED");
|
||||
case ResponseErrorCode.TenantCodeExists:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.TENANT-CODE-EXISTS");
|
||||
case ResponseErrorCode.DmpNewVersionAlreadyCreatedDraft:
|
||||
case ResponseErrorCode.PlanNewVersionAlreadyCreatedDraft:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT");
|
||||
case ResponseErrorCode.DescriptionTemplateInactiveUser:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-INACTIVE-USER");
|
||||
case ResponseErrorCode.DescriptionTemplateMissingUserContactInfo:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO");
|
||||
case ResponseErrorCode.DmpInactiveUser:
|
||||
case ResponseErrorCode.PlanInactiveUser:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-INACTIVE-USER");
|
||||
case ResponseErrorCode.DmpMissingUserContactInfo:
|
||||
case ResponseErrorCode.PlanMissingUserContactInfo:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-MISSING-USER-CONTACT-INFO");
|
||||
case ResponseErrorCode.ImportDescriptionWithoutPlanDescriptionTemplate:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE");
|
||||
|
|
|
@ -72,7 +72,7 @@ export interface UserCredentialData {
|
|||
email: String;
|
||||
}
|
||||
|
||||
export interface DmpAssociatedUser {
|
||||
export interface PlanAssociatedUser {
|
||||
id: Guid;
|
||||
name: string;
|
||||
email: string;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { DmpAssociatedUser, RemoveCredentialRequestPersist, User, UserMergeRequestPersist, UserPersist, UserRolePatchPersist, UserTenantUsersInviteRequest } from '@app/core/model/user/user';
|
||||
import { PlanAssociatedUser, RemoveCredentialRequestPersist, User, UserMergeRequestPersist, UserPersist, UserRolePatchPersist, UserTenantUsersInviteRequest } from '@app/core/model/user/user';
|
||||
import { UserLookup } from '@app/core/query/user.lookup';
|
||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||
|
@ -31,9 +31,9 @@ export class UserService {
|
|||
return this.http.post<QueryResult<User>>(url, q).pipe(catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
queryDmpAssociated(q: UserLookup): Observable<QueryResult<DmpAssociatedUser>> {
|
||||
queryPlanAssociated(q: UserLookup): Observable<QueryResult<PlanAssociatedUser>> {
|
||||
const url = `${this.apiBase}/plan-associated/query`;
|
||||
return this.http.post<QueryResult<DmpAssociatedUser>>(url, q).pipe(catchError((error: any) => throwError(error)));
|
||||
return this.http.post<QueryResult<PlanAssociatedUser>>(url, q).pipe(catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
getSingle(id: Guid, reqFields: string[] = []): Observable<User> {
|
||||
|
@ -178,14 +178,14 @@ export class UserService {
|
|||
valueAssign: (item: User) => item.id,
|
||||
};
|
||||
|
||||
singleAutoCompleteDmpAssociatedUserConfiguration: SingleAutoCompleteConfiguration = {
|
||||
initialItems: (data?: any) => this.queryDmpAssociated(this.buildAutocompleteLookup()).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.queryDmpAssociated(this.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.queryDmpAssociated(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
displayFn: (item: DmpAssociatedUser) => item.name,
|
||||
subtitleFn: (item: DmpAssociatedUser) => item.email,
|
||||
titleFn: (item: DmpAssociatedUser) => item.name,
|
||||
valueAssign: (item: DmpAssociatedUser) => item.id,
|
||||
singleAutoCompletePlanAssociatedUserConfiguration: SingleAutoCompleteConfiguration = {
|
||||
initialItems: (data?: any) => this.queryPlanAssociated(this.buildAutocompleteLookup()).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.queryPlanAssociated(this.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.queryPlanAssociated(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
displayFn: (item: PlanAssociatedUser) => item.name,
|
||||
subtitleFn: (item: PlanAssociatedUser) => item.email,
|
||||
titleFn: (item: PlanAssociatedUser) => item.name,
|
||||
valueAssign: (item: PlanAssociatedUser) => item.id,
|
||||
};
|
||||
|
||||
public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): UserLookup {
|
||||
|
|
|
@ -53,7 +53,7 @@ export class AnnotationDialogComponent extends BaseComponent {
|
|||
private formBuilder: FormBuilder = new FormBuilder();
|
||||
public annotationStatusFormGroup: UntypedFormGroup;
|
||||
public listingStatuses: Status[] = [];
|
||||
public dmpUsersMentionNames: string[] = [];
|
||||
public planUsersMentionNames: string[] = [];
|
||||
|
||||
@ViewChild('annotationStatus') annotationStatus: MatSelectionList;
|
||||
|
||||
|
@ -76,7 +76,7 @@ export class AnnotationDialogComponent extends BaseComponent {
|
|||
this.entityId = data.entityId;
|
||||
this.anchor = data.anchor;
|
||||
this.entityType = data.entityType;
|
||||
this.dmpUsersMentionNames = data.planUsers.map(x => x.user.name);
|
||||
this.planUsersMentionNames = data.planUsers.map(x => x.user.name);
|
||||
dialogRef.backdropClick().pipe(takeUntil(this._destroyed)).subscribe(() => dialogRef.close(this.changesMade));
|
||||
}
|
||||
|
||||
|
|
|
@ -25,26 +25,26 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="card col-auto mt-0" [style.display]="isIntroCardVisible ? 'block' : 'none'">
|
||||
<a *ngIf="this.hasDmps()" class="col-auto d-flex" (click)="dismissIntroCard()"><span class="ml-auto mt-3 material-icons clear-icon">clear</span></a>
|
||||
<a *ngIf="this.hasPlans()" class="col-auto d-flex" (click)="dismissIntroCard()"><span class="ml-auto mt-3 material-icons clear-icon">clear</span></a>
|
||||
|
||||
<p *ngIf="!this.hasDmps()" class="card-title mb-0 pt-4">{{'DASHBOARD.PLAN-QUESTION' | translate}}</p>
|
||||
<p *ngIf="!this.hasDmps()" class="card-content mb-0">{{'DASHBOARD.INFO-PLAN-TEXT' | translate}}</p>
|
||||
<p *ngIf="!this.hasPlans()" class="card-title mb-0 pt-4">{{'DASHBOARD.PLAN-QUESTION' | translate}}</p>
|
||||
<p *ngIf="!this.hasPlans()" class="card-content mb-0">{{'DASHBOARD.INFO-PLAN-TEXT' | translate}}</p>
|
||||
|
||||
<p *ngIf="!this.hasDmps()" class="card-content pt-3 mb-0">
|
||||
<p *ngIf="!this.hasPlans()" class="card-content pt-3 mb-0">
|
||||
{{'DASHBOARD.NEW-QUESTION' | translate}} <a href="https://www.openaire.eu/how-to-create-a-data-management-plan" target="_blank"><u>{{'DASHBOARD.OPEN-AIR-GUIDE' | translate}}</u></a> {{'DASHBOARD.LEARN-MORE' | translate}}
|
||||
</p>
|
||||
<p *ngIf="this.hasDmps()" class="card-content mb-0 pt-0">{{'DASHBOARD.PLAN-ABOUT-BEG' | translate}}
|
||||
<p *ngIf="this.hasPlans()" class="card-content mb-0 pt-0">{{'DASHBOARD.PLAN-ABOUT-BEG' | translate}}
|
||||
<b>{{'DASHBOARD.DESCRIPTIONS-DASHBOARD-TEXT' | translate}}</b>
|
||||
{{'DASHBOARD.PLAN-ABOUT-END' | translate}}
|
||||
</p>
|
||||
|
||||
<div class="row d-flex align-items-center">
|
||||
<div *ngIf="!this.hasDmps()" class="col-auto p-0 add-description-btn d-flex">
|
||||
<div *ngIf="!this.hasPlans()" class="col-auto p-0 add-description-btn d-flex">
|
||||
<div class="pr-2">
|
||||
<button type="button" class="align-self-center normal-btn" (click)="openNewPlanDialog()">{{'DASHBOARD.START-YOUR-FIRST-PLAN' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="this.hasDmps()" class="col-auto p-0 new-description-tour add-description-btn col-auto d-flex">
|
||||
<div *ngIf="this.hasPlans()" class="col-auto p-0 new-description-tour add-description-btn col-auto d-flex">
|
||||
<div class="pr-2">
|
||||
<button mat-raised-button type="button" class="align-self-center yellow-btn" (click)="addNewDescription()">{{'DASHBOARD.ACTIONS.ADD-DESCRIPTION' | translate}}</button>
|
||||
</div>
|
||||
|
@ -55,26 +55,26 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="this.hasDmps()" class="col">
|
||||
<div *ngIf="this.hasPlans()" class="col">
|
||||
<div class="latest-activity-title">{{'DASHBOARD.LATEST-ACTIVITY' | translate}}</div>
|
||||
<mat-tab-group color="#00000" mat-stretch-tabs="false" mat-align-tabs="start" class="my-mat-tab remove-border-bottom" [selectedIndex]="indexFromCurrentType" (selectedTabChange)="currentType = $event.tab.ariaLabel">
|
||||
<mat-tab aria-label="recent" label="{{'DASHBOARD.ALL' | translate}}">
|
||||
<app-recent-edited-activity [isActive]="currentType == 'recent'" [includeDmps]="true" [includeDescriptions]="true"></app-recent-edited-activity>
|
||||
<app-recent-edited-activity [isActive]="currentType == 'recent'" [includePlans]="true" [includeDescriptions]="true"></app-recent-edited-activity>
|
||||
</mat-tab>
|
||||
<mat-tab aria-label="drafts" label="{{'DASHBOARD.DRAFTS' | translate}}">
|
||||
<app-recent-edited-activity [isActive]="currentType == 'drafts'" [includeDmps]="true" [includeDescriptions]="true" [onlyDrafts]="true" type="drafts" [selectedType]="currentType"></app-recent-edited-activity>
|
||||
<app-recent-edited-activity [isActive]="currentType == 'drafts'" [includePlans]="true" [includeDescriptions]="true" [onlyDrafts]="true" type="drafts" [selectedType]="currentType"></app-recent-edited-activity>
|
||||
</mat-tab>>
|
||||
<mat-tab aria-label="plans" label="{{'DASHBOARD.PLANS' | translate}}">
|
||||
<app-recent-edited-activity [isActive]="currentType == 'plans'" [includeDmps]="true" type="plans" [selectedType]="currentType"></app-recent-edited-activity>
|
||||
<app-recent-edited-activity [isActive]="currentType == 'plans'" [includePlans]="true" type="plans" [selectedType]="currentType"></app-recent-edited-activity>
|
||||
</mat-tab>
|
||||
<mat-tab aria-label="descriptions" label="{{'DASHBOARD.DESCRIPTIONS' | translate}}">
|
||||
<app-recent-edited-activity [isActive]="currentType == 'descriptions'" [includeDescriptions]="true" type="descriptions" [selectedType]="currentType" [hasDmps]="this.hasDmps()" (addNewDescription)="addNewDescription($event)"></app-recent-edited-activity>
|
||||
<app-recent-edited-activity [isActive]="currentType == 'descriptions'" [includeDescriptions]="true" type="descriptions" [selectedType]="currentType" [hasPlans]="this.hasPlans()" (addNewDescription)="addNewDescription($event)"></app-recent-edited-activity>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Right Sidebar -->
|
||||
<div *ngIf="!this.hasDmps()" class="col-12 col-xl-2 mb-4 stats">
|
||||
<div *ngIf="!this.hasPlans()" class="col-12 col-xl-2 mb-4 stats">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="personal-usage" style="width: fit-content;">
|
||||
|
@ -101,7 +101,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="this.hasDmps()" class="col-12 col-xl-2 mb-4 stats">
|
||||
<div *ngIf="this.hasPlans()" class="col-12 col-xl-2 mb-4 stats">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="personal-usage" style="width: fit-content;"><span>{{'DASHBOARD.PERSONAL-USAGE' | translate}}</span></div>
|
||||
|
@ -162,7 +162,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-xl-auto mb-4 stats">
|
||||
<div *ngIf="!hasDmps()" class="row flex-xl-column">
|
||||
<div *ngIf="!hasPlans()" class="row flex-xl-column">
|
||||
<div class="col-12">
|
||||
<div class="personal-usage"><span>{{'DASHBOARD.PUBLIC-USAGE' | translate}}</span></div>
|
||||
</div>
|
||||
|
@ -184,7 +184,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="hasDmps()" class="row flex-xl-column">
|
||||
<div *ngIf="hasPlans()" class="row flex-xl-column">
|
||||
<div class="col-12">
|
||||
<div class="personal-usage"><span>{{'DASHBOARD.PUBLIC-USAGE' | translate}}</span></div>
|
||||
</div>
|
||||
|
|
|
@ -126,7 +126,7 @@ export class DashboardComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
public hasDmps(): boolean {
|
||||
public hasPlans(): boolean {
|
||||
if (this.dashboardStatistics) {
|
||||
return this.dashboardStatistics.planCount !== 0
|
||||
|| this.dashboardStatistics.descriptionCount !== 0
|
||||
|
@ -199,10 +199,10 @@ export class DashboardComponent extends BaseComponent implements OnInit {
|
|||
]
|
||||
};
|
||||
|
||||
public setDashboardTourDmpText(): void {
|
||||
const dmpText = this.language.instant('DASHBOARD.TOUR-GUIDE.PLAN') + '\n\n' +
|
||||
public setDashboardTourPlanText(): void {
|
||||
const planText = this.language.instant('DASHBOARD.TOUR-GUIDE.PLAN') + '\n\n' +
|
||||
this.language.instant('DASHBOARD.TOUR-GUIDE.START-NEW');
|
||||
this.dashboardTour.steps[0].title = dmpText;
|
||||
this.dashboardTour.steps[0].title = planText;
|
||||
}
|
||||
|
||||
public setDashboardImportFileText(): void {
|
||||
|
@ -222,7 +222,7 @@ export class DashboardComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
openDashboardTour() {
|
||||
this.setDashboardTourDmpText();
|
||||
this.setDashboardTourPlanText();
|
||||
this.setDashboardImportFileText();
|
||||
this.setDashboardStartWizardText();
|
||||
this.setDescriptionText();
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center mt-5" *ngIf="listingItems?.length == 0 && onlyDescriptions && hasDmps">
|
||||
<div class="row justify-content-center mt-5" *ngIf="listingItems?.length == 0 && onlyDescriptions && hasPlans">
|
||||
<div class="col-auto p-0 add-description">
|
||||
<button mat-raised-button type="button" class="yellow-btn" (click)="addDescription()">{{'DASHBOARD.ACTIONS.ADD-DESCRIPTION' | translate}}</button>
|
||||
</div>
|
||||
|
|
|
@ -44,18 +44,18 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
|||
@Input() type: string;
|
||||
@Input() selectedType: string;
|
||||
@Input() includeDescriptions: boolean = false;
|
||||
@Input() includeDmps: boolean = false;
|
||||
@Input() includePlans: boolean = false;
|
||||
@Input() onlyDrafts: boolean = false;
|
||||
@Input() hasDmps: boolean = false;
|
||||
@Input() hasPlans: boolean = false;
|
||||
|
||||
@Output() addNewDescription: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
|
||||
get onlyPlans(): boolean {
|
||||
return this.includeDmps && !this.includeDescriptions;
|
||||
return this.includePlans && !this.includeDescriptions;
|
||||
}
|
||||
|
||||
get onlyDescriptions(): boolean {
|
||||
return !this.includeDmps && this.includeDescriptions;
|
||||
return !this.includePlans && this.includeDescriptions;
|
||||
}
|
||||
|
||||
pageLessSize= this.pageSize;
|
||||
|
@ -166,7 +166,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
|||
this.lookup.like = this.formGroup.get('like').value;
|
||||
this.lookup.project = {
|
||||
fields : [
|
||||
...(this.includeDmps ? this._getPlanLookup() : []),
|
||||
...(this.includePlans ? this._getPlanLookup() : []),
|
||||
...(this.includeDescriptions ? this._getDescriptionLookup() : [])
|
||||
]
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div class="row mt-3">
|
||||
<div class="col-12">
|
||||
<mat-form-field class="w-100">
|
||||
<app-single-auto-complete [formControl]="data.formGroup.get('planId')" placeholder="{{'DESCRIPTION-COPY-DIALOG.SELECT-PLAN' | translate}}" [configuration]="dmpAutoCompleteConfiguration">
|
||||
<app-single-auto-complete [formControl]="data.formGroup.get('planId')" placeholder="{{'DESCRIPTION-COPY-DIALOG.SELECT-PLAN' | translate}}" [configuration]="planAutoCompleteConfiguration">
|
||||
</app-single-auto-complete>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
|
|
@ -26,10 +26,9 @@ import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition,
|
|||
})
|
||||
export class DescriptionCopyDialogComponent {
|
||||
|
||||
dmpModel: Plan;
|
||||
sections: PlanBlueprintDefinitionSection[] = [];
|
||||
descriptionDescriptionTemplateLabel: String;
|
||||
dmpAutoCompleteConfiguration: SingleAutoCompleteConfiguration = { //TODO: add filter to only get DMPs that have connection with the same Description Template group.
|
||||
planAutoCompleteConfiguration: SingleAutoCompleteConfiguration = { //TODO: add filter to only get DMPs that have connection with the same Description Template group.
|
||||
initialItems: (data?: any) => this.planService.query(this.buildPlanLookup(null,null,null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.planService.query(this.buildPlanLookup(searchQuery, null, null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.planService.query(this.buildPlanLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
|
@ -83,16 +82,16 @@ export class DescriptionCopyDialogComponent {
|
|||
ngOnInit() {
|
||||
}
|
||||
|
||||
findSection(dmp: Plan){
|
||||
const availableSectionIds = dmp.planDescriptionTemplates?.filter(x => x.descriptionTemplateGroupId === this.data.descriptionTemplate.groupId && x.isActive == IsActive.Active).map(y => y.sectionId);
|
||||
this.sections = dmp.blueprint.definition.sections.filter(x => x.hasTemplates == true && availableSectionIds?.includes(x.id)) || [];
|
||||
findSection(plan: Plan){
|
||||
const availableSectionIds = plan.planDescriptionTemplates?.filter(x => x.descriptionTemplateGroupId === this.data.descriptionTemplate.groupId && x.isActive == IsActive.Active).map(y => y.sectionId);
|
||||
this.sections = plan.blueprint.definition.sections.filter(x => x.hasTemplates == true && availableSectionIds?.includes(x.id)) || [];
|
||||
if(this.sections.length == 1){
|
||||
this.data.formGroup.get('sectionId').setValue(this.sections[0].id);
|
||||
}else {
|
||||
this.data.formGroup.get('sectionId').setValue(null);
|
||||
}
|
||||
|
||||
return dmp.id
|
||||
return plan.id
|
||||
}
|
||||
|
||||
cancel() {
|
||||
|
|
|
@ -178,7 +178,7 @@
|
|||
[validationErrorModel]="editorModel.validationErrorModel"
|
||||
[isNew]="isNew || isCopy"
|
||||
[canReview]="canReview"
|
||||
[dmpUsers]="item?.plan?.planUsers ?? []"
|
||||
[planUsers]="item?.plan?.planUsers ?? []"
|
||||
></app-description-form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -140,7 +140,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
const planSectionId = params['planSectionId'];
|
||||
|
||||
const isPublicDescription = params['public'];
|
||||
const newDmpId = params['newDmpId'];
|
||||
const newPlanId = params['newPlanId'];
|
||||
|
||||
this.scrollToField = this.route.snapshot.data['scrollToField'] ?? false
|
||||
this.anchorFieldsetId = params['fieldsetId'] ?? null;
|
||||
|
@ -151,7 +151,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
this.viewOnly = isPublicDescription;
|
||||
|
||||
//Regular Editor case
|
||||
if (itemId != null && newDmpId == null) {
|
||||
if (itemId != null && newPlanId == null) {
|
||||
this.checkLock(this.item.id, LockTargetType.Description, 'DESCRIPTION-EDITOR.LOCKED-DIALOG.TITLE', 'DESCRIPTION-EDITOR.LOCKED-DIALOG.MESSAGE');
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
|
|||
@Input() hideAnnotations: boolean = false;
|
||||
@Input() canReview: boolean = false;
|
||||
@Input() numbering: string;
|
||||
@Input() dmpUsers: PlanUser[] = [];
|
||||
@Input() planUsers: PlanUser[] = [];
|
||||
|
||||
get isMultiplicityEnabled() {
|
||||
return this.fieldSet.hasMultiplicity && this.fieldSet.multiplicity != null;
|
||||
|
@ -186,7 +186,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
|
|||
entityId: this.descriptionId,
|
||||
anchor: fieldSetId,
|
||||
entityType: AnnotationEntityType.Description,
|
||||
planUsers: this.dmpUsers
|
||||
planUsers: this.planUsers
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(changesMade => {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
[isChild]="false"
|
||||
[hideAnnotations]="isNew"
|
||||
[canReview]="canReview"
|
||||
[dmpUsers]="dmpUsers"
|
||||
[planUsers]="planUsers"
|
||||
></app-description-form-field-set>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -26,7 +26,7 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On
|
|||
@Input() visibilityRulesService: VisibilityRulesService;
|
||||
@Input() path: string;
|
||||
@Input() descriptionId: Guid;
|
||||
@Input() dmpUsers: PlanUser[] = [];
|
||||
@Input() planUsers: PlanUser[] = [];
|
||||
|
||||
|
||||
// @Input() descriptionTemplateId: String;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</mat-expansion-panel-header>
|
||||
<ng-container *ngFor="let section of page.sections; let i = index;">
|
||||
<div class="row" *ngIf="visibilityRulesService.isVisibleMap[section.id]">
|
||||
<app-description-form-section class="col-12" [section]="section" [canReview]="canReview" [path]="(z+1)+'.'+(i+1)" [pathName]="'pages.'+z+'.sections.'+i" [propertiesFormGroup]="propertiesFormGroup" [descriptionId]="descriptionId" [visibilityRulesService]="visibilityRulesService" (askedToScroll)="onAskedToScroll(expansionPanel, $event)" [linkToScroll]="linkToScroll" [validationErrorModel]="validationErrorModel" [isNew]="isNew" [dmpUsers]="dmpUsers"></app-description-form-section>
|
||||
<app-description-form-section class="col-12" [section]="section" [canReview]="canReview" [path]="(z+1)+'.'+(i+1)" [pathName]="'pages.'+z+'.sections.'+i" [propertiesFormGroup]="propertiesFormGroup" [descriptionId]="descriptionId" [visibilityRulesService]="visibilityRulesService" (askedToScroll)="onAskedToScroll(expansionPanel, $event)" [linkToScroll]="linkToScroll" [validationErrorModel]="validationErrorModel" [isNew]="isNew" [planUsers]="planUsers"></app-description-form-section>
|
||||
</div>
|
||||
</ng-container>
|
||||
</mat-expansion-panel>
|
||||
|
|
|
@ -27,7 +27,7 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, O
|
|||
@Input() datasetDescription: String;
|
||||
@Input() linkToScroll: LinkToScroll;
|
||||
@Input() validationErrorModel: ValidationErrorModel;
|
||||
@Input() dmpUsers: PlanUser[] = [];
|
||||
@Input() planUsers: PlanUser[] = [];
|
||||
|
||||
@Output() formChanged: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ export class PrefillDescriptionDialogComponent extends BaseComponent implements
|
|||
prefillSelected: boolean = false;
|
||||
prefillForm: UntypedFormGroup;
|
||||
|
||||
dmp: Plan;
|
||||
plan: Plan;
|
||||
planSectionId: Guid;
|
||||
availableDescriptionTemplates: DescriptionTemplate[] = [];
|
||||
|
||||
|
@ -43,13 +43,13 @@ export class PrefillDescriptionDialogComponent extends BaseComponent implements
|
|||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
super();
|
||||
|
||||
this.dmp = data.plan;
|
||||
this.plan = data.plan;
|
||||
this.planSectionId = data.planSectionId;
|
||||
this.availableDescriptionTemplates = this.dmp.planDescriptionTemplates.filter(x => x.sectionId == this.planSectionId && x.isActive == IsActive.Active).map(x => x.currentDescriptionTemplate);
|
||||
this.availableDescriptionTemplates = this.plan.planDescriptionTemplates.filter(x => x.sectionId == this.planSectionId && x.isActive == IsActive.Active).map(x => x.currentDescriptionTemplate);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
const availablePrefillingSourcesIds = this.dmp.blueprint.definition.sections.filter(x => x.id === this.planSectionId)[0].prefillingSources?.map(x => x.id) || null;
|
||||
const availablePrefillingSourcesIds = this.plan.blueprint.definition.sections.filter(x => x.id === this.planSectionId)[0].prefillingSources?.map(x => x.id) || null;
|
||||
this.singlePrefillingSourceAutoCompleteConfiguration = this.prefillingSourceService.getSingleAutocompleteConfiguration(availablePrefillingSourcesIds);
|
||||
|
||||
this.progressIndicationService.getProgressIndicationObservable().pipe(takeUntil(this._destroyed)).subscribe(x => {
|
||||
|
|
|
@ -34,7 +34,7 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver {
|
|||
public static lookupFields(): string[] {
|
||||
return [
|
||||
...DescriptionEditorEntityResolver.descriptionLookupFields(),
|
||||
...DescriptionEditorEntityResolver.dmpLookupFields(nameof<Description>(x => x.plan)),
|
||||
...DescriptionEditorEntityResolver.planLookupFields(nameof<Description>(x => x.plan)),
|
||||
...DescriptionEditorEntityResolver.descriptionTemplateLookupFieldsForDescrption(),
|
||||
]
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver {
|
|||
]
|
||||
}
|
||||
|
||||
public static dmpLookupFields(prefix?: string): string[] {
|
||||
public static planLookupFields(prefix?: string): string[] {
|
||||
return [
|
||||
(prefix ? prefix + '.' : '') + [nameof<Plan>(x => x.id)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<Plan>(x => x.label)].join('.'),
|
||||
|
@ -176,20 +176,20 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver {
|
|||
}
|
||||
return this.descriptionService.getSingle(Guid.parse(id), fields).pipe(tap(d => this.breadcrumbService.addIdResolvedValue(d.id.toString(), d.label)));
|
||||
} else if (planId != null && planSectionId != null && copyPlanId == null) {
|
||||
return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.dmpLookupFields())
|
||||
return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.planLookupFields())
|
||||
.pipe(tap(x => {
|
||||
this.breadcrumbService.addExcludedParam(planId, true);
|
||||
this.breadcrumbService.addIdResolvedValue(planSectionId, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW"));
|
||||
}), takeUntil(this._destroyed), map(dmp => {
|
||||
}), takeUntil(this._destroyed), map(plan => {
|
||||
const description: Description = {};
|
||||
description.plan = dmp;
|
||||
description.plan = plan;
|
||||
description.planDescriptionTemplate = {
|
||||
sectionId: Guid.parse(planSectionId)
|
||||
}
|
||||
return description;
|
||||
}));
|
||||
} else if (copyPlanId != null && id != null && planSectionId != null) {
|
||||
return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(dmp => {
|
||||
return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.planLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(plan => {
|
||||
return this.descriptionService.getSingle(Guid.parse(id), DescriptionEditorEntityResolver.cloneLookupFields())
|
||||
.pipe(tap(x => {
|
||||
this.breadcrumbService.addExcludedParam(copyPlanId, true)
|
||||
|
@ -200,9 +200,9 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver {
|
|||
description.id = null;
|
||||
description.hash = null;
|
||||
description.status = DescriptionStatus.Draft;
|
||||
description.plan = dmp;
|
||||
description.plan = plan;
|
||||
description.planDescriptionTemplate = {
|
||||
id: dmp.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id,
|
||||
id: plan.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id,
|
||||
sectionId: Guid.parse(planSectionId)
|
||||
}
|
||||
return description;
|
||||
|
|
|
@ -46,13 +46,13 @@ export class DescriptionEditorPermissionsResolver extends BaseEditorResolver {
|
|||
}));
|
||||
|
||||
} else if (planId != null && planSectionId != null && copyPlanId == null) {
|
||||
return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.dmpLookupFields())
|
||||
return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.planLookupFields())
|
||||
.pipe(tap(x => {
|
||||
this.breadcrumbService.addExcludedParam(planId, true);
|
||||
this.breadcrumbService.addIdResolvedValue(planSectionId, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW"));
|
||||
}), takeUntil(this._destroyed), map(dmp => {
|
||||
}), takeUntil(this._destroyed), map(plan => {
|
||||
const description: Description = {};
|
||||
description.plan = dmp;
|
||||
description.plan = plan;
|
||||
description.planDescriptionTemplate = {
|
||||
sectionId: Guid.parse(planSectionId)
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ export class DescriptionEditorPermissionsResolver extends BaseEditorResolver {
|
|||
return this.descriptionService.getDescriptionSectionPermissions(descriptionSectionPermissionResolverModel).pipe(takeUntil(this._destroyed));
|
||||
}));
|
||||
} else if (copyPlanId != null && id != null && planSectionId != null) {
|
||||
return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(dmp => {
|
||||
return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.planLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(plan => {
|
||||
//TODO
|
||||
return this.descriptionService.getSingle(Guid.parse(id), DescriptionEditorEntityResolver.cloneLookupFields())
|
||||
.pipe(tap(x => {
|
||||
|
@ -79,9 +79,9 @@ export class DescriptionEditorPermissionsResolver extends BaseEditorResolver {
|
|||
description.id = null;
|
||||
description.hash = null;
|
||||
description.status = DescriptionStatus.Draft;
|
||||
description.plan = dmp;
|
||||
description.plan = plan;
|
||||
description.planDescriptionTemplate = {
|
||||
id: dmp.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id,
|
||||
id: plan.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id,
|
||||
sectionId: Guid.parse(planSectionId)
|
||||
}
|
||||
return description;
|
||||
|
|
|
@ -207,7 +207,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
protected setupColumns() { }
|
||||
|
||||
public dashboardTour: GuidedTour = {
|
||||
tourId: 'dmp-description-tour',
|
||||
tourId: 'plan-description-tour',
|
||||
useOrb: true,
|
||||
steps: [
|
||||
{
|
||||
|
@ -290,12 +290,12 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
}
|
||||
|
||||
public restartTour(): void {
|
||||
this.setDashboardTourDmpText();
|
||||
this.setDashboardTourPlanText();
|
||||
this.setDashboardTourDescriptionText();
|
||||
this.guidedTourService.startTour(this.dashboardTour);
|
||||
}
|
||||
|
||||
public setDashboardTourDmpText(): void {
|
||||
public setDashboardTourPlanText(): void {
|
||||
this.planText = this.language.instant('PLAN-LISTING.TEXT-INFO') + '\n\n' +
|
||||
this.language.instant('PLAN-LISTING.TEXT-INFO-QUESTION') + ' ' +
|
||||
this.language.instant('PLAN-LISTING.LINK-ZENODO') + ' ' +
|
||||
|
@ -392,7 +392,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
} else lookup.descriptionTemplateSubQuery = null;
|
||||
|
||||
// Dmps
|
||||
let plans = formGroup.get("associatedDmpIds")?.value ?? null; let addDmps = plans && plans?.length > 0;
|
||||
let plans = formGroup.get("associatedPlanIds")?.value ?? null; let addDmps = plans && plans?.length > 0;
|
||||
let roles = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null; let addRoles = roles && roles?.length > 0;
|
||||
if (addDmps || addRoles) {
|
||||
lookup.planSubQuery = DescriptionFilterService.initializePlanLookup();
|
||||
|
@ -434,7 +434,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
status: [lookup.statuses?.length > 0 ? lookup.statuses[0] : null],
|
||||
role: lookup.planSubQuery?.planUserSubQuery?.userRoles ? lookup.planSubQuery?.planUserSubQuery?.userRoles[0] : [],
|
||||
descriptionTemplates: lookup.descriptionTemplateSubQuery?.ids ? [lookup.descriptionTemplateSubQuery?.ids] : [],
|
||||
associatedDmpIds: lookup.planSubQuery?.ids ? [lookup.planSubQuery?.ids] : [],
|
||||
associatedPlanIds: lookup.planSubQuery?.ids ? [lookup.planSubQuery?.ids] : [],
|
||||
tags: lookup.descriptionTagSubQuery?.tagIds ? [lookup.descriptionTagSubQuery?.tagIds] : [],
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ const routes: Routes = [
|
|||
},
|
||||
},
|
||||
{
|
||||
path: 'dmp/:planId',
|
||||
path: 'plan/:planId',
|
||||
component: DescriptionListingComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<h6 class="category-title">{{'DESCRIPTION-LISTING.FILTERS.ASSOCIATED-PLANS.NAME' | translate}}</h6>
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DESCRIPTION-LISTING.FILTERS.ASSOCIATED-PLANS.PLACEHOLDER' | translate }}</mat-label>
|
||||
<app-multiple-auto-complete [formControl]="formGroup.get('associatedDmpIds')" [configuration]="dmpAutoCompleteConfiguration"></app-multiple-auto-complete>
|
||||
<app-multiple-auto-complete [formControl]="formGroup.get('associatedPlanIds')" [configuration]="planAutoCompleteConfiguration"></app-multiple-auto-complete>
|
||||
</mat-form-field>
|
||||
<hr>
|
||||
</div>
|
||||
|
|
|
@ -45,7 +45,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent implements
|
|||
options: UntypedFormGroup;
|
||||
|
||||
descriptionTemplateAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
dmpAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
planAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
tagAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
referenceTypeAutocompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
referenceAutocompleteConfiguration: Map<string, MultipleAutoCompleteConfiguration>;
|
||||
|
@ -71,7 +71,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent implements
|
|||
if (changes['filterFormGroup']) {
|
||||
|
||||
this.descriptionTemplateAutoCompleteConfiguration = this.descriptionTemplateService.buildMultipleAutocompleteConfiguration();
|
||||
this.dmpAutoCompleteConfiguration = this.planService.multipleAutocompleteConfiguration;
|
||||
this.planAutoCompleteConfiguration = this.planService.multipleAutocompleteConfiguration;
|
||||
this.tagAutoCompleteConfiguration = this.tagService.multipleAutocompleteConfiguration;
|
||||
this.referenceTypeAutocompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration();
|
||||
this.referenceAutocompleteConfiguration = new Map<string, MultipleAutoCompleteConfiguration>();
|
||||
|
|
|
@ -308,11 +308,11 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
|||
});
|
||||
}
|
||||
|
||||
dmpClicked(dmp: Plan) {
|
||||
dmpClicked(plan: Plan) {
|
||||
if (this.isPublicView) {
|
||||
this.router.navigate([this.routerUtils.generateUrl(['/explore-plans/overview/public/', dmp.id.toString()])]);
|
||||
this.router.navigate([this.routerUtils.generateUrl(['/explore-plans/overview/public/', plan.id.toString()])]);
|
||||
} else {
|
||||
this.router.navigate([this.routerUtils.generateUrl(['/plans/overview/', dmp.id.toString()])]);
|
||||
this.router.navigate([this.routerUtils.generateUrl(['/plans/overview/', plan.id.toString()])]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import { nameof } from 'ts-simple-nameof';
|
|||
})
|
||||
export class PlanDepositDropdown extends BaseComponent implements OnInit {
|
||||
@Input() inputRepos: DepositConfiguration[];
|
||||
@Input() dmp: Plan;
|
||||
@Input() plan: Plan;
|
||||
outputRepos = [];
|
||||
logos: Map<string, SafeResourceUrl> = new Map<string, SafeResourceUrl>();
|
||||
@Output() outputReposEmitter: EventEmitter<EntityDoi[]> = new EventEmitter<EntityDoi[]>();
|
||||
|
@ -49,8 +49,8 @@ export class PlanDepositDropdown extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
for (var i = 0; i < this.dmp?.entityDois?.length; i++) {
|
||||
this.inputRepos = this.inputRepos.filter(r => this.hasDoi(r, this.dmp.entityDois, i));
|
||||
for (var i = 0; i < this.plan?.entityDois?.length; i++) {
|
||||
this.inputRepos = this.inputRepos.filter(r => this.hasDoi(r, this.plan.entityDois, i));
|
||||
}
|
||||
this.inputRepos.forEach(repo => {
|
||||
if (repo.hasLogo) {
|
||||
|
@ -76,12 +76,12 @@ export class PlanDepositDropdown extends BaseComponent implements OnInit {
|
|||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
switch (result) {
|
||||
case 0:
|
||||
this.showOauth2Dialog(this.depositOauth2DialogService.getLoginUrl(repo), repo, this.dmp);
|
||||
this.showOauth2Dialog(this.depositOauth2DialogService.getLoginUrl(repo), repo, this.plan);
|
||||
break;
|
||||
case 1:
|
||||
const depositRequest: DepositRequest = {
|
||||
repositoryId: repo.repositoryId,
|
||||
planId: this.dmp.id,
|
||||
planId: this.plan.id,
|
||||
authorizationCode: null,
|
||||
project: this.EntityDoiFields()
|
||||
};
|
||||
|
@ -99,7 +99,7 @@ export class PlanDepositDropdown extends BaseComponent implements OnInit {
|
|||
} else if (repo.depositType == DepositConfigurationStatus.System) {
|
||||
const depositRequest: DepositRequest = {
|
||||
repositoryId: repo.repositoryId,
|
||||
planId: this.dmp.id,
|
||||
planId: this.plan.id,
|
||||
authorizationCode: null,
|
||||
project: this.EntityDoiFields()
|
||||
};
|
||||
|
@ -121,14 +121,14 @@ export class PlanDepositDropdown extends BaseComponent implements OnInit {
|
|||
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('PLAN-EDITOR.SNACK-BAR.UNSUCCESSFUL-DOI'), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
|
||||
showOauth2Dialog(url: string, repo: DepositConfiguration, dmp: Plan) {
|
||||
showOauth2Dialog(url: string, repo: DepositConfiguration, plan: Plan) {
|
||||
this.depositOauth2DialogService.login(url)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(code => {
|
||||
if (code !== undefined) {
|
||||
const depositRequest: DepositRequest = {
|
||||
repositoryId: repo.repositoryId,
|
||||
planId: dmp.id,
|
||||
planId: plan.id,
|
||||
authorizationCode: code,
|
||||
project: this.EntityDoiFields()
|
||||
};
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { DmpInvitationService } from '@app/core/services/plan/dmp-invitation.service';
|
||||
import { DmpInvitationService } from '@app/core/services/plan/plan-invitation.service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-invitation-accepted-component',
|
||||
templateUrl: 'dmp-invitation-accepted.component.html',
|
||||
selector: 'app-plan-invitation-accepted-component',
|
||||
templateUrl: 'plan-invitation-accepted.component.html',
|
||||
|
||||
})
|
||||
export class InvitationAcceptedComponent extends BaseComponent implements OnInit {
|
||||
|
|
|
@ -150,11 +150,11 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
|
|||
}
|
||||
|
||||
public dashboardTour: GuidedTour = {
|
||||
tourId: 'dmp-description-tour',
|
||||
tourId: 'plan-description-tour',
|
||||
useOrb: true,
|
||||
steps: [
|
||||
{
|
||||
selector: '.dmp-tour',
|
||||
selector: '.plan-tour',
|
||||
content: 'Step 1',
|
||||
orientation: Orientation.Right,
|
||||
isStepUnique: false
|
||||
|
@ -299,12 +299,12 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
|
|||
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight
|
||||
}
|
||||
|
||||
public setDashboardTourDmpText(): void {
|
||||
const dmpText = this.language.instant('PLAN-LISTING.TEXT-INFO') + '\n\n' +
|
||||
public setDashboardTourPlanText(): void {
|
||||
const planText = this.language.instant('PLAN-LISTING.TEXT-INFO') + '\n\n' +
|
||||
this.language.instant('PLAN-LISTING.TEXT-INFO-QUESTION') + ' ' +
|
||||
this.language.instant('PLAN-LISTING.LINK-ZENODO') + ' ' +
|
||||
this.language.instant('PLAN-LISTING.GET-IDEA');
|
||||
this.dashboardTour.steps[0].title = dmpText;
|
||||
this.dashboardTour.steps[0].title = planText;
|
||||
}
|
||||
|
||||
public setDashboardTourDescriptionText(): void {
|
||||
|
@ -315,7 +315,7 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
|
|||
}
|
||||
|
||||
public restartTour(): void {
|
||||
this.setDashboardTourDmpText();
|
||||
this.setDashboardTourPlanText();
|
||||
this.setDashboardTourDescriptionText();
|
||||
this.guidedTourService.startTour(this.dashboardTour);
|
||||
}
|
||||
|
@ -417,8 +417,8 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
|
|||
}
|
||||
|
||||
private _filterDmp(plans: BasePlan[]): BasePlan[] {
|
||||
plans.forEach((dmp: BasePlan) => {
|
||||
dmp.descriptions = dmp.descriptions?.filter(d => d.isActive == IsActive.Active) ?? [];
|
||||
plans.forEach((plan: BasePlan) => {
|
||||
plan.descriptions = plan.descriptions?.filter(d => d.isActive == IsActive.Active) ?? [];
|
||||
})
|
||||
return plans;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<mat-checkbox [checked]="allDescriptionsCompleted" [indeterminate]="someDescriptionsCompleted" (change)="toggleAllDescriptions($event.checked)">{{ 'PLAN-NEW-VERSION-DIALOG.ACTIONS.TOGGLE-DESCRIPTIONS' | translate }}</mat-checkbox>
|
||||
</mat-card-header>
|
||||
<mat-selection-list #selectedItems (selectionChange)="descriptionSelectionChanged($event)">
|
||||
<ng-container *ngFor="let description of dmp.descriptions;">
|
||||
<ng-container *ngFor="let description of plan.descriptions;">
|
||||
<mat-list-option [value]="description.id" [selected]="isDefaultSelected(formGroup.get('descriptions'), description.id)" class="h-auto">
|
||||
<div class="mat-mdc-form-field-bottom-align w-100"></div>
|
||||
<mat-form-field class="w-100" (click)="selectTemplate($event)" floatLabel="never">
|
||||
|
|
|
@ -32,7 +32,7 @@ import { Description } from '@app/core/model/description/description';
|
|||
})
|
||||
export class NewVersionPlanDialogComponent extends BaseComponent {
|
||||
|
||||
dmp: Plan;
|
||||
plan: Plan;
|
||||
editorModel: DmpNewVersionDialogEditorModel;
|
||||
formGroup: UntypedFormGroup;
|
||||
selectedBlueprintSections: PlanBlueprintDefinitionSection[];
|
||||
|
@ -83,8 +83,8 @@ export class NewVersionPlanDialogComponent extends BaseComponent {
|
|||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {
|
||||
super();
|
||||
this.dmp = data.plan;
|
||||
this.dmp.planDescriptionTemplates = this.dmp.planDescriptionTemplates?.filter(x => x.isActive === IsActive.Active);
|
||||
this.plan = data.plan;
|
||||
this.plan.planDescriptionTemplates = this.plan.planDescriptionTemplates?.filter(x => x.isActive === IsActive.Active);
|
||||
}
|
||||
|
||||
get allDescriptionsNo(): number{
|
||||
|
@ -109,15 +109,15 @@ export class NewVersionPlanDialogComponent extends BaseComponent {
|
|||
|
||||
|
||||
ngOnInit() {
|
||||
this.selectedBlueprintSections = this.dmp.blueprint?.definition?.sections?.filter(x => x.hasTemplates) || null;
|
||||
this.editorModel = new DmpNewVersionDialogEditorModel().fromModel(this.dmp, this.dmp.blueprint);
|
||||
this.selectedBlueprintSections = this.plan.blueprint?.definition?.sections?.filter(x => x.hasTemplates) || null;
|
||||
this.editorModel = new DmpNewVersionDialogEditorModel().fromModel(this.plan, this.plan.blueprint);
|
||||
this.formGroup = this.editorModel.buildForm();
|
||||
}
|
||||
|
||||
selectedBlueprintChanged(item: PlanBlueprint): void{
|
||||
this.selectedBlueprintSections = item.definition?.sections?.filter(x => x.hasTemplates) || null;
|
||||
if(this.selectedBlueprintSections && this.hasDescriptions()) {
|
||||
this.formGroup = this.editorModel.fromModel(this.dmp, item, this.formGroup.get('label').value, this.formGroup.get('description').value).buildForm();
|
||||
this.formGroup = this.editorModel.fromModel(this.plan, item, this.formGroup.get('label').value, this.formGroup.get('description').value).buildForm();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ export class NewVersionPlanDialogComponent extends BaseComponent {
|
|||
}
|
||||
|
||||
hasDescriptions() {
|
||||
return this.dmp.descriptions?.length > 0;
|
||||
return this.plan.descriptions?.length > 0;
|
||||
}
|
||||
|
||||
close() {
|
||||
|
@ -188,7 +188,7 @@ export class NewVersionPlanDialogComponent extends BaseComponent {
|
|||
formData.descriptions = formData.descriptions.filter(x => x.blueprintSectionId != null)
|
||||
}
|
||||
this.planService.newVersion(formData, PlanEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)).subscribe(
|
||||
dmp => this.dialogRef.close(dmp),
|
||||
plan => this.dialogRef.close(plan),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ export class DmpNewVersionDialogEditorModel implements NewVersionPlanPersist {
|
|||
// initialize because blueprint changed
|
||||
this.descriptions = [];
|
||||
|
||||
if (item.planDescriptionTemplates?.length > 0 && blueprint.id === item.blueprint.id) { // dmp's first blueprint
|
||||
if (item.planDescriptionTemplates?.length > 0 && blueprint.id === item.blueprint.id) { // plan's first blueprint
|
||||
item.descriptions.forEach(description => {
|
||||
this.descriptions.push(new NewVersionDmpDescriptionEditorModel(this.validationErrorModel).fromModel(description.id, description.planDescriptionTemplate.sectionId));
|
||||
})
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="col-12 col-xl mt-3">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'PLAN-CONTACT-PREFILL-DIALOG.FIELDS.USER' | translate}}</mat-label>
|
||||
<app-single-auto-complete [formControl]="formGroup" [configuration]="singleAutoCompleteDmpAssociatedUserConfiguration"></app-single-auto-complete>
|
||||
<app-single-auto-complete [formControl]="formGroup" [configuration]="singleAutoCompletePlanAssociatedUserConfiguration"></app-single-auto-complete>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="row" style="justify-content: space-between;">
|
||||
|
|
|
@ -4,7 +4,7 @@ import { BaseComponent } from '@common/base/base.component';
|
|||
import { UserService } from '@app/core/services/user/user.service';
|
||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||
import { map } from 'rxjs';
|
||||
import { DmpAssociatedUser } from '@app/core/model/user/user';
|
||||
import { PlanAssociatedUser } from '@app/core/model/user/user';
|
||||
import { UntypedFormGroup } from '@angular/forms';
|
||||
import { PlanContactPrefillDialogEditorModel } from './plan-contact-prefill-dialog.editor.model';
|
||||
import { FormService } from '@common/forms/form-service';
|
||||
|
@ -22,15 +22,15 @@ export class PlanContactPrefillDialogComponent extends BaseComponent {
|
|||
contactFormGroup: UntypedFormGroup;
|
||||
label: string;
|
||||
|
||||
singleAutoCompleteDmpAssociatedUserConfiguration: SingleAutoCompleteConfiguration = {
|
||||
initialItems: (data?: any) => this.userService.queryDmpAssociated(this.userService.buildAutocompleteLookup()).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.userService.queryDmpAssociated(this.userService.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.userService.queryDmpAssociated(this.userService.buildAutocompleteLookup(null, null, [selectedItem.id])).pipe(map(x => x.items[0])),
|
||||
displayFn: (item: DmpAssociatedUser) => item.name,
|
||||
subtitleFn: (item: DmpAssociatedUser) => item.email,
|
||||
titleFn: (item: DmpAssociatedUser) => item.name,
|
||||
valueAssign: (item: DmpAssociatedUser) => item,
|
||||
uniqueAssign: (item: DmpAssociatedUser) => item.id
|
||||
singleAutoCompletePlanAssociatedUserConfiguration: SingleAutoCompleteConfiguration = {
|
||||
initialItems: (data?: any) => this.userService.queryPlanAssociated(this.userService.buildAutocompleteLookup()).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.userService.queryPlanAssociated(this.userService.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.userService.queryPlanAssociated(this.userService.buildAutocompleteLookup(null, null, [selectedItem.id])).pipe(map(x => x.items[0])),
|
||||
displayFn: (item: PlanAssociatedUser) => item.name,
|
||||
subtitleFn: (item: PlanAssociatedUser) => item.email,
|
||||
titleFn: (item: PlanAssociatedUser) => item.name,
|
||||
valueAssign: (item: PlanAssociatedUser) => item,
|
||||
uniqueAssign: (item: PlanAssociatedUser) => item.id
|
||||
|
||||
}; constructor(
|
||||
private userService: UserService,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
|
||||
import { DmpAssociatedUser } from "@app/core/model/user/user";
|
||||
import { PlanAssociatedUser } from "@app/core/model/user/user";
|
||||
import { BackendErrorValidator } from '@common/forms/validation/custom-validator';
|
||||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||
import { Validation, ValidationContext } from '@common/forms/validation/validation-context';
|
||||
import { Guid } from "@common/types/guid";
|
||||
|
||||
export class PlanContactPrefillDialogEditorModel implements DmpAssociatedUser {
|
||||
export class PlanContactPrefillDialogEditorModel implements PlanAssociatedUser {
|
||||
id: Guid;
|
||||
name: string;
|
||||
email: string;
|
||||
|
|
|
@ -250,7 +250,7 @@ export class PlanEditorComponent extends BaseEditor<PlanEditorModel, Plan> imple
|
|||
this.checkLock(this.item.id, LockTargetType.Plan, 'PLAN-EDITOR.LOCKED-DIALOG.TITLE', 'PLAN-EDITOR.LOCKED-DIALOG.MESSAGE');
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error('Could not parse Dmp item: ' + data + error);
|
||||
this.logger.error('Could not parse Plan item: ' + data + error);
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('COMMONS.ERRORS.DEFAULT'), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
}
|
||||
|
@ -532,14 +532,14 @@ export class PlanEditorComponent extends BaseEditor<PlanEditorModel, Plan> imple
|
|||
}
|
||||
|
||||
private buildFormAfterBlueprintSelection() {
|
||||
const dmp: Plan = {
|
||||
const plan: Plan = {
|
||||
label: this.formGroup.get('label').value,
|
||||
description: this.formGroup.get('description').value,
|
||||
blueprint: this.selectedBlueprint,
|
||||
status: PlanStatus.Draft
|
||||
}
|
||||
|
||||
this.prepareForm(dmp);
|
||||
this.prepareForm(plan);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -14,20 +14,20 @@
|
|||
{{ 'PLAN-FINALISE-DIALOG.PLAN' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="plan-title">
|
||||
{{ dmp.label }}
|
||||
{{ plan.label }}
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
{{ dmp.description }}
|
||||
{{ plan.description }}
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel [expanded]="true" *ngIf="isDmpValid">
|
||||
<mat-expansion-panel [expanded]="true" *ngIf="isPlanValid">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'PLAN-FINALISE-DIALOG.DESCRPIPTIONS' | translate }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description></mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="dmp.descriptions && dmp.descriptions.length > 0">
|
||||
<div *ngFor="let description of dmp.descriptions" class="row pl-3 descriptions">
|
||||
<div *ngIf="plan.descriptions && plan.descriptions.length > 0">
|
||||
<div *ngFor="let description of plan.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">
|
||||
|
@ -42,7 +42,7 @@
|
|||
<h4 *ngIf="description.status == descriptionStatusEnum.Finalized" class="col-11 ml-auto mt-1 mb-4">{{ description.label }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="!dmp.descriptions" class="emptyList">{{ 'PLAN-FINALISE-DIALOG.EMPTY' | translate }} </div>
|
||||
<div *ngIf="!plan.descriptions" class="emptyList">{{ 'PLAN-FINALISE-DIALOG.EMPTY' | translate }} </div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
|
@ -56,11 +56,11 @@
|
|||
</div>
|
||||
</mat-selection-list>
|
||||
</div>
|
||||
<ng-container *ngIf="isDmpValid == false">
|
||||
<ng-container *ngIf="isPlanValid == false">
|
||||
<mat-error>
|
||||
{{ 'PLAN-FINALISE-DIALOG.VALIDATION.INVALID-PLAN' | translate }}
|
||||
</mat-error>
|
||||
<ng-container *ngFor="let error of dmpErrors">
|
||||
<ng-container *ngFor="let error of planErrors">
|
||||
<div>
|
||||
<mat-error>
|
||||
<i class="fa fa-circle" style="font-size:16px"></i> {{error}}
|
||||
|
@ -68,7 +68,7 @@
|
|||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
<mat-error *ngIf="getFinalizedDescriptions().length === 0 && descriptionsToBeFinalized.length === 0 && isDmpValid">
|
||||
<mat-error *ngIf="getFinalizedDescriptions().length === 0 && descriptionsToBeFinalized.length === 0 && isPlanValid">
|
||||
{{'PLAN-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DESCRPIPTION-FINALISED' | translate}}
|
||||
</mat-error>
|
||||
</div>
|
||||
|
@ -77,10 +77,10 @@
|
|||
<div class="row pt-2 pb-2 pl-4 pr-4">
|
||||
{{ 'PLAN-FINALISE-DIALOG.IMPACT' | translate }}
|
||||
</div>
|
||||
<div *ngIf="dmp.accessType == planAccessTypeEnum.Public" class="row pl-4 pr-4">
|
||||
<div *ngIf="plan.accessType == planAccessTypeEnum.Public" class="row pl-4 pr-4">
|
||||
{{ 'PLAN-FINALISE-DIALOG.PUBLIC-PLAN-MESSAGE' | translate }}
|
||||
</div>
|
||||
<div *ngIf="dmp.accessType == planAccessTypeEnum.Restricted" class="row pl-4 pr-4">
|
||||
<div *ngIf="plan.accessType == planAccessTypeEnum.Restricted" class="row pl-4 pr-4">
|
||||
{{ 'PLAN-FINALISE-DIALOG.RESTRICTED-PLAN-MESSAGE' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -90,7 +90,7 @@
|
|||
<button mat-raised-button cdkFocusInitial (click)="close()" class="cancel-btn">{{ 'PLAN-FINALISE-DIALOG.ACTIONS.CANCEL' | translate }}</button>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button mat-raised-button [disabled]="!isDmpValid || getFinalizedDescriptions().length === 0 && descriptionsToBeFinalized.length === 0" class="submit-btn" (click)="onSubmit()">{{ 'PLAN-FINALISE-DIALOG.ACTIONS.SUBMIT' | translate }}</button>
|
||||
<button mat-raised-button [disabled]="!isPlanValid || getFinalizedDescriptions().length === 0 && descriptionsToBeFinalized.length === 0" class="submit-btn" (click)="onSubmit()">{{ 'PLAN-FINALISE-DIALOG.ACTIONS.SUBMIT' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -19,9 +19,9 @@ import { takeUntil } from 'rxjs/operators';
|
|||
})
|
||||
export class PlanFinalizeDialogComponent extends BaseComponent implements OnInit {
|
||||
|
||||
dmp: Plan;
|
||||
isDmpValid: boolean;
|
||||
dmpErrors: string[];
|
||||
plan: Plan;
|
||||
isPlanValid: boolean;
|
||||
planErrors: string[];
|
||||
planAccessTypeEnum = PlanAccessType;
|
||||
descriptionStatusEnum = DescriptionStatus;
|
||||
descriptionValidationOutputEnum = DescriptionValidationOutput;
|
||||
|
@ -38,18 +38,18 @@ export class PlanFinalizeDialogComponent extends BaseComponent implements OnInit
|
|||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {
|
||||
super();
|
||||
this.dmp = data.plan;
|
||||
this.plan = data.plan;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.planService.validate(this.dmp.id).pipe(takeUntil(this._destroyed),)
|
||||
this.planService.validate(this.plan.id).pipe(takeUntil(this._destroyed),)
|
||||
.subscribe(result => {
|
||||
if (result.result === PlanValidationOutput.Valid){
|
||||
this.validateDescriptions(this.dmp);
|
||||
this.isDmpValid = true;
|
||||
this.validateDescriptions(this.plan);
|
||||
this.isPlanValid = true;
|
||||
}else{
|
||||
this.isDmpValid = false;
|
||||
this.dmpErrors = result.errors;
|
||||
this.isPlanValid = false;
|
||||
this.planErrors = result.errors;
|
||||
}
|
||||
},
|
||||
error => {
|
||||
|
@ -73,8 +73,8 @@ export class PlanFinalizeDialogComponent extends BaseComponent implements OnInit
|
|||
}
|
||||
|
||||
getFinalizedDescriptions() {
|
||||
if (!this.dmp.descriptions) return [];
|
||||
const finalizedDescriptions = this.dmp.descriptions.filter(x => x.status === DescriptionStatus.Finalized);
|
||||
if (!this.plan.descriptions) return [];
|
||||
const finalizedDescriptions = this.plan.descriptions.filter(x => x.status === DescriptionStatus.Finalized);
|
||||
if (finalizedDescriptions?.length > 0){
|
||||
finalizedDescriptions.forEach(finalize => {
|
||||
this.descriptionValidationOutputMap.set(finalize.id, DescriptionValidationOutput.Valid);
|
||||
|
@ -87,17 +87,17 @@ export class PlanFinalizeDialogComponent extends BaseComponent implements OnInit
|
|||
this.dialogRef.close({ cancelled: true } as PlanFinalizeDialogOutput);
|
||||
}
|
||||
|
||||
validateDescriptions(dmp: Plan) {
|
||||
if (!dmp.descriptions?.some(x => x.status == DescriptionStatus.Draft)) return;
|
||||
validateDescriptions(plan: Plan) {
|
||||
if (!plan.descriptions?.some(x => x.status == DescriptionStatus.Draft)) return;
|
||||
|
||||
const draftDescriptions = this.dmp.descriptions.filter(x => x.status == DescriptionStatus.Draft) || [];
|
||||
const draftDescriptions = this.plan.descriptions.filter(x => x.status == DescriptionStatus.Draft) || [];
|
||||
if ( draftDescriptions.length > 0){
|
||||
draftDescriptions.forEach(draft => {
|
||||
this.descriptionValidationOutputMap.set(draft.id, DescriptionValidationOutput.Pending);
|
||||
});
|
||||
}
|
||||
|
||||
this.descriptionService.validate(dmp.descriptions.filter(x => x.status == DescriptionStatus.Draft).map(x => x.id)).pipe(takeUntil(this._destroyed),)
|
||||
this.descriptionService.validate(plan.descriptions.filter(x => x.status == DescriptionStatus.Draft).map(x => x.id)).pipe(takeUntil(this._destroyed),)
|
||||
.subscribe(result => {
|
||||
this.validationResults = result;
|
||||
},
|
||||
|
@ -108,8 +108,8 @@ export class PlanFinalizeDialogComponent extends BaseComponent implements OnInit
|
|||
}
|
||||
|
||||
get validDraftDescriptions() {
|
||||
if (!this.dmp.descriptions) return [];
|
||||
return this.dmp.descriptions.filter(x => this.validationResults.some(y => y.descriptionId == x.id && y.result == DescriptionValidationOutput.Valid));
|
||||
if (!this.plan.descriptions) return [];
|
||||
return this.plan.descriptions.filter(x => this.validationResults.some(y => y.descriptionId == x.id && y.result == DescriptionValidationOutput.Valid));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<div class="col-12 col-xl mt-3" *ngIf="user.get('userType').value == planUserTypeEnum.Internal">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'PLAN-EDITOR.FIELDS.USER' | translate}}</mat-label>
|
||||
<app-single-auto-complete [formControl]="user.get('user')" [configuration]="userService.singleAutoCompleteDmpAssociatedUserConfiguration"></app-single-auto-complete>
|
||||
<app-single-auto-complete [formControl]="user.get('user')" [configuration]="userService.singleAutoCompletePlanAssociatedUserConfiguration"></app-single-auto-complete>
|
||||
<mat-error *ngIf="user.get('user').hasError('backendError')">{{user.get('user').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="user.get('user').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
|
Loading…
Reference in New Issue