mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Merge pull request #597 from 4Science/#592-miscellaneous-fixes
fix Submission cannot be completed #592
This commit is contained in:
@@ -230,10 +230,10 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
comp.deleteFormats();
|
comp.deleteFormats();
|
||||||
|
|
||||||
expect(bitstreamFormatService.clearBitStreamFormatRequests).toHaveBeenCalled();
|
expect(bitstreamFormatService.clearBitStreamFormatRequests).toHaveBeenCalled();
|
||||||
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat1);
|
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat1.id);
|
||||||
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat2);
|
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat2.id);
|
||||||
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat3);
|
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat3.id);
|
||||||
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat4);
|
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat4.id);
|
||||||
|
|
||||||
expect(notificationsServiceStub.success).toHaveBeenCalledWith('admin.registries.bitstream-formats.delete.success.head',
|
expect(notificationsServiceStub.success).toHaveBeenCalledWith('admin.registries.bitstream-formats.delete.success.head',
|
||||||
'admin.registries.bitstream-formats.delete.success.amount');
|
'admin.registries.bitstream-formats.delete.success.amount');
|
||||||
@@ -276,10 +276,10 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
comp.deleteFormats();
|
comp.deleteFormats();
|
||||||
|
|
||||||
expect(bitstreamFormatService.clearBitStreamFormatRequests).toHaveBeenCalled();
|
expect(bitstreamFormatService.clearBitStreamFormatRequests).toHaveBeenCalled();
|
||||||
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat1);
|
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat1.id);
|
||||||
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat2);
|
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat2.id);
|
||||||
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat3);
|
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat3.id);
|
||||||
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat4);
|
expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat4.id);
|
||||||
|
|
||||||
expect(notificationsServiceStub.error).toHaveBeenCalledWith('admin.registries.bitstream-formats.delete.failure.head',
|
expect(notificationsServiceStub.error).toHaveBeenCalledWith('admin.registries.bitstream-formats.delete.failure.head',
|
||||||
'admin.registries.bitstream-formats.delete.failure.amount');
|
'admin.registries.bitstream-formats.delete.failure.amount');
|
||||||
|
@@ -64,7 +64,7 @@ export class BitstreamFormatsComponent implements OnInit {
|
|||||||
const tasks$ = [];
|
const tasks$ = [];
|
||||||
for (const format of formats) {
|
for (const format of formats) {
|
||||||
if (hasValue(format.id)) {
|
if (hasValue(format.id)) {
|
||||||
tasks$.push(this.bitstreamFormatService.delete(format));
|
tasks$.push(this.bitstreamFormatService.delete(format.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zip(...tasks$).subscribe((results: boolean[]) => {
|
zip(...tasks$).subscribe((results: boolean[]) => {
|
||||||
|
@@ -220,7 +220,7 @@ describe('ItemDeleteComponent', () => {
|
|||||||
spyOn(comp, 'notify');
|
spyOn(comp, 'notify');
|
||||||
comp.performAction();
|
comp.performAction();
|
||||||
expect(mockItemDataService.delete)
|
expect(mockItemDataService.delete)
|
||||||
.toHaveBeenCalledWith(mockItem, types.filter((type) => typesSelection[type]).map((type) => type.id));
|
.toHaveBeenCalledWith(mockItem.id, types.filter((type) => typesSelection[type]).map((type) => type.id));
|
||||||
expect(comp.notify).toHaveBeenCalled();
|
expect(comp.notify).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -312,7 +312,7 @@ export class ItemDeleteComponent
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
).subscribe((types) => {
|
).subscribe((types) => {
|
||||||
this.itemDataService.delete(this.item, types).pipe(first()).subscribe(
|
this.itemDataService.delete(this.item.id, types).pipe(first()).subscribe(
|
||||||
(succeeded: boolean) => {
|
(succeeded: boolean) => {
|
||||||
this.notify(succeeded);
|
this.notify(succeeded);
|
||||||
}
|
}
|
||||||
@@ -322,7 +322,7 @@ export class ItemDeleteComponent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* When the item is successfully delete, navigate to the homepage, otherwise navigate back to the item edit page
|
* When the item is successfully delete, navigate to the homepage, otherwise navigate back to the item edit page
|
||||||
* @param response
|
* @param succeeded
|
||||||
*/
|
*/
|
||||||
notify(succeeded: boolean) {
|
notify(succeeded: boolean) {
|
||||||
if (succeeded) {
|
if (succeeded) {
|
||||||
|
@@ -3,12 +3,11 @@ import { HttpClientModule } from '@angular/common/http';
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
import { RouterStateSerializer, StoreRouterConnectingModule } from '@ngrx/router-store';
|
import { RouterStateSerializer, StoreRouterConnectingModule } from '@ngrx/router-store';
|
||||||
import { META_REDUCERS, MetaReducer, StoreModule, USER_PROVIDED_META_REDUCERS } from '@ngrx/store';
|
import { MetaReducer, StoreModule, USER_PROVIDED_META_REDUCERS } from '@ngrx/store';
|
||||||
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
||||||
|
import { DYNAMIC_MATCHER_PROVIDERS } from '@ng-dynamic-forms/core';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to';
|
import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to';
|
||||||
|
|
||||||
@@ -21,7 +20,7 @@ import { AppRoutingModule } from './app-routing.module';
|
|||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
import { appEffects } from './app.effects';
|
import { appEffects } from './app.effects';
|
||||||
import { appMetaReducers, debugMetaReducers, universalMetaReducer } from './app.metareducers';
|
import { appMetaReducers, debugMetaReducers } from './app.metareducers';
|
||||||
import { appReducers, AppState } from './app.reducer';
|
import { appReducers, AppState } from './app.reducer';
|
||||||
|
|
||||||
import { CoreModule } from './core/core.module';
|
import { CoreModule } from './core/core.module';
|
||||||
@@ -97,7 +96,8 @@ const PROVIDERS = [
|
|||||||
provide: RouterStateSerializer,
|
provide: RouterStateSerializer,
|
||||||
useClass: DSpaceRouterStateSerializer
|
useClass: DSpaceRouterStateSerializer
|
||||||
},
|
},
|
||||||
ClientCookieService
|
ClientCookieService,
|
||||||
|
...DYNAMIC_MATCHER_PROVIDERS,
|
||||||
];
|
];
|
||||||
|
|
||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
|
@@ -282,7 +282,7 @@ describe('BitstreamFormatDataService', () => {
|
|||||||
format.id = 'format-id';
|
format.id = 'format-id';
|
||||||
|
|
||||||
const expected = cold('(b|)', {b: true});
|
const expected = cold('(b|)', {b: true});
|
||||||
const result = service.delete(format);
|
const result = service.delete(format.id);
|
||||||
|
|
||||||
expect(result).toBeObservable(expected);
|
expect(result).toBeObservable(expected);
|
||||||
});
|
});
|
||||||
|
@@ -154,19 +154,19 @@ export class BitstreamFormatDataService extends DataService<BitstreamFormat> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an existing DSpace Object on the server
|
* Delete an existing DSpace Object on the server
|
||||||
* @param format The DSpace Object to be removed
|
* @param formatID The DSpace Object'id to be removed
|
||||||
* Return an observable that emits true when the deletion was successful, false when it failed
|
* Return an observable that emits true when the deletion was successful, false when it failed
|
||||||
*/
|
*/
|
||||||
delete(format: BitstreamFormat): Observable<boolean> {
|
delete(formatID: string): Observable<boolean> {
|
||||||
const requestId = this.requestService.generateRequestId();
|
const requestId = this.requestService.generateRequestId();
|
||||||
|
|
||||||
const hrefObs = this.halService.getEndpoint(this.linkPath).pipe(
|
const hrefObs = this.halService.getEndpoint(this.linkPath).pipe(
|
||||||
map((endpoint: string) => this.getIDHref(endpoint, format.id)));
|
map((endpoint: string) => this.getIDHref(endpoint, formatID)));
|
||||||
|
|
||||||
hrefObs.pipe(
|
hrefObs.pipe(
|
||||||
find((href: string) => hasValue(href)),
|
find((href: string) => hasValue(href)),
|
||||||
map((href: string) => {
|
map((href: string) => {
|
||||||
const request = new DeleteByIDRequest(requestId, href, format.id);
|
const request = new DeleteByIDRequest(requestId, href, formatID);
|
||||||
this.requestService.configure(request);
|
this.requestService.configure(request);
|
||||||
})
|
})
|
||||||
).subscribe();
|
).subscribe();
|
||||||
|
@@ -152,7 +152,11 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
/**
|
/**
|
||||||
* Returns {@link RemoteData} of all object with a list of {@link FollowLinkConfig}, to indicate which embedded
|
* Returns {@link RemoteData} of all object with a list of {@link FollowLinkConfig}, to indicate which embedded
|
||||||
* info should be added to the objects
|
* info should be added to the objects
|
||||||
|
*
|
||||||
|
* @param options Find list options object
|
||||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
||||||
|
* @return {Observable<RemoteData<PaginatedList<T>>>}
|
||||||
|
* Return an observable that emits object list
|
||||||
*/
|
*/
|
||||||
findAll(options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
|
findAll(options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
|
||||||
return this.findList(this.getFindAllHref(options), options, ...linksToFollow);
|
return this.findList(this.getFindAllHref(options), options, ...linksToFollow);
|
||||||
@@ -162,6 +166,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
* Returns an observable of {@link RemoteData} of an object, based on href observable,
|
* Returns an observable of {@link RemoteData} of an object, based on href observable,
|
||||||
* with a list of {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
|
* with a list of {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
|
||||||
* @param href$ Observable of href of object we want to retrieve
|
* @param href$ Observable of href of object we want to retrieve
|
||||||
|
* @param options Find list options object
|
||||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
||||||
*/
|
*/
|
||||||
protected findList(href$, options: FindListOptions, ...linksToFollow: Array<FollowLinkConfig<T>>) {
|
protected findList(href$, options: FindListOptions, ...linksToFollow: Array<FollowLinkConfig<T>>) {
|
||||||
@@ -231,6 +236,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
* Returns a list of observables of {@link RemoteData} of objects, based on an href, with a list of {@link FollowLinkConfig},
|
* Returns a list of observables of {@link RemoteData} of objects, based on an href, with a list of {@link FollowLinkConfig},
|
||||||
* to automatically resolve {@link HALLink}s of the object
|
* to automatically resolve {@link HALLink}s of the object
|
||||||
* @param href The url of object we want to retrieve
|
* @param href The url of object we want to retrieve
|
||||||
|
* @param findListOptions Find list options object
|
||||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
||||||
*/
|
*/
|
||||||
findAllByHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
|
findAllByHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
|
||||||
@@ -259,6 +265,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
*
|
*
|
||||||
* @param searchMethod The search method for the object
|
* @param searchMethod The search method for the object
|
||||||
* @param options The [[FindListOptions]] object
|
* @param options The [[FindListOptions]] object
|
||||||
|
* @param linksToFollow The array of [[FollowLinkConfig]]
|
||||||
* @return {Observable<RemoteData<PaginatedList<T>>}
|
* @return {Observable<RemoteData<PaginatedList<T>>}
|
||||||
* Return an observable that emits response from the server
|
* Return an observable that emits response from the server
|
||||||
*/
|
*/
|
||||||
@@ -367,16 +374,16 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an existing DSpace Object on the server
|
* Delete an existing DSpace Object on the server
|
||||||
* @param dso The DSpace Object to be removed
|
* @param dsoID The DSpace Object' id to be removed
|
||||||
* @param copyVirtualMetadata (optional parameter) the identifiers of the relationship types for which the virtual
|
* @param copyVirtualMetadata (optional parameter) the identifiers of the relationship types for which the virtual
|
||||||
* metadata should be saved as real metadata
|
* metadata should be saved as real metadata
|
||||||
* @return an observable that emits true when the deletion was successful, false when it failed
|
* @return an observable that emits true when the deletion was successful, false when it failed
|
||||||
*/
|
*/
|
||||||
delete(dso: T, copyVirtualMetadata?: string[]): Observable<boolean> {
|
delete(dsoID: string, copyVirtualMetadata?: string[]): Observable<boolean> {
|
||||||
const requestId = this.requestService.generateRequestId();
|
const requestId = this.requestService.generateRequestId();
|
||||||
|
|
||||||
const hrefObs = this.halService.getEndpoint(this.linkPath).pipe(
|
const hrefObs = this.halService.getEndpoint(this.linkPath).pipe(
|
||||||
map((endpoint: string) => this.getIDHref(endpoint, dso.uuid)));
|
map((endpoint: string) => this.getIDHref(endpoint, dsoID)));
|
||||||
|
|
||||||
hrefObs.pipe(
|
hrefObs.pipe(
|
||||||
find((href: string) => hasValue(href)),
|
find((href: string) => hasValue(href)),
|
||||||
@@ -388,7 +395,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
+ id
|
+ id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const request = new DeleteByIDRequest(requestId, href, dso.uuid);
|
const request = new DeleteByIDRequest(requestId, href, dsoID);
|
||||||
this.requestService.configure(request);
|
this.requestService.configure(request);
|
||||||
})
|
})
|
||||||
).subscribe();
|
).subscribe();
|
||||||
|
@@ -125,7 +125,7 @@ describe('DeleteComColPageComponent', () => {
|
|||||||
it('should call delete on the data service', () => {
|
it('should call delete on the data service', () => {
|
||||||
comp.onConfirm(data1);
|
comp.onConfirm(data1);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(dsoDataService.delete).toHaveBeenCalledWith(data1);
|
expect(dsoDataService.delete).toHaveBeenCalledWith(data1.id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ export class DeleteComColPageComponent<TDomain extends DSpaceObject> implements
|
|||||||
* Deletes an existing DSO and redirects to the home page afterwards, showing a notification that states whether or not the deletion was successful
|
* Deletes an existing DSO and redirects to the home page afterwards, showing a notification that states whether or not the deletion was successful
|
||||||
*/
|
*/
|
||||||
onConfirm(dso: TDomain) {
|
onConfirm(dso: TDomain) {
|
||||||
this.dsoDataService.delete(dso)
|
this.dsoDataService.delete(dso.id)
|
||||||
.pipe(first())
|
.pipe(first())
|
||||||
.subscribe((success: boolean) => {
|
.subscribe((success: boolean) => {
|
||||||
if (success) {
|
if (success) {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { async, ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ describe('WorkspaceitemActionsComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
expect(mockDataService.delete).toHaveBeenCalledWith(mockObject);
|
expect(mockDataService.delete).toHaveBeenCalledWith(mockObject.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Injector, Input, OnDestroy } from '@angular/core';
|
import { Component, Injector, Input } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
@@ -62,7 +62,7 @@ export class WorkspaceitemActionsComponent extends MyDSpaceActionsComponent<Work
|
|||||||
(result) => {
|
(result) => {
|
||||||
if (result === 'ok') {
|
if (result === 'ok') {
|
||||||
this.processingDelete$.next(true);
|
this.processingDelete$.next(true);
|
||||||
this.objectDataService.delete(this.object)
|
this.objectDataService.delete(this.object.id)
|
||||||
.subscribe((response: boolean) => {
|
.subscribe((response: boolean) => {
|
||||||
this.processingDelete$.next(false);
|
this.processingDelete$.next(false);
|
||||||
this.handleActionResponse(response);
|
this.handleActionResponse(response);
|
||||||
|
@@ -74,7 +74,7 @@ describe('SubmissionEditComponent Component', () => {
|
|||||||
|
|
||||||
expect(comp.submissionId).toBe(submissionId);
|
expect(comp.submissionId).toBe(submissionId);
|
||||||
expect(comp.collectionId).toBe(submissionObject.collection.id);
|
expect(comp.collectionId).toBe(submissionObject.collection.id);
|
||||||
expect(comp.selfUrl).toBe(submissionObject.self);
|
expect(comp.selfUrl).toBe(submissionObject._links.self.href);
|
||||||
expect(comp.sections).toBe(submissionObject.sections);
|
expect(comp.sections).toBe(submissionObject.sections);
|
||||||
expect(comp.submissionDefinition).toBe(submissionObject.submissionDefinition);
|
expect(comp.submissionDefinition).toBe(submissionObject.submissionDefinition);
|
||||||
|
|
||||||
|
@@ -94,7 +94,7 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
|
|||||||
} else {
|
} else {
|
||||||
this.submissionId = submissionObjectRD.payload.id.toString();
|
this.submissionId = submissionObjectRD.payload.id.toString();
|
||||||
this.collectionId = (submissionObjectRD.payload.collection as Collection).id;
|
this.collectionId = (submissionObjectRD.payload.collection as Collection).id;
|
||||||
this.selfUrl = submissionObjectRD.payload.self;
|
this.selfUrl = submissionObjectRD.payload._links.self.href;
|
||||||
this.sections = submissionObjectRD.payload.sections;
|
this.sections = submissionObjectRD.payload.sections;
|
||||||
this.submissionDefinition = (submissionObjectRD.payload.submissionDefinition as SubmissionDefinitionsModel);
|
this.submissionDefinition = (submissionObjectRD.payload.submissionDefinition as SubmissionDefinitionsModel);
|
||||||
this.changeDetectorRef.detectChanges();
|
this.changeDetectorRef.detectChanges();
|
||||||
|
@@ -10,7 +10,9 @@ import {
|
|||||||
DynamicFormControlEvent,
|
DynamicFormControlEvent,
|
||||||
DynamicFormControlModel,
|
DynamicFormControlModel,
|
||||||
DynamicFormGroupModel,
|
DynamicFormGroupModel,
|
||||||
DynamicSelectModel
|
DynamicSelectModel,
|
||||||
|
MATCH_ENABLED,
|
||||||
|
OR_OPERATOR
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
|
|
||||||
import { WorkspaceitemSectionUploadFileObject } from '../../../../../core/submission/models/workspaceitem-section-upload-file.model';
|
import { WorkspaceitemSectionUploadFileObject } from '../../../../../core/submission/models/workspaceitem-section-upload-file.model';
|
||||||
@@ -206,9 +208,9 @@ export class SubmissionSectionUploadFileEditComponent implements OnChanges {
|
|||||||
hasGroups.push({ id: 'name', value: condition.name });
|
hasGroups.push({ id: 'name', value: condition.name });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const confStart = { relation: [{ action: 'ENABLE', connective: 'OR', when: hasStart }] };
|
const confStart = { relations: [{ match: MATCH_ENABLED, operator: OR_OPERATOR, when: hasStart }] };
|
||||||
const confEnd = { relation: [{ action: 'ENABLE', connective: 'OR', when: hasEnd }] };
|
const confEnd = { relations: [{ match: MATCH_ENABLED, operator: OR_OPERATOR, when: hasEnd }] };
|
||||||
const confGroup = { relation: [{ action: 'ENABLE', connective: 'OR', when: hasGroups }] };
|
const confGroup = { relations: [{ match: MATCH_ENABLED, operator: OR_OPERATOR, when: hasGroups }] };
|
||||||
|
|
||||||
accessConditionsArrayConfig.groupFactory = () => {
|
accessConditionsArrayConfig.groupFactory = () => {
|
||||||
const type = new DynamicSelectModel(accessConditionTypeModelConfig, BITSTREAM_FORM_ACCESS_CONDITION_TYPE_LAYOUT);
|
const type = new DynamicSelectModel(accessConditionTypeModelConfig, BITSTREAM_FORM_ACCESS_CONDITION_TYPE_LAYOUT);
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
DynamicDatePickerModelConfig,
|
DynamicDatePickerModelConfig,
|
||||||
DynamicFormArrayModelConfig,
|
DynamicFormArrayModelConfig,
|
||||||
|
DynamicFormControlLayout,
|
||||||
|
DynamicFormGroupModelConfig,
|
||||||
DynamicSelectModelConfig,
|
DynamicSelectModelConfig,
|
||||||
DynamicFormGroupModelConfig, DynamicFormControlLayout,
|
MATCH_ENABLED,
|
||||||
|
OR_OPERATOR,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
|
|
||||||
export const BITSTREAM_METADATA_FORM_GROUP_CONFIG: DynamicFormGroupModelConfig = {
|
export const BITSTREAM_METADATA_FORM_GROUP_CONFIG: DynamicFormGroupModelConfig = {
|
||||||
@@ -15,7 +18,7 @@ export const BITSTREAM_METADATA_FORM_GROUP_LAYOUT: DynamicFormControlLayout = {
|
|||||||
label: 'col-form-label'
|
label: 'col-form-label'
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
label: 'col-sm-3'
|
label: 'col-sm-3'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,8 +55,8 @@ export const BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_CONFIG: DynamicDatePicke
|
|||||||
toggleIcon: 'far fa-calendar-alt',
|
toggleIcon: 'far fa-calendar-alt',
|
||||||
relations: [
|
relations: [
|
||||||
{
|
{
|
||||||
match: 'ENABLE',
|
match: MATCH_ENABLED,
|
||||||
operator: 'OR',
|
operator: OR_OPERATOR,
|
||||||
when: []
|
when: []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -83,8 +86,8 @@ export const BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_CONFIG: DynamicDatePickerM
|
|||||||
toggleIcon: 'far fa-calendar-alt',
|
toggleIcon: 'far fa-calendar-alt',
|
||||||
relations: [
|
relations: [
|
||||||
{
|
{
|
||||||
match: 'ENABLE',
|
match: MATCH_ENABLED,
|
||||||
operator: 'OR',
|
operator: OR_OPERATOR,
|
||||||
when: []
|
when: []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -112,8 +115,8 @@ export const BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_CONFIG: DynamicSelectModelCo
|
|||||||
options: [],
|
options: [],
|
||||||
relations: [
|
relations: [
|
||||||
{
|
{
|
||||||
match: 'ENABLE',
|
match: MATCH_ENABLED,
|
||||||
operator: 'OR',
|
operator: OR_OPERATOR,
|
||||||
when: []
|
when: []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@@ -164,7 +164,8 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
|
|||||||
flatMap((submissionObject: SubmissionObjectEntry) => this.collectionDataService.findById(submissionObject.collection)),
|
flatMap((submissionObject: SubmissionObjectEntry) => this.collectionDataService.findById(submissionObject.collection)),
|
||||||
filter((rd: RemoteData<Collection>) => isNotUndefined((rd.payload))),
|
filter((rd: RemoteData<Collection>) => isNotUndefined((rd.payload))),
|
||||||
tap((collectionRemoteData: RemoteData<Collection>) => this.collectionName = collectionRemoteData.payload.name),
|
tap((collectionRemoteData: RemoteData<Collection>) => this.collectionName = collectionRemoteData.payload.name),
|
||||||
flatMap((collectionRemoteData: RemoteData<Collection>) => {
|
// TODO review this part when https://github.com/DSpace/dspace-angular/issues/575 is resolved
|
||||||
|
/* flatMap((collectionRemoteData: RemoteData<Collection>) => {
|
||||||
return this.resourcePolicyService.findByHref(
|
return this.resourcePolicyService.findByHref(
|
||||||
(collectionRemoteData.payload as any)._links.defaultAccessConditions.href
|
(collectionRemoteData.payload as any)._links.defaultAccessConditions.href
|
||||||
);
|
);
|
||||||
@@ -176,7 +177,7 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
|
|||||||
this.collectionDefaultAccessConditions = Array.isArray(defaultAccessConditionsRemoteData.payload)
|
this.collectionDefaultAccessConditions = Array.isArray(defaultAccessConditionsRemoteData.payload)
|
||||||
? defaultAccessConditionsRemoteData.payload : [defaultAccessConditionsRemoteData.payload];
|
? defaultAccessConditionsRemoteData.payload : [defaultAccessConditionsRemoteData.payload];
|
||||||
}
|
}
|
||||||
}),
|
}),*/
|
||||||
flatMap(() => config$),
|
flatMap(() => config$),
|
||||||
flatMap((config: SubmissionUploadsModel) => {
|
flatMap((config: SubmissionUploadsModel) => {
|
||||||
this.required$.next(config.required);
|
this.required$.next(config.required);
|
||||||
|
@@ -68,7 +68,7 @@ describe('SubmissionSubmitComponent Component', () => {
|
|||||||
|
|
||||||
expect(comp.submissionId.toString()).toEqual(submissionId);
|
expect(comp.submissionId.toString()).toEqual(submissionId);
|
||||||
expect(comp.collectionId).toBe(submissionObject.collection.id);
|
expect(comp.collectionId).toBe(submissionObject.collection.id);
|
||||||
expect(comp.selfUrl).toBe(submissionObject.self);
|
expect(comp.selfUrl).toBe(submissionObject._links.self.href);
|
||||||
expect(comp.submissionDefinition).toBe(submissionObject.submissionDefinition);
|
expect(comp.submissionDefinition).toBe(submissionObject.submissionDefinition);
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
@@ -95,7 +95,7 @@ export class SubmissionSubmitComponent implements OnDestroy, OnInit {
|
|||||||
this.router.navigate(['/mydspace']);
|
this.router.navigate(['/mydspace']);
|
||||||
} else {
|
} else {
|
||||||
this.collectionId = (submissionObject.collection as Collection).id;
|
this.collectionId = (submissionObject.collection as Collection).id;
|
||||||
this.selfUrl = submissionObject.self;
|
this.selfUrl = submissionObject._links.self.href;
|
||||||
this.submissionDefinition = (submissionObject.submissionDefinition as SubmissionDefinitionsModel);
|
this.submissionDefinition = (submissionObject.submissionDefinition as SubmissionDefinitionsModel);
|
||||||
this.submissionId = submissionObject.id;
|
this.submissionId = submissionObject.id;
|
||||||
this.changeDetectorRef.detectChanges();
|
this.changeDetectorRef.detectChanges();
|
||||||
|
Reference in New Issue
Block a user