more ui changes

This commit is contained in:
Diamantis Tziotzios 2023-12-06 23:10:01 +02:00
parent c1b197ea30
commit 56bd12a4e3
25 changed files with 2716 additions and 2309 deletions

View File

@ -613,3 +613,24 @@ permissions:
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
# DescriptionReference Permissions
BrowseDescriptionTag:
roles:
- Admin
clients: [ ]
allowAnonymous: false
allowAuthenticated: false
EditDescriptionTag:
roles:
- Admin
clients: [ ]
allowAnonymous: false
allowAuthenticated: false
DeleteDescriptionTag:
roles:
- Admin
claims: [ ]
clients: [ ]
allowAnonymous: false
allowAuthenticated: false

View File

@ -9,6 +9,11 @@ export enum AppPermission {
EditDmpBlueprint = "EditDmpBlueprint", EditDmpBlueprint = "EditDmpBlueprint",
DeleteDmpBlueprint = "DeleteDmpBlueprint", DeleteDmpBlueprint = "DeleteDmpBlueprint",
//DmpBlueprint
BrowseDescription = "BrowseDescription",
EditDescription = "EditDescription",
DeleteDescription= "DeleteDescription",
//DescriptionTemplateType //DescriptionTemplateType
BrowseDescriptionTemplate = "BrowseDescriptionTemplate", BrowseDescriptionTemplate = "BrowseDescriptionTemplate",
EditDescriptionTemplate = "EditDescriptionTemplate", EditDescriptionTemplate = "EditDescriptionTemplate",

View File

@ -1,21 +0,0 @@
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
import { Guid } from "@common/types/guid";
import { Reference } from "../reference/reference";
import { Description } from "./description";
export interface DescriptionReference extends BaseEntity {
description?: Description;
reference?: Reference;
data: String;
}
//
// Persist
//
export interface DescriptionPersist extends BaseEntityPersist {
descriptionId: Guid;
referenceId: Guid;
data: String;
}

View File

@ -1,11 +1,11 @@
import { DescriptionStatus } from "@app/core/common/enum/description-status"; import { DescriptionStatus } from "@app/core/common/enum/description-status";
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model"; import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
import { Guid } from "@common/types/guid"; import { Guid } from "@common/types/guid";
import { Dmp, DmpDescriptionTemplatePersist } from "../dmp/dmp";
import { DescriptionTemplate } from "../description-template/description-template"; import { DescriptionTemplate } from "../description-template/description-template";
import { User } from "../user/user"; import { Dmp, DmpDescriptionTemplatePersist } from "../dmp/dmp";
import { Reference, ReferencePersist } from "../reference/reference"; import { Reference, ReferencePersist } from "../reference/reference";
import { Tag } from "../tag/tag"; import { Tag } from "../tag/tag";
import { User } from "../user/user";
@ -13,7 +13,7 @@ export interface Description extends BaseEntity {
label: string; label: string;
properties: PropertyDefinition; properties: PropertyDefinition;
status: DescriptionStatus; status: DescriptionStatus;
description?: String; description?: string;
createdBy: User; createdBy: User;
finalizedAt: Date; finalizedAt: Date;
descriptionReferences: DescriptionReference[]; descriptionReferences: DescriptionReference[];
@ -60,7 +60,7 @@ export interface DescriptionPersist extends BaseEntityPersist {
references: DescriptionReferencePersist[]; references: DescriptionReferencePersist[];
} }
export interface PropertyDefinitionPersist{ export interface PropertyDefinitionPersist {
fields: DescriptionFieldPersist[]; fields: DescriptionFieldPersist[];
} }
@ -69,6 +69,14 @@ export interface DescriptionFieldPersist {
value: string; value: string;
} }
export interface DescriptionReferencePersist extends BaseEntity { export interface DescriptionReferencePersist {
id: Guid;
reference?: ReferencePersist; reference?: ReferencePersist;
hash: string;
}
export interface DescriptionStatusPersist {
id: Guid;
status: DescriptionStatus;
hash: string;
} }

View File

@ -1,24 +1,24 @@
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
import { DmpStatus } from '@app/core/common/enum/dmp-status'; import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { BaseEntity, BaseEntityPersist } from '@common/base/base-entity.model';
import { Guid } from '@common/types/guid';
import { DatasetWizardModel } from '../dataset/dataset-wizard'; import { DatasetWizardModel } from '../dataset/dataset-wizard';
import { DescriptionTemplate } from '../description-template/description-template';
import { Description } from '../description/description';
import { EntityDoi } from '../entity-doi/entity-doi';
import { FunderModel } from "../funder/funder"; import { FunderModel } from "../funder/funder";
import { GrantListingModel } from "../grant/grant-listing"; import { GrantListingModel } from "../grant/grant-listing";
import { OrganizationModel } from "../organisation/organization"; import { OrganizationModel } from "../organisation/organization";
import { ProjectModel } from "../project/project"; import { ProjectModel } from "../project/project";
import { DmpReference, ReferencePersist } from '../reference/reference';
import { ResearcherModel } from "../researcher/researcher"; import { ResearcherModel } from "../researcher/researcher";
import { User, UserModel } from "../user/user"; import { User, UserModel } from "../user/user";
import { UserInfoListingModel } from "../user/user-info-listing"; import { UserInfoListingModel } from "../user/user-info-listing";
import { DmpDatasetProfile } from "./dmp-dataset-profile/dmp-dataset-profile"; import { DmpDatasetProfile } from "./dmp-dataset-profile/dmp-dataset-profile";
import { DmpDynamicField } from "./dmp-dynamic-field"; import { DmpDynamicField } from "./dmp-dynamic-field";
import { DmpExtraField } from "./dmp-extra-field"; import { DmpExtraField } from "./dmp-extra-field";
import { BaseEntity, BaseEntityPersist } from '@common/base/base-entity.model';
import { Description } from '../description/description';
import { DmpReference, ReferencePersist } from '../reference/reference';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
import { Guid } from '@common/types/guid';
import { DescriptionTemplate } from '../description-template/description-template';
import { EntityDoi } from '../entity-doi/entity-doi';
export interface DmpModel { //TODO: Delete export interface DmpModel { //TODO: Delete
id: string; id: string;
@ -154,3 +154,9 @@ export interface DmpUserPersist {
user: Guid; user: Guid;
role: DmpUserRole; role: DmpUserRole;
} }
export interface DmpUserRemovePersist {
id: Guid;
dmpId: Guid;
role: DmpUserRole;
}

View File

