Skip to content

Commit 6349cd1

Browse files
Wout-atmirealexandrevryghem
authored andcommitted
Merge branch 'backport-themed-AuthorizedCollectionSelectorComponent-7.6' into w2p-130443_combined-themed-components
2 parents 25ff036 + 2a94205 commit 6349cd1

File tree

49 files changed

+275
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+275
-109
lines changed

src/app/browse-by/browse-by-geospatial-data/browse-by-geospatial-data.component.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { buildPaginatedList } from '../../core/data/paginated-list.model';
1414
import { PageInfo } from '../../core/shared/page-info.model';
1515
import { SearchService } from '../../core/shared/search/search.service';
1616
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
17+
import { ThemedDSOSelectorComponent } from '../../shared/dso-selector/dso-selector/themed-dso-selector.component';
1718
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
1819
import { FacetValue } from '../../shared/search/models/facet-value.model';
1920
import { FilterType } from '../../shared/search/models/filter-type.model';
@@ -91,6 +92,9 @@ describe('BrowseByGeospatialDataComponent', () => {
9192
],
9293
schemas: [NO_ERRORS_SCHEMA],
9394
})
95+
.overrideComponent(BrowseByGeospatialDataComponent, {
96+
remove: { imports: [ThemedDSOSelectorComponent] },
97+
})
9498
.compileComponents();
9599
}));
96100

