diff --git a/src/app/+submit-page/submit-page-routing.module.ts b/src/app/+submit-page/submit-page-routing.module.ts index c583db2cb6..7a123bfc31 100644 --- a/src/app/+submit-page/submit-page-routing.module.ts +++ b/src/app/+submit-page/submit-page-routing.module.ts @@ -17,4 +17,7 @@ import { SubmissionSubmitComponent } from '../submission/submit/submission-submi ]) ] }) +/** + * This module defines the default component to load when navigating to the submit page path. + */ export class SubmitPageRoutingModule { } diff --git a/src/app/+submit-page/submit-page.module.ts b/src/app/+submit-page/submit-page.module.ts index 6c791d3d77..e43d9d36aa 100644 --- a/src/app/+submit-page/submit-page.module.ts +++ b/src/app/+submit-page/submit-page.module.ts @@ -12,6 +12,9 @@ import { SubmissionModule } from '../submission/submission.module'; SubmissionModule, ], }) +/** + * This module handles all modules that need to access the submit page. + */ export class SubmitPageModule { } diff --git a/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.ts b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.ts index 750f98435f..aa182eb291 100644 --- a/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.ts +++ b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.ts @@ -17,4 +17,7 @@ import { SubmissionEditComponent } from '../submission/edit/submission-edit.comp ]) ] }) +/** + * This module defines the default component to load when navigating to the workflowitems edit page path. + */ export class WorkflowitemsEditPageRoutingModule { } diff --git a/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.ts b/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.ts index 936816f2c3..fbb53d8dcc 100644 --- a/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.ts +++ b/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.ts @@ -13,6 +13,9 @@ import { SubmissionModule } from '../submission/submission.module'; ], declarations: [] }) +/** + * This module handles all modules that need to access the workflowitems edit page. + */ export class WorkflowitemsEditPageModule { } diff --git a/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.ts b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.ts index 07d59dfdd3..d10c53e138 100644 --- a/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.ts +++ b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.ts @@ -17,4 +17,7 @@ import { SubmissionEditComponent } from '../submission/edit/submission-edit.comp ]) ] }) +/** + * This module defines the default component to load when navigating to the workspaceitems edit page path + */ export class WorkspaceitemsEditPageRoutingModule { } diff --git a/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.ts b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.ts index 611304f651..65a40f3f7c 100644 --- a/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.ts +++ b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.ts @@ -13,6 +13,9 @@ import { SubmissionModule } from '../submission/submission.module'; ], declarations: [] }) +/** + * This module handles all modules that need to access the workspaceitems edit page. + */ export class WorkspaceitemsEditPageModule { } diff --git a/src/app/core/cache/models/normalized-license.model.ts b/src/app/core/cache/models/normalized-license.model.ts index 84f1671766..1457394c9d 100644 --- a/src/app/core/cache/models/normalized-license.model.ts +++ b/src/app/core/cache/models/normalized-license.model.ts @@ -3,12 +3,15 @@ import { mapsTo } from '../builders/build-decorators'; import { NormalizedDSpaceObject } from './normalized-dspace-object.model'; import { License } from '../../shared/license.model'; +/** + * Normalized model class for a Collection License + */ @mapsTo(License) @inheritSerialization(NormalizedDSpaceObject) export class NormalizedLicense extends NormalizedDSpaceObject { /** - * Is the license custom? + * A boolean representing if this License is custom or not */ @autoserialize custom: boolean; diff --git a/src/app/core/cache/models/normalized-object-factory.ts b/src/app/core/cache/models/normalized-object-factory.ts index af980c518d..2f54bd45bf 100644 --- a/src/app/core/cache/models/normalized-object-factory.ts +++ b/src/app/core/cache/models/normalized-object-factory.ts @@ -13,7 +13,6 @@ import { NormalizedEPerson } from '../../eperson/models/normalized-eperson.model import { NormalizedGroup } from '../../eperson/models/normalized-group.model'; import { NormalizedWorkflowItem } from '../../submission/models/normalized-workflowitem.model'; import { NormalizedBitstreamFormat } from './normalized-bitstream-format.model'; -import { SubmissionResourceType } from '../../submission/submission-resource-type'; import { SubmissionDefinitionsModel } from '../../config/models/config-submission-definitions.model'; import { SubmissionFormsModel } from '../../config/models/config-submission-forms.model'; import { SubmissionSectionModel } from '../../config/models/config-submission-section.model'; diff --git a/src/app/core/cache/models/search-param.model.ts b/src/app/core/cache/models/search-param.model.ts index 77d5cb744a..a33bbee5e6 100644 --- a/src/app/core/cache/models/search-param.model.ts +++ b/src/app/core/cache/models/search-param.model.ts @@ -1,4 +1,7 @@ +/** + * Class representing a query parameter (query?fieldName=fieldValue) used in FindAllOptions object + */ export class SearchParam { constructor(public fieldName: string, public fieldValue: any) { diff --git a/src/app/core/config/models/config-access-condition-option.model.ts b/src/app/core/config/models/config-access-condition-option.model.ts index 1f2e826af7..0c25d9aa0f 100644 --- a/src/app/core/config/models/config-access-condition-option.model.ts +++ b/src/app/core/config/models/config-access-condition-option.model.ts @@ -1,8 +1,35 @@ +/** + * Model class for an Access Condition + */ export class AccessConditionOption { + + /** + * The name for this Access Condition + */ name: string; + + /** + * The uuid of the Group this Access Condition applies to + */ groupUUID: string; + + /** + * A boolean representing if this Access Condition has a start date + */ hasStartDate: boolean; + + /** + * A boolean representing if this Access Condition has an end date + */ hasEndDate: boolean; + + /** + * Maximum value of the start date + */ maxStartDate: string; + + /** + * Maximum value of the end date + */ maxEndDate: string; } diff --git a/src/app/core/config/models/config-submission-uploads.model.ts b/src/app/core/config/models/config-submission-uploads.model.ts index 1b2bd9ea38..0e5b15d388 100644 --- a/src/app/core/config/models/config-submission-uploads.model.ts +++ b/src/app/core/config/models/config-submission-uploads.model.ts @@ -3,12 +3,21 @@ import { ConfigObject } from './config.model'; import { AccessConditionOption } from './config-access-condition-option.model'; import {SubmissionFormsModel} from './config-submission-forms.model'; +/** + * Normalized model class for the configuration describing the submission upload section + */ @inheritSerialization(ConfigObject) export class SubmissionUploadsModel extends ConfigObject { + /** + * A list of available bitstream access conditions + */ @autoserialize accessConditionOptions: AccessConditionOption[]; + /** + * An object representing the configuration describing the bistream metadata form + */ @autoserializeAs(SubmissionFormsModel) metadata: SubmissionFormsModel; diff --git a/src/app/core/config/submission-uploads-config.service.ts b/src/app/core/config/submission-uploads-config.service.ts index 88b9de9182..245e1fab68 100644 --- a/src/app/core/config/submission-uploads-config.service.ts +++ b/src/app/core/config/submission-uploads-config.service.ts @@ -4,6 +4,9 @@ import { ResponseCacheService } from '../cache/response-cache.service'; import { RequestService } from '../data/request.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; +/** + * Provides methods to retrieve, from REST server, bitstream access conditions configurations applicable during the submission process. + */ @Injectable() export class SubmissionUploadsConfigService extends ConfigService { protected linkPath = 'submissionuploads'; diff --git a/src/app/core/data/request.models.ts b/src/app/core/data/request.models.ts index cb2950d0ec..7a2ea014f4 100644 --- a/src/app/core/data/request.models.ts +++ b/src/app/core/data/request.models.ts @@ -232,6 +232,9 @@ export class IntegrationRequest extends GetRequest { } } +/** + * Class representing a submission HTTP GET request object + */ export class SubmissionRequest extends GetRequest { constructor(uuid: string, href: string) { super(uuid, href); @@ -242,6 +245,9 @@ export class SubmissionRequest extends GetRequest { } } +/** + * Class representing a submission HTTP DELETE request object + */ export class SubmissionDeleteRequest extends DeleteRequest { constructor(public uuid: string, public href: string) { @@ -253,6 +259,9 @@ export class SubmissionDeleteRequest extends DeleteRequest { } } +/** + * Class representing a submission HTTP PATCH request object + */ export class SubmissionPatchRequest extends PatchRequest { constructor(public uuid: string, public href: string, @@ -265,6 +274,9 @@ export class SubmissionPatchRequest extends PatchRequest { } } +/** + * Class representing a submission HTTP POST request object + */ export class SubmissionPostRequest extends PostRequest { constructor(public uuid: string, public href: string, @@ -278,6 +290,9 @@ export class SubmissionPostRequest extends PostRequest { } } +/** + * Class representing an eperson HTTP GET request object + */ export class EpersonRequest extends GetRequest { constructor(uuid: string, href: string) { super(uuid, href); diff --git a/src/app/core/eperson/eperson-response-parsing.service.ts b/src/app/core/eperson/eperson-response-parsing.service.ts index 53d148084d..4af9da71a7 100644 --- a/src/app/core/eperson/eperson-response-parsing.service.ts +++ b/src/app/core/eperson/eperson-response-parsing.service.ts @@ -13,6 +13,9 @@ import { NormalizedObject } from '../cache/models/normalized-object.model'; import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; import { ResourceType } from '../shared/resource-type'; +/** + * Provides method to parse response from eperson endpoint. + */ @Injectable() export class EpersonResponseParsingService extends BaseResponseParsingService implements ResponseParsingService { diff --git a/src/app/core/eperson/eperson.service.ts b/src/app/core/eperson/eperson.service.ts index 2ad0686a22..777dc397ae 100644 --- a/src/app/core/eperson/eperson.service.ts +++ b/src/app/core/eperson/eperson.service.ts @@ -6,6 +6,9 @@ import { HALEndpointService } from '../shared/hal-endpoint.service'; import { NormalizedObject } from '../cache/models/normalized-object.model'; import { DataService } from '../data/data.service'; +/** + * An abstract class that provides methods to make HTTP request to eperson endpoint. + */ export abstract class EpersonService extends DataService { protected request: EpersonRequest; protected abstract responseCache: ResponseCacheService; diff --git a/src/app/core/eperson/group-eperson.service.ts b/src/app/core/eperson/group-eperson.service.ts index a7f24c1ab8..f26ef7d8b7 100644 --- a/src/app/core/eperson/group-eperson.service.ts +++ b/src/app/core/eperson/group-eperson.service.ts @@ -18,6 +18,9 @@ import { SearchParam } from '../cache/models/search-param.model'; import { RemoteData } from '../data/remote-data'; import { PaginatedList } from '../data/paginated-list'; +/** + * Provides methods to retrieve eperson group resources. + */ @Injectable() export class GroupEpersonService extends EpersonService { protected linkPath = 'groups'; @@ -35,6 +38,14 @@ export class GroupEpersonService extends EpersonService super(); } + /** + * Check if the current user is member of to the indicated group + * + * @param groupName + * the group name + * @return boolean + * true if user is member of the indicated group, false otherwise + */ isMemberOf(groupName: string): Observable { const searchHref = 'isMemberOf'; const options = new FindAllOptions(); diff --git a/src/app/core/integration/models/authority.value.ts b/src/app/core/integration/models/authority.value.ts index 3b5ddd68ab..6e48983e6a 100644 --- a/src/app/core/integration/models/authority.value.ts +++ b/src/app/core/integration/models/authority.value.ts @@ -3,31 +3,69 @@ import { isNotEmpty } from '../../../shared/empty.util'; import { PLACEHOLDER_PARENT_METADATA } from '../../../shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; import { OtherInformation } from '../../../shared/form/builder/models/form-field-metadata-value.model'; +/** + * Class representing an authority object + */ export class AuthorityValue extends IntegrationModel { + /** + * The identifier of this authority + */ id: string; + /** + * The display value of this authority + */ display: string; + /** + * The value of this authority + */ value: string; + /** + * An object containing additional information related to this authority + */ otherInformation: OtherInformation; + /** + * The language code of this authority value + */ language: string; + /** + * This method checks if authority has an identifier value + * + * @return boolean + */ hasAuthority(): boolean { return isNotEmpty(this.id); } + /** + * This method checks if authority has a value + * + * @return boolean + */ hasValue(): boolean { return isNotEmpty(this.value); } + /** + * This method checks if authority has related information object + * + * @return boolean + */ hasOtherInformation(): boolean { return isNotEmpty(this.otherInformation); } - hasPlaceholder() { + /** + * This method checks if authority has a placeholder as value + * + * @return boolean + */ + hasPlaceholder(): boolean { return this.hasValue() && this.value === PLACEHOLDER_PARENT_METADATA; } } diff --git a/src/app/core/json-patch/builder/json-patch-operation-path-combiner.ts b/src/app/core/json-patch/builder/json-patch-operation-path-combiner.ts index 1650f57d63..0ee798fbfc 100644 --- a/src/app/core/json-patch/builder/json-patch-operation-path-combiner.ts +++ b/src/app/core/json-patch/builder/json-patch-operation-path-combiner.ts @@ -1,16 +1,19 @@ -/** - * Combines a variable number of strings representing parts - * of a relative REST URL in to a single, absolute REST URL - * - */ import { isNotUndefined } from '../../../shared/empty.util'; +/** + * Interface used to represent a JSON-PATCH path member + * in JsonPatchOperationsState + */ export interface JsonPatchOperationPathObject { rootElement: string; subRootElement: string; path: string; } +/** + * Combines a variable number of strings representing parts + * of a JSON-PATCH path + */ export class JsonPatchOperationPathCombiner { private _rootElement: string; private _subRootElement: string; @@ -28,6 +31,15 @@ export class JsonPatchOperationPathCombiner { return this._subRootElement; } + /** + * Combines the parts of this JsonPatchOperationPathCombiner in to a JSON-PATCH path member + * + * e.g. new JsonPatchOperationPathCombiner('sections', 'basic').getPath(['dc.title', '0']) + * returns: sections/basic/dc.title/0 + * + * @return {string} + * The combined path + */ public getPath(fragment?: string|string[]): JsonPatchOperationPathObject { if (isNotUndefined(fragment) && Array.isArray(fragment)) { fragment = fragment.join('/'); diff --git a/src/app/core/json-patch/builder/json-patch-operations-builder.ts b/src/app/core/json-patch/builder/json-patch-operations-builder.ts index 2cacc870cd..af2ea3496c 100644 --- a/src/app/core/json-patch/builder/json-patch-operations-builder.ts +++ b/src/app/core/json-patch/builder/json-patch-operations-builder.ts @@ -13,12 +13,27 @@ import { AuthorityValue } from '../../integration/models/authority.value'; import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model'; import { FormFieldLanguageValueObject } from '../../../shared/form/builder/models/form-field-language-value.model'; +/** + * Provides methods to dispatch JsonPatch Operations Actions + */ @Injectable() export class JsonPatchOperationsBuilder { constructor(private store: Store) { } + /** + * Dispatches a new NewPatchAddOperationAction + * + * @param path + * a JsonPatchOperationPathObject representing path + * @param value + * The value to update the referenced path + * @param first + * A boolean representing if the value to be added is the first of an array + * @param plain + * A boolean representing if the value to be added is a plain text value + */ add(path: JsonPatchOperationPathObject, value, first = false, plain = false) { this.store.dispatch( new NewPatchAddOperationAction( @@ -27,6 +42,16 @@ export class JsonPatchOperationsBuilder { path.path, this.prepareValue(value, plain, first))); } + /** + * Dispatches a new NewPatchReplaceOperationAction + * + * @param path + * a JsonPatchOperationPathObject representing path + * @param value + * the value to update the referenced path + * @param plain + * a boolean representing if the value to be added is a plain text value + */ replace(path: JsonPatchOperationPathObject, value, plain = false) { this.store.dispatch( new NewPatchReplaceOperationAction( @@ -36,6 +61,12 @@ export class JsonPatchOperationsBuilder { this.prepareValue(value, plain, false))); } + /** + * Dispatches a new NewPatchRemoveOperationAction + * + * @param path + * a JsonPatchOperationPathObject representing path + */ remove(path: JsonPatchOperationPathObject) { this.store.dispatch( new NewPatchRemoveOperationAction( @@ -57,8 +88,6 @@ export class JsonPatchOperationsBuilder { operationValue.push(this.prepareObjectValue(entry)); } else { operationValue.push(new FormFieldMetadataValueObject(entry)); - // operationValue.push({value: entry}); - // operationValue.push(entry); } }); } else if (typeof value === 'object') { @@ -83,7 +112,6 @@ export class JsonPatchOperationsBuilder { operationValue = new FormFieldMetadataValueObject(value.value, value.language); } else if (value.hasOwnProperty('value')) { operationValue = new FormFieldMetadataValueObject(value.value); - // operationValue = value; } else { Object.keys(value) .forEach((key) => { @@ -93,7 +121,6 @@ export class JsonPatchOperationsBuilder { operationValue[key] = value[key]; } }); - // operationValue = {value: value}; } return operationValue; } diff --git a/src/app/core/json-patch/json-patch-operations.effects.ts b/src/app/core/json-patch/json-patch-operations.effects.ts index d7f831f33c..3304db5b9e 100644 --- a/src/app/core/json-patch/json-patch-operations.effects.ts +++ b/src/app/core/json-patch/json-patch-operations.effects.ts @@ -8,9 +8,15 @@ import { JsonPatchOperationsActionTypes } from './json-patch-operations.actions'; +/** + * Provides effect methods for jsonPatch Operations actions + */ @Injectable() export class JsonPatchOperationsEffects { + /** + * Dispatches a FlushPatchOperationsAction for every dispatched CommitPatchOperationsAction + */ @Effect() commit$ = this.actions$.pipe( ofType(JsonPatchOperationsActionTypes.COMMIT_JSON_PATCH_OPERATIONS), map((action: CommitPatchOperationsAction) => { diff --git a/src/app/core/json-patch/json-patch-operations.reducer.ts b/src/app/core/json-patch/json-patch-operations.reducer.ts index 353a93c9b0..906d5e0331 100644 --- a/src/app/core/json-patch/json-patch-operations.reducer.ts +++ b/src/app/core/json-patch/json-patch-operations.reducer.ts @@ -15,15 +15,25 @@ import { } from './json-patch-operations.actions'; import { JsonPatchOperationModel, JsonPatchOperationType } from './json-patch.model'; +/** + * An interface to represent JSON-PATCH Operation objects to execute + */ export interface JsonPatchOperationObject { operation: JsonPatchOperationModel; timeAdded: number; } +/** + * An interface to represent the body containing a list of JsonPatchOperationObject + */ export interface JsonPatchOperationsEntry { body: JsonPatchOperationObject[]; } +/** + * Interface used to represent a JSON-PATCH path member + * in JsonPatchOperationsState + */ export interface JsonPatchOperationsResourceEntry { children: { [resourceId: string]: JsonPatchOperationsEntry }; transactionStartTime: number; @@ -42,6 +52,16 @@ export interface JsonPatchOperationsState { const initialState: JsonPatchOperationsState = Object.create(null); +/** + * The JSON-PATCH operations Reducer + * + * @param state + * the current state + * @param action + * the action to perform on the state + * @return JsonPatchOperationsState + * the new state + */ export function jsonPatchOperationsReducer(state = initialState, action: PatchOperationsActions): JsonPatchOperationsState { switch (action.type) { diff --git a/src/app/core/json-patch/json-patch-operations.service.ts b/src/app/core/json-patch/json-patch-operations.service.ts index bfd296b63e..a6b3ddc7e1 100644 --- a/src/app/core/json-patch/json-patch-operations.service.ts +++ b/src/app/core/json-patch/json-patch-operations.service.ts @@ -19,6 +19,9 @@ import { } from './json-patch-operations.actions'; import { JsonPatchOperationModel } from './json-patch.model'; +/** + * An abstract class that provides methods to make JSON Patch requests. + */ export abstract class JsonPatchOperationsService { protected abstract responseCache: ResponseCacheService; protected abstract requestService: RequestService; @@ -40,6 +43,18 @@ export abstract class JsonPatchOperationsService + * observable of response + */ protected submitJsonPatchOperations(hrefObs: Observable, resourceType: string, resourceId?: string): Observable { let startTransactionTime = null; const [patchRequest$, emptyRequest$] = partition((request: PatchRequestDefinition) => isNotEmpty(request.body))(hrefObs.pipe( @@ -101,6 +116,18 @@ export abstract class JsonPatchOperationsService + * instance of PatchRequestDefinition + */ protected getRequestInstance(uuid: string, href: string, body?: any): PatchRequestDefinition { return new this.patchRequestConstructor(uuid, href, body); } @@ -109,8 +136,20 @@ export abstract class JsonPatchOperationsService { - const href$ = this.halService.getEndpoint(linkName).pipe( + /** + * Make a new JSON Patch request with all operations related to the specified resource type + * + * @param linkPath + * The link path of the request + * @param scopeId + * The scope id + * @param resourceType + * The resource type value + * @return Observable + * observable of response + */ + public jsonPatchByResourceType(linkPath: string, scopeId: string, resourceType: string): Observable { + const href$ = this.halService.getEndpoint(linkPath).pipe( filter((href: string) => isNotEmpty(href)), distinctUntilChanged(), map((endpointURL: string) => this.getEndpointByIDHref(endpointURL, scopeId))); @@ -118,8 +157,22 @@ export abstract class JsonPatchOperationsService { - const hrefObs = this.halService.getEndpoint(linkName).pipe( + /** + * Make a new JSON Patch request with all operations related to the specified resource id + * + * @param linkPath + * The link path of the request + * @param scopeId + * The scope id + * @param resourceType + * The resource type value + * @param resourceId + * The resource id value + * @return Observable + * observable of response + */ + public jsonPatchByResourceID(linkPath: string, scopeId: string, resourceType: string, resourceId: string): Observable { + const hrefObs = this.halService.getEndpoint(linkPath).pipe( filter((href: string) => isNotEmpty(href)), distinctUntilChanged(), map((endpointURL: string) => this.getEndpointByIDHref(endpointURL, scopeId))); diff --git a/src/app/core/json-patch/json-patch.model.ts b/src/app/core/json-patch/json-patch.model.ts index c0553fde97..f855333fab 100644 --- a/src/app/core/json-patch/json-patch.model.ts +++ b/src/app/core/json-patch/json-patch.model.ts @@ -1,3 +1,6 @@ +/** + * Represents all JSON Patch operations type. + */ export enum JsonPatchOperationType { test = 'test', remove = 'remove', @@ -7,6 +10,9 @@ export enum JsonPatchOperationType { copy = 'copy', } +/** + * Represents a JSON Patch operations. + */ export class JsonPatchOperationModel { op: JsonPatchOperationType; path: string; diff --git a/src/app/core/json-patch/selectors.ts b/src/app/core/json-patch/selectors.ts index 547d4b82e8..a77afb7b7d 100644 --- a/src/app/core/json-patch/selectors.ts +++ b/src/app/core/json-patch/selectors.ts @@ -24,11 +24,29 @@ export function subStateSelector(parentSelector: Selector, subSt }); } +/** + * Return MemoizedSelector to select all jsonPatchOperations for a specified resource type, stored in the state + * + * @param resourceType + * the resource type + * @return MemoizedSelector + * MemoizedSelector + */ export function jsonPatchOperationsByResourceType(resourceType: string): MemoizedSelector { return keySelector(coreSelector,'json/patch', resourceType); } -export function jsonPatchOperationsByResourcId(resourceType: string, resourceId: string): MemoizedSelector { +/** + * Return MemoizedSelector to select all jsonPatchOperations for a specified resource id, stored in the state + * + * @param resourceType + * the resource type + * @param resourceId + * the resourceId type + * @return MemoizedSelector + * MemoizedSelector + */ +export function jsonPatchOperationsByResourceId(resourceType: string, resourceId: string): MemoizedSelector { const resourceTypeSelector = jsonPatchOperationsByResourceType(resourceType); return subStateSelector(resourceTypeSelector, resourceId); } diff --git a/src/app/core/shared/file.service.ts b/src/app/core/shared/file.service.ts index 75dbcefda8..6dfdb2b647 100644 --- a/src/app/core/shared/file.service.ts +++ b/src/app/core/shared/file.service.ts @@ -6,12 +6,21 @@ import { RestRequestMethod } from '../data/request.models'; import { saveAs } from 'file-saver'; import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.model'; +/** + * Provides utility methods to save files on the client-side. + */ @Injectable() export class FileService { constructor( private restService: DSpaceRESTv2Service ) { } + /** + * Makes a HTTP Get request to download a file + * + * @param url + * file url + */ downloadFile(url: string) { const headers = new HttpHeaders(); const options: HttpOptions = Object.create({headers, responseType: 'blob'}); @@ -24,12 +33,12 @@ export class FileService { /** * Derives file name from the http response * by looking inside content-disposition - * @param res http DSpaceRESTV2Response + * @param res + * http DSpaceRESTV2Response */ getFileNameFromResponseContentDisposition(res: DSpaceRESTV2Response) { const contentDisposition = res.headers.get('content-disposition') || ''; const matches = /filename="([^;]+)"/ig.exec(contentDisposition) || []; - const fileName = (matches[1] || 'untitled').trim().replace(/\.[^/.]+$/, ''); - return fileName; + return (matches[1] || 'untitled').trim().replace(/\.[^/.]+$/, ''); }; } diff --git a/src/app/core/shared/submit-data-response-definition.model.ts b/src/app/core/shared/submit-data-response-definition.model.ts index 72416253fb..beb2b320cf 100644 --- a/src/app/core/shared/submit-data-response-definition.model.ts +++ b/src/app/core/shared/submit-data-response-definition.model.ts @@ -1,5 +1,8 @@ import { ConfigObject } from '../config/models/config.model'; import { SubmissionObject } from '../submission/models/submission-object.model'; +/** + * Defines a type for submission request responses. + */ export type SubmitDataResponseDefinitionObject = Array; diff --git a/src/app/core/submission/submission-resource-type.ts b/src/app/core/submission/submission-resource-type.ts index 6c5dd11d77..8718fc55d3 100644 --- a/src/app/core/submission/submission-resource-type.ts +++ b/src/app/core/submission/submission-resource-type.ts @@ -1,7 +1,3 @@ -/** - * TODO replace with actual string enum after upgrade to TypeScript 2.4: - * https://github.com/Microsoft/TypeScript/pull/15486 - */ export enum SubmissionResourceType { Bundle = 'bundle', Bitstream = 'bitstream',