@ -16,7 +16,7 @@ export class DmpLookup extends Lookup implements DmpFilter {
accessTypes: DmpAccessType[]; accessTypes: DmpAccessType[];
versions: Number[]; versions: Number[];
dmpDescriptionTemplateSubQuery: DmpDescriptionTemplateLookup; dmpDescriptionTemplateSubQuery: DmpDescriptionTemplateLookup;
groupIds: Guid[];
constructor() { constructor() {
super(); super();
@ -32,4 +32,5 @@ export interface DmpFilter {
statuses: DmpStatus[]; statuses: DmpStatus[];
accessTypes: DmpAccessType[]; accessTypes: DmpAccessType[];
versions: Number[] versions: Number[]
groupIds: Guid[];
} }

View File

@ -1,7 +1,7 @@
import { HttpClient, HttpHeaders } from '@angular/common/http'; import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IsActive } from '@app/core/common/enum/is-active.enum'; import { IsActive } from '@app/core/common/enum/is-active.enum';
import { Description, DescriptionPersist, PublicDescription } from '@app/core/model/description/description'; import { Description, DescriptionPersist, DescriptionStatusPersist, PublicDescription } from '@app/core/model/description/description';
import { DescriptionLookup } from '@app/core/query/description.lookup'; import { DescriptionLookup } from '@app/core/query/description.lookup';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
@ -60,6 +60,14 @@ export class DescriptionService {
catchError((error: any) => throwError(error))); catchError((error: any) => throwError(error)));
} }
persistStatus(item: DescriptionStatusPersist, reqFields: string[] = []): Observable<Description> {
const url = `${this.apiBase}/persist-status`;
return this.http
.post<Description>(url, item).pipe(
catchError((error: any) => throwError(error)));
}
delete(id: Guid): Observable<Description> { delete(id: Guid): Observable<Description> {
const url = `${this.apiBase}/${id}`; const url = `${this.apiBase}/${id}`;

View File

@ -21,7 +21,7 @@ import { DataTableRequest } from '../../model/data-table/data-table-request';
import { DatasetListingModel } from '../../model/dataset/dataset-listing'; import { DatasetListingModel } from '../../model/dataset/dataset-listing';
import { DatasetProfileModel } from '../../model/dataset/dataset-profile'; import { DatasetProfileModel } from '../../model/dataset/dataset-profile';
import { DatasetsToBeFinalized } from '../../model/dataset/datasets-toBeFinalized'; import { DatasetsToBeFinalized } from '../../model/dataset/datasets-toBeFinalized';
import { CloneDmpPersist, Dmp, DmpModel, DmpPersist, DmpUser, DmpUserPersist, NewVersionDmpPersist } from '../../model/dmp/dmp'; import { CloneDmpPersist, Dmp, DmpModel, DmpPersist, DmpUser, DmpUserPersist, DmpUserRemovePersist, NewVersionDmpPersist } from '../../model/dmp/dmp';
import { DmpListingModel } from '../../model/dmp/dmp-listing'; import { DmpListingModel } from '../../model/dmp/dmp-listing';
import { DmpOverviewModel } from '../../model/dmp/dmp-overview'; import { DmpOverviewModel } from '../../model/dmp/dmp-overview';
import { DatasetProfileCriteria } from '../../query/dataset-profile/dataset-profile-criteria'; import { DatasetProfileCriteria } from '../../query/dataset-profile/dataset-profile-criteria';
@ -117,6 +117,14 @@ export class DmpServiceNew {
catchError((error: any) => throwError(error))); catchError((error: any) => throwError(error)));
} }
removeUser(item: DmpUserRemovePersist, reqFields: string[] = []): Observable<Dmp> {
const url = `${this.apiBase}/remove-user`;
return this.http
.post<Dmp>(url, item).pipe(
catchError((error: any) => throwError(error)));
}
downloadXML(id: Guid): Observable<HttpResponse<Blob>> { downloadXML(id: Guid): Observable<HttpResponse<Blob>> {
const url = `${this.apiBase}/xml/export/${id}`; const url = `${this.apiBase}/xml/export/${id}`;
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml'); let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml');

View File

@ -1,382 +0,0 @@
import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
import { ExternalDatasetType } from '@app/core/common/enum/external-dataset-type';
import { DataRepositoryModel } from '@app/core/model/data-repository/data-repository';
import { DatasetProfileModel } from '@app/core/model/dataset/dataset-profile';
import { DatasetWizardModel } from '@app/core/model/dataset/dataset-wizard';
import { DmpModel } from '@app/core/model/dmp/dmp';
import { ExternalDatasetModel } from '@app/core/model/external-dataset/external-dataset';
import { RegistryModel } from '@app/core/model/registry/registry';
import { ServiceModel } from '@app/core/model/service/service';
import { TagModel } from '@app/core/model/tag/tag';
import { DatasetDescriptionFormEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model';
import { BackendErrorValidator } from '@common/forms/validation/custom-validator';
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
import { ValidationContext } from '@common/forms/validation/validation-context';
export class DatasetWizardEditorModel {
public id: string;
public label: string;
public profile: DatasetProfileModel;
public uri: String;
public status: number;
public description: String;
public services: ExternalServiceEditorModel[] = [];
public registries: ExternalRegistryEditorModel[] = [];
public dataRepositories: ExternalDataRepositoryEditorModel[] = [];
public tags: ExternalTagEditorModel[] = [];
public externalDatasets: ExternalDatasetEditorModel[] = [];
public dmp: DmpModel;
public dmpSectionIndex: number;
public datasetProfileDefinition: DatasetDescriptionFormEditorModel;
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
public isProfileLatestVersion: Boolean;
public modified: Date;
fromModel(item: DatasetWizardModel): DatasetWizardEditorModel {
this.id = item.id;
this.label = item.label;
this.profile = item.profile;
this.uri = item.uri;
this.status = item.status;
this.description = item.description;
if (item.services) { this.services = item.services.map(x => new ExternalServiceEditorModel().fromModel(x)); }
if (item.registries) { this.registries = item.registries.map(x => new ExternalRegistryEditorModel().fromModel(x)); }
if (item.dataRepositories) { this.dataRepositories = item.dataRepositories.map(x => new ExternalDataRepositoryEditorModel().fromModel(x)); }
if (item.externalDatasets) { this.externalDatasets = item.externalDatasets.map(x => new ExternalDatasetEditorModel().fromModel(x)); }
this.dmp = item.dmp;
this.dmpSectionIndex = item.dmpSectionIndex;
if (item.datasetProfileDefinition) { this.datasetProfileDefinition = new DatasetDescriptionFormEditorModel().fromModel(item.datasetProfileDefinition); }
if (item.tags) { this.tags = item.tags.map(x => new ExternalTagEditorModel().fromModel(x)); }
this.isProfileLatestVersion = item.isProfileLatestVersion;
this.modified = new Date(item.modified);
return this;
}
buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
if (context == null) { context = this.createValidationContext(); }
const formBuilder = new UntypedFormBuilder();
const formGroup = formBuilder.group({
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
uri: [{ value: this.uri, disabled: disabled }, context.getValidation('uri').validators],
status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
dmp: [{ value: this.dmp, disabled: disabled }, context.getValidation('dmp').validators],
dmpSectionIndex: [{ value: this.dmpSectionIndex, disabled: disabled }, context.getValidation('dmpSectionIndex').validators],
//externalDatasets: [{ value: this.externalDatasets, disabled: disabled }, context.getValidation('externalDatasets').validators],
tags: [{ value: this.tags, disabled: disabled }, context.getValidation('tags').validators],
//registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators],
//dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators],
//services: [{ value: this.services, disabled: disabled }, context.getValidation('services').validators],
profile: [{ value: this.profile, disabled: disabled }, context.getValidation('profile').validators],
modified: [{value: this.modified, disabled: disabled}, context.getValidation('modified').validators]
});
const externalDatasetsFormArray = new Array<UntypedFormGroup>();
//if (this.externalDatasets && this.externalDatasets.length > 0) {
this.externalDatasets.forEach(item => {
externalDatasetsFormArray.push(item.buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
});
// } else {
// //externalDatasetsFormArray.push(new ExternalDatasetModel().buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
// }
formGroup.addControl('externalDatasets', formBuilder.array(externalDatasetsFormArray));
// const tagsFormArray = new Array<FormGroup>();
// if (this.tags && this.tags.length > 0) {
// this.tags.forEach(item => {
// tagsFormArray.push(item.buildForm(context.getValidation('tags').descendantValidations, disabled));
// });
// } else {
// //externalDatasetsFormArray.push(new ExternalDatasetModel().buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
// }
// formGroup.addControl('tags', formBuilder.array(tagsFormArray));
const registriesFormArray = new Array<UntypedFormGroup>();
//if (this.registries && this.registries.length > 0) {
this.registries.forEach(item => {
registriesFormArray.push(item.buildForm(context.getValidation('registries').descendantValidations, disabled));
});
// } else {
// //externalDatasetsFormArray.push(new ExternalDatasetModel().buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
// }
formGroup.addControl('registries', formBuilder.array(registriesFormArray));
const dataRepositoriesFormArray = new Array<UntypedFormGroup>();
//if (this.dataRepositories && this.dataRepositories.length > 0) {
this.dataRepositories.forEach(item => {
dataRepositoriesFormArray.push(item.buildForm(context.getValidation('dataRepositories').descendantValidations, disabled));
});
// } else {
// //externalDatasetsFormArray.push(new ExternalDatasetModel().buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
// }
formGroup.addControl('dataRepositories', formBuilder.array(dataRepositoriesFormArray));
const servicesFormArray = new Array<UntypedFormGroup>();
// if (this.services && this.services.length > 0) {
this.services.forEach(item => {
servicesFormArray.push(item.buildForm(context.getValidation('services').descendantValidations, disabled));
});
// } else {
// //externalDatasetsFormArray.push(new ExternalDatasetModel().buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
// }
formGroup.addControl('services', formBuilder.array(servicesFormArray));
// const tagsFormArray = new Array<FormGroup>();
// this.tags.forEach(item => {
// tagsFormArray.push(item.buildForm(context.getValidation('tags').descendantValidations, disabled));
// });
// formGroup.addControl('tags', formBuilder.array(tagsFormArray));
if (this.datasetProfileDefinition) { formGroup.addControl('datasetProfileDefinition', this.datasetProfileDefinition.buildForm()); }
// formGroup.addControl('profile', this.profile.buildForm());
return formGroup;
}
createValidationContext(): ValidationContext {
const baseContext: ValidationContext = new ValidationContext();
baseContext.validation.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] });
baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
baseContext.validation.push({ key: 'profile', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'profile')] });
baseContext.validation.push({ key: 'uri', validators: [BackendErrorValidator(this.validationErrorModel, 'uri')] });
baseContext.validation.push({ key: 'status', validators: [BackendErrorValidator(this.validationErrorModel, 'status')] });
baseContext.validation.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] });
baseContext.validation.push({ key: 'services', validators: [BackendErrorValidator(this.validationErrorModel, 'services')] });
baseContext.validation.push({ key: 'registries', validators: [BackendErrorValidator(this.validationErrorModel, 'registries')] });
baseContext.validation.push({ key: 'dataRepositories', validators: [BackendErrorValidator(this.validationErrorModel, 'dataRepositories')] });
baseContext.validation.push({ key: 'externalDatasets', validators: [BackendErrorValidator(this.validationErrorModel, 'externalDatasets')] });
baseContext.validation.push({ key: 'dmp', validators: [BackendErrorValidator(this.validationErrorModel, 'dmp')] });
baseContext.validation.push({ key: 'dmpSectionIndex', validators: [BackendErrorValidator(this.validationErrorModel, 'dmpSectionIndex')] });
baseContext.validation.push({ key: 'datasetProfileDefinition', validators: [BackendErrorValidator(this.validationErrorModel, 'datasetProfileDefinition')] });
baseContext.validation.push({ key: 'tags', validators: [BackendErrorValidator(this.validationErrorModel, 'datasetProfileDefinition')] });
baseContext.validation.push({ key: 'modified', validators: []});
return baseContext;
}
}
export class ExternalTagEditorModel {
public abbreviation: String;
public definition: String;
public id: String;
public name: String;
public reference: String;
public uri: String;
constructor(id?: String, name?: String) {
this.id = id;
this.name = name;
}
fromModel(item: TagModel): ExternalTagEditorModel {
this.id = item.id;
this.name = item.name;
return this;
}
buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
return new UntypedFormBuilder().group({
id: [this.id],
name: [this.name]
});
}
}
export class ExternalServiceEditorModel {
public id: String;
public abbreviation: String;
public definition: String;
public uri: String;
public label: String;
public reference: String;
public source: String;
constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String, source?: String) {
this.id = id;
this.abbreviation = abbreviation;
this.definition = definition;
this.uri = uri;
this.label = label;
this.reference = reference;
this.source = source;
}
fromModel(item: ServiceModel): ExternalServiceEditorModel {
this.id = item.id;
this.abbreviation = item.abbreviation;
this.definition = item.definition;
this.uri = item.uri;
this.label = item.label;
this.reference = item.reference;
this.source = item.source;
return this;
}
buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
return new UntypedFormBuilder().group({
id: [this.id],
abbreviation: [this.abbreviation],
label: [this.label, Validators.required],
reference: [this.reference],
uri: [this.uri, Validators.required],
definition: [this.definition],
source: [this.source]
});
}
}
export class ExternalRegistryEditorModel {
public abbreviation: String;
public definition: String;
public id: String;
public label: String;
public reference: String;
public uri: String;
public source: String
constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String, source?: String) {
this.abbreviation = abbreviation;
this.definition = definition;
this.id = id;
this.label = label;
this.reference = reference;
this.uri = uri;
this.source = source;
}
fromModel(item: RegistryModel): ExternalRegistryEditorModel {
this.abbreviation = item.abbreviation;
this.definition = item.definition;
this.id = item.id;
this.label = item.label;
this.reference = item.pid ? item.pid : item.reference;
this.uri = item.uri;
this.source = item.source
return this;
}
buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
return new UntypedFormBuilder().group({
id: [this.id],
abbreviation: [this.abbreviation],
label: [this.label, Validators.required],
reference: [this.reference],
uri: [this.uri, Validators.required],
definition: [this.definition],
source: [this.source]
});
}
}
export class ExternalDatasetEditorModel {
public abbreviation: String;
public id: String;
public name: String;
public reference: String;
public type: ExternalDatasetType;
public info: String;
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
public source: String;
constructor(id?: string, abbreviation?: string, name?: string, reference?: string, source?: String, info?: string, type?: ExternalDatasetType) {
this.id = id;
this.name = name;
this.abbreviation = abbreviation;
this.reference = reference;
this.info = info;
this.type = type;
this.source = source;
}
fromModel(item: ExternalDatasetModel): ExternalDatasetEditorModel {
this.abbreviation = item.abbreviation;
this.id = item.id;
this.name = item.name;
this.reference = item.reference;
this.type = item.type;
this.info = item.info;
this.source = item.source;
return this;
}
buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
return new UntypedFormBuilder().group({
id: [this.id],
abbreviation: [this.abbreviation],
name: [this.name, Validators.required],
reference: [this.reference],
type: [this.type],
info: [this.info],
source: [this.source]
});
}
}
export class ExternalDataRepositoryEditorModel {
public id: string;
public name: string;
public abbreviation: string;
public uri: string;
public reference: string;
public info: string;
public created: Date;
public modified: Date;
public source: string;
constructor(id?: string, name?: string, abbreviation?: string, uri?: string, reference?: string, source?: string) {
this.id = id;
this.name = name;
this.abbreviation = abbreviation;
this.uri = uri;
this.reference = reference;
this.source = source;
}
fromModel(item: DataRepositoryModel): ExternalDataRepositoryEditorModel {
this.id = item.id;
this.name = item.name;
this.abbreviation = item.abbreviation;
this.uri = item.uri;
this.info = item.info;
this.reference = item.pid;
this.source = item.source;
return this;
}
buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
return new UntypedFormBuilder().group({
id: [this.id],
name: [this.name, [Validators.required]],
abbreviation: [this.abbreviation],
uri: [this.uri, [Validators.required]],
info: [this.info],
reference: [this.reference],
source: [this.source]
});
}
}
// export class TagModel implements Serializable<TagModel> {
// public id: string;
// public name: string;
// constructor(id?: string, name?: string) {
// this.id = id;
// this.name = name;
// }
// fromJSONObject(item: any): TagModel {
// this.id = item.id;
// this.name = item.name;
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
// return new FormBuilder().group({
// id: [this.id],
// name: [this.name]
// });
// }
// }

