Merge branch 'dmp-refactoring' of code-repo.d4science.org:MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Efstratios Giannopoulos 2024-03-06 18:18:24 +02:00
commit f92f3c1a4d
27 changed files with 131 additions and 44 deletions

View File

@ -274,7 +274,7 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
predicates.add(inClause); predicates.add(inClause);
} }
if (this.like != null && !this.like.isEmpty()) { if (this.like != null && !this.like.isEmpty()) {
predicates.add(queryContext.CriteriaBuilder.or(queryContext.CriteriaBuilder.like(queryContext.Root.get(DescriptionTemplateEntity._description), this.like), predicates.add(queryContext.CriteriaBuilder.or(queryContext.CriteriaBuilder.like(queryContext.Root.get(DescriptionTemplateEntity._label), this.like),
queryContext.CriteriaBuilder.like(queryContext.Root.get(DescriptionTemplateEntity._description), this.like) queryContext.CriteriaBuilder.like(queryContext.Root.get(DescriptionTemplateEntity._description), this.like)
)); ));
} }

View File

@ -1,6 +1,7 @@
package eu.eudat.query.lookup; package eu.eudat.query.lookup;
import eu.eudat.commons.enums.DmpBlueprintStatus; import eu.eudat.commons.enums.DmpBlueprintStatus;
import eu.eudat.commons.enums.DmpBlueprintVersionStatus;
import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.IsActive;
import eu.eudat.query.DmpBlueprintQuery; import eu.eudat.query.DmpBlueprintQuery;
import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.Lookup;
@ -23,6 +24,8 @@ public class DmpBlueprintLookup extends Lookup {
private List<UUID> groupIds; private List<UUID> groupIds;
private List<DmpBlueprintVersionStatus> versionStatuses;
public String getLike() { public String getLike() {
return like; return like;
} }
@ -63,6 +66,14 @@ public class DmpBlueprintLookup extends Lookup {
this.excludedIds = excludedIds; this.excludedIds = excludedIds;
} }
public List<DmpBlueprintVersionStatus> getVersionStatuses() {
return versionStatuses;
}
public void setVersionStatuses(List<DmpBlueprintVersionStatus> versionStatuses) {
this.versionStatuses = versionStatuses;
}
public List<UUID> getGroupIds() { public List<UUID> getGroupIds() {
return groupIds; return groupIds;
} }
@ -85,6 +96,8 @@ public class DmpBlueprintLookup extends Lookup {
query.excludedIds(this.excludedIds); query.excludedIds(this.excludedIds);
if (this.groupIds != null) if (this.groupIds != null)
query.groupIds(this.groupIds); query.groupIds(this.groupIds);
if (this.versionStatuses != null)
query.versionStatuses(this.versionStatuses);
this.enrichCommon(query); this.enrichCommon(query);

View File

@ -2,8 +2,8 @@ export enum DescriptionTemplateFieldType {
SELECT = "select", SELECT = "select",
BOOLEAN_DECISION = "booleanDecision", BOOLEAN_DECISION = "booleanDecision",
RADIO_BOX = "radiobox", RADIO_BOX = "radiobox",
INTERNAL_DMP_ENTRIES_DMPS = "internalDmpDmps", INTERNAL_ENTRIES_DMPS = "internalEntitiesDmps",
INTERNAL_ENTRIES_DESCRIPTIONS = "internalDmpDescriptions", INTERNAL_ENTRIES_DESCRIPTIONS = "internalEntitiesDescriptions",
CHECK_BOX = "checkBox", CHECK_BOX = "checkBox",
FREE_TEXT = "freetext", FREE_TEXT = "freetext",
TEXT_AREA = "textarea", TEXT_AREA = "textarea",

View File

@ -1,4 +1,5 @@
export enum DescriptionTemplateVersionStatus { export enum DescriptionTemplateVersionStatus {
Current = 0, Current = 0,
Previous = 1 Previous = 1,
NotFinalized = 2
} }

View File

@ -0,0 +1,5 @@
export enum DmpBlueprintVersionStatus {
Current = 0,
Previous = 1,
NotFinalized = 2
}

View File

@ -53,7 +53,7 @@ export class FieldValuePipe implements PipeTransform {
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
case DescriptionTemplateFieldType.TAGS: case DescriptionTemplateFieldType.TAGS:
return this.parseJson(value); return this.parseJson(value);
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
return this.parseJson(value, 'label'); return this.parseJson(value, 'label');
case DescriptionTemplateFieldType.DATASET_IDENTIFIER: case DescriptionTemplateFieldType.DATASET_IDENTIFIER:

View File

@ -2,6 +2,7 @@ import { Lookup } from '@common/model/lookup';
import { Guid } from '@common/types/guid'; import { Guid } from '@common/types/guid';
import { IsActive } from '../common/enum/is-active.enum'; import { IsActive } from '../common/enum/is-active.enum';
import { DmpBlueprintStatus } from '../common/enum/dmp-blueprint-status'; import { DmpBlueprintStatus } from '../common/enum/dmp-blueprint-status';
import { DmpBlueprintVersionStatus } from '../common/enum/dmp-blueprint-version-status';
export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter { export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter {
ids: Guid[]; ids: Guid[];
@ -10,6 +11,7 @@ export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter {
isActive: IsActive[]; isActive: IsActive[];
statuses: DmpBlueprintStatus[]; statuses: DmpBlueprintStatus[];
groupIds: Guid[]; groupIds: Guid[];
versionStatuses: DmpBlueprintVersionStatus[];
constructor() { constructor() {
super(); super();
@ -22,4 +24,5 @@ export interface DmpBlueprintFilter {
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
statuses: DmpBlueprintStatus[]; statuses: DmpBlueprintStatus[];
versionStatuses: DmpBlueprintVersionStatus[];
} }

View File

@ -130,11 +130,11 @@ export class ReferenceTypeService {
return fields; return fields;
} }
public getResearcherReferenceType(): Guid { public getResearcherReferenceType(): any {
return Guid.parse('5a2112e7-ea99-4cfe-98a1-68665e26726e');; return '5a2112e7-ea99-4cfe-98a1-68665e26726e';
} }
public getGrantReferenceType(): Guid { public getGrantReferenceType(): any {
return Guid.parse('5b9c284f-f041-4995-96cc-fad7ad13289c'); return '5b9c284f-f041-4995-96cc-fad7ad13289c';
} }
} }

View File

@ -158,7 +158,7 @@ export class EnumUtils {
case DescriptionTemplateFieldType.SELECT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.SELECT'); case DescriptionTemplateFieldType.SELECT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.SELECT');
case DescriptionTemplateFieldType.BOOLEAN_DECISION: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.BOOLEAN-DECISION'); case DescriptionTemplateFieldType.BOOLEAN_DECISION: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.BOOLEAN-DECISION');
case DescriptionTemplateFieldType.RADIO_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.RADIO-BOX'); case DescriptionTemplateFieldType.RADIO_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.RADIO-BOX');
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DMPS'); case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DMPS');
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DATASETS'); case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DATASETS');
case DescriptionTemplateFieldType.CHECK_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.CHECKBOX'); case DescriptionTemplateFieldType.CHECK_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.CHECKBOX');
case DescriptionTemplateFieldType.FREE_TEXT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.FREE-TEXT'); case DescriptionTemplateFieldType.FREE_TEXT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.FREE-TEXT');

