Skip to content

Commit da6a192

Browse files
[DURACOM-507] Port dynamic layout functionality and related components
1 parent 1363ec0 commit da6a192

305 files changed

Lines changed: 14456 additions & 153 deletions

File tree

Some content is hidden

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

src/app/app.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const initialState = {
6464
export function getMockLocaleService(): LocaleService {
6565
return jasmine.createSpyObj('LocaleService', {
6666
setCurrentLanguageCode: jasmine.createSpy('setCurrentLanguageCode'),
67+
getCurrentLanguageCode: jasmine.createSpy('getCurrentLanguageCode'),
6768
});
6869
}
6970

src/app/collection-page/collection-form/collection-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { RequestService } from '@dspace/core/data/request.service';
2020
import { NotificationsService } from '@dspace/core/notification-system/notifications.service';
2121
import { Collection } from '@dspace/core/shared/collection.model';
2222
import { ItemType } from '@dspace/core/shared/item-relationships/item-type.model';
23-
import { MetadataValue } from '@dspace/core/shared/metadata.models';
23+
import MetadataValue from '@dspace/core/shared/metadata.models';
2424
import { getFirstSucceededRemoteListPayload } from '@dspace/core/shared/operators';
2525
import {
2626
hasNoValue,

src/app/core/breadcrumbs/dso-name.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { MetadataValue } from '@dspace/core/shared/metadata.models';
2+
import MetadataValue from '@dspace/core/shared/metadata.models';
33
import {
44
hasValue,
55
isEmpty,

src/app/core/browse/search-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { DSpaceObject } from '../shared/dspace-object.model';
2525
import { FollowLinkConfig } from '../shared/follow-link-config.model';
2626
import { Item } from '../shared/item.model';
2727
import { ITEM } from '../shared/item.resource-type';
28-
import { MetadataValue } from '../shared/metadata.models';
28+
import MetadataValue from '../shared/metadata.models';
2929
import { Metadata } from '../shared/metadata.utils';
3030
import { getFirstCompletedRemoteData } from '../shared/operators';
3131
import { PaginatedSearchOptions } from '../shared/search/models/paginated-search-options.model';

src/app/core/browse/search.manager.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { FindListOptions } from '../data/find-list-options.model';
88
import { FollowLinkConfig } from '../shared/follow-link-config.model';
99
import { Item } from '../shared/item.model';
1010
import { ITEM } from '../shared/item.resource-type';
11-
import { MetadataValue } from '../shared/metadata.models';
11+
import MetadataValue from '../shared/metadata.models';
1212
import { AUTHORITY_REFERENCE } from '../shared/metadata.utils';
1313
import { createPaginatedList } from '../testing/utils.test';
1414
import {

src/app/core/cookies/browser-orejime.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ConfigurationDataService } from '../data/configuration-data.service';
1616
import { EPersonDataService } from '../eperson/eperson-data.service';
1717
import { EPerson } from '../eperson/models/eperson.model';
1818
import { ConfigurationProperty } from '../shared/configuration-property.model';
19-
import { MetadataValue } from '../shared/metadata.models';
19+
import MetadataValue from '../shared/metadata.models';
2020
import { getMockTranslateService } from '../testing/translate.service.mock';
2121
import {
2222
createFailedRemoteDataObject$,

src/app/core/data-services-map.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { GROUP } from './eperson/models/group.resource-type';
1616
import { WORKFLOWITEM } from './eperson/models/workflowitem.resource-type';
1717
import { WORKSPACEITEM } from './eperson/models/workspaceitem.resource-type';
1818
import { FEEDBACK } from './feedback/models/feedback.resource-type';
19+
import { SECTION } from './layout/models/section.resource-type';
20+
import { TAB } from './layout/models/tab.resource-type';
1921
import { METADATA_FIELD } from './metadata/metadata-field.resource-type';
2022
import { METADATA_SCHEMA } from './metadata/metadata-schema.resource-type';
2123
import { QUALITY_ASSURANCE_EVENT_OBJECT } from './notifications/qa/models/quality-assurance-event-object.resource-type';
@@ -142,4 +144,6 @@ export const LAZY_DATA_SERVICES: LazyDataServicesMap = new Map([
142144
[AUDIT.value, () => import('./data/audit-data.service').then(m => m.AuditDataService)],
143145
[EditItem.type.value, () => import('./submission/edititem-data.service').then(m => m.EditItemDataService)],
144146
[METADATA_SECURITY_TYPE.value, () => import('./submission/metadatasecurityconfig-data.service').then(m => m.MetadataSecurityConfigurationService)],
147+
[SECTION.value, () => import('./layout/section-data.service').then(m => m.SectionDataService)],
148+
[TAB.value, () => import('./layout/tab-data.service').then(m => m.TabDataService)],
145149
]);

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

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ import {
6565
} from './request.models';
6666
import { RequestService } from './request.service';
6767

68+
/**
69+
* Filter for metadata value to be used for rest API
70+
*/
71+
export interface MetadataFilter {
72+
metadataName: string;
73+
metadataValue: string;
74+
}
6875
/**
6976
* A service to retrieve {@link Bitstream}s from the REST API
7077
*/
@@ -379,4 +386,152 @@ export class BitstreamDataService extends IdentifiableDataService<Bitstream> imp
379386
return this.rdbService.buildFromRequestUUIDAndAwait(requestId, () => observableCombineLatest(bitstreams.map((bitstream: Bitstream) => this.invalidateByHref(bitstream._links.self.href))));
380387
}
381388

389+
/**
390+
* Returns an observable of {@link RemoteData} of a {@link Bitstream} that is not marked
391+
* hidden (that hasn't got the metadata `bitstream.hide` or its value is not true/yes).
392+
* resolve {@link HALLink}s of the object
393+
*
394+
* @param uuid The item UUID to retrieve bitstreams from
395+
* @param bundlename Bundle type of the bitstreams
396+
* @param metadataFilters Array of object we want to filter by
397+
* @param options The {@link FindListOptions} for the request
398+
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
399+
* no valid cached version. Defaults to true
400+
* @param reRequestOnStale Whether or not the request should automatically be re-
401+
* requested after the response becomes stale
402+
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
403+
* {@link HALLink}s should be automatically resolved
404+
*/
405+
findShowableBitstreamsByItem(
406+
uuid: string,
407+
bundlename: string,
408+
metadataFilters: MetadataFilter[],
409+
options: FindListOptions = {},
410+
useCachedVersionIfAvailable = true,
411+
reRequestOnStale = true,
412+
...linksToFollow: FollowLinkConfig<Bitstream>[]
413+
): Observable<RemoteData<PaginatedList<Bitstream>>> {
414+
const searchParams = [];
415+
searchParams.push(new RequestParam('uuid', uuid));
416+
searchParams.push(new RequestParam('name', bundlename));
417+
418+
metadataFilters.forEach((entry: MetadataFilter) => {
419+
searchParams.push(new RequestParam('filterMetadata', entry.metadataName));
420+
searchParams.push(new RequestParam('filterMetadataValue', entry.metadataValue));
421+
});
422+
423+
const hrefObs = this.getSearchByHref(
424+
'showableByItem',
425+
{ searchParams },
426+
...linksToFollow,
427+
);
428+
429+
return this.findListByHref(
430+
hrefObs,
431+
options,
432+
useCachedVersionIfAvailable,
433+
reRequestOnStale,
434+
...linksToFollow,
435+
);
436+
}
437+
438+
439+
/**
440+
* Returns an observable of {@link RemoteData} of a {@link Bitstream}, based on a handle and an
441+
* optional sequenceId or filename, with a list of {@link FollowLinkConfig}, to automatically
442+
* resolve {@link HALLink}s of the object
443+
*
444+
* @param uuid The item UUID to retrieve bitstreams from
445+
* @param bundlename Bundle type of the bitstreams
446+
* @param metadataFilters Array of object we want to filter by
447+
* @param options The {@link FindListOptions} for the request
448+
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
449+
* no valid cached version. Defaults to true
450+
* @param reRequestOnStale Whether or not the request should automatically be re-
451+
* requested after the response becomes stale
452+
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
453+
* {@link HALLink}s should be automatically resolved
454+
*/
455+
findByItem(
456+
uuid: string,
457+
bundlename: string,
458+
metadataFilters: MetadataFilter[],
459+
options: FindListOptions,
460+
useCachedVersionIfAvailable = true,
461+
reRequestOnStale = true,
462+
...linksToFollow: FollowLinkConfig<Bitstream>[]
463+
): Observable<RemoteData<PaginatedList<Bitstream>>> {
464+
const searchParams = [];
465+
searchParams.push(new RequestParam('uuid', uuid));
466+
searchParams.push(new RequestParam('name', bundlename));
467+
468+
metadataFilters.forEach((entry: MetadataFilter) => {
469+
searchParams.push(new RequestParam('filterMetadata', entry.metadataName));
470+
searchParams.push(new RequestParam('filterMetadataValue', entry.metadataValue));
471+
});
472+
473+
const hrefObs = this.getSearchByHref(
474+
'byItemId',
475+
{ searchParams },
476+
...linksToFollow,
477+
);
478+
479+
return this.findListByHref(
480+
hrefObs,
481+
options,
482+
useCachedVersionIfAvailable,
483+
reRequestOnStale,
484+
...linksToFollow,
485+
);
486+
}
487+
488+
/**
489+
* Returns an observable of {@link RemoteData} of a {@link Bitstream} that is not marked
490+
* hidden (that hasn't got the metadata `bitstream.hide` or its value is not true/yes).
491+
* resolve {@link HALLink}s of the object
492+
*
493+
* @param uuid The item UUID to retrieve bitstreams from
494+
* @param bundlename Bundle type of the bitstreams
495+
* @param metadataFilters Array of object we want to filter by
496+
* @param options The {@link FindListOptions} for the request
497+
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
498+
* no valid cached version. Defaults to true
499+
* @param reRequestOnStale Whether or not the request should automatically be re-
500+
* requested after the response becomes stale
501+
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
502+
* {@link HALLink}s should be automatically resolved
503+
*/
504+
showableByItem(
505+
uuid: string,
506+
bundlename: string,
507+
metadataFilters: MetadataFilter[],
508+
options: FindListOptions,
509+
useCachedVersionIfAvailable = true,
510+
reRequestOnStale = true,
511+
...linksToFollow: FollowLinkConfig<Bitstream>[]
512+
): Observable<RemoteData<PaginatedList<Bitstream>>> {
513+
const searchParams = [];
514+
searchParams.push(new RequestParam('uuid', uuid));
515+
searchParams.push(new RequestParam('name', bundlename));
516+
517+
metadataFilters.forEach((entry: MetadataFilter) => {
518+
searchParams.push(new RequestParam('filterMetadata', entry.metadataName));
519+
searchParams.push(new RequestParam('filterMetadataValue', entry.metadataValue));
520+
});
521+
522+
const hrefObs = this.getSearchByHref(
523+
'showableByItem',
524+
{ searchParams },
525+
...linksToFollow,
526+
);
527+
528+
return this.findListByHref(
529+
hrefObs,
530+
options,
531+
useCachedVersionIfAvailable,
532+
reRequestOnStale,
533+
...linksToFollow,
534+
);
535+
}
536+
382537
}

src/app/core/data/mydspace-response-parsing.service.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import { hasValue } from '@dspace/shared/utils/empty.util';
44
import { ParsedResponse } from '../cache/response.models';
55
import { DSpaceSerializer } from '../dspace-rest/dspace.serializer';
66
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
7-
import {
8-
MetadataMap,
9-
MetadataValue,
10-
} from '../shared/metadata.models';
7+
import MetadataValue, { MetadataMap } from '../shared/metadata.models';
118
import { SearchObjects } from '../shared/search/models/search-objects.model';
129
import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service';
1310
import { RestRequest } from './rest-request.model';

src/app/core/data/relationship-data.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { HALEndpointService } from '../shared/hal-endpoint.service';
1212
import { Item } from '../shared/item.model';
1313
import { Relationship } from '../shared/item-relationships/relationship.model';
1414
import { RelationshipType } from '../shared/item-relationships/relationship-type.model';
15-
import { MetadataValue } from '../shared/metadata.models';
15+
import MetadataValue from '../shared/metadata.models';
1616
import { MetadataRepresentationType } from '../shared/metadata-representation/metadata-representation.model';
1717
import { PageInfo } from '../shared/page-info.model';
1818
import { HALEndpointServiceStub } from '../testing/hal-endpoint-service.stub';

0 commit comments

Comments
 (0)