View File

@ -1,288 +0,0 @@
<div class="main-content">
<div class="container-fluid dataset-wizard">
<form *ngIf="formGroup" [formGroup]="formGroup">
<!-- <form *ngIf="formGroup" [formGroup]="formGroup" (ngSubmit)="formSubmit()"> -->
<!-- Dataset Header -->
<div class="fixed-editor-header">
<div class="card dataset-editor-header">
<div class="col">
<div class="row">
<div class="col info">
<ng-container *ngIf="!viewOnly else viewOnlyTemplate">
<div *ngIf="isNew" class="dataset-title">{{'DMP-EDITOR.TITLE.ADD-DATASET' | translate}}</div>
<div *ngIf="!isNew" class="dataset-title">{{'DMP-EDITOR.TITLE.EDIT-DESCRIPTION' | translate}}</div>
<div class="dataset-subtitle">{{ formGroup.get('label').value }} <span *ngIf="isDirty()" class="dataset-changes">({{'DMP-EDITOR.CHANGES' | translate}})</span></div>
</ng-container>
<ng-template #viewOnlyTemplate>
<div class="dataset-title">{{'DMP-EDITOR.TITLE.PREVIEW-DATASET' | translate}}</div>
</ng-template>
<div class="d-flex flex-direction-row dmp-info">
<div class="col-auto dataset-to-dmp">{{'DATASET-LISTING.TOOLTIP.TO-DMP' | translate}}</div>
<div class="dmp-title p-0">:&nbsp;{{ formGroup.get('dmp').value.label }}</div>
<div class="col-auto d-flex align-items-center">
<a [routerLink]="['/overview/' + formGroup.get('dmp').value.id]" target="_blank" class="pointer open-in-new-icon">
<mat-icon class="size-18">open_in_new</mat-icon>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-auto d-flex align-items-center">
<button *ngIf="formGroup.get('id').value" [disabled]="isDirty()" [matTooltipDisabled]="!isDirty()"
mat-raised-button class="dataset-export-btn" type="button"
[matMenuTriggerFor]="exportMenu" (click)="$event.stopPropagation();"
[matTooltip]="'DATASET-EDITOR.ACTIONS.DISABLED-EXPORT' | translate">
{{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}
<mat-icon [disabled]="isDirty()" style="width: 14px;">expand_more</mat-icon>
</button>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(formGroup.get('id').value)">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDOCX(formGroup.get('id').value)">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXML(formGroup.get('id').value)">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
</mat-menu>
</div>
<mat-divider *ngIf="formGroup.get('id').value && (!viewOnly || (!lockStatus && !viewOnly) || lockStatus || (hasReversableStatus() && !lockStatus))"
[vertical]="true" class="ml-2 mr-2"></mat-divider>
<div *ngIf="isDirty() && !viewOnly" class="col-auto d-flex align-items-center pr-0">
<button [disabled]="saving" type="button" mat-raised-button class="dataset-discard-btn" (click)="discardChanges()">
{{'DMP-EDITOR.ACTIONS.DISCARD' | translate}}
</button>
</div>
<div class="col-auto d-flex align-items-center">
<button [disabled]="saving" *ngIf="!lockStatus && !viewOnly" mat-raised-button
class="dataset-save-btn mr-2" type="button">
<span class="d-flex flex-row row">
<span (click)="!saving?save():null" class="col">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</span>
<mat-divider [vertical]="true"></mat-divider>
<span *ngIf="!saving" class="align-items-center justify-content-center col-4 d-flex"
(click)="$event.stopPropagation();" [matMenuTriggerFor]="menu">
<mat-icon >expand_more</mat-icon>
</span>
<span *ngIf="saving" class="align-items-center justify-content-center col-4 d-flex">
<mat-icon >expand_more</mat-icon>
</span>
</span>
</button>
<mat-menu #menu="matMenu">
<button [disabled]="saving" mat-menu-item (click)="save(saveAnd.close)" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CLOSE' | translate }}</button>
<button [disabled]="saving" mat-menu-item (click)="save(saveAnd.addNew)" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-ADD' | translate }}</button>
<button [disabled]="saving" mat-menu-item (click)="save()" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CONTINUE' | translate }}</button>
</mat-menu>
<button [disabled]="saving" *ngIf="!lockStatus && !viewOnly" mat-raised-button class="dataset-save-btn mr-2" type="button" (click)="saveFinalize()">{{ 'DATASET-WIZARD.ACTIONS.FINALIZE' | translate }}</button>
<!-- <button *ngIf="!lockStatus && !viewOnly" mat-raised-button class="dataset-save-btn mr-2" (click)="save()" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
<button *ngIf="!lockStatus && !viewOnly" mat-raised-button class="dataset-save-btn mr-2" (click)="save(saveAnd.close)" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CLOSE' | translate }}</button>
<button *ngIf="!lockStatus && !viewOnly" mat-raised-button class="dataset-save-btn mr-2" (click)="save(saveAnd.addNew)">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-ADD' | translate }}</button> -->
<button [disabled]="saving" *ngIf="lockStatus" mat-raised-button disabled class="dataset-save-btn cursor-default" type="button">{{ 'DMP-OVERVIEW.LOCKED' | translate}}</button>
<button [disabled]="saving" *ngIf="hasReversableStatus() && !lockStatus" mat-raised-button class="dataset-save-btn mr-2" (click)="reverse()" type="button">{{ 'DATASET-WIZARD.ACTIONS.REVERSE' | translate }}</button>
<!-- <button *ngIf="!lockStatus" mat-raised-button class="dataset-save-btn mr-2" (click)="touchForm()" type="button">{{ 'DATASET-WIZARD.ACTIONS.VALIDATE' | translate }}</button> -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row editor-content">
<div class="col-auto dataset-stepper">
<div class="stepper-back d-flex flex-direction-row">
<div class="d-flex align-items-center pr-2 back-to-dmp" (click)="backToDmp(formGroup.get('dmp').value.id)">
<mat-icon class="back-icon pointer">chevron_left</mat-icon>
<span class="pointer">{{'DATASET-WIZARD.ACTIONS.BACK-TO' | translate}}</span>
</div>
<div class="col-auto dmp-label ml-3">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
</div>
<div class="stepper-title">{{'DMP-EDITOR.STEPPER.USER-GUIDE' | translate}}</div>
<div class="stepper-options" id="stepper-options">
<div class="col stepper-list">
<div (click)="table0fContents.onToCentrySelected()" *ngIf="!datasetInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0, 'text-danger':hintErrors}">0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (2)</div>
<div (click)="table0fContents.onToCentrySelected()" *ngIf="datasetInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0}">0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (<mat-icon class="done-icon">done</mat-icon>)</div>
<div class="row toc-pane-container" #boundary>
<div #spacer></div>
<table-of-contents [visibilityRulesService]="visRulesService" [selectedFieldsetId]="fieldsetIdWithFocus" #table0fContents
[showErrors]="showtocentriesErrors" [TOCENTRY_ID_PREFIX]="TOCENTRY_ID_PREFIX" [hasFocus]="step > 0"
[formGroup]="formGroup" *ngIf="formGroup && formGroup.get('datasetProfileDefinition')" [links]="links"
[boundary]="boundary" [spacer]="spacer" [isActive]="step !== 0" stickyThing (stepFound)="onStepFound($event)"
(currentLinks)="getLinks($event)" (entrySelected)="changeStep($event.entry, $event.execute)"
[visibilityRules]="formGroup.get('datasetProfileDefinition').get('rules').value"></table-of-contents>
</div>
</div>
</div>
<div class="stepper-actions">
<div mat-raised-button type="button" class="col-auto previous stepper-btn mr-2" [ngClass]="{'previous-disabled': this.step === 0}" (click)="previousStep()">
<span class="material-icons">chevron_left</span>
<div>{{'DMP-EDITOR.STEPPER.PREVIOUS' | translate}}</div>
</div>
<div *ngIf="this.step < this.maxStep" mat-raised-button type="button" class="col-auto stepper-btn dataset-next ml-auto" (click)="nextStep()">
<div>{{'DMP-EDITOR.STEPPER.NEXT' | translate}}</div>
<span class="material-icons">chevron_right</span>
</div>
<div *ngIf="!formGroup.get('profile').value" mat-raised-button type="button" class="col-auto stepper-btn dataset-next next-disabled ml-auto">
<div>{{'DMP-EDITOR.STEPPER.NEXT' | translate}}</div>
<span class="material-icons">chevron_right</span>
</div>
<button [disabled]="saving" (click)="save(saveAnd.addNew)" *ngIf="(step === maxStep) && !lockStatus && formGroup.get('profile').value && !viewOnly" mat-raised-button type="button" class="col-auto stepper-btn add-dataset-btn ml-auto">
{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-ADD' | translate }}
</button>
</div>
<div class="col-auto pr-0">
<app-form-progress-indication class="col-12" *ngIf="formGroup && !viewOnly" [formGroup]="formGroup" [isDatasetEditor]="true"></app-form-progress-indication>
</div>
</div>
<div class="col-auto form" id="dataset-editor-form">
<app-dataset-editor-component [hidden]="this.step !== 0" [formGroup]="formGroup" [dmpId]="formGroup.get('dmp').value.id" [availableProfiles]="availableDescriptionTemplates" (formChanged)="formChanged()"></app-dataset-editor-component>
<app-dataset-description (visibilityRulesInstance)="visRulesService = $event" [TOCENTRY_ID_PREFIX]="TOCENTRY_ID_PREFIX" [hidden]="this.step === 0" *ngIf="formGroup && formGroup.get('datasetProfileDefinition')" [form]="this.formGroup.get('datasetProfileDefinition')" [visibilityRules]="formGroup.get('datasetProfileDefinition').get('rules').value" [datasetProfileId]="formGroup.get('profile').value" [linkToScroll]="linkToScroll" (fieldsetFocusChange)="fieldsetIdWithFocus = $event"></app-dataset-description>
</div>
</div>
</form>
</div>
</div>
<!-- <mat-slide-toggle [(ngModel)]="showtocentriesErrors">
</mat-slide-toggle> -->
<!-- <div class="row">
<div class="col-12">
<button (click)="printForm()">Print form</button>
</div>
<div class="col-12">
<button (click)="printFormValue()">Print form value</button>
</div>
</div> -->
<!-- <div class="main-content">
<div class="container-fluid">
<div class="card dataset-wizard">
<div class="row card-header card-header-plain d-flex">
<div class="col-12 card-desc d-flex flex-column justify-content-center">
<div class="row">
<div class="col d-flex align-items-center flex-wrap-nowrap">
<h4 *ngIf="!isNew" class="card-title">{{datasetWizardModel?.label}}
<span *ngIf="this.formGroup && this.formGroup.dirty"> -
{{ 'GENERAL.STATUSES.EDIT' | translate }}</span>
</h4>
<div *ngIf="isNew" class="card-desc new-dataset d-flex flex-column justify-content-center">
<h4 class="card-title">{{ 'DATASET-WIZARD.TITLE.NEW' | translate }}</h4>
</div>
<div *ngIf="datasetWizardModel && !isNew" class="ml-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu" class="more-icon" *ngIf="!publicMode" (click)="$event.stopImmediatePropagation();">
<mat-icon class="more-horiz">more_horiz</mat-icon>
</button>
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="openDmpSearchDialogue()" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DESCRIPTION' | translate}}
</button>
<button mat-menu-item *ngIf="!viewOnly && !isCopy" (click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button>
</mat-menu>
</div>
</div>
<div class="col-auto d-flex flex-wrap p-2" *ngIf="datasetWizardModel && !isNew">
<button mat-raised-button [matMenuTriggerFor]="exportMenu" color="primary" class="lightblue-btn ml-2 export-btn">
{{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }} <mat-icon>arrow_drop_down</mat-icon>
</button>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF()">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDOCX()">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXML()">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
</mat-menu>
</div>
</div>
</div>
</div>
<form *ngIf="formGroup">
<div class="d-flex flex-column">
<mat-tab-group class="mt-3">
<mat-tab>
<ng-template mat-tab-label class="tab-label">
<i class="material-icons-outlined mr-2">view_agenda</i>
{{'DATASET-PROFILE-EDITOR.STEPS.PAGES.DATASET-DETAILS' | translate}}
</ng-template>
<form *ngIf="formGroup" [formGroup]="formGroup" class="p-3">
<mat-form-field class="col-md-6">
<app-single-auto-complete [required]="true" [formControl]="formGroup.get('dmp')" placeholder="{{'DATASET-EDITOR.FIELDS.DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration">
</app-single-auto-complete>
</mat-form-field>
<mat-form-field class="col-md-6">
<mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" [required]="true" formControlName="profile">
<mat-option *ngFor="let profile of availableProfiles" [value]="profile">
{{profile.label}}
</mat-option>
</mat-select>
<mat-error *ngIf="formGroup.get('profile').hasError('backendError')">
{{formGroup.get('profile').getError('backendError').message}}</mat-error>
</mat-form-field>
<app-dataset-editor-component [formGroup]="formGroup"></app-dataset-editor-component>
</form>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>
<mat-icon class="mr-2">work_outline</mat-icon>
{{'DATASET-PROFILE-EDITOR.STEPS.PAGES.EXTERNAL-REFERENCES' | translate}}
</ng-template>
<form *ngIf="formGroup" [formGroup]="formGroup" class="p-3">
<app-dataset-external-references-editor-component [formGroup]="formGroup" [viewOnly]="viewOnly"></app-dataset-external-references-editor-component>
</form>
</mat-tab>
<mat-tab [disabled]="isNew && (formGroup.get('profile').disabled || !(formGroup.get('profile').valid))">
<ng-template mat-tab-label>
<div class="d-flex">
<mat-icon class="mr-2">library_books</mat-icon>
{{'DATASET-PROFILE-EDITOR.STEPS.PAGES.DESCRIPTION' | translate}}
</div>
</ng-template>
<div class="col">
<div class="row toc-pane-container" #boundary>
<div class="col-md-8 h-100 ">
<app-dataset-description-form class="w-100 h-100" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')" [visibilityRules]="datasetWizardModel.datasetProfileDefinition.rules" [datasetProfileId]="formGroup.get('profile').value" [linkToScroll]="linkToScroll">
</app-dataset-description-form>
</div>
<div #spacer></div>
<div class="col-md-4">
<table-of-contents class="toc-pane-container" [boundary]="boundary" [spacer]="spacer" stickyThing (stepFound)="onStepFound($event)"></table-of-contents>
</div>
</div>
</div>
</mat-tab>
</mat-tab-group>
<div class="actions">
<mat-icon *ngIf="hasNotReversableStatus() || lockStatus" color="accent" class="align-self-center mr-1">info_outlined</mat-icon>
<div *ngIf="hasNotReversableStatus()" class="align-self-center mr-3">{{'DATASET-WIZARD.ACTIONS.INFO' | translate}}</div>
<div *ngIf="lockStatus" class="align-self-center mr-3">{{'DATASET-WIZARD.ACTIONS.LOCK' | translate}}</div>
<button mat-raised-button (click)="cancel()" type="button" class="cancelButton" color="primary">
{{'DMP-EDITOR.ACTIONS.CANCEL' | translate}}
</button>
<button *ngIf="(datasetWizardModel.status == 0 || isNew) && !lockStatus" mat-raised-button class="saveButton" color="primary" (click)="save();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
<button *ngIf="(datasetWizardModel.status == 0 || isNew) && !lockStatus" mat-raised-button class="finalizeButton" color="primary" (click)="saveFinalize();" type="button">{{ 'DATASET-WIZARD.ACTIONS.FINALIZE' | translate }}</button>
<div class="fill-space"></div>
<button *ngIf="hasReversableStatus() && !lockStatus" mat-raised-button class="reverseButton" color="primary" (click)="reverse()" type="button">{{ 'DATASET-WIZARD.ACTIONS.REVERSE' | translate }}</button>
</div>
</div>
</form>
</div>
</div>
</div> -->

View File

@ -0,0 +1,150 @@
<div class="main-content">
<div class="container-fluid description-editor">
<form *ngIf="formGroup" [formGroup]="formGroup">
<!-- <form *ngIf="formGroup" [formGroup]="formGroup" (ngSubmit)="formSubmit()"> -->
<!-- Description Header -->
<div class="fixed-editor-header">
<div class="card description-editor-header">
<div class="col">
<div class="row">
<div class="col info">
<ng-container *ngIf="!viewOnly else viewOnlyTemplate">
<div *ngIf="isNew" class="description-title">{{'DMP-EDITOR.TITLE.ADD-DATASET' | translate}}</div>
<div *ngIf="!isNew" class="description-title">{{'DMP-EDITOR.TITLE.EDIT-DESCRIPTION' | translate}}</div>
<div class="description-subtitle">{{ formGroup.get('label').value }} <span *ngIf="isDirty()" class="description-changes">({{'DMP-EDITOR.CHANGES' | translate}})</span></div>
</ng-container>
<ng-template #viewOnlyTemplate>
<div class="description-title">{{'DMP-EDITOR.TITLE.PREVIEW-DATASET' | translate}}</div>
</ng-template>
<div class="d-flex flex-direction-row dmp-info">
<div class="col-auto description-to-dmp">{{'DATASET-LISTING.TOOLTIP.TO-DMP' | translate}}</div>
<div class="dmp-title p-0">:&nbsp;{{ formGroup.get('dmp').value.label }}</div>
<div class="col-auto d-flex align-items-center">
<a [routerLink]="['/overview/' + formGroup.get('dmp').value.id]" target="_blank" class="pointer open-in-new-icon">
<mat-icon class="size-18">open_in_new</mat-icon>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-auto d-flex align-items-center">
<button *ngIf="formGroup.get('id').value" [disabled]="isDirty()" [matTooltipDisabled]="!isDirty()"
mat-raised-button class="description-export-btn" type="button"
[matMenuTriggerFor]="exportMenu" (click)="$event.stopPropagation();"
[matTooltip]="'DATASET-EDITOR.ACTIONS.DISABLED-EXPORT' | translate">
{{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}
<mat-icon [disabled]="isDirty()" style="width: 14px;">expand_more</mat-icon>
</button>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(formGroup.get('id').value)">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDOCX(formGroup.get('id').value)">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXML(formGroup.get('id').value)">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
</mat-menu>
</div>
<mat-divider *ngIf="formGroup.get('id').value && (!viewOnly || (!lockStatus && !viewOnly) || lockStatus || (hasReversableStatus() && !lockStatus))"
[vertical]="true" class="ml-2 mr-2"></mat-divider>
<div *ngIf="isDirty() && !viewOnly" class="col-auto d-flex align-items-center pr-0">
<button [disabled]="saving" type="button" mat-raised-button class="description-discard-btn" (click)="discardChanges()">
{{'DMP-EDITOR.ACTIONS.DISCARD' | translate}}
</button>
</div>
<div class="col-auto d-flex align-items-center">
<button [disabled]="saving" *ngIf="!lockStatus && !viewOnly" mat-raised-button
class="description-save-btn mr-2" type="button">
<span class="d-flex flex-row row">
<span (click)="!saving?save():null" class="col">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</span>
<mat-divider [vertical]="true"></mat-divider>
<span *ngIf="!saving" class="align-items-center justify-content-center col-4 d-flex"
(click)="$event.stopPropagation();" [matMenuTriggerFor]="menu">
<mat-icon >expand_more</mat-icon>
</span>
<span *ngIf="saving" class="align-items-center justify-content-center col-4 d-flex">
<mat-icon >expand_more</mat-icon>
</span>
</span>
</button>
<mat-menu #menu="matMenu">
<button [disabled]="saving" mat-menu-item (click)="save(saveAnd.close)" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CLOSE' | translate }}</button>
<button [disabled]="saving" mat-menu-item (click)="save(saveAnd.addNew)" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-ADD' | translate }}</button>
<button [disabled]="saving" mat-menu-item (click)="save()" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CONTINUE' | translate }}</button>
</mat-menu>
<button [disabled]="saving" *ngIf="!lockStatus && !viewOnly" mat-raised-button class="description-save-btn mr-2" type="button" (click)="saveFinalize()">{{ 'DATASET-WIZARD.ACTIONS.FINALIZE' | translate }}</button>
<!-- <button *ngIf="!lockStatus && !viewOnly" mat-raised-button class="description-save-btn mr-2" (click)="save()" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
<button *ngIf="!lockStatus && !viewOnly" mat-raised-button class="description-save-btn mr-2" (click)="save(saveAnd.close)" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CLOSE' | translate }}</button>
<button *ngIf="!lockStatus && !viewOnly" mat-raised-button class="description-save-btn mr-2" (click)="save(saveAnd.addNew)">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-ADD' | translate }}</button> -->
<button [disabled]="saving" *ngIf="lockStatus" mat-raised-button disabled class="description-save-btn cursor-default" type="button">{{ 'DMP-OVERVIEW.LOCKED' | translate}}</button>
<button [disabled]="saving" *ngIf="hasReversableStatus() && !lockStatus" mat-raised-button class="description-save-btn mr-2" (click)="reverse()" type="button">{{ 'DATASET-WIZARD.ACTIONS.REVERSE' | translate }}</button>
<!-- <button *ngIf="!lockStatus" mat-raised-button class="description-save-btn mr-2" (click)="touchForm()" type="button">{{ 'DATASET-WIZARD.ACTIONS.VALIDATE' | translate }}</button> -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row editor-content">
<div class="col-auto description-stepper">
<div class="stepper-back d-flex flex-direction-row">
<div class="d-flex align-items-center pr-2 back-to-dmp" (click)="backToDmp(formGroup.get('dmp').value.id)">
<mat-icon class="back-icon pointer">chevron_left</mat-icon>
<span class="pointer">{{'DATASET-WIZARD.ACTIONS.BACK-TO' | translate}}</span>
</div>
<div class="col-auto dmp-label ml-3">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
</div>
<div class="stepper-title">{{'DMP-EDITOR.STEPPER.USER-GUIDE' | translate}}</div>
<div class="stepper-options" id="stepper-options">
<div class="col stepper-list">
<div (click)="table0fContents.onToCentrySelected()" *ngIf="!descriptionInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0, 'text-danger':hintErrors}">0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (2)</div>
<div (click)="table0fContents.onToCentrySelected()" *ngIf="descriptionInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0}">0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (<mat-icon class="done-icon">done</mat-icon>)</div>
<div class="row toc-pane-container" #boundary>
<div #spacer></div>
<table-of-contents [visibilityRulesService]="visRulesService" [selectedFieldsetId]="fieldsetIdWithFocus" #table0fContents
[showErrors]="showtocentriesErrors" [TOCENTRY_ID_PREFIX]="TOCENTRY_ID_PREFIX" [hasFocus]="step > 0"
[formGroup]="formGroup" *ngIf="formGroup && formGroup.get('descriptionProfileDefinition')" [links]="links"
[boundary]="boundary" [spacer]="spacer" [isActive]="step !== 0" stickyThing (stepFound)="onStepFound($event)"
(currentLinks)="getLinks($event)" (entrySelected)="changeStep($event.entry, $event.execute)"
[visibilityRules]="formGroup.get('descriptionProfileDefinition').get('rules').value"></table-of-contents>
</div>
</div>
</div>
<div class="stepper-actions">
<div mat-raised-button type="button" class="col-auto previous stepper-btn mr-2" [ngClass]="{'previous-disabled': this.step === 0}" (click)="previousStep()">
<span class="material-icons">chevron_left</span>
<div>{{'DMP-EDITOR.STEPPER.PREVIOUS' | translate}}</div>
</div>
<div *ngIf="this.step < this.maxStep" mat-raised-button type="button" class="col-auto stepper-btn description-next ml-auto" (click)="nextStep()">
<div>{{'DMP-EDITOR.STEPPER.NEXT' | translate}}</div>
<span class="material-icons">chevron_right</span>
</div>
<div *ngIf="!formGroup.get('profile').value" mat-raised-button type="button" class="col-auto stepper-btn description-next next-disabled ml-auto">
<div>{{'DMP-EDITOR.STEPPER.NEXT' | translate}}</div>
<span class="material-icons">chevron_right</span>
</div>
<button [disabled]="saving" (click)="save(saveAnd.addNew)" *ngIf="(step === maxStep) && !lockStatus && formGroup.get('profile').value && !viewOnly" mat-raised-button type="button" class="col-auto stepper-btn add-description-btn ml-auto">
{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-ADD' | translate }}
</button>
</div>
<div class="col-auto pr-0">
<app-form-progress-indication class="col-12" *ngIf="formGroup && !viewOnly" [formGroup]="formGroup" [isDescriptionEditor]="true"></app-form-progress-indication>
</div>
</div>
<div class="col-auto form" id="description-editor-form">
<app-description-editor-component [hidden]="this.step !== 0" [formGroup]="formGroup" [dmpId]="formGroup.get('dmp').value.id" [availableProfiles]="availableDescriptionTemplates" (formChanged)="formChanged()"></app-description-editor-component>
<app-description-description (visibilityRulesInstance)="visRulesService = $event" [TOCENTRY_ID_PREFIX]="TOCENTRY_ID_PREFIX" [hidden]="this.step === 0" *ngIf="formGroup && formGroup.get('descriptionProfileDefinition')" [form]="this.formGroup.get('descriptionProfileDefinition')" [visibilityRules]="formGroup.get('descriptionProfileDefinition').get('rules').value" [descriptionProfileId]="formGroup.get('profile').value" [linkToScroll]="linkToScroll" (fieldsetFocusChange)="fieldsetIdWithFocus = $event"></app-description-description>
</div>
</div>
</form>
</div>
</div>

View File

@ -3,7 +3,7 @@
margin-top: -80px; margin-top: -80px;
} }
.dataset-wizard { .description-editor {
.toc-pane-container { .toc-pane-container {
&.is-sticky ~ .nav-spacer { &.is-sticky ~ .nav-spacer {
height: 500px; // the container size } height: 500px; // the container size }
@ -81,7 +81,7 @@
margin-right: 15px; margin-right: 15px;
} }
.updateDatasetProfile { .updateDescriptionProfile {
margin-top: 15px; margin-top: 15px;
margin-bottom: 15px; margin-bottom: 15px;
margin-right: 15px; margin-right: 15px;
@ -107,7 +107,7 @@
color: var(--primary-color-3); color: var(--primary-color-3);
} }
.new-dataset { .new-description {
height: 3.5em; height: 3.5em;
} }
@ -118,7 +118,7 @@
background-color: whitesmoke; background-color: whitesmoke;
} }
.dataset-editor-header { .description-editor-header {
height: 113px; height: 113px;
background: var(--unnamed-color-var(--primary-color)) 0% 0% no-repeat padding-box; background: var(--unnamed-color-var(--primary-color)) 0% 0% no-repeat padding-box;
background: var(--secondary-color) 0% 0% no-repeat padding-box; background: var(--secondary-color) 0% 0% no-repeat padding-box;
@ -136,7 +136,7 @@
} }
} }
.dataset-title { .description-title {
text-align: left; text-align: left;
letter-spacing: 0px; letter-spacing: 0px;
color: #212121; color: #212121;
@ -156,7 +156,7 @@
white-space: nowrap; white-space: nowrap;
} }
.dataset-subtitle { .description-subtitle {
text-align: left; text-align: left;
letter-spacing: 0px; letter-spacing: 0px;
color: #212121; color: #212121;
@ -195,7 +195,7 @@
color: var(--primary-color); color: var(--primary-color);
} }
.dataset-discard-btn { .description-discard-btn {
border: 1px solid #212121; border: 1px solid #212121;
border-radius: 30px; border-radius: 30px;
opacity: 1; opacity: 1;
@ -208,7 +208,7 @@
align-items: center; align-items: center;
} }
.dataset-save-btn, .dataset-export-btn { .description-save-btn, .description-export-btn {
background: #ffffff 0% 0% no-repeat padding-box; background: #ffffff 0% 0% no-repeat padding-box;
border-radius: 30px; border-radius: 30px;
opacity: 1; opacity: 1;
@ -220,7 +220,7 @@
align-items: center; align-items: center;
} }
.dataset-to-dmp { .description-to-dmp {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0; padding: 0;
@ -267,7 +267,7 @@
color: var(--primary-color); color: var(--primary-color);
} }
.dataset-stepper { .description-stepper {
position: fixed; position: fixed;
// height: 100%; // height: 100%;
display: flex; display: flex;
@ -339,7 +339,7 @@
opacity: 1; opacity: 1;
} }
.stepper-list .active-dataset { .stepper-list .active-description {
color: #212121; color: #212121;
font-weight: 700; font-weight: 700;
opacity: 1; opacity: 1;
@ -422,7 +422,7 @@
cursor: pointer; cursor: pointer;
} }
.add-dataset-btn { .add-description-btn {
background: var(--secondary-color) 0% 0% no-repeat padding-box; background: var(--secondary-color) 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 6px #1e202029; box-shadow: 0px 3px 6px #1e202029;
font-weight: 500; font-weight: 500;
@ -439,7 +439,7 @@
cursor: pointer; cursor: pointer;
} }
.dataset-next { .description-next {
background: var(--secondary-color) 0% 0% no-repeat padding-box; background: var(--secondary-color) 0% 0% no-repeat padding-box;
color: #212121; color: #212121;
box-shadow: 0px 3px 6px #1e202029; box-shadow: 0px 3px 6px #1e202029;

View File

@ -0,0 +1,613 @@
import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
import { DescriptionStatus } from "@app/core/common/enum/description-status";
import { Description, DescriptionField, DescriptionFieldPersist, DescriptionPersist, DescriptionReference, DescriptionReferencePersist, PropertyDefinition, PropertyDefinitionPersist } from "@app/core/model/description/description";
import { ReferencePersist } from "@app/core/model/reference/reference";
import { BaseEditorModel } from "@common/base/base-form-editor-model";
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 DescriptionEditorModel extends BaseEditorModel implements DescriptionPersist {
label: string;
dmpId: Guid;
dmpDescriptionTemplateId: Guid;
descriptionTemplateId: Guid;
status: DescriptionStatus;
description: string;
properties: DescriptionPropertyDefinitionEditorModel;
tags: string[];
references: DescriptionReferenceEditorModel[];
permissions: string[];
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor() { super(); }
public fromModel(item: Description): DescriptionEditorModel {
if (item) {
super.fromModel(item);
this.label = item.label;
this.dmpId = item.dmp?.id;
this.dmpDescriptionTemplateId = item.dmpDescriptionTemplate?.id;
this.descriptionTemplateId = item.descriptionTemplate?.id;
this.status = item.status;
this.description = item.description;
this.tags = item.descriptionTags?.map(x => x.tag?.label);
this.properties = new DescriptionPropertyDefinitionEditorModel().fromModel(item.properties);
//if (item.references) { item.references.map(x => this.references.push(new DescriptionReferenceEditorModel().fromModel(x))); }
}
return this;
}
buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
if (context == null) { context = this.createValidationContext(); }
return this.formBuilder.group({
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
dmpId: [{ value: this.dmpId, disabled: disabled }, context.getValidation('dmpId').validators],
dmpDescriptionTemplateId: [{ value: this.dmpDescriptionTemplateId, disabled: disabled }, context.getValidation('dmpDescriptionTemplateId').validators],
descriptionTemplateId: [{ value: this.descriptionTemplateId, disabled: disabled }, context.getValidation('descriptionTemplateId').validators],
status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
tags: [{ value: this.tags, disabled: disabled }, context.getValidation('tags').validators],
properties: this.properties.buildForm({
rootPath: `properties.`
}),
hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators]
});
}
createValidationContext(): ValidationContext {
const baseContext: ValidationContext = new ValidationContext();
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] });
baseValidationArray.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
baseValidationArray.push({ key: 'dmpId', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'dmpId')] });
baseValidationArray.push({ key: 'dmpDescriptionTemplateId', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'dmpDescriptionTemplateId')] });
baseValidationArray.push({ key: 'descriptionTemplateId', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'descriptionTemplateId')] });
baseValidationArray.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'status')] });
baseValidationArray.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] });
baseValidationArray.push({ key: 'tags', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'tags')] });
baseValidationArray.push({ key: 'hash', validators: [] });
baseContext.validation = baseValidationArray;
return baseContext;
}
}
export class DescriptionPropertyDefinitionEditorModel implements PropertyDefinitionPersist {
fields: DescriptionFieldEditorModel[] = [];
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor(
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { }
public fromModel(item: PropertyDefinition): DescriptionPropertyDefinitionEditorModel {
if (item) {
if (item.fields) { item.fields.map(x => this.fields.push(new DescriptionFieldEditorModel().fromModel(x))); }
}
return this;
}
buildForm(params?: {
context?: ValidationContext,
disabled?: boolean,
rootPath?: string
}): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) {
context = DescriptionPropertyDefinitionEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel,
rootPath
});
}
return this.formBuilder.group({
fields: this.formBuilder.array(
(this.fields ?? []).map(
(item, index) => new DescriptionFieldEditorModel(
this.validationErrorModel
).fromModel(item).buildForm({
rootPath: `${rootPath}fields[${index}].`
}), context.getValidation('fields')
)
),
});
}
static createValidationContext(params: {
rootPath?: string,
validationErrorModel: ValidationErrorModel
}): ValidationContext {
const { rootPath = '', validationErrorModel } = params;
const baseContext: ValidationContext = new ValidationContext();
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'fields', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}fields`)] });
baseContext.validation = baseValidationArray;
return baseContext;
}
}
export class DescriptionFieldEditorModel implements DescriptionFieldPersist {
key?: string;
value: string;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor(
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { }
public fromModel(item: DescriptionField): DescriptionFieldEditorModel {
if (item) {
this.key = item.key;
this.value = item.value;
}
return this;
}
buildForm(params?: {
context?: ValidationContext,
disabled?: boolean,
rootPath?: string
}): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) {
context = DescriptionFieldEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel,
rootPath
});
}
return this.formBuilder.group({
key: [{ value: this.key, disabled: disabled }, context.getValidation('key').validators],
value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators]
});
}
static createValidationContext(params: {
rootPath?: string,
validationErrorModel: ValidationErrorModel
}): ValidationContext {
const { rootPath = '', validationErrorModel } = params;
const baseContext: ValidationContext = new ValidationContext();
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'key', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}key`)] });
baseValidationArray.push({ key: 'value', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}value`)] });
baseContext.validation = baseValidationArray;
return baseContext;
}
}
export class DescriptionReferenceEditorModel implements DescriptionReferencePersist {
id: Guid;
reference?: ReferencePersist;
hash: string;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor(
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { }
fromModel(item: DescriptionReference): DescriptionReferenceEditorModel {
this.id = item.id;
this.reference = item.reference;
this.hash = item.hash;
return this;
}
buildForm(params?: {
context?: ValidationContext,
disabled?: boolean,
rootPath?: string
}): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) {
context = DescriptionReferenceEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel,
rootPath
});
}
return this.formBuilder.group({
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
reference: [{ value: this.reference, disabled: disabled }, context.getValidation('reference').validators],
hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators]
});
}
static createValidationContext(params: {
rootPath?: string,
validationErrorModel: ValidationErrorModel
}): ValidationContext {
const { rootPath = '', validationErrorModel } = params;
const baseContext: ValidationContext = new ValidationContext();
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}id`)] });
baseValidationArray.push({ key: 'reference', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}reference`)] });
baseValidationArray.push({ key: 'hash', validators: [] });
baseContext.validation = baseValidationArray;
return baseContext;
}
}
// export class DescriptionEditorModel {
// public id: string;
// public label: string;
// public profile: DescriptionProfileModel;
// public uri: String;
// public status: number;
// public description: String;
// public services: ExternalServiceEditorModel[] = [];
// public registries: ExternalRegistryEditorModel[] = [];
// public dataRepositories: ExternalDataRepositoryEditorModel[] = [];
// public tags: ExternalTagEditorModel[] = [];
// public externalDescriptions: ExternalDescriptionEditorModel[] = [];
// public dmp: DmpModel;
// public dmpSectionIndex: number;
// public descriptionProfileDefinition: DescriptionDescriptionFormEditorModel;
// public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
// public isProfileLatestVersion: Boolean;
// public modified: Date;
// fromModel(item: DescriptionModel): DescriptionEditorModel {
// this.id = item.id;
// this.label = item.label;
// this.profile = item.profile;
// this.uri = item.uri;
// this.status = item.status;
// this.description = item.description;
// if (item.services) { this.services = item.services.map(x => new ExternalServiceEditorModel().fromModel(x)); }
// if (item.registries) { this.registries = item.registries.map(x => new ExternalRegistryEditorModel().fromModel(x)); }
// if (item.dataRepositories) { this.dataRepositories = item.dataRepositories.map(x => new ExternalDataRepositoryEditorModel().fromModel(x)); }
// if (item.externalDescriptions) { this.externalDescriptions = item.externalDescriptions.map(x => new ExternalDescriptionEditorModel().fromModel(x)); }
// this.dmp = item.dmp;
// this.dmpSectionIndex = item.dmpSectionIndex;
// if (item.descriptionProfileDefinition) { this.descriptionProfileDefinition = new DescriptionDescriptionFormEditorModel().fromModel(item.descriptionProfileDefinition); }
// if (item.tags) { this.tags = item.tags.map(x => new ExternalTagEditorModel().fromModel(x)); }
// this.isProfileLatestVersion = item.isProfileLatestVersion;
// this.modified = new Date(item.modified);
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// if (context == null) { context = this.createValidationContext(); }
// const formBuilder = new UntypedFormBuilder();
// const formGroup = formBuilder.group({
// id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
// label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
// uri: [{ value: this.uri, disabled: disabled }, context.getValidation('uri').validators],
// status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
// description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
// dmp: [{ value: this.dmp, disabled: disabled }, context.getValidation('dmp').validators],
// dmpSectionIndex: [{ value: this.dmpSectionIndex, disabled: disabled }, context.getValidation('dmpSectionIndex').validators],
// //externalDescriptions: [{ value: this.externalDescriptions, disabled: disabled }, context.getValidation('externalDescriptions').validators],
// tags: [{ value: this.tags, disabled: disabled }, context.getValidation('tags').validators],
// //registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators],
// //dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators],
// //services: [{ value: this.services, disabled: disabled }, context.getValidation('services').validators],
// profile: [{ value: this.profile, disabled: disabled }, context.getValidation('profile').validators],
// modified: [{value: this.modified, disabled: disabled}, context.getValidation('modified').validators]
// });
// const externalDescriptionsFormArray = new Array<UntypedFormGroup>();
// //if (this.externalDescriptions && this.externalDescriptions.length > 0) {
// this.externalDescriptions.forEach(item => {
// externalDescriptionsFormArray.push(item.buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// formGroup.addControl('externalDescriptions', formBuilder.array(externalDescriptionsFormArray));
// // const tagsFormArray = new Array<FormGroup>();
// // if (this.tags && this.tags.length > 0) {
// // this.tags.forEach(item => {
// // tagsFormArray.push(item.buildForm(context.getValidation('tags').descendantValidations, disabled));
// // });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// // formGroup.addControl('tags', formBuilder.array(tagsFormArray));
// const registriesFormArray = new Array<UntypedFormGroup>();
// //if (this.registries && this.registries.length > 0) {
// this.registries.forEach(item => {
// registriesFormArray.push(item.buildForm(context.getValidation('registries').descendantValidations, disabled));
// });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// formGroup.addControl('registries', formBuilder.array(registriesFormArray));
// const dataRepositoriesFormArray = new Array<UntypedFormGroup>();
// //if (this.dataRepositories && this.dataRepositories.length > 0) {
// this.dataRepositories.forEach(item => {
// dataRepositoriesFormArray.push(item.buildForm(context.getValidation('dataRepositories').descendantValidations, disabled));
// });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// formGroup.addControl('dataRepositories', formBuilder.array(dataRepositoriesFormArray));
// const servicesFormArray = new Array<UntypedFormGroup>();
// // if (this.services && this.services.length > 0) {
// this.services.forEach(item => {
// servicesFormArray.push(item.buildForm(context.getValidation('services').descendantValidations, disabled));
// });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// formGroup.addControl('services', formBuilder.array(servicesFormArray));
// // const tagsFormArray = new Array<FormGroup>();
// // this.tags.forEach(item => {
// // tagsFormArray.push(item.buildForm(context.getValidation('tags').descendantValidations, disabled));
// // });
// // formGroup.addControl('tags', formBuilder.array(tagsFormArray));
// if (this.descriptionProfileDefinition) { formGroup.addControl('descriptionProfileDefinition', this.descriptionProfileDefinition.buildForm()); }
// // formGroup.addControl('profile', this.profile.buildForm());
// return formGroup;
// }
// createValidationContext(): ValidationContext {
// const baseContext: ValidationContext = new ValidationContext();
// baseContext.validation.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] });
// baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
// baseContext.validation.push({ key: 'profile', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'profile')] });
// baseContext.validation.push({ key: 'uri', validators: [BackendErrorValidator(this.validationErrorModel, 'uri')] });
// baseContext.validation.push({ key: 'status', validators: [BackendErrorValidator(this.validationErrorModel, 'status')] });
// baseContext.validation.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] });
// baseContext.validation.push({ key: 'services', validators: [BackendErrorValidator(this.validationErrorModel, 'services')] });
// baseContext.validation.push({ key: 'registries', validators: [BackendErrorValidator(this.validationErrorModel, 'registries')] });
// baseContext.validation.push({ key: 'dataRepositories', validators: [BackendErrorValidator(this.validationErrorModel, 'dataRepositories')] });
// baseContext.validation.push({ key: 'externalDescriptions', validators: [BackendErrorValidator(this.validationErrorModel, 'externalDescriptions')] });
// baseContext.validation.push({ key: 'dmp', validators: [BackendErrorValidator(this.validationErrorModel, 'dmp')] });
// baseContext.validation.push({ key: 'dmpSectionIndex', validators: [BackendErrorValidator(this.validationErrorModel, 'dmpSectionIndex')] });
// baseContext.validation.push({ key: 'descriptionProfileDefinition', validators: [BackendErrorValidator(this.validationErrorModel, 'descriptionProfileDefinition')] });
// baseContext.validation.push({ key: 'tags', validators: [BackendErrorValidator(this.validationErrorModel, 'descriptionProfileDefinition')] });
// baseContext.validation.push({ key: 'modified', validators: []});
// return baseContext;
// }
// }
// export class ExternalTagEditorModel {
// public abbreviation: String;
// public definition: String;
// public id: String;
// public name: String;
// public reference: String;
// public uri: String;
// constructor(id?: String, name?: String) {
// this.id = id;
// this.name = name;
// }
// fromModel(item: TagModel): ExternalTagEditorModel {
// this.id = item.id;
// this.name = item.name;
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// name: [this.name]
// });
// }
// }
// export class ExternalServiceEditorModel {
// public id: String;
// public abbreviation: String;
// public definition: String;
// public uri: String;
// public label: String;
// public reference: String;
// public source: String;
// constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String, source?: String) {
// this.id = id;
// this.abbreviation = abbreviation;
// this.definition = definition;
// this.uri = uri;
// this.label = label;
// this.reference = reference;
// this.source = source;
// }
// fromModel(item: ServiceModel): ExternalServiceEditorModel {
// this.id = item.id;
// this.abbreviation = item.abbreviation;
// this.definition = item.definition;
// this.uri = item.uri;
// this.label = item.label;
// this.reference = item.reference;
// this.source = item.source;
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// abbreviation: [this.abbreviation],
// label: [this.label, Validators.required],
// reference: [this.reference],
// uri: [this.uri, Validators.required],
// definition: [this.definition],
// source: [this.source]
// });
// }
// }
// export class ExternalRegistryEditorModel {
// public abbreviation: String;
// public definition: String;
// public id: String;
// public label: String;
// public reference: String;
// public uri: String;
// public source: String
// constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String, source?: String) {
// this.abbreviation = abbreviation;
// this.definition = definition;
// this.id = id;
// this.label = label;
// this.reference = reference;
// this.uri = uri;
// this.source = source;
// }
// fromModel(item: RegistryModel): ExternalRegistryEditorModel {
// this.abbreviation = item.abbreviation;
// this.definition = item.definition;
// this.id = item.id;
// this.label = item.label;
// this.reference = item.pid ? item.pid : item.reference;
// this.uri = item.uri;
// this.source = item.source
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// abbreviation: [this.abbreviation],
// label: [this.label, Validators.required],
// reference: [this.reference],
// uri: [this.uri, Validators.required],
// definition: [this.definition],
// source: [this.source]
// });
// }
// }
// export class ExternalDescriptionEditorModel {
// public abbreviation: String;
// public id: String;
// public name: String;
// public reference: String;
// public type: ExternalDescriptionType;
// public info: String;
// public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
// public source: String;
// constructor(id?: string, abbreviation?: string, name?: string, reference?: string, source?: String, info?: string, type?: ExternalDescriptionType) {
// this.id = id;
// this.name = name;
// this.abbreviation = abbreviation;
// this.reference = reference;
// this.info = info;
// this.type = type;
// this.source = source;
// }
// fromModel(item: ExternalDescriptionModel): ExternalDescriptionEditorModel {
// this.abbreviation = item.abbreviation;
// this.id = item.id;
// this.name = item.name;
// this.reference = item.reference;
// this.type = item.type;
// this.info = item.info;
// this.source = item.source;
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// abbreviation: [this.abbreviation],
// name: [this.name, Validators.required],
// reference: [this.reference],
// type: [this.type],
// info: [this.info],
// source: [this.source]
// });
// }
// }
// export class ExternalDataRepositoryEditorModel {
// public id: string;
// public name: string;
// public abbreviation: string;
// public uri: string;
// public reference: string;
// public info: string;
// public created: Date;
// public modified: Date;
// public source: string;
// constructor(id?: string, name?: string, abbreviation?: string, uri?: string, reference?: string, source?: string) {
// this.id = id;
// this.name = name;
// this.abbreviation = abbreviation;
// this.uri = uri;
// this.reference = reference;
// this.source = source;
// }
// fromModel(item: DataRepositoryModel): ExternalDataRepositoryEditorModel {
// this.id = item.id;
// this.name = item.name;
// this.abbreviation = item.abbreviation;
// this.uri = item.uri;
// this.info = item.info;
// this.reference = item.pid;
// this.source = item.source;
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// name: [this.name, [Validators.required]],
// abbreviation: [this.abbreviation],
// uri: [this.uri, [Validators.required]],
// info: [this.info],
// reference: [this.reference],
// source: [this.source]
// });
// }
// }
// // export class TagModel implements Serializable<TagModel> {
// // public id: string;
// // public name: string;
// // constructor(id?: string, name?: string) {
// // this.id = id;
// // this.name = name;
// // }
// // fromJSONObject(item: any): TagModel {
// // this.id = item.id;
// // this.name = item.name;
// // return this;
// // }
// // buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
// // return new FormBuilder().group({
// // id: [this.id],
// // name: [this.name]
// // });
// // }
// // }

View File

@ -0,0 +1,67 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
import { Description, DescriptionField, DescriptionReference, DescriptionTag, PropertyDefinition } from '@app/core/model/description/description';
import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
import { Reference } from '@app/core/model/reference/reference';
import { Tag } from '@app/core/model/tag/tag';
import { DescriptionService } from '@app/core/services/description/description.service';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { BaseEditorResolver } from '@common/base/base-editor.resolver';
import { Guid } from '@common/types/guid';
import { takeUntil, tap } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
@Injectable()
export class DescriptionEditorResolver extends BaseEditorResolver {
constructor(private descriptionService: DescriptionService, private breadcrumbService: BreadcrumbService) {
super();
}
public static lookupFields(): string[] {
return [
...BaseEditorResolver.lookupFields(),
nameof<Description>(x => x.id),
nameof<Description>(x => x.label),
nameof<Description>(x => x.status),
nameof<Description>(x => x.description),
nameof<Description>(x => x.status),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.properties), nameof<PropertyDefinition>(x => x.fields), nameof<DescriptionField>(x => x.key)].join('.'),
[nameof<Description>(x => x.properties), nameof<PropertyDefinition>(x => x.fields), nameof<DescriptionField>(x => x.value)].join('.'),
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.id),].join('.'),
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.tag), nameof<Tag>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
nameof<Description>(x => x.createdAt),
nameof<Description>(x => x.hash),
nameof<Description>(x => x.isActive)
]
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
const fields = [
...DescriptionEditorResolver.lookupFields()
];
const id = route.paramMap.get('id');
// const cloneid = route.paramMap.get('cloneid');
if (id != null) {
return this.descriptionService.getSingle(Guid.parse(id), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed));
}
//TODO: check this
// else if (cloneid != null) {
// return this.descriptionService.clone(Guid.parse(cloneid), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed));
// }
}
}

View File

@ -0,0 +1,15 @@
import { Injectable } from "@angular/core";
import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model";
@Injectable()
export class DescriptionEditorService {
private validationErrorModel: ValidationErrorModel;
public setValidationErrorModel(validationErrorModel: ValidationErrorModel): void {
this.validationErrorModel = validationErrorModel;
}
public getValidationErrorModel(): ValidationErrorModel {
return this.validationErrorModel;
}
}

View File

@ -27,6 +27,7 @@ import { CommonUiModule } from '@common/ui/common-ui.module';
import { AngularStickyThingsModule } from '@w11k/angular-sticky-things'; import { AngularStickyThingsModule } from '@w11k/angular-sticky-things';
import { DescriptionCopyDialogModule } from './description-copy-dialog/description-copy-dialog.module'; import { DescriptionCopyDialogModule } from './description-copy-dialog/description-copy-dialog.module';
import { DescriptionOverviewModule } from './overview/description-overview.module'; import { DescriptionOverviewModule } from './overview/description-overview.module';
import { DescriptionEditorComponent } from './dataset-wizard/description-editor.component';
// import { FormProgressIndicationModule } from '../misc/description-description-form/components/form-progress-indication/form-progress-indication.module'; // import { FormProgressIndicationModule } from '../misc/description-description-form/components/form-progress-indication/form-progress-indication.module';
// import { DescriptionCopyDialogModule } from './description-wizard/description-copy-dialogue/description-copy-dialogue.module'; // import { DescriptionCopyDialogModule } from './description-wizard/description-copy-dialogue/description-copy-dialogue.module';
// import { DescriptionCriteriaDialogComponent } from './listing/criteria/description-criteria-dialogue/description-criteria-dialog.component'; // import { DescriptionCriteriaDialogComponent } from './listing/criteria/description-criteria-dialogue/description-criteria-dialog.component';
@ -53,13 +54,13 @@ import { DescriptionOverviewModule } from './overview/description-overview.modul
RichTextEditorModule, RichTextEditorModule,
DescriptionCopyDialogModule, DescriptionCopyDialogModule,
DescriptionOverviewModule DescriptionOverviewModule,
], ],
declarations: [ declarations: [
DescriptionListingComponent, DescriptionListingComponent,
// DescriptionCriteriaComponent, // DescriptionCriteriaComponent,
// DescriptionWizardComponent, // DescriptionWizardComponent,
// DescriptionEditorComponent, DescriptionEditorComponent,
// DescriptionExternalReferencesEditorComponent, // DescriptionExternalReferencesEditorComponent,
// DescriptionExternalDataRepositoryDialogEditorComponent, // DescriptionExternalDataRepositoryDialogEditorComponent,
// DescriptionExternalDescriptionDialogEditorComponent, // DescriptionExternalDescriptionDialogEditorComponent,

View File

@ -4,7 +4,13 @@ import { AuthGuard } from '../../core/auth-guard.service';
// import { DescriptionWizardComponent } from './description-wizard/description-wizard.component'; // import { DescriptionWizardComponent } from './description-wizard/description-wizard.component';
import { DescriptionListingComponent } from './listing/description-listing.component'; import { DescriptionListingComponent } from './listing/description-listing.component';
import { DescriptionOverviewComponent } from './overview/description-overview.component'; import { DescriptionOverviewComponent } from './overview/description-overview.component';
import { CanDeactivateGuard } from '@app/library/deactivate/can-deactivate.guard';
import { DescriptionEditorComponent } from './dataset-wizard/description-editor.component';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { DescriptionEditorResolver } from './dataset-wizard/description-editor.resolver';
import { PendingChangesGuard } from '@common/forms/pending-form-changes/pending-form-changes-guard.service';
// import { DescriptionOverviewComponent } from './overview/description-overview.component'; // import { DescriptionOverviewComponent } from './overview/description-overview.component';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
const routes: Routes = [ const routes: Routes = [
{ {
@ -38,7 +44,24 @@ const routes: Routes = [
breadcrumb: true, breadcrumb: true,
title: 'GENERAL.TITLES.DATASET-OVERVIEW' title: 'GENERAL.TITLES.DATASET-OVERVIEW'
}, },
},
{
path: 'edit/:id',
canActivate: [AuthGuard],
component: DescriptionEditorComponent,
canDeactivate: [PendingChangesGuard],
resolve: {
'entity': DescriptionEditorResolver
},
data: {
...BreadcrumbService.generateRouteDataConfiguration({
title: 'BREADCRUMBS.EDIT-DESCRIPTION'
}),
authContext: {
permissions: [AppPermission.EditDescription]
} }
}
},
// { // {
// path: 'new/:dmpId/:dmpSectionIndex', // path: 'new/:dmpId/:dmpSectionIndex',
// component: DescriptionWizardComponent, // component: DescriptionWizardComponent,
@ -49,17 +72,7 @@ const routes: Routes = [
// }, // },
// canDeactivate:[CanDeactivateGuard] // canDeactivate:[CanDeactivateGuard]
// }, // },
// {
// path: 'edit/:id',
// component: DescriptionWizardComponent,
// canActivate: [AuthGuard],
// data: {
// breadcrumb: true,
// public: false,
// title: 'GENERAL.TITLES.DATASET-EDIT'
// },
// canDeactivate:[CanDeactivateGuard]
// },
// { // {
// path: 'edit/:id/finalize', // path: 'edit/:id/finalize',
// component: DescriptionWizardComponent, // component: DescriptionWizardComponent,
@ -117,6 +130,7 @@ const routes: Routes = [
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule] exports: [RouterModule],
providers: [DescriptionEditorResolver]
}) })
export class DescriptionRoutingModule { } export class DescriptionRoutingModule { }

View File

@ -103,7 +103,7 @@
<hr class="hr-line"> <hr class="hr-line">
</div> </div>
</div> </div>
<div *ngIf="hasReversableStatus(description)" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="reverse(description)"> <div *ngIf="hasReversableStatus(description)" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="reverseFinalization(description)">
<button mat-mini-fab class="frame-btn"> <button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">unarchive</mat-icon> <mat-icon class="mat-mini-fab-icon">unarchive</mat-icon>
</button> </button>

View File

@ -12,8 +12,8 @@ import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role'; import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
import { ReferenceType } from '@app/core/common/enum/reference-type'; import { ReferenceType } from '@app/core/common/enum/reference-type';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
import { Description } from '@app/core/model/description/description'; import { Description, DescriptionStatusPersist } from '@app/core/model/description/description';
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp'; import { Dmp, DmpUser, DmpUserRemovePersist } from '@app/core/model/dmp/dmp';
import { DmpReference, Reference } from '@app/core/model/reference/reference'; import { DmpReference, Reference } from '@app/core/model/reference/reference';
import { AuthService } from '@app/core/services/auth/auth.service'; import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
@ -365,18 +365,18 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
}); });
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
if (result) { if (result) {
//TODO: implement remove user from backend const dmpUserRemovePersist: DmpUserRemovePersist = {
// const index = this.users.findIndex(x => x.id === user.id); id: dmpUser.id,
// if (index > -1) { dmpId: this.description.dmp.id,
// this.users.splice(index, 1); role: dmpUser.role
// } };
// this.dmpService.updateUsers(this.description.dmp.id, this.users).pipe(takeUntil(this._destroyed)) this.dmpService.removeUser(dmpUserRemovePersist).pipe(takeUntil(this._destroyed))
// .subscribe( .subscribe(data => {
// complete => { this.reloadPage();
// this.onUpdateCallbackSuccess(); }, (error: any) => {
// }, //TODO: Error handling
// error => this.onUpdateCallbackError(error) });
// );
} }
}); });
} }
@ -405,7 +405,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
return description.dmp.status == DmpStatus.Draft && description.status == DescriptionStatus.Finalized return description.dmp.status == DmpStatus.Draft && description.status == DescriptionStatus.Finalized
} }
reverse(description: Description) { reverseFinalization(description: Description) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, { const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false, restoreFocus: false,
data: { data: {
@ -417,19 +417,18 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
}); });
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) { if (result) {
// TODO: implement endpoint to undo finalization to a Description and set it to Draft again const dmpUserRemovePersist: DescriptionStatusPersist = {
// this.descriptionWizardService.getSingle(description.id) id: description.id,
// .pipe(takeUntil(this._destroyed)) status: DescriptionStatus.Draft,
// .subscribe(data => { hash: description.hash
// this.description = data; };
// this.description.status = DescriptionStatus.Draft; this.descriptionService.persistStatus(dmpUserRemovePersist).pipe(takeUntil(this._destroyed))
// this.descriptionWizardService.createDescription(this.description) .subscribe(data => {
// .pipe(takeUntil(this._destroyed)) this.reloadPage();
// .subscribe( this.onUpdateCallbackSuccess()
// data => this.onUpdateCallbackSuccess(), }, (error: any) => {
// error => this.onUpdateCallbackError(error) this.onUpdateCallbackError(error)
// ); });
// });
} }
}); });
} }

View File

@ -94,7 +94,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
this.lookup.isActive = [IsActive.Active]; this.lookup.isActive = [IsActive.Active];
if (this.groupId != null && Guid.isGuid(this.groupId)) { if (this.groupId != null && Guid.isGuid(this.groupId)) {
// this.lookup.groupIds = [this.groupId]; //TODO: add filter in backend this.lookup.groupIds = [Guid.parse(this.groupId)];
} }
this.refresh(this.lookup); this.refresh(this.lookup);

View File

@ -32,7 +32,7 @@
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(dmp)" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isDraftDmp(dmp)" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner(dmp)" (click)="openShareDialog(dmp.id, dmp.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isUserOwner(dmp)" (click)="openShareDialog(dmp.id, dmp.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneOrNewVersionClicked(dmp, false)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneOrNewVersionClicked(dmp, false)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="!isAuthenticated()" (click)="viewVersions(dmp.groupId, dmp.label, dmp)"><span class="material-icons icon-align pr-2">library_books</span>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="!isAuthenticated()" (click)="viewVersions(dmp)"><span class="material-icons icon-align pr-2">library_books</span>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="!isDraftDmp(dmp) && isUserOwner(dmp)" (click)="deleteClicked(dmp.id)"><span class="material-icons icon-align pr-2">delete</span>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}</a> <a class="col-auto border-right pointer" *ngIf="!isDraftDmp(dmp) && isUserOwner(dmp)" (click)="deleteClicked(dmp.id)"><span class="material-icons icon-align pr-2">delete</span>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}</a>
<a class="col-auto pointer" *ngIf="isAuthenticated()" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a> <a class="col-auto pointer" *ngIf="isAuthenticated()" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
@ -60,7 +60,7 @@
<button *ngIf="isUserOwner(dmp)" mat-menu-item (click)="cloneOrNewVersionClicked(dmp, true)"> <button *ngIf="isUserOwner(dmp)" mat-menu-item (click)="cloneOrNewVersionClicked(dmp, true)">
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}} <mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button> </button>
<button mat-menu-item (click)="viewVersions(dmp.groupId, dmp.label, dmp)"> <button mat-menu-item (click)="viewVersions(dmp)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}} <mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button> </button>
<button mat-menu-item *ngIf="isDraftDmp(dmp) && isUserOwner(dmp)" (click)="deleteClicked(dmp.id)" class="menu-item"> <button mat-menu-item *ngIf="isDraftDmp(dmp) && isUserOwner(dmp)" (click)="deleteClicked(dmp.id)" class="menu-item">

View File

@ -100,16 +100,14 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
this.router.navigate(['/datasets/dmp/' + rowId, { dmpLabel: rowLabel }]); this.router.navigate(['/datasets/dmp/' + rowId, { dmpLabel: rowLabel }]);
} }
viewVersions(rowId: String, rowLabel: String, dmp: Dmp) { viewVersions(dmp: Dmp) {
// if (dmp.public && !this.isUserOwner(dmp)) { if (dmp.accessType == DmpAccessType.Public && dmp.status == DmpStatus.Finalized && !this.isUserOwner(dmp)) {
// let url = this.router.createUrlTree(['/explore-plans/versions/', rowId, { groupLabel: rowLabel }]); let url = this.router.createUrlTree(['/explore-plans/versions/', dmp.groupId]);
// window.open(url.toString(), '_blank'); window.open(url.toString(), '_blank');
// // this.router.navigate(['/explore-plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } }); } else {
// } else { let url = this.router.createUrlTree(['/plans/versions/', dmp.groupId]);
// let url = this.router.createUrlTree(['/plans/versions/', rowId, { groupLabel: rowLabel }]); window.open(url.toString(), '_blank');
// window.open(url.toString(), '_blank'); }
// // this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
// }
} }
isUserDMPRelated() { isUserDMPRelated() {

View File

@ -2,7 +2,6 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router'; import { ActivatedRoute, Params, Router } from '@angular/router';
import { DmpStatus } from '@app/core/common/enum/dmp-status'; import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { UserInfoListingModel } from '@app/core/model/user/user-info-listing';
import { AuthService } from '@app/core/services/auth/auth.service'; import { AuthService } from '@app/core/services/auth/auth.service';
import { DmpServiceNew } from '@app/core/services/dmp/dmp.service'; import { DmpServiceNew } from '@app/core/services/dmp/dmp.service';
import { import {
@ -18,7 +17,7 @@ import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
import { ReferenceType } from '@app/core/common/enum/reference-type'; import { ReferenceType } from '@app/core/common/enum/reference-type';
import { DepositConfigurationModel } from '@app/core/model/deposit/deposit-configuration'; import { DepositConfigurationModel } from '@app/core/model/deposit/deposit-configuration';
import { Description } from '@app/core/model/description/description'; import { Description } from '@app/core/model/description/description';
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp'; import { Dmp, DmpUser, DmpUserRemovePersist } from '@app/core/model/dmp/dmp';
import { DoiModel } from '@app/core/model/doi/doi'; import { DoiModel } from '@app/core/model/doi/doi';
import { EntityDoi } from '@app/core/model/entity-doi/entity-doi'; import { EntityDoi } from '@app/core/model/entity-doi/entity-doi';
import { DmpReference, Reference } from '@app/core/model/reference/reference'; import { DmpReference, Reference } from '@app/core/model/reference/reference';
@ -642,26 +641,31 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
// ); // );
// } // }
removeUserFromDmp(user: UserInfoListingModel) { removeUserFromDmp(dmpUser: DmpUser) {
//TODO: implement remove user from backend const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
// const dialogRef = this.dialog.open(ConfirmationDialogComponent, { data: {
// data: { message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-USER'),
// message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-USER'), confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE'),
// confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE'), cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
// cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'), isDeleteConfirmation: false
// isDeleteConfirmation: false }
// } });
// }); dialogRef.afterClosed().subscribe(result => {
// dialogRef.afterClosed().subscribe(result => { if (result) {
// if (result) { const dmpUserRemovePersist: DmpUserRemovePersist = {
// const list = this.dmp.users; id: dmpUser.id,
// const index = this.dmp.users.indexOf(user); dmpId: this.dmp.id,
// if (index > -1) { role: dmpUser.role
// this.dmp.users.splice(index, 1); };
// } this.dmpService.removeUser(dmpUserRemovePersist).pipe(takeUntil(this._destroyed))
// this.updateUsers(); .subscribe(data => {
// } this.reloadPage();
// }); this.onUpdateCallbackSuccess()
}, (error: any) => {
this.onUpdateCallbackError(error)
});
}
});
} }
copyDoi(doi) { copyDoi(doi) {