View File

@ -530,11 +530,11 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
break; break;
} }
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: { case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: {
//TODO: refactor //TODO: refactor
break; break;
} }
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: { case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: {
const data: DescriptionTemplateLabelAndMultiplicityData = { const data: DescriptionTemplateLabelAndMultiplicityData = {
label: '', label: '',

View File

@ -162,11 +162,11 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
break; break;
} }
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: { case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: {
//TODO: refactor //TODO: refactor
break; break;
} }
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:{ case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:{
const data: DescriptionTemplateLabelAndMultiplicityData = { const data: DescriptionTemplateLabelAndMultiplicityData = {
label: '', label: '',

View File

@ -808,7 +808,7 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
case DescriptionTemplateFieldType.CURRENCY: case DescriptionTemplateFieldType.CURRENCY:
case DescriptionTemplateFieldType.VALIDATION: case DescriptionTemplateFieldType.VALIDATION:
return new DescriptionTemplateLabelDataEditorModel(this.validationErrorModel); return new DescriptionTemplateLabelDataEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
return new DescriptionTemplateLabelAndMultiplicityDataEditorModel(this.validationErrorModel); return new DescriptionTemplateLabelAndMultiplicityDataEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: case DescriptionTemplateFieldType.EXTERNAL_DATASETS:

View File

@ -28,6 +28,7 @@ import { DescriptionTemplateService } from '@app/core/services/description-templ
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status'; import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup'; import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
import { DescriptionTemplateVersionStatus } from '@app/core/common/enum/description-template-version-status';
@Component({ @Component({
@ -93,8 +94,12 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
lookup.metadata = { countAll: true }; lookup.metadata = { countAll: true };
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE }; lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
lookup.isActive = [IsActive.Active]; lookup.isActive = [IsActive.Active];
lookup.versionStatuses = [DescriptionTemplateVersionStatus.Current, DescriptionTemplateVersionStatus.NotFinalized];
lookup.order = { items: [this.toDescSortField(nameof<DescriptionTemplate>(x => x.createdAt))] }; lookup.order = { items: [this.toDescSortField(nameof<DescriptionTemplate>(x => x.createdAt))] };
if (this.mode && this.mode == 'versions-listing') lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))] if (this.mode && this.mode == 'versions-listing') {
lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))];
lookup.versionStatuses = null;
}
this.updateOrderUiFields(lookup.order); this.updateOrderUiFields(lookup.order);
lookup.project = { lookup.project = {

View File

@ -28,6 +28,7 @@ import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof'; import { nameof } from 'ts-simple-nameof';
import { ImportDmpBlueprintDialogComponent } from './import-dmp-blueprint/import-dmp-blueprint.dialog.component'; import { ImportDmpBlueprintDialogComponent } from './import-dmp-blueprint/import-dmp-blueprint.dialog.component';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
import { DmpBlueprintVersionStatus } from '@app/core/common/enum/dmp-blueprint-version-status';
@Component({ @Component({
@ -92,8 +93,12 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
lookup.metadata = { countAll: true }; lookup.metadata = { countAll: true };
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE }; lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
lookup.isActive = [IsActive.Active]; lookup.isActive = [IsActive.Active];
lookup.versionStatuses = [DmpBlueprintVersionStatus.Current, DmpBlueprintVersionStatus.NotFinalized];
lookup.order = { items: [this.toDescSortField(nameof<DmpBlueprint>(x => x.createdAt))] }; lookup.order = { items: [this.toDescSortField(nameof<DmpBlueprint>(x => x.createdAt))] };
if (this.mode && this.mode == 'versions-listing') lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))] if (this.mode && this.mode == 'versions-listing') {
lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))];
lookup.versionStatuses = null;
}
this.updateOrderUiFields(lookup.order); this.updateOrderUiFields(lookup.order);
lookup.project = { lookup.project = {

View File

@ -5,13 +5,13 @@ import { DashboardComponent } from '@app/ui/dashboard/dashboard.component';
import { DashboardRoutingModule } from '@app/ui/dashboard/dashboard.routing'; import { DashboardRoutingModule } from '@app/ui/dashboard/dashboard.routing';
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module'; import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
import { CommonUiModule } from '@common/ui/common-ui.module'; import { CommonUiModule } from '@common/ui/common-ui.module';
import { DescriptionModule } from '../description/description.module'; import { DescriptionListingModule } from '../description/listing/description-listing.module';
import { DmpModule } from '../dmp/dmp.module'; import { DmpListingModule } from '../dmp/listing/dmp-listing.module';
import { StartNewDmpDialogModule } from '../dmp/new/start-new-dmp-dialogue/start-new-dmp-dialog.module';
import { DraftsComponent } from './drafts/drafts.component'; import { DraftsComponent } from './drafts/drafts.component';
import { RecentEditedActivityComponent } from './recent-edited-activity/recent-edited-activity.component'; import { RecentEditedActivityComponent } from './recent-edited-activity/recent-edited-activity.component';
import { RecentEditedDescriptionActivityComponent } from './recent-edited-description-activity/recent-edited-description-activity.component'; import { RecentEditedDescriptionActivityComponent } from './recent-edited-description-activity/recent-edited-description-activity.component';
import { RecentEditedDmpActivityComponent } from './recent-edited-dmp-activity/recent-edited-dmp-activity.component'; import { RecentEditedDmpActivityComponent } from './recent-edited-dmp-activity/recent-edited-dmp-activity.component';
import { StartNewDmpDialogModule } from '../dmp/new/start-new-dmp-dialogue/start-new-dmp-dialog.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -23,8 +23,8 @@ import { StartNewDmpDialogModule } from '../dmp/new/start-new-dmp-dialogue/start
FormsModule, FormsModule,
ReactiveFormsModule, ReactiveFormsModule,
DmpModule, //TODO: add only listing component to a seperate module DmpListingModule,
DescriptionModule, //TODO: add only listing component to a seperate module DescriptionListingModule,
StartNewDmpDialogModule StartNewDmpDialogModule
], ],
declarations: [ declarations: [

View File

@ -89,6 +89,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
this.updateUrl(); this.updateUrl();
} }
}); });
this.refresh();
} }
ngOnChanges() { ngOnChanges() {

View File

@ -27,6 +27,21 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
} }
public static lookupFields(): string[] { public static lookupFields(): string[] {
return [
...DescriptionEditorResolver.descriptionLookupFields(),
...DescriptionEditorResolver.dmpLookupFields(nameof<Description>(x => x.dmp)),
...DescriptionEditorResolver.descriptionTemplateLookupFields(nameof<Description>(x => x.descriptionTemplate)),
]
}
public static cloneLookupFields(): string[] {
return [
...DescriptionEditorResolver.descriptionLookupFields(),
...DescriptionEditorResolver.descriptionTemplateLookupFields(nameof<Description>(x => x.descriptionTemplate)),
]
}
public static descriptionLookupFields(): string[] {
return [ return [
...BaseEditorResolver.lookupFields(), ...BaseEditorResolver.lookupFields(),
nameof<Description>(x => x.id), nameof<Description>(x => x.id),
@ -35,13 +50,9 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
nameof<Description>(x => x.description), nameof<Description>(x => x.description),
nameof<Description>(x => x.status), nameof<Description>(x => x.status),
...DescriptionEditorResolver.dmpLookupFields(nameof<Description>(x => x.dmp)),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.id)].join('.'), [nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'), [nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
...DescriptionEditorResolver.descriptionTemplateLookupFields(nameof<Description>(x => x.descriptionTemplate)),
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.comment)].join('.'), [nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.comment)].join('.'),
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.ordinal)].join('.'), [nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.ordinal)].join('.'),
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.textValue)].join('.'), [nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.textValue)].join('.'),
@ -60,7 +71,6 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
nameof<Description>(x => x.createdAt), nameof<Description>(x => x.createdAt),
nameof<Description>(x => x.hash), nameof<Description>(x => x.hash),
nameof<Description>(x => x.isActive) nameof<Description>(x => x.isActive)
] ]
} }
@ -141,6 +151,7 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
const id = route.paramMap.get('id'); const id = route.paramMap.get('id');
const dmpId = route.paramMap.get('dmpId'); const dmpId = route.paramMap.get('dmpId');
const dmpSectionId = route.paramMap.get('dmpSectionId'); const dmpSectionId = route.paramMap.get('dmpSectionId');
const copyDmpId = route.paramMap.get('copyDmpId');
// const cloneid = route.paramMap.get('cloneid'); // const cloneid = route.paramMap.get('cloneid');
if (id != null) { if (id != null) {
return this.descriptionService.getSingle(Guid.parse(id), fields) return this.descriptionService.getSingle(Guid.parse(id), fields)
@ -154,6 +165,17 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
} }
return description; return description;
})); }));
} else if (copyDmpId != null && id != null && dmpSectionId != null) {
return this.dmpService.getSingle(Guid.parse(copyDmpId), DescriptionEditorResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), map(dmp => {
return this.descriptionService.getSingle(Guid.parse(id), DescriptionEditorResolver.cloneLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), map(description => {
description.dmp = dmp;
description.dmpDescriptionTemplate = {
sectionId: Guid.parse(dmpSectionId)
}
return description;
}));
}));
} }
//TODO: check this //TODO: check this
// else if (cloneid != null) { // else if (cloneid != null) {