src/app/core/data/collection-data.service.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,20 @@ export class CollectionDataService extends ComColDataService<Collection> {
125125
/**
126126
* Get all collections the user is authorized to submit to, by community
127127
*
128+
* TODO This method should be replaced with `getAuthorizedCollection` and the `options` parameter `scopeID` should be
129+
* supported instead in `BaseDataService#buildHrefFromFindOptions`
130+
*
128131
* @param communityId The community id
129132
* @param query limit the returned collection to those with metadata values matching the query terms.
130133
* @param options The [[FindListOptions]] object
131-
* @param reRequestOnStale Whether or not the request should automatically be re-
132-
* requested after the response becomes stale
133-
* @return Observable<RemoteData<PaginatedList<Collection>>>
134-
* collection list
134+
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's no valid-cached
135+
* version. Defaults to true
136+
* @param reRequestOnStale Whether or not the request should automatically be re-requested after the response become
137+
* s stale
138+
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically
139+
* resolved
135140
*/
136-
getAuthorizedCollectionByCommunity(communityId: string, query: string, options: FindListOptions = {}, reRequestOnStale = true): Observable<RemoteData<PaginatedList<Collection>>> {
141+
getAuthorizedCollectionByCommunity(communityId: string, query: string, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Collection>[]): Observable<RemoteData<PaginatedList<Collection>>> {
137142
const searchHref = 'findSubmitAuthorizedByCommunity';
138143
options = Object.assign({}, options, {
139144
searchParams: [
@@ -142,10 +147,11 @@ export class CollectionDataService extends ComColDataService<Collection> {
142147
],
143148
});
144149

145-
return this.searchBy(searchHref, options, reRequestOnStale).pipe(
150+
return this.searchBy(searchHref, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow).pipe(
146151
getAllCompletedRemoteData(),
147152
);
148153
}
154+
149155
/**
150156
* Get all collections the user is authorized to submit to, by community and has the metadata
151157
*

src/app/item-page/edit-item-page/item-move/item-move.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { RequestService } from '../../../core/data/request.service';
1919
import { Collection } from '../../../core/shared/collection.model';
2020
import { Item } from '../../../core/shared/item.model';
2121
import { SearchService } from '../../../core/shared/search/search.service';
22-
import { AuthorizedCollectionSelectorComponent } from '../../../shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component';
22+
import { ThemedAuthorizedCollectionSelectorComponent } from '../../../shared/dso-selector/dso-selector/authorized-collection-selector/themed-authorized-collection-selector.component';
2323
import { getMockRequestService } from '../../../shared/mocks/request.service.mock';
2424
import { NotificationsService } from '../../../shared/notifications/notifications.service';
2525
import {
@@ -114,7 +114,7 @@ describe('ItemMoveComponent', () => {
114114
})
115115
.overrideComponent(ItemMoveComponent, {
116116
remove: {
117-
imports: [AuthorizedCollectionSelectorComponent],
117+
imports: [ThemedAuthorizedCollectionSelectorComponent],
118118
},
119119
})
120120
.compileComponents();

src/app/item-page/edit-item-page/item-move/item-move.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
} from '../../../core/shared/operators';
3636
import { SearchService } from '../../../core/shared/search/search.service';
3737
import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive';
38-
import { AuthorizedCollectionSelectorComponent } from '../../../shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component';
38+
import { ThemedAuthorizedCollectionSelectorComponent } from '../../../shared/dso-selector/dso-selector/authorized-collection-selector/themed-authorized-collection-selector.component';
3939
import { NotificationsService } from '../../../shared/notifications/notifications.service';
4040
import { followLink } from '../../../shared/utils/follow-link-config.model';
4141
import {
@@ -52,7 +52,7 @@ import {
5252
FormsModule,
5353
RouterLink,
5454
AsyncPipe,
55-
AuthorizedCollectionSelectorComponent,
55+
ThemedAuthorizedCollectionSelectorComponent,
5656
BtnDisabledDirective,
5757
],
5858
standalone: true,

src/app/item-page/simple/related-entities/tabbed-related-entities-search/tabbed-related-entities-search.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { of as observableOf } from 'rxjs';
1616
import { Item } from '../../../../core/shared/item.model';
1717
import { RouterMock } from '../../../../shared/mocks/router.mock';
1818
import { VarDirective } from '../../../../shared/utils/var.directive';
19-
import { RelatedEntitiesSearchComponent } from '../related-entities-search/related-entities-search.component';
19+
import { ThemedRelatedEntitiesSearchComponent } from '../related-entities-search/themed-related-entities-search.component';
2020
import { TabbedRelatedEntitiesSearchComponent } from './tabbed-related-entities-search.component';
2121

2222
describe('TabbedRelatedEntitiesSearchComponent', () => {
@@ -53,7 +53,7 @@ describe('TabbedRelatedEntitiesSearchComponent', () => {
5353
.overrideComponent(TabbedRelatedEntitiesSearchComponent, {
5454
remove: {
5555
imports: [
56-
RelatedEntitiesSearchComponent,
56+
ThemedRelatedEntitiesSearchComponent,
5757
],
5858
},
5959
})

src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { followLink } from '../../../utils/follow-link-config.model';
4141
import { DSOSelectorComponent } from '../dso-selector.component';
4242

4343
@Component({
44-
selector: 'ds-authorized-collection-selector',
44+
selector: 'ds-base-authorized-collection-selector',
4545
styleUrls: ['../dso-selector.component.scss'],
4646
templateUrl: '../dso-selector.component.html',
4747
standalone: true,
@@ -59,11 +59,11 @@ export class AuthorizedCollectionSelectorComponent extends DSOSelectorComponent
5959
constructor(
6060
protected searchService: SearchService,
6161
protected collectionDataService: CollectionDataService,
62-
protected notifcationsService: NotificationsService,
62+
protected notificationService: NotificationsService,
6363
protected translate: TranslateService,
6464
protected dsoNameService: DSONameService,
6565
) {
66-
super(searchService, notifcationsService, translate, dsoNameService);
66+
super(searchService, notificationService, translate, dsoNameService);
6767
}
6868

6969
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import {
2+
Component,
3+
EventEmitter,
4+
Input,
5+
Output,
6+
} from '@angular/core';
7+
8+
import { SortOptions } from '../../../../core/cache/models/sort-options.model';
9+
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
10+
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
11+
import { ThemedComponent } from '../../../theme-support/themed.component';
12+
import { AuthorizedCollectionSelectorComponent } from './authorized-collection-selector.component';
13+
14+
/**
15+
* Themed wrapper for {@link AuthorizedCollectionSelectorComponent}
16+
*/
17+
@Component({
18+
selector: 'ds-authorized-collection-selector',
19+
templateUrl: '../../../theme-support/themed.component.html',
20+
standalone: true,
21+
imports: [AuthorizedCollectionSelectorComponent],
22+
})
23+
export class ThemedAuthorizedCollectionSelectorComponent extends ThemedComponent<AuthorizedCollectionSelectorComponent> {
24+
25+
@Input() currentDSOId: string;
26+
27+
@Input() types: DSpaceObjectType[];
28+
29+
@Input() sort: SortOptions;
30+
31+
@Input() entityType: string;
32+
33+
@Output() onSelect: EventEmitter<DSpaceObject> = new EventEmitter();
34+
35+
protected inAndOutputNames: (keyof AuthorizedCollectionSelectorComponent & keyof this)[] = [
36+
'currentDSOId',
37+
'types',
38+
'sort',
39+
'entityType',
40+
'onSelect',
41+
];
42+
43+
protected getComponentName(): string {
44+
return 'AuthorizedCollectionSelectorComponent';
45+
}
46+
47+
protected importThemedComponent(themeName: string): Promise<any> {
48+
return import(`../../../../../themes/${themeName}/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component`);
49+
}
50+
51+
protected importUnthemedComponent(): Promise<any> {
52+
return import('./authorized-collection-selector.component');
53+
}
54+
55+
}

src/app/shared/dso-selector/dso-selector/dso-selector.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import { PaginatedSearchOptions } from '../../search/models/paginated-search-opt
7373
import { SearchResult } from '../../search/models/search-result.model';
7474

7575
@Component({
76-
selector: 'ds-dso-selector',
76+
selector: 'ds-base-dso-selector',
7777
styleUrls: ['./dso-selector.component.scss'],
7878
templateUrl: './dso-selector.component.html',
7979
standalone: true,
@@ -183,7 +183,7 @@ export class DSOSelectorComponent implements OnInit, OnDestroy {
183183

184184
constructor(
185185
protected searchService: SearchService,
186-
protected notifcationsService: NotificationsService,
186+
protected notificationService: NotificationsService,
187187
protected translate: TranslateService,
188188
protected dsoNameService: DSONameService,
189189
) {
@@ -230,7 +230,7 @@ export class DSOSelectorComponent implements OnInit, OnDestroy {
230230
...rd.payload.page.filter((result) => isNotEmpty(query) || result.indexableObject.id !== this.currentDSOId),
231231
];
232232
} else if (rd.hasFailed) {
233-
this.notifcationsService.error(this.translate.instant('dso-selector.error.title', { type: this.typesString }), rd.errorMessage);
233+
this.notificationService.error(this.translate.instant('dso-selector.error.title', { type: this.typesString }), rd.errorMessage);
234234
}
235235
return rd;
236236
}),
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import {
2+
Component,
3+
EventEmitter,
4+
Input,
5+
Output,
6+
} from '@angular/core';
7+
8+
import { SortOptions } from '../../../core/cache/models/sort-options.model';
9+
import { Context } from '../../../core/shared/context.model';
10+
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
11+
import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
12+
import { ThemedComponent } from '../../theme-support/themed.component';
13+
import { DSOSelectorComponent } from './dso-selector.component';
14+
15+
/**
16+
* Themed wrapper for {@link DSOSelectorComponent}
17+
*/
18+
@Component({
19+
selector: 'ds-dso-selector',
20+
templateUrl: '../../theme-support/themed.component.html',
21+
imports: [DSOSelectorComponent],
22+
standalone: true,
23+
})
24+
export class ThemedDSOSelectorComponent extends ThemedComponent<DSOSelectorComponent> {
25+
26+
@Input() context: Context;
27+
28+
@Input() currentDSOId: string;
29+
30+
@Input() types: DSpaceObjectType[];
31+
32+
@Input() sort: SortOptions;
33+
34+
@Output() onSelect: EventEmitter<DSpaceObject> = new EventEmitter();
35+
36+
protected inAndOutputNames: (keyof DSOSelectorComponent & keyof this)[] = [
37+
'context',
38+
'currentDSOId',
39+
'types',
40+
'sort',
41+
'onSelect',
42+
];
43+
44+
protected getComponentName(): string {
45+
return 'DSOSelectorComponent';
46+
}
47+
48+
protected importThemedComponent(themeName: string): Promise<any> {
49+
return import(`../../../../themes/${themeName}/app/shared/dso-selector/dso-selector/dso-selector.component`);
50+
}
51+
52+
protected importUnthemedComponent(): Promise<any> {
53+
return import('./dso-selector.component');
54+
}
55+
56+
}

src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Community } from '../../../../core/shared/community.model';
1818
import { MetadataValue } from '../../../../core/shared/metadata.models';
1919
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
2020
import { RouterStub } from '../../../testing/router.stub';
21-
import { DSOSelectorComponent } from '../../dso-selector/dso-selector.component';
21+
import { ThemedDSOSelectorComponent } from '../../dso-selector/themed-dso-selector.component';
2222
import { CreateCollectionParentSelectorComponent } from './create-collection-parent-selector.component';
2323

2424
describe('CreateCollectionParentSelectorComponent', () => {
@@ -64,7 +64,7 @@ describe('CreateCollectionParentSelectorComponent', () => {
6464
schemas: [NO_ERRORS_SCHEMA],
6565
})
6666
.overrideComponent(CreateCollectionParentSelectorComponent, {
67-
remove: { imports: [DSOSelectorComponent] },
67+
remove: { imports: [ThemedDSOSelectorComponent] },
6868
})
6969
.compileComponents();
7070

0 commit comments

Comments
 (0)