@@ -50,6 +50,7 @@ import {
5050 AcceptRequestAccess ,
5151 AddContributor ,
5252 BulkAddContributors ,
53+ BulkAddContributorsFromParentProject ,
5354 BulkUpdateContributors ,
5455 ContributorsSelectors ,
5556 CreateViewOnlyLink ,
@@ -164,6 +165,7 @@ export class ContributorsComponent implements OnInit, OnDestroy {
164165 deleteContributor : DeleteContributor ,
165166 bulkUpdateContributors : BulkUpdateContributors ,
166167 bulkAddContributors : BulkAddContributors ,
168+ bulkAddContributorsFromParentProject : BulkAddContributorsFromParentProject ,
167169 addContributor : AddContributor ,
168170 createViewOnlyLink : CreateViewOnlyLink ,
169171 deleteViewOnlyLink : DeleteViewOnlyLink ,
@@ -255,33 +257,42 @@ export class ContributorsComponent implements OnInit, OnDestroy {
255257 }
256258
257259 openAddContributorDialog ( ) {
258- const rootParentId = this . resourceDetails ( ) . rootParentId ?? this . resourceId ( ) ;
260+ const resourceDetails = this . resourceDetails ( ) ;
261+ const resourceId = this . resourceId ( ) ;
262+ const rootParentId = resourceDetails . rootParentId ?? resourceId ;
259263
260264 this . loaderService . show ( ) ;
261265
262266 this . actions
263- . getResourceWithChildren ( rootParentId , this . resourceId ( ) , this . resourceType ( ) )
267+ . getResourceWithChildren ( rootParentId , resourceId , this . resourceType ( ) )
264268 . pipe ( takeUntilDestroyed ( this . destroyRef ) )
265269 . subscribe ( ( ) => {
266270 this . loaderService . hide ( ) ;
267271
268- const components = this . mapNodesToComponentCheckboxItems ( this . resourceChildren ( ) , this . resourceId ( ) ) ;
272+ const components = this . mapNodesToComponentCheckboxItems ( this . resourceChildren ( ) , resourceId ) ;
269273
270274 this . customDialogService
271275 . open ( AddContributorDialogComponent , {
272276 header : 'project.contributors.addDialog.addRegisteredContributor' ,
273277 width : '448px' ,
274278 data : {
275279 components,
276- resourceName : this . resourceDetails ( ) . title ,
280+ resourceName : resourceDetails . title ,
281+ parentResourceName : resourceDetails . parent ?. title ,
282+ allowAddingContributorsFromParentProject :
283+ this . resourceType ( ) === ResourceType . Project &&
284+ resourceDetails . rootParentId &&
285+ resourceDetails . rootParentId !== resourceId ,
277286 } ,
278287 } )
279288 . onClose . pipe (
280289 filter ( ( res : ContributorDialogAddModel ) => ! ! res ) ,
281290 takeUntilDestroyed ( this . destroyRef )
282291 )
283292 . subscribe ( ( res : ContributorDialogAddModel ) => {
284- if ( res . type === AddContributorType . Unregistered ) {
293+ if ( res . type === AddContributorType . ParentProject ) {
294+ this . addContributorsFromParentProjectToComponents ( ) ;
295+ } else if ( res . type === AddContributorType . Unregistered ) {
285296 this . openAddUnregisteredContributorDialog ( ) ;
286297 } else {
287298 this . addContributorsToComponents ( res ) ;
@@ -311,6 +322,13 @@ export class ContributorsComponent implements OnInit, OnDestroy {
311322 . subscribe ( ( ) => this . toastService . showSuccess ( 'project.contributors.toastMessages.multipleAddSuccessMessage' ) ) ;
312323 }
313324
325+ private addContributorsFromParentProjectToComponents ( ) : void {
326+ this . actions
327+ . bulkAddContributorsFromParentProject ( this . resourceId ( ) , this . resourceType ( ) )
328+ . pipe ( takeUntilDestroyed ( this . destroyRef ) )
329+ . subscribe ( ( ) => this . toastService . showSuccess ( 'project.contributors.toastMessages.multipleAddSuccessMessage' ) ) ;
330+ }
331+
314332 openAddUnregisteredContributorDialog ( ) {
315333 this . customDialogService
316334 . open ( AddUnregisteredContributorDialogComponent , {
0 commit comments