View File

@ -44,6 +44,23 @@ const routes: Routes = [
} }
} }
}, },
{
path: 'copy/:id/:copyDmpId/:dmpSectionId',
canActivate: [AuthGuard],
component: DescriptionEditorComponent,
canDeactivate: [PendingChangesGuard],
resolve: {
'entity': DescriptionEditorResolver
},
data: {
...BreadcrumbService.generateRouteDataConfiguration({
title: 'BREADCRUMBS.EDIT-DESCRIPTION'
}),
authContext: {
permissions: [AppPermission.EditDescription]
}
}
},
// { // {
// path: 'edit/:id/finalize', // path: 'edit/:id/finalize',

View File

@ -196,7 +196,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
this.makeAutocompleteConfiguration(this.searchDatasets.bind(this), "label"); this.makeAutocompleteConfiguration(this.searchDatasets.bind(this), "label");
break; break;
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
this.makeAutocompleteConfiguration(this.searchDmps.bind(this), "label"); this.makeAutocompleteConfiguration(this.searchDmps.bind(this), "label");
break; break;
} }

View File

@ -14,6 +14,7 @@ import { Description } from '@app/core/model/description/description';
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp'; import { Dmp, DmpUser } from '@app/core/model/dmp/dmp';
import { DmpReference } from '@app/core/model/dmp/dmp-reference'; import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { FileFormat } from '@app/core/model/file/file-format.model'; import { FileFormat } from '@app/core/model/file/file-format.model';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { Reference } from '@app/core/model/reference/reference'; import { Reference } from '@app/core/model/reference/reference';
import { DescriptionLookup } from '@app/core/query/description.lookup'; import { DescriptionLookup } from '@app/core/query/description.lookup';
import { DmpLookup } from '@app/core/query/dmp.lookup'; import { DmpLookup } from '@app/core/query/dmp.lookup';
@ -197,7 +198,7 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
] ]
}; };

