diff --git a/src/frontend/app/diffusions/diffusions-list.component.ts b/src/frontend/app/diffusions/diffusions-list.component.ts index 790b8f1dbb4b0f725f0d8b4f83933a173c6404e4..90018e0e992dca2204c8226df3d247152694ab6e 100644 --- a/src/frontend/app/diffusions/diffusions-list.component.ts +++ b/src/frontend/app/diffusions/diffusions-list.component.ts @@ -48,9 +48,9 @@ export class DiffusionsListComponent implements OnInit { @Input('entityId') entityId: any = null; /** - * Category identifier to specify the context to load listModel + * To specify the context to load listModel */ - @Input() categoryId: any = null; + @Input() selfDest: boolean = false; /** * For manage current loaded list @@ -101,7 +101,7 @@ export class DiffusionsListComponent implements OnInit { if (this.resId !== null && this.resId != 0 && this.target !== 'redirect') { this.loadListinstance(this.resId); } else if ((this.resId === null || this.resId == 0) && !this.functions.empty(this.entityId)) { - this.loadListModel(this.entityId, false, this.categoryId === 'outgoing'); + this.loadListModel(this.entityId, false, this.selfDest); } this.loading = false; } diff --git a/src/frontend/app/indexation/indexing-form/indexing-form.component.html b/src/frontend/app/indexation/indexing-form/indexing-form.component.html index bc5f2eae7323d7de40f537f6ba9e34dde46e6f4d..f7d1fb1620ec0b1f5353259a13be3c431ed8680e 100644 --- a/src/frontend/app/indexation/indexing-form/indexing-form.component.html +++ b/src/frontend/app/indexation/indexing-form/indexing-form.component.html @@ -229,7 +229,7 @@ <i class="fas fa-check fieldFull" *ngIf="!adminMode && arrFormControl['diffusionList'].valid && !isEmptyField(field)"></i> </div> </div> - <app-diffusions-list #appDiffusionsList [resId]="resId" [entityId]="arrFormControl[field.identifier].value" [diffFormControl]="arrFormControl['diffusionList']" [allowedEntities]="field.allowedEntities" [target]="'indexation'" [categoryId]="currentCategory" (triggerEvent)="changeDestination($event,field.allowedEntities)"> + <app-diffusions-list #appDiffusionsList [resId]="resId" [entityId]="arrFormControl[field.identifier].value" [diffFormControl]="arrFormControl['diffusionList']" [allowedEntities]="field.allowedEntities" [target]="'indexation'" [selfDest]="selfDest" (triggerEvent)="changeDestination($event,field.allowedEntities)"> </app-diffusions-list> <mat-divider></mat-divider> </div> diff --git a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts index 20ec038dd89921d39c8b6ead3d40cb7f37a0a568..54ab3330e8ff44673836ede19cbc3d0d1bca784b 100755 --- a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts +++ b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts @@ -194,6 +194,8 @@ export class IndexingFormComponent implements OnInit { currentResourceValues: any = null; + selfDest: boolean = false; + dialogRef: MatDialogRef<any>; constructor( @@ -506,9 +508,11 @@ export class IndexingFormComponent implements OnInit { } else { let title = ''; if (elem.default_value === '#myPrimaryEntity') { + this.selfDest = this.currentCategory === 'outgoing'; elem.default_value = this.headerService.user.entities[0].id; this.arrFormControl[elem.identifier].setValue(elem.default_value); } else { + this.selfDest = false; const defaultVal = data.entities.filter((entity: any) => entity.enabled === true && entity.id === elem.default_value); elem.default_value = defaultVal.length > 0 ? defaultVal[0].id : null; this.arrFormControl[elem.identifier].setValue(defaultVal.length > 0 ? defaultVal[0].id : '');