mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Fixed errors after upgrade to angular 7
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
|
import { DynamicFormControlModel, DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
|
||||||
import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynamic-form-control.model';
|
|
||||||
import { Collection } from '../../core/shared/collection.model';
|
import { Collection } from '../../core/shared/collection.model';
|
||||||
import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component';
|
import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component';
|
||||||
import { NormalizedCollection } from '../../core/cache/models/normalized-collection.model';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form used for creating and editing collections
|
* Form used for creating and editing collections
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
|
import { DynamicFormControlModel, DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
|
||||||
import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynamic-form-control.model';
|
|
||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
import { ResourceType } from '../../core/shared/resource-type';
|
|
||||||
import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component';
|
import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -312,7 +312,7 @@ export class CommunityListService {
|
|||||||
|
|
||||||
hasColls$ = this.collectionDataService.findByParent(community.uuid, { elementsPerPage: 1 })
|
hasColls$ = this.collectionDataService.findByParent(community.uuid, { elementsPerPage: 1 })
|
||||||
.pipe(
|
.pipe(
|
||||||
filter((rd: RemoteData<PaginatedList<Community>>) => rd.hasSucceeded),
|
filter((rd: RemoteData<PaginatedList<Collection>>) => rd.hasSucceeded),
|
||||||
take(1),
|
take(1),
|
||||||
map((results) => results.payload.totalElements > 0),
|
map((results) => results.payload.totalElements > 0),
|
||||||
);
|
);
|
||||||
@@ -320,8 +320,8 @@ export class CommunityListService {
|
|||||||
let hasChildren$: Observable<boolean>;
|
let hasChildren$: Observable<boolean>;
|
||||||
hasChildren$ = observableCombineLatest(hasSubcoms$, hasColls$).pipe(
|
hasChildren$ = observableCombineLatest(hasSubcoms$, hasColls$).pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map((result: [boolean]) => {
|
map(([hasSubcoms, hasColls]: [boolean, boolean]) => {
|
||||||
if (result[0] || result[1]) {
|
if (hasSubcoms || hasColls) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -5,7 +5,6 @@ import { RequestService } from './request.service';
|
|||||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||||
import { createSelector, select, Store } from '@ngrx/store';
|
import { createSelector, select, Store } from '@ngrx/store';
|
||||||
import { CoreState } from '../core.reducers';
|
|
||||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
@@ -43,7 +42,7 @@ export class BitstreamFormatDataService extends DataService<BitstreamFormat> {
|
|||||||
protected requestService: RequestService,
|
protected requestService: RequestService,
|
||||||
protected rdbService: RemoteDataBuildService,
|
protected rdbService: RemoteDataBuildService,
|
||||||
protected dataBuildService: NormalizedObjectBuildService,
|
protected dataBuildService: NormalizedObjectBuildService,
|
||||||
protected store: Store<CoreState>,
|
protected store: Store<AppState>,
|
||||||
protected objectCache: ObjectCacheService,
|
protected objectCache: ObjectCacheService,
|
||||||
protected halService: HALEndpointService,
|
protected halService: HALEndpointService,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
@@ -55,6 +54,7 @@ export class BitstreamFormatDataService extends DataService<BitstreamFormat> {
|
|||||||
/**
|
/**
|
||||||
* Get the endpoint for browsing bitstream formats
|
* Get the endpoint for browsing bitstream formats
|
||||||
* @param {FindListOptions} options
|
* @param {FindListOptions} options
|
||||||
|
* @param {string} linkPath
|
||||||
* @returns {Observable<string>}
|
* @returns {Observable<string>}
|
||||||
*/
|
*/
|
||||||
getBrowseEndpoint(options: FindListOptions = {}, linkPath?: string): Observable<string> {
|
getBrowseEndpoint(options: FindListOptions = {}, linkPath?: string): Observable<string> {
|
||||||
@@ -99,7 +99,7 @@ export class BitstreamFormatDataService extends DataService<BitstreamFormat> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new BitstreamFormat
|
* Create a new BitstreamFormat
|
||||||
* @param BitstreamFormat
|
* @param {BitstreamFormat} bitstreamFormat
|
||||||
*/
|
*/
|
||||||
public createBitstreamFormat(bitstreamFormat: BitstreamFormat): Observable<RestResponse> {
|
public createBitstreamFormat(bitstreamFormat: BitstreamFormat): Observable<RestResponse> {
|
||||||
const requestId = this.requestService.generateRequestId();
|
const requestId = this.requestService.generateRequestId();
|
||||||
|
@@ -6,7 +6,6 @@ import { Store } from '@ngrx/store';
|
|||||||
|
|
||||||
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
||||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||||
import { CoreState } from '../core.reducers';
|
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||||
import { PaginatedList } from './paginated-list';
|
import { PaginatedList } from './paginated-list';
|
||||||
@@ -14,9 +13,9 @@ import { RemoteData } from './remote-data';
|
|||||||
import {
|
import {
|
||||||
CreateRequest,
|
CreateRequest,
|
||||||
DeleteByIDRequest,
|
DeleteByIDRequest,
|
||||||
|
FindByIDRequest,
|
||||||
FindListOptions,
|
FindListOptions,
|
||||||
FindListRequest,
|
FindListRequest,
|
||||||
FindByIDRequest,
|
|
||||||
GetRequest
|
GetRequest
|
||||||
} from './request.models';
|
} from './request.models';
|
||||||
import { RequestService } from './request.service';
|
import { RequestService } from './request.service';
|
||||||
@@ -42,7 +41,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
protected abstract requestService: RequestService;
|
protected abstract requestService: RequestService;
|
||||||
protected abstract rdbService: RemoteDataBuildService;
|
protected abstract rdbService: RemoteDataBuildService;
|
||||||
protected abstract dataBuildService: NormalizedObjectBuildService;
|
protected abstract dataBuildService: NormalizedObjectBuildService;
|
||||||
protected abstract store: Store<CoreState>;
|
protected abstract store: Store<any>;
|
||||||
protected abstract linkPath: string;
|
protected abstract linkPath: string;
|
||||||
protected abstract halService: HALEndpointService;
|
protected abstract halService: HALEndpointService;
|
||||||
protected abstract objectCache: ObjectCacheService;
|
protected abstract objectCache: ObjectCacheService;
|
||||||
@@ -231,7 +230,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
*/
|
*/
|
||||||
update(object: T): Observable<RemoteData<T>> {
|
update(object: T): Observable<RemoteData<T>> {
|
||||||
const oldVersion$ = this.objectCache.getObjectBySelfLink(object.self);
|
const oldVersion$ = this.objectCache.getObjectBySelfLink(object.self);
|
||||||
return oldVersion$.pipe(take(1), mergeMap((oldVersion: T) => {
|
return oldVersion$.pipe(take(1), mergeMap((oldVersion: NormalizedObject<T>) => {
|
||||||
const operations = this.comparator.diff(oldVersion, object);
|
const operations = this.comparator.diff(oldVersion, object);
|
||||||
if (isNotEmpty(operations)) {
|
if (isNotEmpty(operations)) {
|
||||||
this.objectCache.addPatch(object.self, operations);
|
this.objectCache.addPatch(object.self, operations);
|
||||||
|
@@ -5,8 +5,6 @@ import { createSelector, MemoizedSelector, select, Store } from '@ngrx/store';
|
|||||||
import { Observable, race as observableRace } from 'rxjs';
|
import { Observable, race as observableRace } from 'rxjs';
|
||||||
import { filter, map, mergeMap, take } from 'rxjs/operators';
|
import { filter, map, mergeMap, take } from 'rxjs/operators';
|
||||||
import { cloneDeep, remove } from 'lodash';
|
import { cloneDeep, remove } from 'lodash';
|
||||||
|
|
||||||
import { AppState } from '../../app.reducer';
|
|
||||||
import { hasValue, isEmpty, isNotEmpty } from '../../shared/empty.util';
|
import { hasValue, isEmpty, isNotEmpty } from '../../shared/empty.util';
|
||||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||||
@@ -19,7 +17,7 @@ import {
|
|||||||
} from '../index/index.selectors';
|
} from '../index/index.selectors';
|
||||||
import { UUIDService } from '../shared/uuid.service';
|
import { UUIDService } from '../shared/uuid.service';
|
||||||
import { RequestConfigureAction, RequestExecuteAction, RequestRemoveAction } from './request.actions';
|
import { RequestConfigureAction, RequestExecuteAction, RequestRemoveAction } from './request.actions';
|
||||||
import { GetRequest, RestRequest, SubmissionRequest } from './request.models';
|
import { GetRequest, RestRequest } from './request.models';
|
||||||
import { RequestEntry, RequestState } from './request.reducer';
|
import { RequestEntry, RequestState } from './request.reducer';
|
||||||
import { CommitSSBAction } from '../cache/server-sync-buffer.actions';
|
import { CommitSSBAction } from '../cache/server-sync-buffer.actions';
|
||||||
import { RestRequestMethod } from './rest-request-method';
|
import { RestRequestMethod } from './rest-request-method';
|
||||||
@@ -52,7 +50,7 @@ const entryFromUUIDSelector = (uuid: string): MemoizedSelector<CoreState, Reques
|
|||||||
* @param href Substring that the request's href should contain
|
* @param href Substring that the request's href should contain
|
||||||
*/
|
*/
|
||||||
const uuidsFromHrefSubstringSelector =
|
const uuidsFromHrefSubstringSelector =
|
||||||
(selector: MemoizedSelector<AppState, IndexState>, href: string): MemoizedSelector<AppState, string[]> => createSelector(
|
(selector: MemoizedSelector<CoreState, IndexState>, href: string): MemoizedSelector<CoreState, string[]> => createSelector(
|
||||||
selector,
|
selector,
|
||||||
(state: IndexState) => getUuidsFromHrefSubstring(state, href)
|
(state: IndexState) => getUuidsFromHrefSubstring(state, href)
|
||||||
);
|
);
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import { createSelector, MemoizedSelector } from '@ngrx/store';
|
import { createSelector, MemoizedSelector } from '@ngrx/store';
|
||||||
import { AppState } from '../../app.reducer';
|
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import { CoreState } from '../core.reducers';
|
import { CoreState } from '../core.reducers';
|
||||||
import { coreSelector } from '../core.selectors';
|
import { coreSelector } from '../core.selectors';
|
||||||
@@ -11,7 +10,7 @@ import { IndexName, IndexState, MetaIndexState } from './index.reducer';
|
|||||||
* @returns
|
* @returns
|
||||||
* a MemoizedSelector to select the MetaIndexState
|
* a MemoizedSelector to select the MetaIndexState
|
||||||
*/
|
*/
|
||||||
export const metaIndexSelector: MemoizedSelector<AppState, MetaIndexState> = createSelector(
|
export const metaIndexSelector: MemoizedSelector<CoreState, MetaIndexState> = createSelector(
|
||||||
coreSelector,
|
coreSelector,
|
||||||
(state: CoreState) => state.index
|
(state: CoreState) => state.index
|
||||||
);
|
);
|
||||||
@@ -23,7 +22,7 @@ export const metaIndexSelector: MemoizedSelector<AppState, MetaIndexState> = cre
|
|||||||
* @returns
|
* @returns
|
||||||
* a MemoizedSelector to select the object index
|
* a MemoizedSelector to select the object index
|
||||||
*/
|
*/
|
||||||
export const objectIndexSelector: MemoizedSelector<AppState, IndexState> = createSelector(
|
export const objectIndexSelector: MemoizedSelector<CoreState, IndexState> = createSelector(
|
||||||
metaIndexSelector,
|
metaIndexSelector,
|
||||||
(state: MetaIndexState) => state[IndexName.OBJECT]
|
(state: MetaIndexState) => state[IndexName.OBJECT]
|
||||||
);
|
);
|
||||||
@@ -34,7 +33,7 @@ export const objectIndexSelector: MemoizedSelector<AppState, IndexState> = creat
|
|||||||
* @returns
|
* @returns
|
||||||
* a MemoizedSelector to select the request index
|
* a MemoizedSelector to select the request index
|
||||||
*/
|
*/
|
||||||
export const requestIndexSelector: MemoizedSelector<AppState, IndexState> = createSelector(
|
export const requestIndexSelector: MemoizedSelector<CoreState, IndexState> = createSelector(
|
||||||
metaIndexSelector,
|
metaIndexSelector,
|
||||||
(state: MetaIndexState) => state[IndexName.REQUEST]
|
(state: MetaIndexState) => state[IndexName.REQUEST]
|
||||||
);
|
);
|
||||||
@@ -45,7 +44,7 @@ export const requestIndexSelector: MemoizedSelector<AppState, IndexState> = crea
|
|||||||
* @returns
|
* @returns
|
||||||
* a MemoizedSelector to select the request UUID mapping
|
* a MemoizedSelector to select the request UUID mapping
|
||||||
*/
|
*/
|
||||||
export const requestUUIDIndexSelector: MemoizedSelector<AppState, IndexState> = createSelector(
|
export const requestUUIDIndexSelector: MemoizedSelector<CoreState, IndexState> = createSelector(
|
||||||
metaIndexSelector,
|
metaIndexSelector,
|
||||||
(state: MetaIndexState) => state[IndexName.UUID_MAPPING]
|
(state: MetaIndexState) => state[IndexName.UUID_MAPPING]
|
||||||
);
|
);
|
||||||
@@ -53,14 +52,13 @@ export const requestUUIDIndexSelector: MemoizedSelector<AppState, IndexState> =
|
|||||||
/**
|
/**
|
||||||
* Return the self link of an object in the object-cache based on its UUID
|
* Return the self link of an object in the object-cache based on its UUID
|
||||||
*
|
*
|
||||||
* @param id
|
* @param uuid
|
||||||
* the UUID for which you want to find the matching self link
|
* the UUID for which you want to find the matching self link
|
||||||
* @param identifierType the type of index, used to select index from state
|
|
||||||
* @returns
|
* @returns
|
||||||
* a MemoizedSelector to select the self link
|
* a MemoizedSelector to select the self link
|
||||||
*/
|
*/
|
||||||
export const selfLinkFromUuidSelector =
|
export const selfLinkFromUuidSelector =
|
||||||
(uuid: string): MemoizedSelector<AppState, string> => createSelector(
|
(uuid: string): MemoizedSelector<CoreState, string> => createSelector(
|
||||||
objectIndexSelector,
|
objectIndexSelector,
|
||||||
(state: IndexState) => hasValue(state) ? state[uuid] : undefined
|
(state: IndexState) => hasValue(state) ? state[uuid] : undefined
|
||||||
);
|
);
|
||||||
@@ -74,7 +72,7 @@ export const selfLinkFromUuidSelector =
|
|||||||
* a MemoizedSelector to select the UUID
|
* a MemoizedSelector to select the UUID
|
||||||
*/
|
*/
|
||||||
export const uuidFromHrefSelector =
|
export const uuidFromHrefSelector =
|
||||||
(href: string): MemoizedSelector<AppState, string> => createSelector(
|
(href: string): MemoizedSelector<CoreState, string> => createSelector(
|
||||||
requestIndexSelector,
|
requestIndexSelector,
|
||||||
(state: IndexState) => hasValue(state) ? state[href] : undefined
|
(state: IndexState) => hasValue(state) ? state[href] : undefined
|
||||||
);
|
);
|
||||||
@@ -89,7 +87,7 @@ export const uuidFromHrefSelector =
|
|||||||
* a MemoizedSelector to select the UUID of the cached request
|
* a MemoizedSelector to select the UUID of the cached request
|
||||||
*/
|
*/
|
||||||
export const originalRequestUUIDFromRequestUUIDSelector =
|
export const originalRequestUUIDFromRequestUUIDSelector =
|
||||||
(uuid: string): MemoizedSelector<AppState, string> => createSelector(
|
(uuid: string): MemoizedSelector<CoreState, string> => createSelector(
|
||||||
requestUUIDIndexSelector,
|
requestUUIDIndexSelector,
|
||||||
(state: IndexState) => hasValue(state) ? state[uuid] : undefined
|
(state: IndexState) => hasValue(state) ? state[uuid] : undefined
|
||||||
);
|
);
|
||||||
|
@@ -17,7 +17,6 @@ import {
|
|||||||
} from './json-patch-operations.actions';
|
} from './json-patch-operations.actions';
|
||||||
import { JsonPatchOperationModel } from './json-patch.model';
|
import { JsonPatchOperationModel } from './json-patch.model';
|
||||||
import { getResponseFromEntry } from '../shared/operators';
|
import { getResponseFromEntry } from '../shared/operators';
|
||||||
import { ObjectCacheEntry } from '../cache/object-cache.reducer';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract class that provides methods to make JSON Patch requests.
|
* An abstract class that provides methods to make JSON Patch requests.
|
||||||
@@ -88,8 +87,8 @@ export abstract class JsonPatchOperationsService<ResponseDefinitionDomain, Patch
|
|||||||
flatMap(() => {
|
flatMap(() => {
|
||||||
const [successResponse$, errorResponse$] = partition((response: RestResponse) => response.isSuccessful)(this.requestService.getByUUID(requestId).pipe(
|
const [successResponse$, errorResponse$] = partition((response: RestResponse) => response.isSuccessful)(this.requestService.getByUUID(requestId).pipe(
|
||||||
getResponseFromEntry(),
|
getResponseFromEntry(),
|
||||||
find((entry: ObjectCacheEntry) => startTransactionTime < entry.timeAdded),
|
find((entry: RestResponse) => startTransactionTime < entry.timeAdded),
|
||||||
map((entry: ObjectCacheEntry) => entry),
|
map((entry: RestResponse) => entry),
|
||||||
));
|
));
|
||||||
return observableMerge(
|
return observableMerge(
|
||||||
errorResponse$.pipe(
|
errorResponse$.pipe(
|
||||||
|
@@ -1,12 +1,6 @@
|
|||||||
import { distinctUntilChanged, filter, map, tap } from 'rxjs/operators';
|
import { distinctUntilChanged, filter, map } from 'rxjs/operators';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {
|
import { ActivatedRoute, NavigationEnd, Params, Router, RouterStateSnapshot, } from '@angular/router';
|
||||||
ActivatedRoute,
|
|
||||||
NavigationEnd,
|
|
||||||
Params,
|
|
||||||
Router,
|
|
||||||
RouterStateSnapshot,
|
|
||||||
} from '@angular/router';
|
|
||||||
|
|
||||||
import { combineLatest, Observable } from 'rxjs';
|
import { combineLatest, Observable } from 'rxjs';
|
||||||
import { createSelector, MemoizedSelector, select, Store } from '@ngrx/store';
|
import { createSelector, MemoizedSelector, select, Store } from '@ngrx/store';
|
||||||
@@ -18,6 +12,7 @@ import { SetParametersAction, SetQueryParametersAction } from './route.actions';
|
|||||||
import { CoreState } from '../core.reducers';
|
import { CoreState } from '../core.reducers';
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import { coreSelector } from '../core.selectors';
|
import { coreSelector } from '../core.selectors';
|
||||||
|
import { AppState } from '../../app.reducer';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selector to select all route parameters from the store
|
* Selector to select all route parameters from the store
|
||||||
@@ -67,7 +62,7 @@ export function parameterSelector(key: string, paramsSelector: (state: CoreState
|
|||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RouteService {
|
export class RouteService {
|
||||||
constructor(private route: ActivatedRoute, private router: Router, private store: Store<CoreState>) {
|
constructor(private route: ActivatedRoute, private router: Router, private store: Store<AppState|CoreState>) {
|
||||||
this.saveRouting();
|
this.saveRouting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import {
|
import {
|
||||||
|
DynamicFormControlModel,
|
||||||
DynamicFormService,
|
DynamicFormService,
|
||||||
DynamicInputModel
|
DynamicInputModel
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynamic-form-control.model';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
import { MetadataMap, MetadataValue } from '../../../core/shared/metadata.models';
|
import { MetadataMap, MetadataValue } from '../../../core/shared/metadata.models';
|
||||||
import { ResourceType } from '../../../core/shared/resource-type';
|
import { ResourceType } from '../../../core/shared/resource-type';
|
||||||
@@ -82,7 +83,7 @@ export class ComColFormComponent<T extends DSpaceObject> implements OnInit {
|
|||||||
* Checks which new fields were added and sends the updated version of the DSO to the parent component
|
* Checks which new fields were added and sends the updated version of the DSO to the parent component
|
||||||
*/
|
*/
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
const formMetadata = new Object() as MetadataMap;
|
const formMetadata = {} as MetadataMap;
|
||||||
this.formModel.forEach((fieldModel: DynamicInputModel) => {
|
this.formModel.forEach((fieldModel: DynamicInputModel) => {
|
||||||
const value: MetadataValue = {
|
const value: MetadataValue = {
|
||||||
value: fieldModel.value as string,
|
value: fieldModel.value as string,
|
||||||
|
@@ -30,7 +30,7 @@ import {
|
|||||||
DynamicFormControl,
|
DynamicFormControl,
|
||||||
DynamicFormControlContainerComponent,
|
DynamicFormControlContainerComponent,
|
||||||
DynamicFormControlEvent,
|
DynamicFormControlEvent,
|
||||||
DynamicFormControlModel,
|
DynamicFormControlModel, DynamicFormInstancesService,
|
||||||
DynamicFormLayout,
|
DynamicFormLayout,
|
||||||
DynamicFormLayoutService,
|
DynamicFormLayoutService,
|
||||||
DynamicFormValidationService,
|
DynamicFormValidationService,
|
||||||
@@ -168,12 +168,13 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
protected test: boolean;
|
protected test: boolean;
|
||||||
constructor(
|
constructor(
|
||||||
protected componentFactoryResolver: ComponentFactoryResolver,
|
protected componentFactoryResolver: ComponentFactoryResolver,
|
||||||
|
protected dynamicFormInstanceService: DynamicFormInstancesService,
|
||||||
protected layoutService: DynamicFormLayoutService,
|
protected layoutService: DynamicFormLayoutService,
|
||||||
protected validationService: DynamicFormValidationService,
|
protected validationService: DynamicFormValidationService,
|
||||||
protected translateService: TranslateService
|
protected translateService: TranslateService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
super(componentFactoryResolver, layoutService, validationService);
|
super(componentFactoryResolver, layoutService, validationService, dynamicFormInstanceService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
import { DynamicDateControlModel, DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core';
|
import {
|
||||||
import { DynamicDateControlModelConfig } from '@ng-dynamic-forms/core/src/model/dynamic-date-control.model';
|
DynamicDateControlModel,
|
||||||
|
DynamicDateControlModelConfig,
|
||||||
|
DynamicFormControlLayout,
|
||||||
|
serializable
|
||||||
|
} from '@ng-dynamic-forms/core';
|
||||||
|
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
export const DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER = 'DATE';
|
export const DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER = 'DATE';
|
||||||
|
@@ -1,7 +1,12 @@
|
|||||||
import { DynamicFormControlLayout, DynamicFormGroupModel, serializable } from '@ng-dynamic-forms/core';
|
import {
|
||||||
|
DynamicFormControlLayout,
|
||||||
|
DynamicFormGroupModel,
|
||||||
|
DynamicFormGroupModelConfig,
|
||||||
|
serializable
|
||||||
|
} from '@ng-dynamic-forms/core';
|
||||||
import { DsDynamicInputModel } from './ds-dynamic-input.model';
|
import { DsDynamicInputModel } from './ds-dynamic-input.model';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { DynamicFormGroupModelConfig } from '@ng-dynamic-forms/core/src/model/form-group/dynamic-form-group.model';
|
|
||||||
import { LanguageCode } from '../../models/form-field-language-value.model';
|
import { LanguageCode } from '../../models/form-field-language-value.model';
|
||||||
|
|
||||||
export const QUALDROP_GROUP_SUFFIX = '_QUALDROP_GROUP';
|
export const QUALDROP_GROUP_SUFFIX = '_QUALDROP_GROUP';
|
||||||
|
@@ -11,8 +11,7 @@ import {
|
|||||||
DynamicFormControlModel,
|
DynamicFormControlModel,
|
||||||
DynamicFormGroupModel,
|
DynamicFormGroupModel,
|
||||||
DynamicFormService, DynamicFormValidationService,
|
DynamicFormService, DynamicFormValidationService,
|
||||||
DynamicPathable,
|
DynamicPathable, parseReviver,
|
||||||
JSONUtils,
|
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { isObject, isString, mergeWith } from 'lodash';
|
import { isObject, isString, mergeWith } from 'lodash';
|
||||||
|
|
||||||
@@ -207,7 +206,7 @@ export class FormBuilderService extends DynamicFormService {
|
|||||||
|
|
||||||
modelFromConfiguration(submissionId: string, json: string | SubmissionFormsModel, scopeUUID: string, sectionData: any = {}, submissionScope?: string, readOnly = false): DynamicFormControlModel[] | never {
|
modelFromConfiguration(submissionId: string, json: string | SubmissionFormsModel, scopeUUID: string, sectionData: any = {}, submissionScope?: string, readOnly = false): DynamicFormControlModel[] | never {
|
||||||
let rows: DynamicFormControlModel[] = [];
|
let rows: DynamicFormControlModel[] = [];
|
||||||
const rawData = typeof json === 'string' ? JSON.parse(json, JSONUtils.parseReviver) : json;
|
const rawData = typeof json === 'string' ? JSON.parse(json, parseReviver) : json;
|
||||||
|
|
||||||
if (rawData.rows && !isEmpty(rawData.rows)) {
|
if (rawData.rows && !isEmpty(rawData.rows)) {
|
||||||
rawData.rows.forEach((currentRow) => {
|
rawData.rows.forEach((currentRow) => {
|
||||||
|
@@ -1,24 +1,35 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MemoizedSelector, select, Store } from '@ngrx/store';
|
import { createSelector, MemoizedSelector, select, Store } from '@ngrx/store';
|
||||||
import { MenuSection, MenuSectionIndex, MenuSections, MenusState, MenuState } from './menu.reducer';
|
import { MenuSection, MenuSections, MenuState } from './menu.reducer';
|
||||||
import { AppState, keySelector } from '../../app.reducer';
|
import { AppState, keySelector } from '../../app.reducer';
|
||||||
import { MenuID } from './initial-menus-state';
|
import { MenuID } from './initial-menus-state';
|
||||||
import { Observable } from 'rxjs';
|
import { combineLatest as observableCombineLatest, Observable } from 'rxjs';
|
||||||
import { map, switchMap } from 'rxjs/operators';
|
import { map, switchMap } from 'rxjs/operators';
|
||||||
import {
|
import {
|
||||||
ActivateMenuSectionAction,
|
ActivateMenuSectionAction,
|
||||||
AddMenuSectionAction,
|
AddMenuSectionAction,
|
||||||
CollapseMenuAction, CollapseMenuPreviewAction,
|
CollapseMenuAction,
|
||||||
|
CollapseMenuPreviewAction,
|
||||||
DeactivateMenuSectionAction,
|
DeactivateMenuSectionAction,
|
||||||
ExpandMenuAction, ExpandMenuPreviewAction,
|
ExpandMenuAction,
|
||||||
|
ExpandMenuPreviewAction,
|
||||||
HideMenuAction,
|
HideMenuAction,
|
||||||
RemoveMenuSectionAction,
|
RemoveMenuSectionAction,
|
||||||
ShowMenuAction,
|
ShowMenuAction,
|
||||||
ToggleActiveMenuSectionAction,
|
ToggleActiveMenuSectionAction,
|
||||||
ToggleMenuAction,
|
ToggleMenuAction,
|
||||||
} from './menu.actions';
|
} from './menu.actions';
|
||||||
import { hasNoValue, isNotEmpty } from '../empty.util';
|
import { hasNoValue, hasValue, isNotEmpty } from '../empty.util';
|
||||||
import { combineLatest as observableCombineLatest } from 'rxjs';
|
|
||||||
|
export function menuKeySelector<T>(key: string, selector): MemoizedSelector<MenuState, T> {
|
||||||
|
return createSelector(selector, (state) => {
|
||||||
|
if (hasValue(state)) {
|
||||||
|
return state[key];
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const menusStateSelector = (state) => state.menus;
|
const menusStateSelector = (state) => state.menus;
|
||||||
|
|
||||||
@@ -28,20 +39,20 @@ const menuByIDSelector = (menuID: MenuID): MemoizedSelector<AppState, MenuState>
|
|||||||
|
|
||||||
const menuSectionStateSelector = (state: MenuState) => state.sections;
|
const menuSectionStateSelector = (state: MenuState) => state.sections;
|
||||||
|
|
||||||
const menuSectionByIDSelector = (id: string): MemoizedSelector<AppState, MenuSection> => {
|
const menuSectionByIDSelector = (id: string): MemoizedSelector<MenuState, MenuSection> => {
|
||||||
return keySelector<MenuSection>(id, menuSectionStateSelector);
|
return menuKeySelector<MenuSection>(id, menuSectionStateSelector);
|
||||||
};
|
};
|
||||||
|
|
||||||
const menuSectionIndexStateSelector = (state: MenuState) => state.sectionToSubsectionIndex;
|
const menuSectionIndexStateSelector = (state: MenuState) => state.sectionToSubsectionIndex;
|
||||||
|
|
||||||
const getSubSectionsFromSectionSelector = (id: string): MemoizedSelector<AppState, MenuSectionIndex> => {
|
const getSubSectionsFromSectionSelector = (id: string): MemoizedSelector<MenuState, string[]> => {
|
||||||
return keySelector<MenuSectionIndex>(id, menuSectionIndexStateSelector);
|
return menuKeySelector<string[]>(id, menuSectionIndexStateSelector);
|
||||||
};
|
};
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MenuService {
|
export class MenuService {
|
||||||
|
|
||||||
constructor(private store: Store<MenusState>) {
|
constructor(private store: Store<any>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -16,7 +16,7 @@ import { hasValue } from '../../empty.util';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class SidebarFilterService {
|
export class SidebarFilterService {
|
||||||
|
|
||||||
constructor(private store:Store<SidebarFilterState>) {
|
constructor(private store:Store<SidebarFiltersState>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,14 +3,7 @@ import { HttpHeaders } from '@angular/common/http';
|
|||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { Observable, of as observableOf, Subscription, timer as observableTimer } from 'rxjs';
|
import { Observable, of as observableOf, Subscription, timer as observableTimer } from 'rxjs';
|
||||||
import {
|
import { catchError, concatMap, distinctUntilChanged, filter, find, map, startWith, take, tap } from 'rxjs/operators';
|
||||||
catchError, concatMap,
|
|
||||||
distinctUntilChanged,
|
|
||||||
filter,
|
|
||||||
find,
|
|
||||||
map,
|
|
||||||
startWith, take, tap
|
|
||||||
} from 'rxjs/operators';
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
@@ -50,11 +43,7 @@ import { WorkspaceitemSectionsObject } from '../core/submission/models/workspace
|
|||||||
import { RemoteData } from '../core/data/remote-data';
|
import { RemoteData } from '../core/data/remote-data';
|
||||||
import { ErrorResponse } from '../core/cache/response.models';
|
import { ErrorResponse } from '../core/cache/response.models';
|
||||||
import { RemoteDataError } from '../core/data/remote-data-error';
|
import { RemoteDataError } from '../core/data/remote-data-error';
|
||||||
import {
|
import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject } from '../shared/testing/utils';
|
||||||
createFailedRemoteDataObject$,
|
|
||||||
createSuccessfulRemoteDataObject,
|
|
||||||
createSuccessfulRemoteDataObject$
|
|
||||||
} from '../shared/testing/utils';
|
|
||||||
import { SearchService } from '../+search-page/search-service/search.service';
|
import { SearchService } from '../+search-page/search-service/search.service';
|
||||||
import { RequestService } from '../core/data/request.service';
|
import { RequestService } from '../core/data/request.service';
|
||||||
|
|
||||||
@@ -117,8 +106,8 @@ export class SubmissionService {
|
|||||||
*/
|
*/
|
||||||
createSubmission(): Observable<SubmissionObject> {
|
createSubmission(): Observable<SubmissionObject> {
|
||||||
return this.restService.postToEndpoint('workspaceitems', {}).pipe(
|
return this.restService.postToEndpoint('workspaceitems', {}).pipe(
|
||||||
map((workspaceitem: SubmissionObject) => workspaceitem[0]),
|
map((workspaceitem: SubmissionObject[]) => workspaceitem[0] as SubmissionObject),
|
||||||
catchError(() => observableOf({})))
|
catchError(() => observableOf({} as SubmissionObject)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user