View File

@ -20,6 +20,7 @@ import { DescriptionCopyDialogModule } from '../description-copy-dialog/descript
DescriptionListingItemComponent, DescriptionListingItemComponent,
], ],
exports: [ exports: [
DescriptionListingItemComponent
] ]
}) })
export class DescriptionListingModule { } export class DescriptionListingModule { }

View File

@ -29,10 +29,10 @@
</div> </div>
<span *ngIf="lockStatus" class="ml-2 mr-2">.</span> <span *ngIf="lockStatus" class="ml-2 mr-2">.</span>
<div class="d-flex mr-2">{{'DESCRIPTION-OVERVIEW.EDITED' | translate}} : <div class="d-flex mr-2">{{'DESCRIPTION-OVERVIEW.EDITED' | translate}} :
{{description.modified | dateTimeCultureFormatter: "d MMMM y"}} {{description.updatedAt | dateTimeCultureFormatter: "d MMMM y"}}
</div> </div>
<div class="d-flex ml-2 mr-4"> <div class="d-flex ml-2 mr-4">
<div *ngIf="description.status === descriptionStatusEnum.Draft" class="d-flex flex-row uppercase"> <div *ngIf="description.status === descriptionStatusEnum.Finalized" class="d-flex flex-row uppercase">
<mat-icon class="status-icon check-icon">check</mat-icon> <mat-icon class="status-icon check-icon">check</mat-icon>
{{'DESCRIPTION-OVERVIEW.FINALISED' | translate}} {{'DESCRIPTION-OVERVIEW.FINALISED' | translate}}
</div> </div>

