mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 04:53:06 +00:00
57557: Added JSDocs
This commit is contained in:
@@ -11,6 +11,10 @@ import { getRemoteDataPayload } from '../../../../core/shared/operators';
|
|||||||
import { hasValue } from '../../../../shared/empty.util';
|
import { hasValue } from '../../../../shared/empty.util';
|
||||||
import { ITEM } from '../../../../shared/entities/switcher/entity-type-switcher.component';
|
import { ITEM } from '../../../../shared/entities/switcher/entity-type-switcher.component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operator for comparing arrays using a mapping function
|
||||||
|
* @param mapFn Function for mapping the arrays
|
||||||
|
*/
|
||||||
const compareArraysUsing = <T>(mapFn: (t: T) => any) =>
|
const compareArraysUsing = <T>(mapFn: (t: T) => any) =>
|
||||||
(a: T[], b: T[]): boolean => {
|
(a: T[], b: T[]): boolean => {
|
||||||
if (!Array.isArray(a) || ! Array.isArray(b)) {
|
if (!Array.isArray(a) || ! Array.isArray(b)) {
|
||||||
@@ -25,6 +29,9 @@ const compareArraysUsing = <T>(mapFn: (t: T) => any) =>
|
|||||||
bIds.every((e) => aIds.includes(e));
|
bIds.every((e) => aIds.includes(e));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operator for comparing arrays using the object's ids
|
||||||
|
*/
|
||||||
const compareArraysUsingIds = <T extends { id: string }>() =>
|
const compareArraysUsingIds = <T extends { id: string }>() =>
|
||||||
compareArraysUsing((t: T) => hasValue(t) ? t.id : undefined);
|
compareArraysUsing((t: T) => hasValue(t) ? t.id : undefined);
|
||||||
|
|
||||||
|
@@ -18,12 +18,6 @@ import { SearchConfigurationService } from './search-service/search-configuratio
|
|||||||
import { getSucceededRemoteData } from '../core/shared/operators';
|
import { getSucceededRemoteData } from '../core/shared/operators';
|
||||||
import { RouteService } from '../shared/services/route.service';
|
import { RouteService } from '../shared/services/route.service';
|
||||||
|
|
||||||
/**
|
|
||||||
* This component renders a simple item page.
|
|
||||||
* The route parameter 'id' is used to request the item it represents.
|
|
||||||
* All fields of the item that should be displayed, are defined in its template.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-search-page',
|
selector: 'ds-search-page',
|
||||||
styleUrls: ['./search-page.component.scss'],
|
styleUrls: ['./search-page.component.scss'],
|
||||||
@@ -34,6 +28,7 @@ import { RouteService } from '../shared/services/route.service';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This component represents the whole search page
|
* This component represents the whole search page
|
||||||
|
* It renders search results depending on the current search options
|
||||||
*/
|
*/
|
||||||
export class SearchPageComponent implements OnInit {
|
export class SearchPageComponent implements OnInit {
|
||||||
|
|
||||||
|
@@ -9,11 +9,6 @@ import { SearchResult } from '../search-result.model';
|
|||||||
import { PaginatedList } from '../../core/data/paginated-list';
|
import { PaginatedList } from '../../core/data/paginated-list';
|
||||||
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
||||||
|
|
||||||
/**
|
|
||||||
* This component renders a simple item page.
|
|
||||||
* The route parameter 'id' is used to request the item it represents.
|
|
||||||
* All fields of the item that should be displayed, are defined in its template.
|
|
||||||
*/
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-search-results',
|
selector: 'ds-search-results',
|
||||||
templateUrl: './search-results.component.html',
|
templateUrl: './search-results.component.html',
|
||||||
|
@@ -5,16 +5,28 @@ import { mapsTo } from '../../builders/build-decorators';
|
|||||||
import { NormalizedObject } from '../normalized-object.model';
|
import { NormalizedObject } from '../normalized-object.model';
|
||||||
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalized model class for a DSpace EntityType
|
||||||
|
*/
|
||||||
@mapsTo(EntityType)
|
@mapsTo(EntityType)
|
||||||
@inheritSerialization(NormalizedObject)
|
@inheritSerialization(NormalizedObject)
|
||||||
export class NormalizedEntityType extends NormalizedObject {
|
export class NormalizedEntityType extends NormalizedObject {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The label that describes the ResourceType of the Entity
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
label: string;
|
label: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of this EntityType
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The universally unique identifier of this EntityType
|
||||||
|
*/
|
||||||
@autoserializeAs(new IDToUUIDSerializer(ResourceType.EntityType), 'id')
|
@autoserializeAs(new IDToUUIDSerializer(ResourceType.EntityType), 'id')
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
@@ -6,12 +6,22 @@ import { NormalizedDSpaceObject } from '../normalized-dspace-object.model';
|
|||||||
import { NormalizedObject } from '../normalized-object.model';
|
import { NormalizedObject } from '../normalized-object.model';
|
||||||
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalized model class for a DSpace RelationshipType
|
||||||
|
*/
|
||||||
@mapsTo(RelationshipType)
|
@mapsTo(RelationshipType)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
export class NormalizedRelationshipType extends NormalizedObject {
|
export class NormalizedRelationshipType extends NormalizedObject {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of this RelationshipType
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The label that describes the Relation to the left of this RelationshipType
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
leftLabel: string;
|
leftLabel: string;
|
||||||
|
|
||||||
@@ -21,6 +31,9 @@ export class NormalizedRelationshipType extends NormalizedObject {
|
|||||||
@autoserialize
|
@autoserialize
|
||||||
leftMinCardinality: number;
|
leftMinCardinality: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The label that describes the Relation to the right of this RelationshipType
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
rightLabel: string;
|
rightLabel: string;
|
||||||
|
|
||||||
@@ -30,14 +43,23 @@ export class NormalizedRelationshipType extends NormalizedObject {
|
|||||||
@autoserialize
|
@autoserialize
|
||||||
rightMinCardinality: number;
|
rightMinCardinality: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of Entity found to the left of this RelationshipType
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.EntityType, false)
|
@relationship(ResourceType.EntityType, false)
|
||||||
leftType: string;
|
leftType: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of Entity found to the right of this RelationshipType
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.EntityType, false)
|
@relationship(ResourceType.EntityType, false)
|
||||||
rightType: string;
|
rightType: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The universally unique identifier of this RelationshipType
|
||||||
|
*/
|
||||||
@autoserializeAs(new IDToUUIDSerializer(ResourceType.RelationshipType), 'id')
|
@autoserializeAs(new IDToUUIDSerializer(ResourceType.RelationshipType), 'id')
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
@@ -5,26 +5,44 @@ import { mapsTo, relationship } from '../../builders/build-decorators';
|
|||||||
import { NormalizedObject } from '../normalized-object.model';
|
import { NormalizedObject } from '../normalized-object.model';
|
||||||
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalized model class for a DSpace Relationship
|
||||||
|
*/
|
||||||
@mapsTo(Relationship)
|
@mapsTo(Relationship)
|
||||||
@inheritSerialization(NormalizedObject)
|
@inheritSerialization(NormalizedObject)
|
||||||
export class NormalizedRelationship extends NormalizedObject {
|
export class NormalizedRelationship extends NormalizedObject {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of this Relationship
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the Relationship to the left side of this Relationship
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
leftId: string;
|
leftId: string;
|
||||||
|
|
||||||
@autoserialize
|
@autoserialize
|
||||||
place: number;
|
place: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the Relationship to the right side of this Relationship
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
rightId: string;
|
rightId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of Relationship
|
||||||
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.RelationshipType, false)
|
@relationship(ResourceType.RelationshipType, false)
|
||||||
relationshipType: string;
|
relationshipType: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The universally unique identifier of this Relationship
|
||||||
|
*/
|
||||||
@autoserializeAs(new IDToUUIDSerializer(ResourceType.Relationship), 'id')
|
@autoserializeAs(new IDToUUIDSerializer(ResourceType.Relationship), 'id')
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,10 @@ import { ObjectCacheService } from '../cache/object-cache.service';
|
|||||||
import { GlobalConfig } from '../../../config/global-config.interface';
|
import { GlobalConfig } from '../../../config/global-config.interface';
|
||||||
import { GLOBAL_CONFIG } from '../../../config';
|
import { GLOBAL_CONFIG } from '../../../config';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A ResponseParsingService used to parse DSpaceRESTV2Response coming from the REST API to a discovery query (string)
|
||||||
|
* wrapped in a FilteredDiscoveryQueryResponse
|
||||||
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FilteredDiscoveryPageResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
|
export class FilteredDiscoveryPageResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
|
||||||
objectFactory = {};
|
objectFactory = {};
|
||||||
@@ -17,6 +21,13 @@ export class FilteredDiscoveryPageResponseParsingService extends BaseResponsePar
|
|||||||
protected objectCache: ObjectCacheService,
|
protected objectCache: ObjectCacheService,
|
||||||
) { super();
|
) { super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses data from the REST API to a discovery query wrapped in a FilteredDiscoveryQueryResponse
|
||||||
|
* @param {RestRequest} request
|
||||||
|
* @param {DSpaceRESTV2Response} data
|
||||||
|
* @returns {RestResponse}
|
||||||
|
*/
|
||||||
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
|
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
|
||||||
const query = data.payload['discovery-query'];
|
const query = data.payload['discovery-query'];
|
||||||
return new FilteredDiscoveryQueryResponse(query, data.statusCode);
|
return new FilteredDiscoveryQueryResponse(query, data.statusCode);
|
||||||
|
@@ -2,8 +2,23 @@ import { CacheableObject } from '../../cache/object-cache.reducer';
|
|||||||
import { ResourceType } from '../resource-type';
|
import { ResourceType } from '../resource-type';
|
||||||
|
|
||||||
export class EntityType implements CacheableObject {
|
export class EntityType implements CacheableObject {
|
||||||
|
/**
|
||||||
|
* The identifier of this EntityType
|
||||||
|
*/
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The link to the rest endpoint where this object can be found
|
||||||
|
*/
|
||||||
self: string;
|
self: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of Resource this is
|
||||||
|
*/
|
||||||
type: ResourceType;
|
type: ResourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The universally unique identifier of this EntityType
|
||||||
|
*/
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
@@ -5,29 +5,56 @@ import { ResourceType } from '../resource-type';
|
|||||||
import { EntityType } from './entity-type.model';
|
import { EntityType } from './entity-type.model';
|
||||||
|
|
||||||
export class RelationshipType implements CacheableObject {
|
export class RelationshipType implements CacheableObject {
|
||||||
|
/**
|
||||||
|
* The link to the rest endpoint where this object can be found
|
||||||
|
*/
|
||||||
self: string;
|
self: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of Resource this is
|
||||||
|
*/
|
||||||
type: ResourceType;
|
type: ResourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The label that describes this RelationshipType
|
||||||
|
*/
|
||||||
label: string;
|
label: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of this RelationshipType
|
||||||
|
*/
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The universally unique identifier of this RelationshipType
|
||||||
|
*/
|
||||||
uuid: string;
|
uuid: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The label that describes the Relation to the left of this RelationshipType
|
||||||
|
*/
|
||||||
leftLabel: string;
|
leftLabel: string;
|
||||||
|
|
||||||
leftMaxCardinality: number;
|
leftMaxCardinality: number;
|
||||||
|
|
||||||
leftMinCardinality: number;
|
leftMinCardinality: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The label that describes the Relation to the right of this RelationshipType
|
||||||
|
*/
|
||||||
rightLabel: string;
|
rightLabel: string;
|
||||||
|
|
||||||
rightMaxCardinality: number;
|
rightMaxCardinality: number;
|
||||||
|
|
||||||
rightMinCardinality: number;
|
rightMinCardinality: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of Entity found to the left of this RelationshipType
|
||||||
|
*/
|
||||||
leftType: Observable<RemoteData<EntityType>>;
|
leftType: Observable<RemoteData<EntityType>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of Entity found to the right of this RelationshipType
|
||||||
|
*/
|
||||||
rightType: Observable<RemoteData<EntityType>>;
|
rightType: Observable<RemoteData<EntityType>>;
|
||||||
}
|
}
|
||||||
|
@@ -5,19 +5,40 @@ import { ResourceType } from '../resource-type';
|
|||||||
import { RelationshipType } from './relationship-type.model';
|
import { RelationshipType } from './relationship-type.model';
|
||||||
|
|
||||||
export class Relationship implements CacheableObject {
|
export class Relationship implements CacheableObject {
|
||||||
|
/**
|
||||||
|
* The link to the rest endpoint where this object can be found
|
||||||
|
*/
|
||||||
self: string;
|
self: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of Resource this is
|
||||||
|
*/
|
||||||
type: ResourceType;
|
type: ResourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The universally unique identifier of this Relationship
|
||||||
|
*/
|
||||||
uuid: string;
|
uuid: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of this Relationship
|
||||||
|
*/
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the Relationship to the left side of this Relationship
|
||||||
|
*/
|
||||||
leftId: string;
|
leftId: string;
|
||||||
|
|
||||||
place: string;
|
place: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the Relationship to the right side of this Relationship
|
||||||
|
*/
|
||||||
rightId: string;
|
rightId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of Relationship
|
||||||
|
*/
|
||||||
relationshipType: Observable<RemoteData<RelationshipType>>;
|
relationshipType: Observable<RemoteData<RelationshipType>>;
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,12 @@ import { ElementViewMode } from '../view-mode';
|
|||||||
export const DEFAULT_ENTITY_TYPE = 'Default';
|
export const DEFAULT_ENTITY_TYPE = 'Default';
|
||||||
|
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decorator used for rendering simple item pages for an Entity by type and viewMode
|
||||||
|
* @param type
|
||||||
|
* @param viewMode
|
||||||
|
*/
|
||||||
export function rendersEntityType(type: string, viewMode: ElementViewMode) {
|
export function rendersEntityType(type: string, viewMode: ElementViewMode) {
|
||||||
return function decorator(component: any) {
|
return function decorator(component: any) {
|
||||||
if (hasNoValue(map.get(viewMode))) {
|
if (hasNoValue(map.get(viewMode))) {
|
||||||
@@ -16,6 +22,11 @@ export function rendersEntityType(type: string, viewMode: ElementViewMode) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the component used for rendering an entity by type and viewMode
|
||||||
|
* @param type
|
||||||
|
* @param viewMode
|
||||||
|
*/
|
||||||
export function getComponentByEntityType(type: string, viewMode: ElementViewMode) {
|
export function getComponentByEntityType(type: string, viewMode: ElementViewMode) {
|
||||||
let component = map.get(viewMode).get(type);
|
let component = map.get(viewMode).get(type);
|
||||||
if (hasNoValue(component)) {
|
if (hasNoValue(component)) {
|
||||||
|
@@ -1,11 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Enum used for defining the view-mode of a set of elements
|
||||||
|
* List Display the elements in a (vertical) list
|
||||||
|
* Grid Display the elements in a grid
|
||||||
|
*/
|
||||||
export enum SetViewMode {
|
export enum SetViewMode {
|
||||||
List = 'list',
|
List = 'list',
|
||||||
Grid = 'grid'
|
Grid = 'grid'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enum used for defining the view-mode of a single element
|
||||||
|
* Full Display the full element
|
||||||
|
* SetElement Display the element as part of a set
|
||||||
|
*/
|
||||||
export enum ElementViewMode {
|
export enum ElementViewMode {
|
||||||
Full,
|
Full,
|
||||||
SetElement
|
SetElement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ViewMode refers to either a SetViewMode or ElementViewMode
|
||||||
|
*/
|
||||||
export type ViewMode = SetViewMode | ElementViewMode;
|
export type ViewMode = SetViewMode | ElementViewMode;
|
||||||
|
Reference in New Issue
Block a user