diff --git a/src/app/core/data/collection-data.service.ts b/src/app/core/data/collection-data.service.ts index b2d5476d21..ee6a5677da 100644 --- a/src/app/core/data/collection-data.service.ts +++ b/src/app/core/data/collection-data.service.ts @@ -77,11 +77,11 @@ export class CollectionDataService extends ComColDataService { * requested after the response becomes stale * @param linksToFollow List of {@link FollowLinkConfig} that indicate which * {@link HALLink}s should be automatically resolved + * @param searchHref The backend search endpoint to use (default to submit) * @return Observable>> * collection list */ - getAuthorizedCollection(query: string, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig[]): Observable>> { - const searchHref = 'findSubmitAuthorized'; + getAuthorizedCollection(query: string, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, searchHref: string = 'findSubmitAuthorized', ...linksToFollow: FollowLinkConfig[]): Observable>> { options = Object.assign({}, options, { searchParams: [new RequestParam('query', query)], }); diff --git a/src/app/core/data/community-data.service.ts b/src/app/core/data/community-data.service.ts index 79dedf0c84..ba4feedbb5 100644 --- a/src/app/core/data/community-data.service.ts +++ b/src/app/core/data/community-data.service.ts @@ -11,9 +11,11 @@ import { isNotEmpty } from '../../shared/empty.util'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { RequestParam } from '../cache/models/request-param.model'; import { ObjectCacheService } from '../cache/object-cache.service'; import { Community } from '../shared/community.model'; import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { getAllCompletedRemoteData } from '../shared/operators'; import { BitstreamDataService } from './bitstream-data.service'; import { ComColDataService } from './comcol-data.service'; import { DSOChangeAnalyzer } from './dso-change-analyzer.service'; @@ -38,6 +40,32 @@ export class CommunityDataService extends ComColDataService { super('communities', requestService, rdbService, objectCache, halService, comparator, notificationsService, bitstreamDataService); } + /** + * Get all communities the user is authorized to submit to + * + * @param query limit the returned community to those with metadata values + * matching the query terms. + * @param options The [[FindListOptions]] object + * @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's + * no valid cached version. Defaults to true + * @param reRequestOnStale Whether or not the request should automatically be re- + * requested after the response becomes stale + * @param linksToFollow List of {@link FollowLinkConfig} that indicate which + * {@link HALLink}s should be automatically resolved + * @return Observable>> + * community list + */ + getAuthorizedCommunity(query: string, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig[]): Observable>> { + const searchHref = 'findAdminAuthorized'; + options = Object.assign({}, options, { + searchParams: [new RequestParam('query', query)], + }); + + return this.searchBy(searchHref, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow).pipe( + getAllCompletedRemoteData(), + ); + } + // this method is overridden in order to make it public getEndpoint() { return this.halService.getEndpoint(this.linkPath); diff --git a/src/app/shared/collection-dropdown/collection-dropdown.component.ts b/src/app/shared/collection-dropdown/collection-dropdown.component.ts index 0fef74b389..2c2214e78b 100644 --- a/src/app/shared/collection-dropdown/collection-dropdown.component.ts +++ b/src/app/shared/collection-dropdown/collection-dropdown.component.ts @@ -141,6 +141,12 @@ export class CollectionDropdownComponent implements OnInit, OnDestroy { */ @Input() entityType: string; + /** + * Search endpoint to use for finding authorized collections. + * Defaults to 'findSubmitAuthorized', but can be overridden (e.g. to 'findAdminAuthorized') + */ + @Input() searchHref = 'findSubmitAuthorized'; + /** * Emit to notify whether search is complete */ @@ -249,7 +255,7 @@ export class CollectionDropdownComponent implements OnInit, OnDestroy { followLink('parentCommunity')); } else { searchListService$ = this.collectionDataService - .getAuthorizedCollection(query, findOptions, true, true, followLink('parentCommunity')); + .getAuthorizedCollection(query, findOptions, true, true, this.searchHref, followLink('parentCommunity')); } this.searchListCollection$ = searchListService$.pipe( getFirstCompletedRemoteData(), diff --git a/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.spec.ts b/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.spec.ts index 1695d43f52..4a40f90f01 100644 --- a/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.spec.ts +++ b/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.spec.ts @@ -83,5 +83,19 @@ describe('AuthorizedCollectionSelectorComponent', () => { }); }); }); + + describe('when using searchHref', () => { + it('should call getAuthorizedCollection with "findAdminAuthorized" when overridden', (done) => { + component.searchHref = 'findAdminAuthorized'; + + component.search('', 1).subscribe(() => { + expect(collectionService.getAuthorizedCollection).toHaveBeenCalledWith( + '', jasmine.any(Object), true, false, 'findAdminAuthorized', jasmine.anything(), + ); + done(); + }); + }); + }); + }); }); diff --git a/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.ts b/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.ts index 7e8019a54b..29f6422952 100644 --- a/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.ts +++ b/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.ts @@ -58,6 +58,12 @@ export class AuthorizedCollectionSelectorComponent extends DSOSelectorComponent */ @Input() entityType: string; + /** + * Search endpoint to use for finding authorized collections. + * Defaults to 'findSubmitAuthorized', but can be overridden (e.g. to 'findAdminAuthorized') + */ + @Input() searchHref = 'findSubmitAuthorized'; + constructor( protected searchService: SearchService, protected collectionDataService: CollectionDataService, @@ -96,7 +102,7 @@ export class AuthorizedCollectionSelectorComponent extends DSOSelectorComponent findOptions); } else { searchListService$ = this.collectionDataService - .getAuthorizedCollection(query, findOptions, useCache, false, followLink('parentCommunity')); + .getAuthorizedCollection(query, findOptions, useCache, false, this.searchHref, followLink('parentCommunity')); } return searchListService$.pipe( getFirstCompletedRemoteData(), diff --git a/src/app/shared/dso-selector/dso-selector/authorized-community-selector/authorized-community-selector.component.spec.ts b/src/app/shared/dso-selector/dso-selector/authorized-community-selector/authorized-community-selector.component.spec.ts new file mode 100644 index 0000000000..d11291c756 --- /dev/null +++ b/src/app/shared/dso-selector/dso-selector/authorized-community-selector/authorized-community-selector.component.spec.ts @@ -0,0 +1,71 @@ +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { + ComponentFixture, + TestBed, + waitForAsync, +} from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CommunityDataService } from '../../../../core/data/community-data.service'; +import { Community } from '../../../../core/shared/community.model'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { SearchService } from '../../../../core/shared/search/search.service'; +import { ThemedLoadingComponent } from '../../../loading/themed-loading.component'; +import { NotificationsService } from '../../../notifications/notifications.service'; +import { ListableObjectComponentLoaderComponent } from '../../../object-collection/shared/listable-object/listable-object-component-loader.component'; +import { createSuccessfulRemoteDataObject$ } from '../../../remote-data.utils'; +import { createPaginatedList } from '../../../testing/utils.test'; +import { VarDirective } from '../../../utils/var.directive'; +import { AuthorizedCommunitySelectorComponent } from './authorized-community-selector.component'; + +describe('AuthorizedCommunitySelectorComponent', () => { + let component: AuthorizedCommunitySelectorComponent; + let fixture: ComponentFixture; + + let communityService; + let community; + + let notificationsService: NotificationsService; + + beforeEach(waitForAsync(() => { + community = Object.assign(new Community(), { + id: 'authorized-community', + }); + communityService = jasmine.createSpyObj('communityService', { + getAuthorizedCommunity: createSuccessfulRemoteDataObject$(createPaginatedList([community])), + }); + notificationsService = jasmine.createSpyObj('notificationsService', ['error']); + TestBed.configureTestingModule({ + imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), AuthorizedCommunitySelectorComponent, VarDirective], + providers: [ + { provide: SearchService, useValue: {} }, + { provide: CommunityDataService, useValue: communityService }, + { provide: NotificationsService, useValue: notificationsService }, + ], + schemas: [NO_ERRORS_SCHEMA], + }) + .overrideComponent(AuthorizedCommunitySelectorComponent, { + remove: { imports: [ListableObjectComponentLoaderComponent, ThemedLoadingComponent] }, + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AuthorizedCommunitySelectorComponent); + component = fixture.componentInstance; + component.types = [DSpaceObjectType.COMMUNITY]; + fixture.detectChanges(); + }); + + describe('search', () => { + it('should call getAuthorizedCommunity and return the authorized community in a SearchResult', (done) => { + component.search('', 1).subscribe((resultRD) => { + expect(communityService.getAuthorizedCommunity).toHaveBeenCalled(); + expect(resultRD.payload.page.length).toEqual(1); + expect(resultRD.payload.page[0].indexableObject).toEqual(community); + done(); + }); + }); + }); +}); diff --git a/src/app/shared/dso-selector/dso-selector/authorized-community-selector/authorized-community-selector.component.ts b/src/app/shared/dso-selector/dso-selector/authorized-community-selector/authorized-community-selector.component.ts new file mode 100644 index 0000000000..f5a6ed752e --- /dev/null +++ b/src/app/shared/dso-selector/dso-selector/authorized-community-selector/authorized-community-selector.component.ts @@ -0,0 +1,109 @@ +import { + AsyncPipe, + CommonModule, + NgClass, + NgIf, +} from '@angular/common'; +import { Component } from '@angular/core'; +import { + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { + TranslateModule, + TranslateService, +} from '@ngx-translate/core'; +import { InfiniteScrollModule } from 'ngx-infinite-scroll'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service'; +import { CommunityDataService } from '../../../../core/data/community-data.service'; +import { FindListOptions } from '../../../../core/data/find-list-options.model'; +import { + buildPaginatedList, + PaginatedList, +} from '../../../../core/data/paginated-list.model'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { Community } from '../../../../core/shared/community.model'; +import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; +import { getFirstCompletedRemoteData } from '../../../../core/shared/operators'; +import { SearchService } from '../../../../core/shared/search/search.service'; +import { hasValue } from '../../../empty.util'; +import { HoverClassDirective } from '../../../hover-class.directive'; +import { ThemedLoadingComponent } from '../../../loading/themed-loading.component'; +import { NotificationsService } from '../../../notifications/notifications.service'; +import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model'; +import { ListableObjectComponentLoaderComponent } from '../../../object-collection/shared/listable-object/listable-object-component-loader.component'; +import { SearchResult } from '../../../search/models/search-result.model'; +import { followLink } from '../../../utils/follow-link-config.model'; +import { DSOSelectorComponent } from '../dso-selector.component'; + +@Component({ + selector: 'ds-authorized-community-selector', + styleUrls: ['../dso-selector.component.scss'], + templateUrl: '../dso-selector.component.html', + standalone: true, + imports: [ + AsyncPipe, + CommonModule, + FormsModule, + HoverClassDirective, + InfiniteScrollModule, + ListableObjectComponentLoaderComponent, + NgClass, + NgIf, + ReactiveFormsModule, + ThemedLoadingComponent, + TranslateModule, + ], +}) +/** + * Component rendering a list of communities to select from + */ +export class AuthorizedCommunitySelectorComponent extends DSOSelectorComponent { + /** + * If present this value is used to filter community list by entity type + */ + + constructor( + protected searchService: SearchService, + protected communityDataService: CommunityDataService, + protected notifcationsService: NotificationsService, + protected translate: TranslateService, + protected dsoNameService: DSONameService, + ) { + super(searchService, notifcationsService, translate, dsoNameService); + } + + /** + * Get a query to send for retrieving the current DSO + */ + getCurrentDSOQuery(): string { + return this.currentDSOId; + } + + /** + * Perform a search for authorized communities with the current query and page + * @param query Query to search objects for + * @param page Page to retrieve + * @param useCache Whether or not to use the cache + */ + search(query: string, page: number, useCache: boolean = true): Observable>>> { + let searchListService$: Observable>> = null; + const findOptions: FindListOptions = { + currentPage: page, + elementsPerPage: this.defaultPagination.pageSize, + }; + + searchListService$ = this.communityDataService + .getAuthorizedCommunity(query, findOptions, useCache, false, followLink('parentCommunity')); + + return searchListService$.pipe( + getFirstCompletedRemoteData(), + map((rd) => Object.assign(new RemoteData(null, null, null, null), rd, { + payload: hasValue(rd.payload) ? buildPaginatedList(rd.payload.pageInfo, rd.payload.page.map((col) => Object.assign(new CommunitySearchResult(), { indexableObject: col }))) : null, + })), + ); + } +} diff --git a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.html new file mode 100644 index 0000000000..4f6cdee1e3 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.html @@ -0,0 +1,12 @@ +
+ + +
diff --git a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts index 7c6994f083..1077dfdfcb 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts @@ -18,7 +18,7 @@ import { Community } from '../../../../core/shared/community.model'; import { MetadataValue } from '../../../../core/shared/metadata.models'; import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils'; import { RouterStub } from '../../../testing/router.stub'; -import { DSOSelectorComponent } from '../../dso-selector/dso-selector.component'; +import { AuthorizedCommunitySelectorComponent } from '../../dso-selector/authorized-community-selector/authorized-community-selector.component'; import { CreateCollectionParentSelectorComponent } from './create-collection-parent-selector.component'; describe('CreateCollectionParentSelectorComponent', () => { @@ -64,7 +64,7 @@ describe('CreateCollectionParentSelectorComponent', () => { schemas: [NO_ERRORS_SCHEMA], }) .overrideComponent(CreateCollectionParentSelectorComponent, { - remove: { imports: [DSOSelectorComponent] }, + remove: { imports: [AuthorizedCommunitySelectorComponent] }, }) .compileComponents(); diff --git a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.ts index 05efb987a3..5159a408bd 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.ts @@ -22,7 +22,7 @@ import { } from '../../../../core/cache/models/sort-options.model'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; -import { DSOSelectorComponent } from '../../dso-selector/dso-selector.component'; +import { AuthorizedCommunitySelectorComponent } from '../../dso-selector/authorized-community-selector/authorized-community-selector.component'; import { DSOSelectorModalWrapperComponent, SelectorActionType, @@ -34,9 +34,9 @@ import { @Component({ selector: 'ds-base-create-collection-parent-selector', - templateUrl: '../dso-selector-modal-wrapper.component.html', + templateUrl: './create-collection-parent-selector.component.html', standalone: true, - imports: [NgIf, DSOSelectorComponent, TranslateModule], + imports: [NgIf, AuthorizedCommunitySelectorComponent, TranslateModule], }) export class CreateCollectionParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit { objectType = DSpaceObjectType.COLLECTION; diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.html index a8ec02239d..1c195e257c 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.html +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.html @@ -15,6 +15,8 @@ {{'dso-selector.create.community.sub-level' | translate}} - + diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts index 04922d4deb..b457419d91 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts @@ -21,7 +21,7 @@ import { Community } from '../../../../core/shared/community.model'; import { MetadataValue } from '../../../../core/shared/metadata.models'; import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils'; import { RouterStub } from '../../../testing/router.stub'; -import { DSOSelectorComponent } from '../../dso-selector/dso-selector.component'; +import { AuthorizedCommunitySelectorComponent } from '../../dso-selector/authorized-community-selector/authorized-community-selector.component'; import { CreateCommunityParentSelectorComponent } from './create-community-parent-selector.component'; describe('CreateCommunityParentSelectorComponent', () => { @@ -69,7 +69,7 @@ describe('CreateCommunityParentSelectorComponent', () => { schemas: [NO_ERRORS_SCHEMA], }) .overrideComponent(CreateCommunityParentSelectorComponent, { - remove: { imports: [DSOSelectorComponent] }, + remove: { imports: [AuthorizedCommunitySelectorComponent] }, }) .compileComponents(); diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts index 9d6ce3a692..0e950dc562 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts @@ -29,7 +29,7 @@ import { FeatureID } from '../../../../core/data/feature-authorization/feature-i import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; import { hasValue } from '../../../empty.util'; -import { DSOSelectorComponent } from '../../dso-selector/dso-selector.component'; +import { AuthorizedCommunitySelectorComponent } from '../../dso-selector/authorized-community-selector/authorized-community-selector.component'; import { DSOSelectorModalWrapperComponent, SelectorActionType, @@ -49,7 +49,7 @@ import { standalone: true, imports: [ AsyncPipe, - DSOSelectorComponent, + AuthorizedCommunitySelectorComponent, NgIf, TranslateModule, ], @@ -66,7 +66,6 @@ export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrap } ngOnInit() { - super.ngOnInit(); this.isAdmin$ = this.authorizationService.isAuthorized(FeatureID.AdministratorOf); } diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.html new file mode 100644 index 0000000000..92041b3970 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.html @@ -0,0 +1,13 @@ +
+ + +
diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts index 43b1288925..08280fb85c 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts @@ -18,7 +18,7 @@ import { Collection } from '../../../../core/shared/collection.model'; import { MetadataValue } from '../../../../core/shared/metadata.models'; import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils'; import { RouterStub } from '../../../testing/router.stub'; -import { DSOSelectorComponent } from '../../dso-selector/dso-selector.component'; +import { AuthorizedCollectionSelectorComponent } from '../../dso-selector/authorized-collection-selector/authorized-collection-selector.component'; import { EditCollectionSelectorComponent } from './edit-collection-selector.component'; describe('EditCollectionSelectorComponent', () => { @@ -64,7 +64,7 @@ describe('EditCollectionSelectorComponent', () => { }) .overrideComponent(EditCollectionSelectorComponent, { remove: { - imports: [DSOSelectorComponent], + imports: [AuthorizedCollectionSelectorComponent], }, }) .compileComponents(); diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.ts index 611a4f13de..3972a8053b 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.ts @@ -18,7 +18,7 @@ import { } from '../../../../core/cache/models/sort-options.model'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; -import { DSOSelectorComponent } from '../../dso-selector/dso-selector.component'; +import { AuthorizedCollectionSelectorComponent } from '../../dso-selector/authorized-collection-selector/authorized-collection-selector.component'; import { DSOSelectorModalWrapperComponent, SelectorActionType, @@ -31,9 +31,9 @@ import { @Component({ selector: 'ds-base-edit-collection-selector', - templateUrl: '../dso-selector-modal-wrapper.component.html', + templateUrl: './edit-collection-selector.component.html', standalone: true, - imports: [NgIf, DSOSelectorComponent, TranslateModule], + imports: [NgIf, AuthorizedCollectionSelectorComponent, TranslateModule], }) export class EditCollectionSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit { objectType = DSpaceObjectType.COLLECTION; diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.html new file mode 100644 index 0000000000..1f8e6ec79f --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.html @@ -0,0 +1,12 @@ +
+ + +
diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts index cd5c0d1831..750df1c268 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts @@ -18,7 +18,7 @@ import { Community } from '../../../../core/shared/community.model'; import { MetadataValue } from '../../../../core/shared/metadata.models'; import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils'; import { RouterStub } from '../../../testing/router.stub'; -import { DSOSelectorComponent } from '../../dso-selector/dso-selector.component'; +import { AuthorizedCommunitySelectorComponent } from '../../dso-selector/authorized-community-selector/authorized-community-selector.component'; import { EditCommunitySelectorComponent } from './edit-community-selector.component'; describe('EditCommunitySelectorComponent', () => { @@ -64,7 +64,7 @@ describe('EditCommunitySelectorComponent', () => { }) .overrideComponent(EditCommunitySelectorComponent, { remove: { - imports: [DSOSelectorComponent], + imports: [AuthorizedCommunitySelectorComponent], }, }) .compileComponents(); diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.ts index 3f7ede0de0..dda75a7d93 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.ts @@ -18,7 +18,7 @@ import { } from '../../../../core/cache/models/sort-options.model'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; -import { DSOSelectorComponent } from '../../dso-selector/dso-selector.component'; +import { AuthorizedCommunitySelectorComponent } from '../../dso-selector/authorized-community-selector/authorized-community-selector.component'; import { DSOSelectorModalWrapperComponent, SelectorActionType, @@ -31,9 +31,9 @@ import { @Component({ selector: 'ds-base-edit-community-selector', - templateUrl: '../dso-selector-modal-wrapper.component.html', + templateUrl: './edit-community-selector.component.html', standalone: true, - imports: [NgIf, DSOSelectorComponent, TranslateModule], + imports: [NgIf, AuthorizedCommunitySelectorComponent, TranslateModule], }) export class EditCommunitySelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit { diff --git a/src/themes/custom/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts b/src/themes/custom/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts index d1d2a4a1f0..182a0a17a2 100644 --- a/src/themes/custom/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts +++ b/src/themes/custom/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts @@ -4,8 +4,8 @@ import { } from '@angular/common'; import { Component } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; +import { AuthorizedCommunitySelectorComponent } from 'src/app/shared/dso-selector/dso-selector/authorized-community-selector/authorized-community-selector.component'; -import { DSOSelectorComponent } from '../../../../../../../app/shared/dso-selector/dso-selector/dso-selector.component'; import { CreateCommunityParentSelectorComponent as BaseComponent } from '../../../../../../../app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component'; @Component({ @@ -17,7 +17,7 @@ import { CreateCommunityParentSelectorComponent as BaseComponent } from '../../. standalone: true, imports: [ AsyncPipe, - DSOSelectorComponent, + AuthorizedCommunitySelectorComponent, NgIf, TranslateModule, ],