View File

@ -27,6 +27,10 @@ import { TranslateService } from '@ngx-translate/core';
import { NgDialogAnimationService } from "ng-dialog-animation"; import { NgDialogAnimationService } from "ng-dialog-animation";
import { debounceTime, takeUntil } from 'rxjs/operators'; import { debounceTime, takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof'; import { nameof } from 'ts-simple-nameof';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { Reference } from '@app/core/model/reference/reference';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
@Component({ @Component({
selector: 'app-dmp-listing-component', selector: 'app-dmp-listing-component',
@ -95,6 +99,9 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
if (this.groupId != null && Guid.isGuid(this.groupId)) { if (this.groupId != null && Guid.isGuid(this.groupId)) {
this.lookup.groupIds = [Guid.parse(this.groupId)]; this.lookup.groupIds = [Guid.parse(this.groupId)];
this.lookup.versionStatuses = null;
} else {
this.lookup.versionStatuses = [DmpVersionStatus.Current];
} }
this.refresh(this.lookup); this.refresh(this.lookup);
@ -184,11 +191,11 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'), [nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'), [nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'), [nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'), [nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'), [nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'), [nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'), [nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'), // [nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
] ]
}; };
this.dmpService.query(lookup).pipe(takeUntil(this._destroyed)) this.dmpService.query(lookup).pipe(takeUntil(this._destroyed))

View File

@ -24,6 +24,7 @@ import { DmpInvitationDialogModule } from '../invitation/dialog/dmp-invitation-d
DmpListingItemComponent, DmpListingItemComponent,
], ],
exports: [ exports: [
DmpListingItemComponent
] ]
}) })
export class DmpListingModule { } export class DmpListingModule { }

View File

