description authz changes
This commit is contained in:
parent
965af355d8
commit
da8efe5130
|
@ -73,6 +73,7 @@ public final class Permission {
|
||||||
//Dmp
|
//Dmp
|
||||||
public static String BrowseDmp = "BrowseDmp";
|
public static String BrowseDmp = "BrowseDmp";
|
||||||
public static String EditDmp = "EditDmp";
|
public static String EditDmp = "EditDmp";
|
||||||
|
public static String ReviewDmp = "ReviewDmp";
|
||||||
public static String NewDmp = "NewDmp";
|
public static String NewDmp = "NewDmp";
|
||||||
public static String DepositDmp = "DepositDmp";
|
public static String DepositDmp = "DepositDmp";
|
||||||
public static String DeleteDmp = "DeleteDmp";
|
public static String DeleteDmp = "DeleteDmp";
|
||||||
|
@ -105,6 +106,7 @@ public final class Permission {
|
||||||
|
|
||||||
//Description
|
//Description
|
||||||
public static String BrowseDescription = "BrowseDescription";
|
public static String BrowseDescription = "BrowseDescription";
|
||||||
|
public static String ReviewDescription = "ReviewDescription";
|
||||||
public static String EditDescription = "EditDescription";
|
public static String EditDescription = "EditDescription";
|
||||||
public static String FinalizeDescription = "FinalizeDescription";
|
public static String FinalizeDescription = "FinalizeDescription";
|
||||||
public static String DeleteDescription = "DeleteDescription";
|
public static String DeleteDescription = "DeleteDescription";
|
||||||
|
|
|
@ -179,6 +179,18 @@ permissions:
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
ReviewDescription:
|
||||||
|
roles:
|
||||||
|
- TenantAdmin
|
||||||
|
dmp:
|
||||||
|
roles:
|
||||||
|
- Owner
|
||||||
|
- User
|
||||||
|
- DescriptionContributor
|
||||||
|
- Reviewer
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
EditDescription:
|
EditDescription:
|
||||||
roles:
|
roles:
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
|
@ -408,6 +420,18 @@ permissions:
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
ReviewDmp:
|
||||||
|
roles:
|
||||||
|
- TenantAdmin
|
||||||
|
dmp:
|
||||||
|
roles:
|
||||||
|
- Owner
|
||||||
|
- User
|
||||||
|
- DescriptionContributor
|
||||||
|
- Reviewer
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
NewDmp:
|
NewDmp:
|
||||||
roles:
|
roles:
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
|
|
|
@ -71,6 +71,7 @@ export enum AppPermission {
|
||||||
//Dmp
|
//Dmp
|
||||||
BrowseDmp = "BrowseDmp",
|
BrowseDmp = "BrowseDmp",
|
||||||
EditDmp = "EditDmp",
|
EditDmp = "EditDmp",
|
||||||
|
ReviewDmp = "ReviewDmp",
|
||||||
NewDmp = "NewDmp",
|
NewDmp = "NewDmp",
|
||||||
DepositDmp = "DepositDmp",
|
DepositDmp = "DepositDmp",
|
||||||
DeleteDmp = "DeleteDmp",
|
DeleteDmp = "DeleteDmp",
|
||||||
|
@ -103,10 +104,12 @@ export enum AppPermission {
|
||||||
|
|
||||||
//Description
|
//Description
|
||||||
BrowseDescription = "BrowseDescription",
|
BrowseDescription = "BrowseDescription",
|
||||||
|
ReviewDescription = "ReviewDescription",
|
||||||
EditDescription = "EditDescription",
|
EditDescription = "EditDescription",
|
||||||
FinalizeDescription = "FinalizeDescription",
|
FinalizeDescription = "FinalizeDescription",
|
||||||
DeleteDescription = "DeleteDescription",
|
DeleteDescription = "DeleteDescription",
|
||||||
CloneDescription = "CloneDescription",
|
CloneDescription = "CloneDescription",
|
||||||
|
ExportDescription = "ExportDescription",
|
||||||
|
|
||||||
//DescriptionTag
|
//DescriptionTag
|
||||||
BrowseDescriptionTag = "BrowseDescriptionTag",
|
BrowseDescriptionTag = "BrowseDescriptionTag",
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
<mat-progress-bar color="primary" mode="indeterminate"></mat-progress-bar>
|
<mat-progress-bar color="primary" mode="indeterminate"></mat-progress-bar>
|
||||||
</div>
|
</div>
|
||||||
<div mat-dialog-content class="definition-content">
|
<div mat-dialog-content class="definition-content">
|
||||||
<app-description-form *ngIf="formGroup && formGroup.get('properties')" [propertiesFormGroup]="previewPropertiesFormGroup" [descriptionId]="descriptionId" [descriptionTemplate]="descriptionTemplate" [visibilityRulesService]="visibilityRulesService" [isNew]="true"></app-description-form>
|
<app-description-form *ngIf="formGroup && formGroup.get('properties')" [propertiesFormGroup]="previewPropertiesFormGroup" [descriptionId]="descriptionId" [descriptionTemplate]="descriptionTemplate" [canReview]="false" [visibilityRulesService]="visibilityRulesService" [isNew]="true"></app-description-form>
|
||||||
</div>
|
</div>
|
||||||
<div mat-mat-dialog-actions *ngIf="formGroup">
|
<div mat-mat-dialog-actions *ngIf="formGroup">
|
||||||
<div class="col-auto d-flex pb-4 pt-2">
|
<div class="col-auto d-flex pb-4 pt-2">
|
||||||
<button mat-raised-button type="button" class="start-btn ml-auto" (click)="select()">{{'TYPES.EXTERNAL-DATASET-TYPE.SELECT' | translate}}</button>
|
<button mat-raised-button type="button" class="start-btn ml-auto" (click)="select()">{{'TYPES.EXTERNAL-DATASET-TYPE.SELECT' | translate}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div [id]="'preview_container'+ form.get('id').value" class="row">
|
<div [id]="'preview_container'+ form.get('id').value" class="row">
|
||||||
<div *ngIf="previewFieldSet && showPreview && firstField?.get('data')?.get('fieldType')?.value" class="col-12" [@fade-in-fast]>
|
<div *ngIf="previewFieldSet && showPreview && firstField?.get('data')?.get('fieldType')?.value" class="col-12" [@fade-in-fast]>
|
||||||
<app-description-form-field-set class="w-100" [propertiesFormGroup]="previewPropertiesFormGroup" [fieldSet]="previewFieldSet" [visibilityRulesService]="visibilityRulesService" [hideAnnotations]="true"></app-description-form-field-set>
|
<app-description-form-field-set class="w-100" [canReview]="false" [propertiesFormGroup]="previewPropertiesFormGroup" [fieldSet]="previewFieldSet" [visibilityRulesService]="visibilityRulesService" [hideAnnotations]="true"></app-description-form-field-set>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<app-description-form *ngIf="previewPropertiesFormGroup" [propertiesFormGroup]="previewPropertiesFormGroup" [descriptionTemplate]="descriptionTemplate" [visibilityRulesService]="visibilityRulesService" [isNew]="true"></app-description-form>
|
<app-description-form *ngIf="previewPropertiesFormGroup" [canReview]="false" [propertiesFormGroup]="previewPropertiesFormGroup" [descriptionTemplate]="descriptionTemplate" [visibilityRulesService]="visibilityRulesService" [isNew]="true"></app-description-form>
|
||||||
|
|
|
@ -123,4 +123,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -176,14 +176,14 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="row sticky-top table-container" style="top : 7em;">
|
<div class="row sticky-top table-container" style="top : 7em;">
|
||||||
<description-template-table-of-contents class="toc-pane-container col" style="margin-bottom: 2em;"
|
<description-template-table-of-contents class="toc-pane-container col" style="margin-bottom: 2em;"
|
||||||
[links]="toCEntries"
|
[links]="toCEntries"
|
||||||
(itemClick)="displayItem($event)"
|
(itemClick)="displayItem($event)"
|
||||||
(createEntry)="addNewEntry($event)"
|
(createEntry)="addNewEntry($event)"
|
||||||
(removeEntry)="onRemoveEntry($event)"
|
(removeEntry)="onRemoveEntry($event)"
|
||||||
[itemSelected]="selectedTocEntry"
|
[itemSelected]="selectedTocEntry"
|
||||||
[viewOnly]="formGroup.disabled"
|
[viewOnly]="formGroup.disabled"
|
||||||
(dataNeedsRefresh)="onDataNeedsRefresh($event)"
|
(dataNeedsRefresh)="onDataNeedsRefresh($event)"
|
||||||
[colorizeInvalid]="colorizeInvalid">
|
[colorizeInvalid]="colorizeInvalid">
|
||||||
</description-template-table-of-contents>
|
</description-template-table-of-contents>
|
||||||
</div>
|
</div>
|
||||||
|
@ -210,7 +210,7 @@
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<mat-form-field class="w-100">
|
<mat-form-field class="w-100">
|
||||||
<input type="text" matInput formControlName="title" [placeholder]="('DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.UNTITLED' | translate) +' '+ ('DESCRIPTION-TEMPLATE-EDITOR.STEPS.PAGE-INFO.PAGE' |translate)">
|
<input type="text" matInput formControlName="title" [placeholder]="('DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.UNTITLED' | translate) +' '+ ('DESCRIPTION-TEMPLATE-EDITOR.STEPS.PAGE-INFO.PAGE' |translate)">
|
||||||
<mat-error *ngIf="selectedTocEntry.form.get('title').hasError('backendError')">{{selectedTocEntry.form.get('title').getError('backendError').message}}</mat-error>
|
<mat-error *ngIf="selectedTocEntry.form.get('title').hasError('backendError')">{{selectedTocEntry.form.get('title').getError('backendError').message}}</mat-error>
|
||||||
<mat-error *ngIf="selectedTocEntry.form.get('title').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="selectedTocEntry.form.get('title').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
@ -223,11 +223,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12" *ngIf="(selectedTocEntry.type === tocEntryEnumValues.Section) || (selectedTocEntry.type === tocEntryEnumValues.FieldSet)">
|
<div class="col-12" *ngIf="(selectedTocEntry.type === tocEntryEnumValues.Section) || (selectedTocEntry.type === tocEntryEnumValues.FieldSet)">
|
||||||
<app-description-template-editor-section-fieldset-component
|
<app-description-template-editor-section-fieldset-component
|
||||||
[tocentry]="selectedTocEntry"
|
[tocentry]="selectedTocEntry"
|
||||||
[viewOnly]="formGroup.disabled"
|
[viewOnly]="formGroup.disabled"
|
||||||
[datasetProfileId]="datasetProfileId"
|
[datasetProfileId]="datasetProfileId"
|
||||||
[validationErrorModel]="editorModel.validationErrorModel"
|
[validationErrorModel]="editorModel.validationErrorModel"
|
||||||
[validationRootPath]="selectedTocEntry.validationRootPath"
|
[validationRootPath]="selectedTocEntry.validationRootPath"
|
||||||
(addNewFieldSet)="addNewEntry({childType: tocEntryEnumValues.FieldSet,parent: {formGroup: $event}})" (removeFieldSet)="onRemoveEntry(_findTocEntryById($event, toCEntries))" (cloneFieldSet)="cloneFieldSet($event, selectedTocEntry.validationRootPath)" (selectedEntryId)="displayItem(_findTocEntryById($event, toCEntries))" (dataNeedsRefresh)="onDataNeedsRefresh()"
|
(addNewFieldSet)="addNewEntry({childType: tocEntryEnumValues.FieldSet,parent: {formGroup: $event}})" (removeFieldSet)="onRemoveEntry(_findTocEntryById($event, toCEntries))" (cloneFieldSet)="cloneFieldSet($event, selectedTocEntry.validationRootPath)" (selectedEntryId)="displayItem(_findTocEntryById($event, toCEntries))" (dataNeedsRefresh)="onDataNeedsRefresh()"
|
||||||
>
|
>
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<app-final-preview-component [descriptionTemplatePersist]="finalPreviewDescriptionTemplatePersist">
|
<app-final-preview-component [descriptionTemplatePersist]="finalPreviewDescriptionTemplatePersist">
|
||||||
|
|
||||||
</app-final-preview-component>
|
</app-final-preview-component>
|
||||||
</div>
|
</div>
|
||||||
|
@ -340,4 +340,4 @@
|
||||||
{{'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FINALIZE' | translate}}
|
{{'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FINALIZE' | translate}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-3 stepper-actions justify-content-around">
|
<div class="row mt-3 stepper-actions justify-content-around">
|
||||||
<div class="col-auto mb-1">
|
<div class="col-auto mb-1">
|
||||||
|
@ -150,6 +150,7 @@
|
||||||
[linkToScroll]="linkToScroll"
|
[linkToScroll]="linkToScroll"
|
||||||
[validationErrorModel]="editorModel.validationErrorModel"
|
[validationErrorModel]="editorModel.validationErrorModel"
|
||||||
[isNew]="isNew || isCopy"
|
[isNew]="isNew || isCopy"
|
||||||
|
[canReview]="canReview"
|
||||||
(fieldsetFocusChange)="fieldsetIdWithFocus = $event"
|
(fieldsetFocusChange)="fieldsetIdWithFocus = $event"
|
||||||
></app-description-form>
|
></app-description-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -63,6 +63,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
isNew = true;
|
isNew = true;
|
||||||
isDeleted = false;
|
isDeleted = false;
|
||||||
isCopy = false;
|
isCopy = false;
|
||||||
|
canReview = false;
|
||||||
item: Description;
|
item: Description;
|
||||||
fieldsetIdWithFocus: string;
|
fieldsetIdWithFocus: string;
|
||||||
fileTransformerEntityTypeEnum = FileTransformerEntityType;
|
fileTransformerEntityTypeEnum = FileTransformerEntityType;
|
||||||
|
@ -217,7 +218,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().subscribe((result: Description) => {
|
dialogRef.afterClosed().subscribe((result: Description) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.titleService.setTitle(result.label);
|
this.titleService.setTitle(result.label);
|
||||||
result.dmp = this.item.dmp;
|
result.dmp = this.item.dmp;
|
||||||
result.dmpDescriptionTemplate = this.item.dmpDescriptionTemplate;
|
result.dmpDescriptionTemplate = this.item.dmpDescriptionTemplate;
|
||||||
|
|
||||||
|
@ -582,19 +583,20 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
const descriptionSectionPermissionResolverModel: DescriptionSectionPermissionResolver = {
|
const descriptionSectionPermissionResolverModel: DescriptionSectionPermissionResolver = {
|
||||||
dmpId: this.item.dmp.id,
|
dmpId: this.item.dmp.id,
|
||||||
sectionIds: [this.item.dmpDescriptionTemplate.sectionId],
|
sectionIds: [this.item.dmpDescriptionTemplate.sectionId],
|
||||||
permissions: [AppPermission.EditDescription, AppPermission.DeleteDescription]
|
permissions: [AppPermission.EditDescription, AppPermission.DeleteDescription, AppPermission.FinalizeDescription, AppPermission.ReviewDescription]
|
||||||
}
|
}
|
||||||
this.descriptionService.getDescriptionSectionPermissions(descriptionSectionPermissionResolverModel)
|
this.descriptionService.getDescriptionSectionPermissions(descriptionSectionPermissionResolverModel)
|
||||||
.pipe(takeUntil(this._destroyed)).subscribe(
|
.pipe(takeUntil(this._destroyed)).subscribe(
|
||||||
permissionPerSection => {
|
permissionPerSection => {
|
||||||
const canedit = permissionPerSection && permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()] && permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()].some(x => x === AppPermission.EditDescription);
|
const canedit = permissionPerSection && permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()] && permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()].some(x => x === AppPermission.EditDescription);
|
||||||
|
this.canReview = permissionPerSection && permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()] && permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()].some(x => x === AppPermission.ReviewDescription);
|
||||||
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !canedit);
|
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !canedit);
|
||||||
if (this.item.descriptionTemplate?.definition) this.visibilityRulesService.setContext(this.item.descriptionTemplate.definition, this.formGroup.get('properties'));
|
if (this.item.descriptionTemplate?.definition) this.visibilityRulesService.setContext(this.item.descriptionTemplate.definition, this.formGroup.get('properties'));
|
||||||
if (this.item.descriptionTemplate?.definition) this.pageToFieldSetMap = this.mapPageToFieldSet(this.item.descriptionTemplate);;
|
if (this.item.descriptionTemplate?.definition) this.pageToFieldSetMap = this.mapPageToFieldSet(this.item.descriptionTemplate);;
|
||||||
|
|
||||||
// this.selectedSystemFields = this.selectedSystemFieldDisabled();
|
// this.selectedSystemFields = this.selectedSystemFieldDisabled();
|
||||||
this.descriptionEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
|
this.descriptionEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
|
||||||
if (this.editorModel.status == DescriptionStatus.Finalized || this.isDeleted) {
|
if (this.editorModel.status == DescriptionStatus.Finalized || this.isDeleted || !canedit) {
|
||||||
this.viewOnly = true;
|
this.viewOnly = true;
|
||||||
this.isFinalized = true;
|
this.isFinalized = true;
|
||||||
this.formGroup.disable();
|
this.formGroup.disable();
|
||||||
|
@ -943,7 +945,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
get maxStep() {
|
get maxStep() {
|
||||||
return this.visibleFieldSets.length;
|
return this.visibleFieldSets.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public nextStep() {
|
public nextStep() {
|
||||||
if (this.step < this.maxStep) {//view is changing
|
if (this.step < this.maxStep) {//view is changing
|
||||||
this.step = Math.floor(this.step + 1);
|
this.step = Math.floor(this.step + 1);
|
||||||
|
@ -990,9 +992,9 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
|
|
||||||
get countErrorsOfBaseInfoPage(): number {
|
get countErrorsOfBaseInfoPage(): number {
|
||||||
if (this.formGroup == null) return 0;
|
if (this.formGroup == null) return 0;
|
||||||
|
|
||||||
let errorsCount: number = 0;
|
let errorsCount: number = 0;
|
||||||
|
|
||||||
const baseInfoControlNames: string[] = [nameof<DescriptionEditorModel>(x => x.label), nameof<DescriptionEditorModel>(x => x.descriptionTemplateId)];
|
const baseInfoControlNames: string[] = [nameof<DescriptionEditorModel>(x => x.label), nameof<DescriptionEditorModel>(x => x.descriptionTemplateId)];
|
||||||
baseInfoControlNames.forEach((name: string) => {
|
baseInfoControlNames.forEach((name: string) => {
|
||||||
if (this.formGroup.get(name)?.touched && !this.formGroup.get(name)?.valid) errorsCount += 1;
|
if (this.formGroup.get(name)?.touched && !this.formGroup.get(name)?.valid) errorsCount += 1;
|
||||||
|
@ -1034,7 +1036,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
this.formGroup.get('properties').valueChanges
|
this.formGroup.get('properties').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(next => this.tocValidationService.validateForm());
|
.subscribe(next => this.tocValidationService.validateForm());
|
||||||
|
|
||||||
// // const labelSubscription =
|
// // const labelSubscription =
|
||||||
// this.formGroup.get('label').valueChanges
|
// this.formGroup.get('label').valueChanges
|
||||||
// .pipe(takeUntil(this._destroyed))
|
// .pipe(takeUntil(this._destroyed))
|
||||||
|
@ -1089,7 +1091,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
// this.getDefinition(profiledId);
|
// this.getDefinition(profiledId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapPageToFieldSet(descriptionTemplate: DescriptionTemplate): Map<string, DescriptionFieldIndicator[]> {
|
mapPageToFieldSet(descriptionTemplate: DescriptionTemplate): Map<string, DescriptionFieldIndicator[]> {
|
||||||
const pageToFieldSetMap = new Map<string, DescriptionFieldIndicator[]>();
|
const pageToFieldSetMap = new Map<string, DescriptionFieldIndicator[]>();
|
||||||
|
|
||||||
|
@ -1103,7 +1105,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
|
|
||||||
getFieldsetsOfPage(page: DescriptionTemplatePage): DescriptionFieldIndicator[] {
|
getFieldsetsOfPage(page: DescriptionTemplatePage): DescriptionFieldIndicator[] {
|
||||||
const fieldsByPage: DescriptionFieldIndicator[] = []
|
const fieldsByPage: DescriptionFieldIndicator[] = []
|
||||||
|
|
||||||
page.sections?.forEach((section: DescriptionTemplateSection) => {
|
page.sections?.forEach((section: DescriptionTemplateSection) => {
|
||||||
let fieldsets = this.getNestedSectionFieldsets(section);
|
let fieldsets = this.getNestedSectionFieldsets(section);
|
||||||
let fieldsBySection: DescriptionFieldIndicator[] = fieldsets?.flatMap((fieldset: DescriptionTemplateFieldSet) =>
|
let fieldsBySection: DescriptionFieldIndicator[] = fieldsets?.flatMap((fieldset: DescriptionTemplateFieldSet) =>
|
||||||
|
@ -1126,7 +1128,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
|
|
||||||
else return section.fieldSets;
|
else return section.fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNestedSectionIdsByField(section: DescriptionTemplateSection, fieldSetId: string): string[] {
|
getNestedSectionIdsByField(section: DescriptionTemplateSection, fieldSetId: string): string[] {
|
||||||
if (section.sections) {
|
if (section.sections) {
|
||||||
return [section.id, ...section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIdsByField(subsection, fieldSetId))];
|
return [section.id, ...section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIdsByField(subsection, fieldSetId))];
|
||||||
|
|
|
@ -55,6 +55,7 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
|
||||||
[nameof<Description>(x => x.authorizationFlags), AppPermission.EditDescription].join('.'),
|
[nameof<Description>(x => x.authorizationFlags), AppPermission.EditDescription].join('.'),
|
||||||
[nameof<Description>(x => x.authorizationFlags), AppPermission.DeleteDescription].join('.'),
|
[nameof<Description>(x => x.authorizationFlags), AppPermission.DeleteDescription].join('.'),
|
||||||
[nameof<Description>(x => x.authorizationFlags), AppPermission.FinalizeDescription].join('.'),
|
[nameof<Description>(x => x.authorizationFlags), AppPermission.FinalizeDescription].join('.'),
|
||||||
|
[nameof<Description>(x => x.authorizationFlags), AppPermission.ReviewDescription].join('.'),
|
||||||
|
|
||||||
[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('.'),
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<app-description-form-field-set-title class="row" [fieldSet]="fieldSet" [path]="path" [isChild]="isChild"></app-description-form-field-set-title>
|
<app-description-form-field-set-title class="row" [fieldSet]="fieldSet" [path]="path" [isChild]="isChild"></app-description-form-field-set-title>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!hideAnnotations" class="col-auto">
|
<div *ngIf="!hideAnnotations" class="col-auto">
|
||||||
<button mat-icon-button class="col-auto annotation-icon" (click)="showAnnotations(fieldSet.id)" [disabled]="propertiesFormGroup.disabled">
|
<button mat-icon-button class="col-auto annotation-icon" (click)="showAnnotations(fieldSet.id)" [disabled]="!canReview">
|
||||||
<mat-icon matTooltip="{{'DATASET-EDITOR.QUESTION.EXTENDED-DESCRIPTION.ANNOTATIONS' | translate}}" [matBadge]="annotationsCount" [matBadgeHidden]="annotationsCount <= 0" matBadgeColor="warn">comment</mat-icon>
|
<mat-icon matTooltip="{{'DATASET-EDITOR.QUESTION.EXTENDED-DESCRIPTION.ANNOTATIONS' | translate}}" [matBadge]="annotationsCount" [matBadgeHidden]="annotationsCount <= 0" matBadgeColor="warn">comment</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,6 +28,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
|
||||||
@Input() propertiesFormGroup: UntypedFormGroup;
|
@Input() propertiesFormGroup: UntypedFormGroup;
|
||||||
@Input() descriptionId: Guid;
|
@Input() descriptionId: Guid;
|
||||||
@Input() hideAnnotations: boolean = false;
|
@Input() hideAnnotations: boolean = false;
|
||||||
|
@Input() canReview: boolean = false;
|
||||||
|
|
||||||
get isMultiplicityEnabled() {
|
get isMultiplicityEnabled() {
|
||||||
return this.fieldSet.hasMultiplicity && this.fieldSet.multiplicity != null;
|
return this.fieldSet.hasMultiplicity && this.fieldSet.multiplicity != null;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
[validationErrorModel]="validationErrorModel"
|
[validationErrorModel]="validationErrorModel"
|
||||||
[isChild]="false"
|
[isChild]="false"
|
||||||
[hideAnnotations]="isNew"
|
[hideAnnotations]="isNew"
|
||||||
|
[canReview]="canReview"
|
||||||
></app-description-form-field-set>
|
></app-description-form-field-set>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,7 +33,7 @@
|
||||||
<div *ngIf="section?.sections?.length > 0" class="col-12">
|
<div *ngIf="section?.sections?.length > 0" class="col-12">
|
||||||
<ng-container *ngFor="let innerSection of section.sections; let j = index;">
|
<ng-container *ngFor="let innerSection of section.sections; let j = index;">
|
||||||
<div class="row" *ngIf="visibilityRulesService.isVisibleMap[innerSection.id]">
|
<div class="row" *ngIf="visibilityRulesService.isVisibleMap[innerSection.id]">
|
||||||
<app-description-form-section class="col-12" [section]="innerSection" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j" (askedToScroll)="onAskedToScroll($event)" [propertiesFormGroup]="propertiesFormGroup" [descriptionId]="descriptionId" [visibilityRulesService]="visibilityRulesService" [linkToScroll]="subsectionLinkToScroll"></app-description-form-section>
|
<app-description-form-section class="col-12" [section]="innerSection" [canReview]="canReview" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j" (askedToScroll)="onAskedToScroll($event)" [propertiesFormGroup]="propertiesFormGroup" [descriptionId]="descriptionId" [visibilityRulesService]="visibilityRulesService" [linkToScroll]="subsectionLinkToScroll"></app-description-form-section>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { Guid } from '@common/types/guid';
|
||||||
export class DescriptionFormSectionComponent extends BaseComponent implements OnInit, OnChanges {
|
export class DescriptionFormSectionComponent extends BaseComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
@Input() isNew: boolean = false;
|
@Input() isNew: boolean = false;
|
||||||
|
@Input() canReview: boolean = false;
|
||||||
@Input() section: DescriptionTemplateSection;
|
@Input() section: DescriptionTemplateSection;
|
||||||
@Input() propertiesFormGroup: UntypedFormGroup;
|
@Input() propertiesFormGroup: UntypedFormGroup;
|
||||||
@Input() visibilityRulesService: VisibilityRulesService;
|
@Input() visibilityRulesService: VisibilityRulesService;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
<ng-container *ngFor="let section of page.sections; let i = index;">
|
<ng-container *ngFor="let section of page.sections; let i = index;">
|
||||||
<div class="row" *ngIf="visibilityRulesService.isVisibleMap[section.id]">
|
<div class="row" *ngIf="visibilityRulesService.isVisibleMap[section.id]">
|
||||||
<app-description-form-section class="col-12" [section]="section" [path]="(z+1)+'.'+(i+1)" [pathName]="'pages.'+z+'.sections.'+i" [propertiesFormGroup]="propertiesFormGroup" [descriptionId]="descriptionId" [visibilityRulesService]="visibilityRulesService" (askedToScroll)="onAskedToScroll(expansionPanel, $event)" [linkToScroll]="linkToScroll" [validationErrorModel]="validationErrorModel" [isNew]="isNew"></app-description-form-section>
|
<app-description-form-section class="col-12" [section]="section" [canReview]="canReview" [path]="(z+1)+'.'+(i+1)" [pathName]="'pages.'+z+'.sections.'+i" [propertiesFormGroup]="propertiesFormGroup" [descriptionId]="descriptionId" [visibilityRulesService]="visibilityRulesService" (askedToScroll)="onAskedToScroll(expansionPanel, $event)" [linkToScroll]="linkToScroll" [validationErrorModel]="validationErrorModel" [isNew]="isNew"></app-description-form-section>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
|
|
|
@ -21,6 +21,7 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, A
|
||||||
@Input() visibilityRulesService: VisibilityRulesService;
|
@Input() visibilityRulesService: VisibilityRulesService;
|
||||||
@Input() descriptionId: Guid;
|
@Input() descriptionId: Guid;
|
||||||
@Input() isNew: boolean = false;
|
@Input() isNew: boolean = false;
|
||||||
|
@Input() canReview: boolean = false;
|
||||||
|
|
||||||
// @ViewChild('stepper', { static: false }) stepper: MatStepper;
|
// @ViewChild('stepper', { static: false }) stepper: MatStepper;
|
||||||
@Input() path: string;
|
@Input() path: string;
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-4 pb-3">
|
<div class="row mb-4 pb-3">
|
||||||
<div *ngIf="canEdit && isDraftDescription(description) && !isLocked" class="col-auto pr-0">
|
<div *ngIf="(canEdit || canReview) && isDraftDescription(description) && !isLocked" class="col-auto pr-0">
|
||||||
<button (click)="editClicked(description)" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
|
<button (click)="editClicked(description)" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-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>
|
||||||
|
|
|
@ -68,6 +68,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
||||||
canEdit = false;
|
canEdit = false;
|
||||||
canDelete = false;
|
canDelete = false;
|
||||||
canFinalize = false;
|
canFinalize = false;
|
||||||
|
canReview = false;
|
||||||
canInviteDmpUsers = false;
|
canInviteDmpUsers = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -123,6 +124,9 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
||||||
this.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) ||
|
this.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) ||
|
||||||
this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false;
|
this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false;
|
||||||
|
|
||||||
|
this.canReview = (this.authService.hasPermission(AppPermission.ReviewDescription) ||
|
||||||
|
this.description.authorizationFlags?.some(x => x === AppPermission.ReviewDescription)) && this.description.belongsToCurrentTenant != false;
|
||||||
|
|
||||||
this.canFinalize = (this.authService.hasPermission(AppPermission.FinalizeDescription) ||
|
this.canFinalize = (this.authService.hasPermission(AppPermission.FinalizeDescription) ||
|
||||||
this.description.authorizationFlags?.some(x => x === AppPermission.FinalizeDescription)) && this.description.belongsToCurrentTenant != false;
|
this.description.authorizationFlags?.some(x => x === AppPermission.FinalizeDescription)) && this.description.belongsToCurrentTenant != false;
|
||||||
|
|
||||||
|
@ -479,6 +483,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
||||||
[nameof<Description>(x => x.authorizationFlags), AppPermission.DeleteDescription].join('.'),
|
[nameof<Description>(x => x.authorizationFlags), AppPermission.DeleteDescription].join('.'),
|
||||||
[nameof<Description>(x => x.authorizationFlags), AppPermission.FinalizeDescription].join('.'),
|
[nameof<Description>(x => x.authorizationFlags), AppPermission.FinalizeDescription].join('.'),
|
||||||
[nameof<Description>(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'),
|
[nameof<Description>(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'),
|
||||||
|
[nameof<Description>(x => x.authorizationFlags), AppPermission.ReviewDescription].join('.'),
|
||||||
|
|
||||||
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.id)].join('.'),
|
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.id)].join('.'),
|
||||||
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.label)].join('.'),
|
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.label)].join('.'),
|
||||||
|
|
Loading…
Reference in New Issue