@ -28,7 +28,7 @@
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="dmp.descriptions?.length > 3" [routerLink]="isPublic ? ['/explore-plans/overview/public/' + dmp.id] : ['/plans/overview/' + dmp.id]"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a> <a class="d-flex justify-content-center pb-3 show-more" *ngIf="dmp.descriptions?.length > 3" [routerLink]="isPublic ? ['/explore-plans/overview/public/' + dmp.id] : ['/plans/overview/' + dmp.id]"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</a> </a>
<div class="dmp-card-actions"> <div class="dmp-card-actions">
<a class="col-auto border-right pointer" *ngIf="canExportDmp(dmp)" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="canExportDmp(dmp) && fileTransformerService.availableFormats.length > 0" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | 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="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="canInviteDmpUsers(dmp)" (click)="inviteToDmp()"><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="canInviteDmpUsers(dmp)" (click)="inviteToDmp()"><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="canCloneDmp(dmp)" (click)="cloneClicked()"><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="canCloneDmp(dmp)" (click)="cloneClicked()"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>

View File

@ -44,7 +44,7 @@
</div> </div>
<div class="row"> <div class="row">
<!-- <button *ngIf="isDraftDmp(dmp) && isDmpOwner(dmp) && !lockStatus" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above"> --> <!-- <button *ngIf="isDraftDmp(dmp) && isDmpOwner(dmp) && !lockStatus" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above"> -->
<button *ngIf="isDraftDmp(dmp) && !lockStatus" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above"> <button *ngIf="canEditDmp() && !lockStatus" (click)="editClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon> <mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button> </button>
<button *ngIf="canCloneDmp()" (click)="cloneClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.CLONE' | translate}}" matTooltipPosition="above"> <button *ngIf="canCloneDmp()" (click)="cloneClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
@ -99,7 +99,7 @@
</div> </div>
</div> </div>
<div class="row mt-2 add-description-txt" *ngIf="!lockStatus"> <div class="row mt-2 add-description-txt" *ngIf="!lockStatus">
<a class="add-description-btn" *ngIf="isDraftDmp(dmp)" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank"> <a class="add-description-btn" *ngIf="canEditDmp()" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
{{'DMP-OVERVIEW.ACTIONS.ADD-DESCRIPTION' | translate}} {{'DMP-OVERVIEW.ACTIONS.ADD-DESCRIPTION' | translate}}
</a> </a>
@ -133,7 +133,7 @@
</div> </div>
</div> </div>
<div class="frame mb-3 pt-4 pl-3 pr-5 pb-1"> <div class="frame mb-3 pt-4 pl-3 pr-5 pb-1">
<div *ngIf="isDraftDmp(dmp) && canFinalizeDmp() && !lockStatus"> <div *ngIf="isDraftDmp() && canFinalizeDmp() && !lockStatus">
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dmp)"> <div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dmp)">
<button mat-mini-fab class="finalize-btn"> <button mat-mini-fab class="finalize-btn">
<mat-icon class="mat-mini-fab-icon">check</mat-icon> <mat-icon class="mat-mini-fab-icon">check</mat-icon>

View File

@ -193,6 +193,10 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
if (principalId) return !!this.dmp.dmpUsers?.find(x => (x.role === DmpUserRole.Owner) && (principalId === x.id)); if (principalId) return !!this.dmp.dmpUsers?.find(x => (x.role === DmpUserRole.Owner) && (principalId === x.id));
} }
canEditDmp(): boolean{
return (this.isDraftDmp()) && (this.isDmpOwner() || this.authentication.hasPermission(AppPermission.EditDmp));
}
canCreateNewVersion(): boolean { canCreateNewVersion(): boolean {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp); return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp);
} }
@ -221,8 +225,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.AssignDmpUsers); return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.AssignDmpUsers);
} }
editClicked(dmp: Dmp) { editClicked() {
this.router.navigate(['/plans/edit/', dmp.id]); this.router.navigate(['/plans/edit/', this.dmp.id]);
} }
cloneClicked() { cloneClicked() {
@ -442,8 +446,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
return this.dmp.dmpUsers?.some(x => (x.user.id === principalId)); return this.dmp.dmpUsers?.some(x => (x.user.id === principalId));
} }
isDraftDmp(dmp: Dmp) { isDraftDmp() {
return dmp.status == DmpStatus.Draft; return this.dmp.status == DmpStatus.Draft;
} }
isFinalizedDmp(dmp: Dmp) { isFinalizedDmp(dmp: Dmp) {