diff --git a/src/app/+item-page/edit-item-page/item-status/item-status.component.spec.ts b/src/app/+item-page/edit-item-page/item-status/item-status.component.spec.ts
index 00ea9b9f62..30f326bec4 100644
--- a/src/app/+item-page/edit-item-page/item-status/item-status.component.spec.ts
+++ b/src/app/+item-page/edit-item-page/item-status/item-status.component.spec.ts
@@ -11,7 +11,7 @@ import { Item } from '../../../core/shared/item.model';
import { By } from '@angular/platform-browser';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { of as observableOf } from 'rxjs';
-import { RemoteData } from '../../../core/data/remote-data';
+import { createSuccessfulRemoteDataObject } from '../../../shared/testing/utils';
describe('ItemStatusComponent', () => {
let comp: ItemStatusComponent;
@@ -27,7 +27,7 @@ describe('ItemStatusComponent', () => {
const routeStub = {
parent: {
- data: observableOf({ item: new RemoteData(false, false, true, null, mockItem) })
+ data: observableOf({ item: createSuccessfulRemoteDataObject(mockItem) })
}
};
diff --git a/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.spec.ts b/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.spec.ts
index ac49eee7e7..4c23a1d1e5 100644
--- a/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.spec.ts
+++ b/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.spec.ts
@@ -16,6 +16,7 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ItemWithdrawComponent } from './item-withdraw.component';
import { By } from '@angular/platform-browser';
import { RestResponse } from '../../../core/cache/response.models';
+import { createSuccessfulRemoteDataObject } from '../../../shared/testing/utils';
let comp: ItemWithdrawComponent;
let fixture: ComponentFixture;
@@ -50,7 +51,7 @@ describe('ItemWithdrawComponent', () => {
routeStub = {
data: observableOf({
- item: new RemoteData(false, false, true, null, {
+ item: createSuccessfulRemoteDataObject({
id: 'fake-id'
})
})
diff --git a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts
index 32acdef467..e4413e47c6 100644
--- a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts
+++ b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts
@@ -17,6 +17,10 @@ import { By } from '@angular/platform-browser';
import { of as observableOf } from 'rxjs';
import { getItemEditPath } from '../../item-page-routing.module';
import { RestResponse } from '../../../core/cache/response.models';
+import {
+ createSuccessfulRemoteDataObject,
+ createSuccessfulRemoteDataObject$
+} from '../../../shared/testing/utils';
/**
* Test component that implements the AbstractSimpleItemActionComponent used to test the
@@ -65,12 +69,12 @@ describe('AbstractSimpleItemActionComponent', () => {
});
mockItemDataService = jasmine.createSpyObj({
- findById: observableOf(new RemoteData(false, false, true, undefined, mockItem))
+ findById: createSuccessfulRemoteDataObject$(mockItem)
});
routeStub = {
data: observableOf({
- item: new RemoteData(false, false, true, null, {
+ item: createSuccessfulRemoteDataObject({
id: 'fake-id'
})
})
diff --git a/src/app/+item-page/field-components/collections/collections.component.spec.ts b/src/app/+item-page/field-components/collections/collections.component.spec.ts
index 53fcded9e3..b53f499881 100644
--- a/src/app/+item-page/field-components/collections/collections.component.spec.ts
+++ b/src/app/+item-page/field-components/collections/collections.component.spec.ts
@@ -9,6 +9,10 @@ import { Item } from '../../../core/shared/item.model';
import { of as observableOf } from 'rxjs';
import { RemoteData } from '../../../core/data/remote-data';
import { TranslateModule } from '@ngx-translate/core';
+import {
+ createFailedRemoteDataObject$,
+ createSuccessfulRemoteDataObject$
+} from '../../../shared/testing/utils';
let collectionsComponent: CollectionsComponent;
let fixture: ComponentFixture;
@@ -24,8 +28,8 @@ const mockCollection1: Collection = Object.assign(new Collection(), {
}
});
-const succeededMockItem: Item = Object.assign(new Item(), {owningCollection: observableOf(new RemoteData(false, false, true, null, mockCollection1))});
-const failedMockItem: Item = Object.assign(new Item(), {owningCollection: observableOf(new RemoteData(false, false, false, null, mockCollection1))});
+const succeededMockItem: Item = Object.assign(new Item(), {owningCollection: createSuccessfulRemoteDataObject$(mockCollection1)});
+const failedMockItem: Item = Object.assign(new Item(), {owningCollection: createFailedRemoteDataObject$(mockCollection1)});
describe('CollectionsComponent', () => {
beforeEach(async(() => {
diff --git a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.scss b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.scss
index dff97a6eb2..75dfd09d0d 100644
--- a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.scss
+++ b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../styles/variables.scss';
-
:host {
.simple-view-element {
margin-bottom: 15px;
diff --git a/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.scss b/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.scss
index 96ce861942..e69de29bb2 100644
--- a/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.scss
+++ b/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.scss
@@ -1 +0,0 @@
-@import '../../../../styles/variables.scss';
diff --git a/src/app/+item-page/field-components/metadata-values/metadata-values.component.scss b/src/app/+item-page/field-components/metadata-values/metadata-values.component.scss
index 96ce861942..e69de29bb2 100644
--- a/src/app/+item-page/field-components/metadata-values/metadata-values.component.scss
+++ b/src/app/+item-page/field-components/metadata-values/metadata-values.component.scss
@@ -1 +0,0 @@
-@import '../../../../styles/variables.scss';
diff --git a/src/app/+item-page/full/field-components/file-section/full-file-section.component.scss b/src/app/+item-page/full/field-components/file-section/full-file-section.component.scss
index 77db5d97cf..5bb04cac2f 100644
--- a/src/app/+item-page/full/field-components/file-section/full-file-section.component.scss
+++ b/src/app/+item-page/full/field-components/file-section/full-file-section.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../../styles/variables';
-@import '../../../../../styles/mixins';
@media screen and (min-width: map-get($grid-breakpoints, md)) {
dt {
text-align: right;
diff --git a/src/app/+item-page/full/full-item-page.component.scss b/src/app/+item-page/full/full-item-page.component.scss
index 4fe93bbb7a..458c4992c7 100644
--- a/src/app/+item-page/full/full-item-page.component.scss
+++ b/src/app/+item-page/full/full-item-page.component.scss
@@ -1,5 +1,3 @@
-@import '../../../styles/variables.scss';
-
:host {
div.simple-view-link {
text-align: center;
diff --git a/src/app/+item-page/full/full-item-page.component.spec.ts b/src/app/+item-page/full/full-item-page.component.spec.ts
index 15dd001964..2f151b4997 100644
--- a/src/app/+item-page/full/full-item-page.component.spec.ts
+++ b/src/app/+item-page/full/full-item-page.component.spec.ts
@@ -17,9 +17,13 @@ import { RemoteData } from '../../core/data/remote-data';
import { of as observableOf } from 'rxjs';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { By } from '@angular/platform-browser';
+import {
+ createSuccessfulRemoteDataObject,
+ createSuccessfulRemoteDataObject$
+} from '../../shared/testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: {
'dc.title': [
{
@@ -30,7 +34,7 @@ const mockItem: Item = Object.assign(new Item(), {
}
});
const routeStub = Object.assign(new ActivatedRouteStub(), {
- data: observableOf({ item: new RemoteData(false, false, true, null, mockItem) })
+ data: observableOf({ item: createSuccessfulRemoteDataObject(mockItem) })
});
const metadataServiceStub = {
/* tslint:disable:no-empty */
diff --git a/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts
index ea6e722c66..1b7acb2e3b 100644
--- a/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts
+++ b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts
@@ -11,6 +11,7 @@ import { ItemPageFieldComponent } from './item-page-field.component';
import { MetadataValuesComponent } from '../../../field-components/metadata-values/metadata-values.component';
import { of as observableOf } from 'rxjs';
import { MetadataMap, MetadataValue } from '../../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
let comp: ItemPageFieldComponent;
let fixture: ComponentFixture;
@@ -52,7 +53,7 @@ describe('ItemPageFieldComponent', () => {
export function mockItemWithMetadataFieldAndValue(field: string, value: string): Item {
const item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: new MetadataMap()
});
item.metadata[field] = [{
diff --git a/src/app/+item-page/simple/item-page.component.spec.ts b/src/app/+item-page/simple/item-page.component.spec.ts
index e1202ab725..cd5c385671 100644
--- a/src/app/+item-page/simple/item-page.component.spec.ts
+++ b/src/app/+item-page/simple/item-page.component.spec.ts
@@ -16,9 +16,13 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { By } from '@angular/platform-browser';
import { createRelationshipsObservable } from './item-types/shared/item.component.spec';
import { of as observableOf } from 'rxjs';
+import {
+ createFailedRemoteDataObject$, createPendingRemoteDataObject$, createSuccessfulRemoteDataObject,
+ createSuccessfulRemoteDataObject$
+} from '../../shared/testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: [],
relationships: createRelationshipsObservable()
});
@@ -33,7 +37,7 @@ describe('ItemPageComponent', () => {
/* tslint:enable:no-empty */
};
const mockRoute = Object.assign(new ActivatedRouteStub(), {
- data: observableOf({ item: new RemoteData(false, false, true, null, mockItem) })
+ data: observableOf({ item: createSuccessfulRemoteDataObject(mockItem) })
});
beforeEach(async(() => {
@@ -66,7 +70,8 @@ describe('ItemPageComponent', () => {
describe('when the item is loading', () => {
beforeEach(() => {
- comp.itemRD$ = observableOf(new RemoteData(true, true, true, null, undefined));
+ comp.itemRD$ = createPendingRemoteDataObject$(undefined);
+ // comp.itemRD$ = observableOf(new RemoteData(true, true, true, null, undefined));
fixture.detectChanges();
});
@@ -78,7 +83,7 @@ describe('ItemPageComponent', () => {
describe('when the item failed loading', () => {
beforeEach(() => {
- comp.itemRD$ = observableOf(new RemoteData(false, false, false, null, undefined));
+ comp.itemRD$ = createFailedRemoteDataObject$(undefined);
fixture.detectChanges();
});
diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.html b/src/app/+item-page/simple/item-types/publication/publication.component.html
index 37135c6036..abf5225c27 100644
--- a/src/app/+item-page/simple/item-types/publication/publication.component.html
+++ b/src/app/+item-page/simple/item-types/publication/publication.component.html
@@ -21,6 +21,10 @@
[fields]="['journalvolume.identifier.name']"
[label]="'publication.page.volume-title'">
+
+
+
+
+
() =>
/**
* Fetch the relationships which match the type label given
* @param {string} label Type label
+ * @param thisId The item's id of which the relations belong to
* @returns {(source: Observable<[Relationship[] , RelationshipType[]]>) => Observable}
*/
-export const filterRelationsByTypeLabel = (label: string) =>
+export const filterRelationsByTypeLabel = (label: string, thisId?: string) =>
(source: Observable<[Relationship[], RelationshipType[]]>): Observable =>
source.pipe(
- map(([relsCurrentPage, relTypesCurrentPage]) =>
- relsCurrentPage.filter((rel: Relationship, idx: number) =>
- hasValue(relTypesCurrentPage[idx]) && (relTypesCurrentPage[idx].leftLabel === label ||
- relTypesCurrentPage[idx].rightLabel === label)
- )
- ),
+ switchMap(([relsCurrentPage, relTypesCurrentPage]) => {
+ const relatedItems$ = observableZip(...relsCurrentPage.map((rel: Relationship) =>
+ observableCombineLatest(
+ rel.leftItem.pipe(getSucceededRemoteData(), getRemoteDataPayload()),
+ rel.rightItem.pipe(getSucceededRemoteData(), getRemoteDataPayload()))
+ )
+ );
+ return relatedItems$.pipe(
+ map((arr) => relsCurrentPage.filter((rel: Relationship, idx: number) =>
+ hasValue(relTypesCurrentPage[idx]) && (
+ (hasNoValue(thisId) && (relTypesCurrentPage[idx].leftLabel === label ||
+ relTypesCurrentPage[idx].rightLabel === label)) ||
+ (thisId === arr[idx][0].id && relTypesCurrentPage[idx].leftLabel === label) ||
+ (thisId === arr[idx][1].id && relTypesCurrentPage[idx].rightLabel === label)
+ )
+ ))
+ );
+ }),
distinctUntilChanged(compareArraysUsingIds())
);
/**
* Operator for turning a list of relationships into a list of the relevant items
- * @param {string} thisId The item's id of which the relations belong to
+ * @param {string} thisId The item's id of which the relations belong to
* @returns {(source: Observable) => Observable- }
*/
export const relationsToItems = (thisId: string) =>
@@ -79,10 +91,25 @@ export const relationsToItems = (thisId: string) =>
} else if (rightItem.payload.id === thisId) {
return leftItem.payload;
}
- })),
+ })
+ .filter((item: Item) => hasValue(item))
+ ),
distinctUntilChanged(compareArraysUsingIds()),
);
+/**
+ * Operator for turning a list of relationships and their relationship-types into a list of relevant items by relationship label
+ * @param thisId The item's id of which the relations belong to
+ * @param label The label of the relationship-type to filter on
+ * @param side Filter only on one side of the relationship (for example: child-parent relationships)
+ */
+export const getRelatedItemsByTypeLabel = (thisId: string, label: string) =>
+ (source: Observable<[Relationship[], RelationshipType[]]>): Observable
- =>
+ source.pipe(
+ filterRelationsByTypeLabel(label, thisId),
+ relationsToItems(thisId)
+ );
+
/**
* Operator for turning a list of relationships into a list of metadatarepresentations given the original metadata
* @param parentId The id of the parent item
diff --git a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts
index 95235c5a72..3f525e6a25 100644
--- a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts
+++ b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts
@@ -26,6 +26,7 @@ import { MetadatumRepresentation } from '../../../../core/shared/metadata-repres
import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model';
import { MetadataMap, MetadataValue } from '../../../../core/shared/metadata.models';
import { compareArraysUsing, compareArraysUsingIds } from './item-relationships-utils';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
/**
* Create a generic test for an item-page-fields component using a mockItem and the type of component
@@ -102,11 +103,13 @@ export function containsFieldInput(fields: DebugElement[], metadataKey: string):
}
export function createRelationshipsObservable() {
- return observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), [
+ return createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [
Object.assign(new Relationship(), {
- relationshipType: observableOf(new RemoteData(false, false, true, null, new RelationshipType()))
+ relationshipType: createSuccessfulRemoteDataObject$(new RelationshipType()),
+ leftItem: createSuccessfulRemoteDataObject$(new Item()),
+ rightItem: createSuccessfulRemoteDataObject$(new Item())
})
- ])));
+ ]));
}
describe('ItemComponent', () => {
const arr1 = [
@@ -335,15 +338,15 @@ describe('ItemComponent', () => {
uuid: '1',
metadata: new MetadataMap()
});
- mockItem.relationships = observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), [
+ mockItem.relationships = createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [
Object.assign(new Relationship(), {
uuid: '123',
id: '123',
- leftItem: observableOf(new RemoteData(false, false, true, null, mockItem)),
- rightItem: observableOf(new RemoteData(false, false, true, null, relatedItem)),
- relationshipType: observableOf(new RemoteData(false, false, true, null, new RelationshipType()))
+ leftItem: createSuccessfulRemoteDataObject$(mockItem),
+ rightItem: createSuccessfulRemoteDataObject$(relatedItem),
+ relationshipType: createSuccessfulRemoteDataObject$(new RelationshipType())
})
- ])));
+ ]));
mockItem.metadata[metadataField] = [
{
value: 'Second value',
@@ -367,7 +370,7 @@ describe('ItemComponent', () => {
const mockItemDataService = Object.assign({
findById: (id) => {
if (id === relatedItem.id) {
- return observableOf(new RemoteData(false, false, true, null, relatedItem))
+ return createSuccessfulRemoteDataObject$(relatedItem)
}
}
}) as ItemDataService;
diff --git a/src/app/+item-page/simple/related-items/related-items.component.spec.ts b/src/app/+item-page/simple/related-items/related-items.component.spec.ts
index ef42ab1098..1896f46015 100644
--- a/src/app/+item-page/simple/related-items/related-items.component.spec.ts
+++ b/src/app/+item-page/simple/related-items/related-items.component.spec.ts
@@ -8,14 +8,15 @@ import { PageInfo } from '../../../core/shared/page-info.model';
import { By } from '@angular/platform-browser';
import { createRelationshipsObservable } from '../item-types/shared/item.component.spec';
import { of as observableOf } from 'rxjs';
+import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
const mockItem1: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: [],
relationships: createRelationshipsObservable()
});
const mockItem2: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: [],
relationships: createRelationshipsObservable()
});
diff --git a/src/app/+login-page/login-page.component.scss b/src/app/+login-page/login-page.component.scss
index 38adf24671..58e7272e5f 100644
--- a/src/app/+login-page/login-page.component.scss
+++ b/src/app/+login-page/login-page.component.scss
@@ -1,5 +1,3 @@
-@import '../../styles/variables.scss';
-
.login-logo {
height: $login-logo-height;
width: $login-logo-width;
diff --git a/src/app/+my-dspace-page/my-dspace-page.component.spec.ts b/src/app/+my-dspace-page/my-dspace-page.component.spec.ts
index 9658814a6a..34af21073f 100644
--- a/src/app/+my-dspace-page/my-dspace-page.component.spec.ts
+++ b/src/app/+my-dspace-page/my-dspace-page.component.spec.ts
@@ -29,6 +29,7 @@ import { RoleDirective } from '../shared/roles/role.directive';
import { RoleService } from '../core/roles/role.service';
import { MockRoleService } from '../shared/mocks/mock-role-service';
import { SearchFixedFilterService } from '../+search-page/search-filters/search-filter/search-fixed-filter.service';
+import { createSuccessfulRemoteDataObject$ } from '../shared/testing/utils';
describe('MyDSpacePageComponent', () => {
let comp: MyDSpacePageComponent;
@@ -46,7 +47,7 @@ describe('MyDSpacePageComponent', () => {
pagination.currentPage = 1;
pagination.pageSize = 10;
const sort: SortOptions = new SortOptions('score', SortDirection.DESC);
- const mockResults = observableOf(new RemoteData(false, false, true, null, ['test', 'data']));
+ const mockResults = createSuccessfulRemoteDataObject$(['test', 'data']);
const searchServiceStub = jasmine.createSpyObj('SearchService', {
search: mockResults,
getSearchLink: '/mydspace',
diff --git a/src/app/+search-page/normalized-search-result.model.ts b/src/app/+search-page/normalized-search-result.model.ts
index 32f3217b54..abb5f21250 100644
--- a/src/app/+search-page/normalized-search-result.model.ts
+++ b/src/app/+search-page/normalized-search-result.model.ts
@@ -1,10 +1,12 @@
-import { autoserialize, autoserializeAs } from 'cerialize';
+import { autoserialize, inheritSerialization } from 'cerialize';
import { MetadataMap } from '../core/shared/metadata.models';
import { ListableObject } from '../shared/object-collection/shared/listable-object.model';
+import { NormalizedObject } from '../core/cache/models/normalized-object.model';
/**
* Represents a normalized version of a search result object of a certain DSpaceObject
*/
+@inheritSerialization(NormalizedObject)
export class NormalizedSearchResult implements ListableObject {
/**
* The UUID of the DSpaceObject that was found
diff --git a/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.scss b/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.scss
index a28db359b5..20f1bf2952 100644
--- a/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.scss
+++ b/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../../styles/variables.scss';
-@import '../../../../../styles/mixins.scss';
.filters {
.toggle-more-filters a {
diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.html b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.html
index 7ab7ffd0ca..b853346fa5 100644
--- a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.html
+++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.html
@@ -1,9 +1,9 @@
-
- {{filterValue.value}}
-
+ [routerLink]="[getSearchLink()]"
+ [queryParams]="addQueryParams" queryParamsHandling="merge">
+
+ {{filterValue.value}}
+
{{filterValue.count}}
-
\ No newline at end of file
+
diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.scss b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.scss
index 6452f2469b..c5a38f24a7 100644
--- a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.scss
+++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../../../styles/variables.scss';
-
a {
color: $body-color;
&:hover, &focus {
diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.html b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.html
index 8e8ad9b4e3..4efee3e7b5 100644
--- a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.html
+++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.html
@@ -1,8 +1,8 @@
- {{filterValue.label}}
-
+ {{filterValue.label}}
+
{{filterValue.count}}
diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.scss b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.scss
index 7b5448b980..93d85fcba8 100644
--- a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.scss
+++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../../../styles/variables.scss';
-
a {
color: $link-color;
&:hover {
diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.ts b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.ts
index 54d5d535df..77f240a899 100644
--- a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.ts
+++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.ts
@@ -18,6 +18,7 @@ const rangeDelimiter = '-';
@Component({
selector: 'ds-search-facet-range-option',
styleUrls: ['./search-facet-range-option.component.scss'],
+ // templateUrl: './search-facet-range-option.component.html',
templateUrl: './search-facet-range-option.component.html',
})
diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.scss b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.scss
index 6452f2469b..c5a38f24a7 100644
--- a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.scss
+++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../../../styles/variables.scss';
-
a {
color: $body-color;
&:hover, &focus {
diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.spec.ts b/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.spec.ts
index 5d8b51de96..af5ca68de1 100644
--- a/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.spec.ts
+++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.spec.ts
@@ -20,6 +20,7 @@ import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-d
import { SearchConfigurationServiceStub } from '../../../../shared/testing/search-configuration-service-stub';
import { SEARCH_CONFIG_SERVICE } from '../../../../+my-dspace-page/my-dspace-page.component';
import { tap } from 'rxjs/operators';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
describe('SearchFacetFilterComponent', () => {
let comp: SearchFacetFilterComponent;
@@ -61,7 +62,7 @@ describe('SearchFacetFilterComponent', () => {
let router;
const page = observableOf(0);
- const mockValues = observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), values)));
+ const mockValues = createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), values));
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule],
diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.component.scss b/src/app/+search-page/search-filters/search-filter/search-filter.component.scss
index 1db5e9a1b2..c94edb01bb 100644
--- a/src/app/+search-page/search-filters/search-filter/search-filter.component.scss
+++ b/src/app/+search-page/search-filters/search-filter/search-filter.component.scss
@@ -1,13 +1,10 @@
-@import '../../../../styles/variables.scss';
-@import '../../../../styles/mixins.scss';
-
:host .facet-filter {
- border: 1px solid map-get($theme-colors, light);
- cursor: pointer;
- .search-filter-wrapper.closed {
- overflow: hidden;
- }
- .filter-toggle {
- line-height: $line-height-base;
- }
+ border: 1px solid map-get($theme-colors, light);
+ cursor: pointer;
+ .search-filter-wrapper.closed {
+ overflow: hidden;
+ }
+ .filter-toggle {
+ line-height: $line-height-base;
+ }
}
diff --git a/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.scss b/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.scss
index d8bb1ff1b3..489b7bab63 100644
--- a/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.scss
+++ b/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.scss
@@ -1,6 +1,3 @@
-@import '../../../../../styles/variables.scss';
-@import '../../../../../styles/mixins.scss';
-
.filters {
.toggle-more-filters a {
color: $link-color;
diff --git a/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss b/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss
index caaef5985e..9e536626b0 100644
--- a/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss
+++ b/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss
@@ -1,14 +1,10 @@
-@import '../../../../../styles/variables.scss';
-@import '../../../../../styles/mixins.scss';
-
-
.filters {
- .toggle-more-filters a {
- color: $link-color;
- text-decoration: underline;
- cursor: pointer;
- }
- }
+ .toggle-more-filters a {
+ color: $link-color;
+ text-decoration: underline;
+ cursor: pointer;
+ }
+}
$slider-handle-width: 18px;
::ng-deep
diff --git a/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.spec.ts b/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.spec.ts
index 119f3f92a9..da86e3a759 100644
--- a/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.spec.ts
+++ b/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.spec.ts
@@ -20,6 +20,7 @@ import { RouteService } from '../../../../shared/services/route.service';
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
import { SEARCH_CONFIG_SERVICE } from '../../../../+my-dspace-page/my-dspace-page.component';
import { SearchConfigurationServiceStub } from '../../../../shared/testing/search-configuration-service-stub';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
describe('SearchRangeFilterComponent', () => {
let comp: SearchRangeFilterComponent;
@@ -66,7 +67,7 @@ describe('SearchRangeFilterComponent', () => {
let router;
const page = observableOf(0);
- const mockValues = observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), values)));
+ const mockValues = createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), values));
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule],
diff --git a/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.scss b/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.scss
index d8bb1ff1b3..1d062960c7 100644
--- a/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.scss
+++ b/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../../styles/variables.scss';
-@import '../../../../../styles/mixins.scss';
.filters {
.toggle-more-filters a {
diff --git a/src/app/+search-page/search-filters/search-filters.component.scss b/src/app/+search-page/search-filters/search-filters.component.scss
index 628c8ed46f..e69de29bb2 100644
--- a/src/app/+search-page/search-filters/search-filters.component.scss
+++ b/src/app/+search-page/search-filters/search-filters.component.scss
@@ -1,2 +0,0 @@
-@import '../../../styles/variables.scss';
-@import '../../../styles/mixins.scss';
\ No newline at end of file
diff --git a/src/app/+search-page/search-page.component.scss b/src/app/+search-page/search-page.component.scss
index 26011dd57e..05abf74f05 100644
--- a/src/app/+search-page/search-page.component.scss
+++ b/src/app/+search-page/search-page.component.scss
@@ -1,5 +1,3 @@
-@import '../../styles/variables.scss';
-@import '../../styles/mixins.scss';
@include media-breakpoint-down(md) {
.container {
diff --git a/src/app/+search-page/search-page.component.spec.ts b/src/app/+search-page/search-page.component.spec.ts
index 88c7c693d3..fe4c301bd5 100644
--- a/src/app/+search-page/search-page.component.spec.ts
+++ b/src/app/+search-page/search-page.component.spec.ts
@@ -25,6 +25,7 @@ import { RouteService } from '../shared/services/route.service';
import { SearchConfigurationServiceStub } from '../shared/testing/search-configuration-service-stub';
import { PaginatedSearchOptions } from './paginated-search-options.model';
import { SearchFixedFilterService } from './search-filters/search-filter/search-fixed-filter.service';
+import { createSuccessfulRemoteDataObject$ } from '../shared/testing/utils';
let comp: SearchPageComponent;
let fixture: ComponentFixture;
@@ -41,7 +42,7 @@ pagination.id = 'search-results-pagination';
pagination.currentPage = 1;
pagination.pageSize = 10;
const sort: SortOptions = new SortOptions('score', SortDirection.DESC);
-const mockResults = observableOf(new RemoteData(false, false, true, null, ['test', 'data']));
+const mockResults = createSuccessfulRemoteDataObject$(['test', 'data']);
const searchServiceStub = jasmine.createSpyObj('SearchService', {
search: mockResults,
getSearchLink: '/search',
diff --git a/src/app/+search-page/search-results/search-results.component.spec.ts b/src/app/+search-page/search-results/search-results.component.spec.ts
index 518829e69f..6eb48bb037 100644
--- a/src/app/+search-page/search-results/search-results.component.spec.ts
+++ b/src/app/+search-page/search-results/search-results.component.spec.ts
@@ -114,7 +114,7 @@ export const objects = [
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
- type: ResourceType.Community,
+ type: Community.type,
metadata: {
'dc.description': [
{
@@ -168,7 +168,7 @@ export const objects = [
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/9076bd16-e69a-48d6-9e41-0238cb40d863',
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
- type: ResourceType.Community,
+ type: Community.type,
metadata: {
'dc.description': [
{
diff --git a/src/app/+search-page/search-service/search-configuration.service.ts b/src/app/+search-page/search-service/search-configuration.service.ts
index 14fcdd8d60..e55363f1f5 100644
--- a/src/app/+search-page/search-service/search-configuration.service.ts
+++ b/src/app/+search-page/search-service/search-configuration.service.ts
@@ -21,6 +21,7 @@ import { getSucceededRemoteData } from '../../core/shared/operators';
import { SearchFilter } from '../search-filter.model';
import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model';
import { SearchFixedFilterService } from '../search-filters/search-filter/search-fixed-filter.service';
+import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
/**
* Service that performs all actions that have to do with the current search configuration
@@ -269,7 +270,7 @@ export class SearchConfigurationService implements OnDestroy {
scope: this.defaultScope,
query: this.defaultQuery
});
- this._defaults = observableOf(new RemoteData(false, false, true, null, options));
+ this._defaults = createSuccessfulRemoteDataObject$(options);
}
return this._defaults;
}
diff --git a/src/app/+search-page/search-service/search.service.spec.ts b/src/app/+search-page/search-service/search.service.spec.ts
index 9ec5bc35f2..4ae9876159 100644
--- a/src/app/+search-page/search-service/search.service.spec.ts
+++ b/src/app/+search-page/search-service/search.service.spec.ts
@@ -28,6 +28,7 @@ import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.serv
import { map } from 'rxjs/operators';
import { RouteService } from '../../shared/services/route.service';
import { routeServiceStub } from '../../shared/testing/route-service-stub';
+import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
@Component({ template: '' })
class DummyComponent {
@@ -91,7 +92,7 @@ describe('SearchService', () => {
);
},
aggregate: (input: Array>>): Observable> => {
- return observableOf(new RemoteData(false, false, true, null, []));
+ return createSuccessfulRemoteDataObject$([]);
}
};
diff --git a/src/app/+search-page/search-service/search.service.ts b/src/app/+search-page/search-service/search.service.ts
index 598657a1b2..86611cc87b 100644
--- a/src/app/+search-page/search-service/search.service.ts
+++ b/src/app/+search-page/search-service/search.service.ts
@@ -1,6 +1,6 @@
import { combineLatest as observableCombineLatest, Observable, of as observableOf } from 'rxjs';
import { Injectable, OnDestroy } from '@angular/core';
-import { NavigationExtras, PRIMARY_OUTLET, Router, UrlSegmentGroup } from '@angular/router';
+import { NavigationExtras, Router } from '@angular/router';
import { first, map, switchMap } from 'rxjs/operators';
import { RemoteDataBuildService } from '../../core/cache/builders/remote-data-build.service';
import {
@@ -40,7 +40,6 @@ import { PaginatedSearchOptions } from '../paginated-search-options.model';
import { Community } from '../../core/shared/community.model';
import { CommunityDataService } from '../../core/data/community-data.service';
import { ViewMode } from '../../core/shared/view-mode.model';
-import { ResourceType } from '../../core/shared/resource-type';
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
import { RouteService } from '../../shared/services/route.service';
@@ -296,7 +295,7 @@ export class SearchService implements OnDestroy {
const scopeObject: Observable> = this.dspaceObjectService.findById(scopeId).pipe(getSucceededRemoteData());
const scopeList: Observable = scopeObject.pipe(
switchMap((dsoRD: RemoteData) => {
- if (dsoRD.payload.type === ResourceType.Community) {
+ if ((dsoRD.payload as any).type === Community.type.value) {
const community: Community = dsoRD.payload as Community;
return observableCombineLatest(community.subcommunities, community.collections).pipe(
map(([subCommunities, collections]) => {
diff --git a/src/app/+search-page/search-settings/search-settings.component.scss b/src/app/+search-page/search-settings/search-settings.component.scss
index 0a3824f815..cd18456888 100644
--- a/src/app/+search-page/search-settings/search-settings.component.scss
+++ b/src/app/+search-page/search-settings/search-settings.component.scss
@@ -1,5 +1,3 @@
-@import '../../../styles/variables.scss';
-
.setting-option {
- border: 1px solid map-get($theme-colors, light);
+ border: 1px solid map-get($theme-colors, light);
}
diff --git a/src/app/+search-page/search-sidebar/search-sidebar.component.scss b/src/app/+search-page/search-sidebar/search-sidebar.component.scss
index 35ce5eebce..38e742bca4 100644
--- a/src/app/+search-page/search-sidebar/search-sidebar.component.scss
+++ b/src/app/+search-page/search-sidebar/search-sidebar.component.scss
@@ -1,6 +1,3 @@
-@import '../../../styles/variables.scss';
-@import '../../../styles/mixins.scss';
-
:host {
.results {
line-height: $button-height;
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 aa182eb291..d5df70698c 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
@@ -20,4 +20,4 @@ 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 { }
+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 fbb53d8dcc..7a89f18c7d 100644
--- a/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.ts
+++ b/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.ts
@@ -1,12 +1,12 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { SharedModule } from '../shared/shared.module';
-import { WorkflowitemsEditPageRoutingModule } from './workflowitems-edit-page-routing.module';
+import { WorkflowItemsEditPageRoutingModule } from './workflowitems-edit-page-routing.module';
import { SubmissionModule } from '../submission/submission.module';
@NgModule({
imports: [
- WorkflowitemsEditPageRoutingModule,
+ WorkflowItemsEditPageRoutingModule,
CommonModule,
SharedModule,
SubmissionModule,
@@ -16,6 +16,6 @@ import { SubmissionModule } from '../submission/submission.module';
/**
* This module handles all modules that need to access the workflowitems edit page.
*/
-export class WorkflowitemsEditPageModule {
+export class WorkflowItemsEditPageModule {
}
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 34bba9513b..e1ddc2b889 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -38,7 +38,7 @@ export function getAdminModulePath() {
{ path: 'logout', loadChildren: './+logout-page/logout-page.module#LogoutPageModule' },
{ path: 'submit', loadChildren: './+submit-page/submit-page.module#SubmitPageModule' },
{ path: 'workspaceitems', loadChildren: './+workspaceitems-edit-page/workspaceitems-edit-page.module#WorkspaceitemsEditPageModule' },
- { path: 'workflowitems', loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowitemsEditPageModule' },
+ { path: 'workflowitems', loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowItemsEditPageModule' },
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
])
],
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 898208db80..4482cd02f8 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -9,7 +9,6 @@
-
diff --git a/src/app/app.component.scss b/src/app/app.component.scss
index fa7e7a873a..7793b7529c 100644
--- a/src/app/app.component.scss
+++ b/src/app/app.component.scss
@@ -1,4 +1,3 @@
-@import '../styles/variables.scss';
@import '../styles/helpers/font_awesome_imports.scss';
@import '../../node_modules/bootstrap/scss/bootstrap.scss';
@import '../../node_modules/nouislider/distribute/nouislider.min';
@@ -48,4 +47,3 @@ ds-admin-sidebar {
position: fixed;
z-index: $sidebar-z-index;
}
-
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 37cc791558..52c169e7bc 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -28,10 +28,10 @@ import variables from '../styles/_exposed_variables.scss';
import { CSSVariableService } from './shared/sass-helper/sass-helper.service';
import { MenuService } from './shared/menu/menu.service';
import { MenuID } from './shared/menu/initial-menus-state';
-import { Observable } from 'rxjs/internal/Observable';
+import { combineLatest as combineLatestObservable, Observable, of } from 'rxjs';
import { slideSidebarPadding } from './shared/animations/slide';
-import { combineLatest as combineLatestObservable } from 'rxjs';
import { HostWindowService } from './shared/host-window.service';
+import { Theme } from '../config/theme.inferface';
@Component({
selector: 'ds-app',
@@ -47,6 +47,7 @@ export class AppComponent implements OnInit, AfterViewInit {
slideSidebarOver: Observable
;
collapsedSidebarWidth: Observable;
totalSidebarWidth: Observable;
+ theme: Observable = of({} as any);
constructor(
@Inject(GLOBAL_CONFIG) public config: GlobalConfig,
@@ -59,7 +60,7 @@ export class AppComponent implements OnInit, AfterViewInit {
private router: Router,
private cssService: CSSVariableService,
private menuService: MenuService,
- private windowService: HostWindowService
+ private windowService: HostWindowService,
) {
// Load all the languages that are defined as active from the config file
translate.addLangs(config.languages.filter((LangConfig) => LangConfig.active === true).map((a) => a.code));
@@ -83,6 +84,7 @@ export class AppComponent implements OnInit, AfterViewInit {
}
ngOnInit() {
+
const env: string = this.config.production ? 'Production' : 'Development';
const color: string = this.config.production ? 'red' : 'green';
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
diff --git a/src/app/core/auth/auth-object-factory.ts b/src/app/core/auth/auth-object-factory.ts
deleted file mode 100644
index 02458f4e3e..0000000000
--- a/src/app/core/auth/auth-object-factory.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { AuthType } from './auth-type';
-import { GenericConstructor } from '../shared/generic-constructor';
-import { NormalizedAuthStatus } from './models/normalized-auth-status.model';
-import { NormalizedEPerson } from '../eperson/models/normalized-eperson.model';
-import { NormalizedObject } from '../cache/models/normalized-object.model';
-import { CacheableObject } from '../cache/object-cache.reducer';
-import { NormalizedGroup } from '../eperson/models/normalized-group.model';
-
-export class AuthObjectFactory {
- public static getConstructor(type): GenericConstructor> {
- switch (type) {
- case AuthType.EPerson: {
- return NormalizedEPerson
- }
-
- case AuthType.Group: {
- return NormalizedGroup
- }
-
- case AuthType.Status: {
- return NormalizedAuthStatus
- }
-
- default: {
- return undefined;
- }
- }
- }
-}
diff --git a/src/app/core/auth/auth-response-parsing.service.spec.ts b/src/app/core/auth/auth-response-parsing.service.spec.ts
index 0b2c32fc04..112d60b8d2 100644
--- a/src/app/core/auth/auth-response-parsing.service.spec.ts
+++ b/src/app/core/auth/auth-response-parsing.service.spec.ts
@@ -35,95 +35,103 @@ describe('AuthResponseParsingService', () => {
});
describe('parse', () => {
- const validRequest = new AuthPostRequest(
- '69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
- 'https://rest.api/dspace-spring-rest/api/authn/login',
- 'password=test&user=myself@testshib.org');
+ let validRequest;
+ let validRequest2;
+ let validResponse;
+ let validResponse1;
+ let validResponse2;
+ beforeEach(() => {
- const validRequest2 = new AuthGetRequest(
- '69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
- 'https://rest.api/dspace-spring-rest/api/authn/status');
+ validRequest = new AuthPostRequest(
+ '69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
+ 'https://rest.api/dspace-spring-rest/api/authn/login',
+ 'password=test&user=myself@testshib.org');
- const validResponse = {
- payload: {
- authenticated: true,
- id: null,
- okay: true,
- token: {
- accessToken: 'eyJhbGciOiJIUzI1NiJ9.eyJlaWQiOiI0ZGM3MGFiNS1jZDczLTQ5MmYtYjAwNy0zMTc5ZDJkOTI5NmIiLCJzZyI6W10sImV4cCI6MTUyNjMxODMyMn0.ASmvcbJFBfzhN7D5ncloWnaVZr5dLtgTuOgHaCKiimc',
- expires: 1526318322000
- },
- } as AuthStatus,
- statusCode: 200,
- statusText: '200'
- };
+ validRequest2 = new AuthGetRequest(
+ '69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
+ 'https://rest.api/dspace-spring-rest/api/authn/status');
- const validResponse1 = {
- payload: {},
- statusCode: 404,
- statusText: '404'
- };
+ validResponse = {
+ payload: {
+ authenticated: true,
+ id: null,
+ okay: true,
+ token: {
+ accessToken: 'eyJhbGciOiJIUzI1NiJ9.eyJlaWQiOiI0ZGM3MGFiNS1jZDczLTQ5MmYtYjAwNy0zMTc5ZDJkOTI5NmIiLCJzZyI6W10sImV4cCI6MTUyNjMxODMyMn0.ASmvcbJFBfzhN7D5ncloWnaVZr5dLtgTuOgHaCKiimc',
+ expires: 1526318322000
+ },
+ } as AuthStatus,
+ statusCode: 200,
+ statusText: '200'
+ };
- const validResponse2 = {
- payload: {
- authenticated: true,
- id: null,
- okay: true,
- type: 'status',
- _embedded: {
- eperson: {
- canLogIn: true,
- email: 'myself@testshib.org',
- groups: [],
- handle: null,
- id: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
- lastActive: '2018-05-14T17:03:31.277+0000',
- metadata: {
- 'eperson.firstname': [
- {
- language: null,
- value: 'User'
+ validResponse1 = {
+ payload: {},
+ statusCode: 404,
+ statusText: '404'
+ };
+
+ validResponse2 = {
+ payload: {
+ authenticated: true,
+ id: null,
+ okay: true,
+ type: 'status',
+ _embedded: {
+ eperson: {
+ canLogIn: true,
+ email: 'myself@testshib.org',
+ groups: [],
+ handle: null,
+ id: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
+ lastActive: '2018-05-14T17:03:31.277+0000',
+ metadata: {
+ 'eperson.firstname': [
+ {
+ language: null,
+ value: 'User'
+ }
+ ],
+ 'eperson.lastname': [
+ {
+ language: null,
+ value: 'Test'
+ }
+ ],
+ 'eperson.language': [
+ {
+ language: null,
+ value: 'en'
+ }
+ ]
+ },
+ name: 'User Test',
+ netid: 'myself@testshib.org',
+ requireCertificate: false,
+ selfRegistered: false,
+ type: 'eperson',
+ uuid: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
+ _links: {
+ self: {
+ href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
}
- ],
- 'eperson.lastname': [
- {
- language: null,
- value: 'Test'
- }
- ],
- 'eperson.language': [
- {
- language: null,
- value: 'en'
- }
- ]
- },
- name: 'User Test',
- netid: 'myself@testshib.org',
- requireCertificate: false,
- selfRegistered: false,
- type: 'eperson',
- uuid: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
- _links: {
- self: {
- href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
}
}
+ },
+ _links: {
+ eperson: {
+ href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
+ },
+ self: {
+ href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/authn/status'
+ }
}
},
- _links: {
- eperson: {
- href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
- },
- self: {
- href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/authn/status'
- }
- }
- },
- statusCode: 200,
- statusText: '200'
+ statusCode: 200,
+ statusText: '200'
- };
+ };
+ });
it('should return a AuthStatusResponse if data contains a valid AuthStatus object as payload', () => {
const response = service.parse(validRequest, validResponse);
diff --git a/src/app/core/auth/auth-response-parsing.service.ts b/src/app/core/auth/auth-response-parsing.service.ts
index c736c3b22b..a5a160531c 100644
--- a/src/app/core/auth/auth-response-parsing.service.ts
+++ b/src/app/core/auth/auth-response-parsing.service.ts
@@ -1,6 +1,5 @@
import { Inject, Injectable } from '@angular/core';
-import { AuthObjectFactory } from './auth-object-factory';
import { BaseResponseParsingService } from '../data/base-response-parsing.service';
import { AuthStatusResponse, RestResponse } from '../cache/response.models';
import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.model';
@@ -10,7 +9,6 @@ import { isNotEmpty } from '../../shared/empty.util';
import { ObjectCacheService } from '../cache/object-cache.service';
import { ResponseParsingService } from '../data/parsing.service';
import { RestRequest } from '../data/request.models';
-import { AuthType } from './auth-type';
import { AuthStatus } from './models/auth-status.model';
import { NormalizedAuthStatus } from './models/normalized-auth-status.model';
import { NormalizedObject } from '../cache/models/normalized-object.model';
@@ -18,7 +16,6 @@ import { NormalizedObject } from '../cache/models/normalized-object.model';
@Injectable()
export class AuthResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
- protected objectFactory = AuthObjectFactory;
protected toCache = true;
constructor(@Inject(GLOBAL_CONFIG) protected EnvConfig: GlobalConfig,
@@ -28,7 +25,7 @@ export class AuthResponseParsingService extends BaseResponseParsingService imple
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links) && (data.statusCode === 200)) {
- const response = this.process, AuthType>(data.payload, request.uuid);
+ const response = this.process>(data.payload, request.uuid);
return new AuthStatusResponse(response, data.statusCode, data.statusText);
} else {
return new AuthStatusResponse(data.payload as NormalizedAuthStatus, data.statusCode, data.statusText);
diff --git a/src/app/core/auth/auth-type.ts b/src/app/core/auth/auth-type.ts
deleted file mode 100644
index f0460449ea..0000000000
--- a/src/app/core/auth/auth-type.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export enum AuthType {
- EPerson = 'eperson',
- Status = 'status',
- Group = 'group'
-}
diff --git a/src/app/core/auth/models/auth-status.model.ts b/src/app/core/auth/models/auth-status.model.ts
index 6e722a80c9..e0d568397a 100644
--- a/src/app/core/auth/models/auth-status.model.ts
+++ b/src/app/core/auth/models/auth-status.model.ts
@@ -4,20 +4,51 @@ import { EPerson } from '../../eperson/models/eperson.model';
import { RemoteData } from '../../data/remote-data';
import { Observable } from 'rxjs';
import { CacheableObject } from '../../cache/object-cache.reducer';
+import { ResourceType } from '../../shared/resource-type';
+/**
+ * Object that represents the authenticated status of a user
+ */
export class AuthStatus implements CacheableObject {
+ static type = new ResourceType('status');
+ /**
+ * The unique identifier of this auth status
+ */
id: string;
+ /**
+ * The unique uuid of this auth status
+ */
+ uuid: string;
+
+ /**
+ * True if REST API is up and running, should never return false
+ */
okay: boolean;
+ /**
+ * If the auth status represents an authenticated state
+ */
authenticated: boolean;
+ /**
+ * Authentication error if there was one for this status
+ */
error?: AuthError;
+ /**
+ * The eperson of this auth status
+ */
eperson: Observable>;
+ /**
+ * True if the token is valid, false if there was no token or the token wasn't valid
+ */
token?: AuthTokenInfo;
+ /**
+ * The self link of this auth status' REST object
+ */
self: string;
}
diff --git a/src/app/core/auth/models/normalized-auth-status.model.ts b/src/app/core/auth/models/normalized-auth-status.model.ts
index a13a996604..3892bee408 100644
--- a/src/app/core/auth/models/normalized-auth-status.model.ts
+++ b/src/app/core/auth/models/normalized-auth-status.model.ts
@@ -1,16 +1,22 @@
import { AuthStatus } from './auth-status.model';
import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
-import { ResourceType } from '../../shared/resource-type';
import { NormalizedObject } from '../../cache/models/normalized-object.model';
import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer';
+import { EPerson } from '../../eperson/models/eperson.model';
@mapsTo(AuthStatus)
@inheritSerialization(NormalizedObject)
export class NormalizedAuthStatus extends NormalizedObject {
+ /**
+ * The unique identifier of this auth status
+ */
@autoserialize
id: string;
+ /**
+ * The unique generated uuid of this auth status
+ */
@autoserializeAs(new IDToUUIDSerializer('auth-status'), 'id')
uuid: string;
@@ -26,7 +32,10 @@ export class NormalizedAuthStatus extends NormalizedObject {
@autoserialize
authenticated: boolean;
- @relationship(ResourceType.EPerson, false)
+ /**
+ * The self link to the eperson of this auth status
+ */
+ @relationship(EPerson, false)
@autoserialize
eperson: string;
}
diff --git a/src/app/core/browse/browse.service.ts b/src/app/core/browse/browse.service.ts
index bf368e37ce..eb494d7bdb 100644
--- a/src/app/core/browse/browse.service.ts
+++ b/src/app/core/browse/browse.service.ts
@@ -1,8 +1,9 @@
import { Injectable } from '@angular/core';
import { Observable, of as observableOf } from 'rxjs';
-import { distinctUntilChanged, map, startWith, take } from 'rxjs/operators';
+import { distinctUntilChanged, map, startWith } from 'rxjs/operators';
import {
- ensureArrayHasValue, hasValue,
+ ensureArrayHasValue,
+ hasValue,
hasValueOperator,
isEmpty,
isNotEmpty,
@@ -23,7 +24,9 @@ import { BrowseEntry } from '../shared/browse-entry.model';
import { HALEndpointService } from '../shared/hal-endpoint.service';
import {
configureRequest,
- filterSuccessfulResponses, getBrowseDefinitionLinks, getFirstOccurrence,
+ filterSuccessfulResponses,
+ getBrowseDefinitionLinks,
+ getFirstOccurrence,
getRemoteDataPayload,
getRequestFromRequestHref
} from '../shared/operators';
@@ -32,7 +35,6 @@ import { Item } from '../shared/item.model';
import { DSpaceObject } from '../shared/dspace-object.model';
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
import { GenericSuccessResponse } from '../cache/response.models';
-import { RequestEntry } from '../data/request.reducer';
/**
* The service handling all browse requests
diff --git a/src/app/core/cache/builders/build-decorators.ts b/src/app/core/cache/builders/build-decorators.ts
index 937fb37cd3..0bfb5f0321 100644
--- a/src/app/core/cache/builders/build-decorators.ts
+++ b/src/app/core/cache/builders/build-decorators.ts
@@ -1,23 +1,59 @@
import 'reflect-metadata';
import { GenericConstructor } from '../../shared/generic-constructor';
-import { CacheableObject } from '../object-cache.reducer';
+import { CacheableObject, TypedObject } from '../object-cache.reducer';
import { ResourceType } from '../../shared/resource-type';
const mapsToMetadataKey = Symbol('mapsTo');
const relationshipKey = Symbol('relationship');
const relationshipMap = new Map();
+const typeMap = new Map();
-export function mapsTo(value: GenericConstructor) {
- return Reflect.metadata(mapsToMetadataKey, value);
+/**
+ * Decorator function to map a normalized class to it's not-normalized counter part class
+ * It will also maps a type to the matching class
+ * @param value The not-normalized class to map to
+ */
+export function mapsTo(value: GenericConstructor) {
+ return function decorator(objectConstructor: GenericConstructor) {
+ Reflect.defineMetadata(mapsToMetadataKey, value, objectConstructor);
+ mapsToType((value as any).type, objectConstructor);
+ }
}
+/**
+ * Maps a type to the matching class
+ * @param value The resourse type
+ * @param objectConstructor The class to map to
+ */
+function mapsToType(value: ResourceType, objectConstructor: GenericConstructor) {
+ if (!objectConstructor || !value) {
+ return;
+ }
+ typeMap.set(value.value, objectConstructor);
+}
+
+/**
+ * Returns the mapped class for the given normalized class
+ * @param target The normalized class
+ */
export function getMapsTo(target: any) {
return Reflect.getOwnMetadata(mapsToMetadataKey, target);
}
-export function relationship(value: ResourceType, isList: boolean = false): any {
+/**
+ * Returns the mapped class for the given type
+ * @param type The resource type
+ */
+export function getMapsToType(type: string | ResourceType) {
+ if (typeof(type) === 'object') {
+ type = (type as ResourceType).value;
+ }
+ return typeMap.get(type);
+}
+
+export function relationship(value: GenericConstructor, isList: boolean = false): any {
return function r(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
if (!target || !propertyKey) {
return;
@@ -28,8 +64,10 @@ export function relationship(value: ResourceType, isList: boolean = false): any
metaDataList.push(propertyKey);
}
relationshipMap.set(target.constructor, metaDataList);
-
- return Reflect.metadata(relationshipKey, { resourceType: value, isList }).apply(this, arguments);
+ return Reflect.metadata(relationshipKey, {
+ resourceType: (value as any).type.value,
+ isList
+ }).apply(this, arguments);
};
}
diff --git a/src/app/core/cache/builders/normalized-object-build.service.ts b/src/app/core/cache/builders/normalized-object-build.service.ts
index 79665fec3d..936548cdd4 100644
--- a/src/app/core/cache/builders/normalized-object-build.service.ts
+++ b/src/app/core/cache/builders/normalized-object-build.service.ts
@@ -1,9 +1,8 @@
import { Injectable } from '@angular/core';
import { NormalizedObject } from '../models/normalized-object.model';
-import { CacheableObject } from '../object-cache.reducer';
-import { getRelationships } from './build-decorators';
-import { NormalizedObjectFactory } from '../models/normalized-object-factory';
+import { getMapsToType, getRelationships } from './build-decorators';
import { hasValue, isNotEmpty } from '../../../shared/empty.util';
+import { TypedObject } from '../object-cache.reducer';
/**
* Return true if halObj has a value for `_links.self`
@@ -35,8 +34,8 @@ export class NormalizedObjectBuildService {
*
* @param {TDomain} domainModel a domain model
*/
- normalize(domainModel: T): NormalizedObject {
- const normalizedConstructor = NormalizedObjectFactory.getConstructor(domainModel.type);
+ normalize(domainModel: T): NormalizedObject {
+ const normalizedConstructor = getMapsToType((domainModel as any).type);
const relationships = getRelationships(normalizedConstructor) || [];
const normalizedModel = Object.assign({}, domainModel) as any;
diff --git a/src/app/core/cache/builders/remote-data-build.service.spec.ts b/src/app/core/cache/builders/remote-data-build.service.spec.ts
index 272969050d..2f0e024521 100644
--- a/src/app/core/cache/builders/remote-data-build.service.spec.ts
+++ b/src/app/core/cache/builders/remote-data-build.service.spec.ts
@@ -4,6 +4,7 @@ import { PaginatedList } from '../../data/paginated-list';
import { PageInfo } from '../../shared/page-info.model';
import { RemoteData } from '../../data/remote-data';
import { of as observableOf } from 'rxjs';
+import { createSuccessfulRemoteDataObject } from '../../../shared/testing/utils';
const pageInfo = new PageInfo();
const array = [
@@ -29,8 +30,8 @@ const array = [
})
];
const paginatedList = new PaginatedList(pageInfo, array);
-const arrayRD = new RemoteData(false, false, true, undefined, array);
-const paginatedListRD = new RemoteData(false, false, true, undefined, paginatedList);
+const arrayRD = createSuccessfulRemoteDataObject(array);
+const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
describe('RemoteDataBuildService', () => {
let service: RemoteDataBuildService;
diff --git a/src/app/core/cache/builders/remote-data-build.service.ts b/src/app/core/cache/builders/remote-data-build.service.ts
index 563dce23d1..85ba7636b6 100644
--- a/src/app/core/cache/builders/remote-data-build.service.ts
+++ b/src/app/core/cache/builders/remote-data-build.service.ts
@@ -21,7 +21,8 @@ import {
getRequestFromRequestUUID,
getResourceLinksFromResponse
} from '../../shared/operators';
-import { CacheableObject } from '../object-cache.reducer';
+import { CacheableObject, TypedObject } from '../object-cache.reducer';
+import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
@Injectable()
export class RemoteDataBuildService {
@@ -200,7 +201,7 @@ export class RemoteDataBuildService {
aggregate(input: Array>>): Observable> {
if (isEmpty(input)) {
- return observableOf(new RemoteData(false, false, true, null, []));
+ return createSuccessfulRemoteDataObject$([]);
}
return observableCombineLatest(...input).pipe(
diff --git a/src/app/core/cache/models/items/normalized-item-type.model.ts b/src/app/core/cache/models/items/normalized-item-type.model.ts
index ed38d80a4b..fdb3b9e455 100644
--- a/src/app/core/cache/models/items/normalized-item-type.model.ts
+++ b/src/app/core/cache/models/items/normalized-item-type.model.ts
@@ -1,6 +1,5 @@
import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
import { ItemType } from '../../../shared/item-relationships/item-type.model';
-import { ResourceType } from '../../../shared/resource-type';
import { mapsTo } from '../../builders/build-decorators';
import { NormalizedObject } from '../normalized-object.model';
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
@@ -11,7 +10,6 @@ import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
@mapsTo(ItemType)
@inheritSerialization(NormalizedObject)
export class NormalizedItemType extends NormalizedObject {
-
/**
* The label that describes the ResourceType of the Item
*/
@@ -27,6 +25,6 @@ export class NormalizedItemType extends NormalizedObject {
/**
* The universally unique identifier of this ItemType
*/
- @autoserializeAs(new IDToUUIDSerializer(ResourceType.ItemType), 'id')
+ @autoserializeAs(new IDToUUIDSerializer(ItemType.type.value), 'id')
uuid: string;
}
diff --git a/src/app/core/cache/models/items/normalized-relationship-type.model.ts b/src/app/core/cache/models/items/normalized-relationship-type.model.ts
index d201fb2746..800b27cd7e 100644
--- a/src/app/core/cache/models/items/normalized-relationship-type.model.ts
+++ b/src/app/core/cache/models/items/normalized-relationship-type.model.ts
@@ -5,6 +5,7 @@ import { mapsTo, relationship } from '../../builders/build-decorators';
import { NormalizedDSpaceObject } from '../normalized-dspace-object.model';
import { NormalizedObject } from '../normalized-object.model';
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
+import { ItemType } from '../../../shared/item-relationships/item-type.model';
/**
* Normalized model class for a DSpace RelationshipType
@@ -12,7 +13,6 @@ import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
@mapsTo(RelationshipType)
@inheritSerialization(NormalizedDSpaceObject)
export class NormalizedRelationshipType extends NormalizedObject {
-
/**
* The identifier of this RelationshipType
*/
@@ -59,19 +59,19 @@ export class NormalizedRelationshipType extends NormalizedObject {
* The item to the left of this relationship
*/
@autoserialize
- @relationship(ResourceType.Item, false)
+ @relationship(Item, false)
leftItem: string;
/**
* The item to the right of this relationship
*/
@autoserialize
- @relationship(ResourceType.Item, false)
+ @relationship(Item, false)
rightItem: string;
/**
@@ -48,12 +49,12 @@ export class NormalizedRelationship extends NormalizedObject {
* The type of Relationship
*/
@autoserialize
- @relationship(ResourceType.RelationshipType, false)
+ @relationship(RelationshipType, false)
relationshipType: string;
/**
* The universally unique identifier of this Relationship
*/
- @autoserializeAs(new IDToUUIDSerializer(ResourceType.Relationship), 'id')
+ @autoserializeAs(new IDToUUIDSerializer(Relationship.type.value), 'id')
uuid: string;
}
diff --git a/src/app/core/cache/models/normalized-bitstream-format.model.ts b/src/app/core/cache/models/normalized-bitstream-format.model.ts
index 798aec8dc2..2283ecb368 100644
--- a/src/app/core/cache/models/normalized-bitstream-format.model.ts
+++ b/src/app/core/cache/models/normalized-bitstream-format.model.ts
@@ -12,7 +12,6 @@ import { BitstreamFormatSupportLevel } from '../../shared/bitstream-format-suppo
@mapsTo(BitstreamFormat)
@inheritSerialization(NormalizedObject)
export class NormalizedBitstreamFormat extends NormalizedObject {
-
/**
* Short description of this Bitstream Format
*/
diff --git a/src/app/core/cache/models/normalized-bitstream.model.ts b/src/app/core/cache/models/normalized-bitstream.model.ts
index 64a17aae84..a9e389fd41 100644
--- a/src/app/core/cache/models/normalized-bitstream.model.ts
+++ b/src/app/core/cache/models/normalized-bitstream.model.ts
@@ -1,9 +1,10 @@
-import { inheritSerialization, autoserialize } from 'cerialize';
+import { autoserialize, inheritSerialization } from 'cerialize';
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
import { Bitstream } from '../../shared/bitstream.model';
import { mapsTo, relationship } from '../builders/build-decorators';
-import { ResourceType } from '../../shared/resource-type';
+import { Item } from '../../shared/item.model';
+import { BitstreamFormat } from '../../shared/bitstream-format.model';
/**
* Normalized model class for a DSpace Bitstream
@@ -11,7 +12,6 @@ import { ResourceType } from '../../shared/resource-type';
@mapsTo(Bitstream)
@inheritSerialization(NormalizedDSpaceObject)
export class NormalizedBitstream extends NormalizedDSpaceObject {
-
/**
* The size of this bitstream in bytes
*/
@@ -28,7 +28,7 @@ export class NormalizedBitstream extends NormalizedDSpaceObject {
* The format of this Bitstream
*/
@autoserialize
- @relationship(ResourceType.BitstreamFormat, false)
+ @relationship(BitstreamFormat, false)
format: string;
/**
@@ -41,14 +41,14 @@ export class NormalizedBitstream extends NormalizedDSpaceObject {
* An array of Bundles that are direct parents of this Bitstream
*/
@autoserialize
- @relationship(ResourceType.Item, true)
+ @relationship(Item, true)
parents: string[];
/**
* The Bundle that owns this Bitstream
*/
@autoserialize
- @relationship(ResourceType.Item, false)
+ @relationship(Item, false)
owner: string;
/**
diff --git a/src/app/core/cache/models/normalized-bundle.model.ts b/src/app/core/cache/models/normalized-bundle.model.ts
index 342b13629f..3f4e28bca5 100644
--- a/src/app/core/cache/models/normalized-bundle.model.ts
+++ b/src/app/core/cache/models/normalized-bundle.model.ts
@@ -3,7 +3,7 @@ import { autoserialize, inheritSerialization } from 'cerialize';
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
import { Bundle } from '../../shared/bundle.model';
import { mapsTo, relationship } from '../builders/build-decorators';
-import { ResourceType } from '../../shared/resource-type';
+import { Bitstream } from '../../shared/bitstream.model';
/**
* Normalized model class for a DSpace Bundle
@@ -15,7 +15,7 @@ export class NormalizedBundle extends NormalizedDSpaceObject {
* The primary bitstream of this Bundle
*/
@autoserialize
- @relationship(ResourceType.Bitstream, false)
+ @relationship(Bitstream, false)
primaryBitstream: string;
/**
@@ -32,7 +32,7 @@ export class NormalizedBundle extends NormalizedDSpaceObject {
* List of Bitstreams that are part of this Bundle
*/
@autoserialize
- @relationship(ResourceType.Bitstream, true)
+ @relationship(Bitstream, true)
bitstreams: string[];
}
diff --git a/src/app/core/cache/models/normalized-collection.model.ts b/src/app/core/cache/models/normalized-collection.model.ts
index ddfcc29a2c..9b3419675a 100644
--- a/src/app/core/cache/models/normalized-collection.model.ts
+++ b/src/app/core/cache/models/normalized-collection.model.ts
@@ -3,7 +3,15 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
import { Collection } from '../../shared/collection.model';
import { mapsTo, relationship } from '../builders/build-decorators';
-import { ResourceType } from '../../shared/resource-type';
+import { NormalizedResourcePolicy } from './normalized-resource-policy.model';
+import { NormalizedBitstream } from './normalized-bitstream.model';
+import { NormalizedCommunity } from './normalized-community.model';
+import { NormalizedItem } from './normalized-item.model';
+import { License } from '../../shared/license.model';
+import { ResourcePolicy } from '../../shared/resource-policy.model';
+import { Bitstream } from '../../shared/bitstream.model';
+import { Community } from '../../shared/community.model';
+import { Item } from '../../shared/item.model';
/**
* Normalized model class for a DSpace Collection
@@ -22,42 +30,42 @@ export class NormalizedCollection extends NormalizedDSpaceObject {
* The Bitstream that represents the license of this Collection
*/
@autoserialize
- @relationship(ResourceType.License, false)
+ @relationship(License, false)
license: string;
/**
* The Bitstream that represents the default Access Conditions of this Collection
*/
@autoserialize
- @relationship(ResourceType.ResourcePolicy, false)
+ @relationship(ResourcePolicy, false)
defaultAccessConditions: string;
/**
* The Bitstream that represents the logo of this Collection
*/
@deserialize
- @relationship(ResourceType.Bitstream, false)
+ @relationship(Bitstream, false)
logo: string;
/**
* An array of Communities that are direct parents of this Collection
*/
@deserialize
- @relationship(ResourceType.Community, true)
+ @relationship(Community, true)
parents: string[];
/**
* The Community that owns this Collection
*/
@deserialize
- @relationship(ResourceType.Community, false)
+ @relationship(Community, false)
owner: string;
/**
* List of Items that are part of (not necessarily owned by) this Collection
*/
@deserialize
- @relationship(ResourceType.Item, true)
+ @relationship(Item, true)
items: string[];
}
diff --git a/src/app/core/cache/models/normalized-community.model.ts b/src/app/core/cache/models/normalized-community.model.ts
index f561089949..173760ca72 100644
--- a/src/app/core/cache/models/normalized-community.model.ts
+++ b/src/app/core/cache/models/normalized-community.model.ts
@@ -1,9 +1,13 @@
-import { autoserialize, deserialize, inheritSerialization, serialize } from 'cerialize';
+import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
import { Community } from '../../shared/community.model';
import { mapsTo, relationship } from '../builders/build-decorators';
import { ResourceType } from '../../shared/resource-type';
+import { NormalizedBitstream } from './normalized-bitstream.model';
+import { NormalizedCollection } from './normalized-collection.model';
+import { Bitstream } from '../../shared/bitstream.model';
+import { Collection } from '../../shared/collection.model';
/**
* Normalized model class for a DSpace Community
@@ -11,7 +15,6 @@ import { ResourceType } from '../../shared/resource-type';
@mapsTo(Community)
@inheritSerialization(NormalizedDSpaceObject)
export class NormalizedCommunity extends NormalizedDSpaceObject {
-
/**
* A string representing the unique handle of this Community
*/
@@ -22,32 +25,32 @@ export class NormalizedCommunity extends NormalizedDSpaceObject {
* The Bitstream that represents the logo of this Community
*/
@deserialize
- @relationship(ResourceType.Bitstream, false)
+ @relationship(Bitstream, false)
logo: string;
/**
* An array of Communities that are direct parents of this Community
*/
@deserialize
- @relationship(ResourceType.Community, true)
+ @relationship(Community, true)
parents: string[];
/**
* The Community that owns this Community
*/
@deserialize
- @relationship(ResourceType.Community, false)
+ @relationship(Community, false)
owner: string;
/**
* List of Collections that are owned by this Community
*/
@deserialize
- @relationship(ResourceType.Collection, true)
+ @relationship(Collection, true)
collections: string[];
@deserialize
- @relationship(ResourceType.Community, true)
+ @relationship(Community, true)
subcommunities: string[];
}
diff --git a/src/app/core/cache/models/normalized-dspace-object.model.ts b/src/app/core/cache/models/normalized-dspace-object.model.ts
index e12faa4a77..3c43dd85dc 100644
--- a/src/app/core/cache/models/normalized-dspace-object.model.ts
+++ b/src/app/core/cache/models/normalized-dspace-object.model.ts
@@ -1,15 +1,15 @@
-import { autoserializeAs, deserializeAs } from 'cerialize';
+import { autoserializeAs, deserializeAs, autoserialize } from 'cerialize';
import { DSpaceObject } from '../../shared/dspace-object.model';
import { MetadataMap, MetadataMapSerializer } from '../../shared/metadata.models';
-import { ResourceType } from '../../shared/resource-type';
import { mapsTo } from '../builders/build-decorators';
import { NormalizedObject } from './normalized-object.model';
+import { TypedObject } from '../object-cache.reducer';
/**
* An model class for a DSpaceObject.
*/
@mapsTo(DSpaceObject)
-export class NormalizedDSpaceObject extends NormalizedObject {
+export class NormalizedDSpaceObject extends NormalizedObject implements TypedObject {
/**
* The link to the rest endpoint where this object can be found
@@ -38,8 +38,8 @@ export class NormalizedDSpaceObject extends NormalizedOb
/**
* A string representing the kind of DSpaceObject, e.g. community, item, …
*/
- @autoserializeAs(String)
- type: ResourceType;
+ @autoserialize
+ type: string;
/**
* All metadata of this DSpaceObject
diff --git a/src/app/core/cache/models/normalized-item.model.ts b/src/app/core/cache/models/normalized-item.model.ts
index d2b7b9c92d..4afceb7612 100644
--- a/src/app/core/cache/models/normalized-item.model.ts
+++ b/src/app/core/cache/models/normalized-item.model.ts
@@ -4,6 +4,12 @@ import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
import { Item } from '../../shared/item.model';
import { mapsTo, relationship } from '../builders/build-decorators';
import { ResourceType } from '../../shared/resource-type';
+import { NormalizedCollection } from './normalized-collection.model';
+import { NormalizedBitstream } from './normalized-bitstream.model';
+import { NormalizedRelationship } from './items/normalized-relationship.model';
+import { Collection } from '../../shared/collection.model';
+import { Bitstream } from '../../shared/bitstream.model';
+import { Relationship } from '../../shared/item-relationships/relationship.model';
/**
* Normalized model class for a DSpace Item
@@ -46,25 +52,25 @@ export class NormalizedItem extends NormalizedDSpaceObject- {
* An array of Collections that are direct parents of this Item
*/
@deserialize
- @relationship(ResourceType.Collection, true)
+ @relationship(Collection, true)
parents: string[];
/**
* The Collection that owns this Item
*/
@deserialize
- @relationship(ResourceType.Collection, false)
+ @relationship(Collection, false)
owningCollection: string;
/**
* List of Bitstreams that are owned by this Item
*/
@deserialize
- @relationship(ResourceType.Bitstream, true)
+ @relationship(Bitstream, true)
bitstreams: string[];
@autoserialize
- @relationship(ResourceType.Relationship, true)
+ @relationship(Relationship, true)
relationships: string[];
}
diff --git a/src/app/core/cache/models/normalized-object-factory.ts b/src/app/core/cache/models/normalized-object-factory.ts
deleted file mode 100644
index aa1f6f2958..0000000000
--- a/src/app/core/cache/models/normalized-object-factory.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-import { NormalizedItemType } from './items/normalized-item-type.model';
-import { NormalizedRelationshipType } from './items/normalized-relationship-type.model';
-import { NormalizedRelationship } from './items/normalized-relationship.model';
-import { NormalizedBitstream } from './normalized-bitstream.model';
-import { NormalizedBundle } from './normalized-bundle.model';
-import { NormalizedItem } from './normalized-item.model';
-import { NormalizedCollection } from './normalized-collection.model';
-import { GenericConstructor } from '../../shared/generic-constructor';
-import { NormalizedCommunity } from './normalized-community.model';
-import { ResourceType } from '../../shared/resource-type';
-import { NormalizedObject } from './normalized-object.model';
-import { NormalizedLicense } from './normalized-license.model';
-import { NormalizedResourcePolicy } from './normalized-resource-policy.model';
-import { NormalizedWorkspaceItem } from '../../submission/models/normalized-workspaceitem.model';
-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 { NormalizedClaimedTask } from '../../tasks/models/normalized-claimed-task-object.model';
-import { NormalizedPoolTask } from '../../tasks/models/normalized-pool-task-object.model';
-import { NormalizedBitstreamFormat } from './normalized-bitstream-format.model';
-import { NormalizedMetadataSchema } from '../../metadata/normalized-metadata-schema.model';
-import { CacheableObject } from '../object-cache.reducer';
-import { NormalizedSubmissionDefinitionsModel } from '../../config/models/normalized-config-submission-definitions.model';
-import { NormalizedSubmissionFormsModel } from '../../config/models/normalized-config-submission-forms.model';
-import { NormalizedSubmissionSectionModel } from '../../config/models/normalized-config-submission-section.model';
-
-export class NormalizedObjectFactory {
- public static getConstructor(type: ResourceType): GenericConstructor> {
- switch (type) {
- case ResourceType.Bitstream: {
- return NormalizedBitstream
- }
- case ResourceType.Bundle: {
- return NormalizedBundle
- }
- case ResourceType.Item: {
- return NormalizedItem
- }
- case ResourceType.Collection: {
- return NormalizedCollection
- }
- case ResourceType.Community: {
- return NormalizedCommunity
- }
- case ResourceType.BitstreamFormat: {
- return NormalizedBitstreamFormat
- }
- case ResourceType.License: {
- return NormalizedLicense
- }
- case ResourceType.ResourcePolicy: {
- return NormalizedResourcePolicy
- }
- case ResourceType.Relationship: {
- return NormalizedRelationship
- }
- case ResourceType.RelationshipType: {
- return NormalizedRelationshipType
- }
- case ResourceType.ItemType: {
- return NormalizedItemType
- }
- case ResourceType.EPerson: {
- return NormalizedEPerson
- }
- case ResourceType.Group: {
- return NormalizedGroup
- }
- case ResourceType.MetadataSchema: {
- return NormalizedMetadataSchema
- }
- case ResourceType.MetadataField: {
- return NormalizedGroup
- }
- case ResourceType.Workspaceitem: {
- return NormalizedWorkspaceItem
- }
- case ResourceType.Workflowitem: {
- return NormalizedWorkflowItem
- }
- case ResourceType.ClaimedTask: {
- return NormalizedClaimedTask
- }
- case ResourceType.PoolTask: {
- return NormalizedPoolTask
- }
- case ResourceType.SubmissionDefinition:
- case ResourceType.SubmissionDefinitions: {
- return NormalizedSubmissionDefinitionsModel
- }
- case ResourceType.SubmissionForm:
- case ResourceType.SubmissionForms: {
- return NormalizedSubmissionFormsModel
- }
- case ResourceType.SubmissionSection:
- case ResourceType.SubmissionSections: {
- return NormalizedSubmissionSectionModel
- }
- default: {
- return undefined;
- }
- }
- }
-}
diff --git a/src/app/core/cache/models/normalized-object.model.ts b/src/app/core/cache/models/normalized-object.model.ts
index 6ac8985d64..bb5f192a7a 100644
--- a/src/app/core/cache/models/normalized-object.model.ts
+++ b/src/app/core/cache/models/normalized-object.model.ts
@@ -1,25 +1,24 @@
-import { CacheableObject } from '../object-cache.reducer';
+import { CacheableObject, TypedObject } from '../object-cache.reducer';
import { autoserialize } from 'cerialize';
import { ResourceType } from '../../shared/resource-type';
/**
* An abstract model class for a NormalizedObject.
*/
-export abstract class NormalizedObject implements CacheableObject {
-
+export abstract class NormalizedObject implements CacheableObject {
/**
* The link to the rest endpoint where this object can be found
*/
@autoserialize
self: string;
- /**
- * A string representing the kind of DSpaceObject, e.g. community, item, …
- */
- @autoserialize
- type: ResourceType;
-
@autoserialize
_links: {
[name: string]: string
- }
+ };
+
+ /**
+ * A string representing the kind of object
+ */
+ @autoserialize
+ type: string;
}
diff --git a/src/app/core/cache/models/normalized-resource-policy.model.ts b/src/app/core/cache/models/normalized-resource-policy.model.ts
index 9438c1da0a..cd25a0af05 100644
--- a/src/app/core/cache/models/normalized-resource-policy.model.ts
+++ b/src/app/core/cache/models/normalized-resource-policy.model.ts
@@ -12,7 +12,6 @@ import { ActionType } from './action-type.model';
@mapsTo(ResourcePolicy)
@inheritSerialization(NormalizedObject)
export class NormalizedResourcePolicy extends NormalizedObject {
-
/**
* The action that is allowed by this Resource Policy
*/
diff --git a/src/app/core/cache/models/support-level.model.ts b/src/app/core/cache/models/support-level.model.ts
index 30f759d55f..103ff2c626 100644
--- a/src/app/core/cache/models/support-level.model.ts
+++ b/src/app/core/cache/models/support-level.model.ts
@@ -8,7 +8,7 @@ export enum SupportLevel {
Unknown = 0,
/**
- * Unknown for Bitstream Formats that are known to the system, but not fully supported
+ * Known for Bitstream Formats that are known to the system, but not fully supported
*/
Known = 1,
diff --git a/src/app/core/cache/object-cache.reducer.spec.ts b/src/app/core/cache/object-cache.reducer.spec.ts
index efa28d7249..a65e63ab86 100644
--- a/src/app/core/cache/object-cache.reducer.spec.ts
+++ b/src/app/core/cache/object-cache.reducer.spec.ts
@@ -9,6 +9,7 @@ import {
ResetObjectCacheTimestampsAction
} from './object-cache.actions';
import { Operation } from 'fast-json-patch';
+import { Item } from '../shared/item.model';
class NullAction extends RemoveFromObjectCacheAction {
type = null;
@@ -28,6 +29,7 @@ describe('objectCacheReducer', () => {
const testState = {
[selfLink1]: {
data: {
+ type: Item.type,
self: selfLink1,
foo: 'bar'
},
@@ -39,6 +41,7 @@ describe('objectCacheReducer', () => {
},
[selfLink2]: {
data: {
+ type: Item.type,
self: requestUUID2,
foo: 'baz'
},
@@ -67,7 +70,7 @@ describe('objectCacheReducer', () => {
it('should add the payload to the cache in response to an ADD action', () => {
const state = Object.create(null);
- const objectToCache = { self: selfLink1 };
+ const objectToCache = { self: selfLink1, type: Item.type };
const timeAdded = new Date().getTime();
const msToLive = 900000;
const requestUUID = requestUUID1;
@@ -80,7 +83,12 @@ describe('objectCacheReducer', () => {
});
it('should overwrite an object in the cache in response to an ADD action if it already exists', () => {
- const objectToCache = { self: selfLink1, foo: 'baz', somethingElse: true };
+ const objectToCache = {
+ self: selfLink1,
+ foo: 'baz',
+ somethingElse: true,
+ type: Item.type
+ };
const timeAdded = new Date().getTime();
const msToLive = 900000;
const requestUUID = requestUUID1;
@@ -95,7 +103,7 @@ describe('objectCacheReducer', () => {
it('should perform the ADD action without affecting the previous state', () => {
const state = Object.create(null);
- const objectToCache = { self: selfLink1 };
+ const objectToCache = { self: selfLink1, type: Item.type };
const timeAdded = new Date().getTime();
const msToLive = 900000;
const requestUUID = requestUUID1;
diff --git a/src/app/core/cache/object-cache.reducer.ts b/src/app/core/cache/object-cache.reducer.ts
index 982c77341e..f41151fd90 100644
--- a/src/app/core/cache/object-cache.reducer.ts
+++ b/src/app/core/cache/object-cache.reducer.ts
@@ -32,15 +32,19 @@ export interface Patch {
operations: Operation[];
}
+export abstract class TypedObject {
+ static type: ResourceType;
+}
+
+/* tslint:disable:max-classes-per-file */
/**
* An interface to represent objects that can be cached
*
* A cacheable object should have a self link
*/
-export interface CacheableObject {
+export class CacheableObject extends TypedObject {
uuid?: string;
self: string;
- type?: ResourceType;
// isNew: boolean;
// dirtyType: DirtyType;
// hasDirtyAttributes: boolean;
@@ -59,6 +63,7 @@ export class ObjectCacheEntry implements CacheEntry {
patches: Patch[] = [];
isDirty: boolean;
}
+/* tslint:enable:max-classes-per-file */
/**
* The ObjectCache State
diff --git a/src/app/core/cache/object-cache.service.spec.ts b/src/app/core/cache/object-cache.service.spec.ts
index 20e12108ad..39dc10de2c 100644
--- a/src/app/core/cache/object-cache.service.spec.ts
+++ b/src/app/core/cache/object-cache.service.spec.ts
@@ -10,13 +10,13 @@ import {
RemoveFromObjectCacheAction
} from './object-cache.actions';
import { CoreState } from '../core.reducers';
-import { ResourceType } from '../shared/resource-type';
import { NormalizedItem } from './models/normalized-item.model';
import { first } from 'rxjs/operators';
import { Operation } from 'fast-json-patch';
import { RestRequestMethod } from '../data/rest-request-method';
import { AddToSSBAction } from './server-sync-buffer.actions';
import { Patch } from './object-cache.reducer';
+import { Item } from '../shared/item.model';
describe('ObjectCacheService', () => {
let service: ObjectCacheService;
@@ -28,7 +28,7 @@ describe('ObjectCacheService', () => {
const msToLive = 900000;
let objectToCache = {
self: selfLink,
- type: ResourceType.Item
+ type: Item.type
};
let cacheEntry;
let invalidCacheEntry;
@@ -37,7 +37,7 @@ describe('ObjectCacheService', () => {
function init() {
objectToCache = {
self: selfLink,
- type: ResourceType.Item
+ type: Item.type
};
cacheEntry = {
data: objectToCache,
diff --git a/src/app/core/cache/object-cache.service.ts b/src/app/core/cache/object-cache.service.ts
index e6384571c3..e18ff3b3a4 100644
--- a/src/app/core/cache/object-cache.service.ts
+++ b/src/app/core/cache/object-cache.service.ts
@@ -10,7 +10,6 @@ import { coreSelector } from '../core.selectors';
import { RestRequestMethod } from '../data/rest-request-method';
import { selfLinkFromUuidSelector } from '../index/index.selectors';
import { GenericConstructor } from '../shared/generic-constructor';
-import { NormalizedObjectFactory } from './models/normalized-object-factory';
import { NormalizedObject } from './models/normalized-object.model';
import {
AddPatchObjectCacheAction,
@@ -21,6 +20,7 @@ import {
import { CacheableObject, ObjectCacheEntry, ObjectCacheState } from './object-cache.reducer';
import { AddToSSBAction } from './server-sync-buffer.actions';
+import { getMapsToType } from './builders/build-decorators';
/**
* The base selector function to select the object cache in the store
@@ -109,7 +109,7 @@ export class ObjectCacheService {
}
),
map((entry: ObjectCacheEntry) => {
- const type: GenericConstructor> = NormalizedObjectFactory.getConstructor(entry.data.type);
+ const type: GenericConstructor> = getMapsToType((entry.data as any).type);
return Object.assign(new type(), entry.data) as NormalizedObject
})
);
diff --git a/src/app/core/cache/response.models.ts b/src/app/core/cache/response.models.ts
index b3523addc5..03233e616b 100644
--- a/src/app/core/cache/response.models.ts
+++ b/src/app/core/cache/response.models.ts
@@ -8,12 +8,12 @@ import { IntegrationModel } from '../integration/models/integration.model';
import { RegistryMetadataschemasResponse } from '../registry/registry-metadataschemas-response.model';
import { RegistryMetadatafieldsResponse } from '../registry/registry-metadatafields-response.model';
import { RegistryBitstreamformatsResponse } from '../registry/registry-bitstreamformats-response.model';
-import { MetadataSchema } from '../metadata/metadataschema.model';
-import { MetadataField } from '../metadata/metadatafield.model';
import { PaginatedList } from '../data/paginated-list';
import { SubmissionObject } from '../submission/models/submission-object.model';
import { DSpaceObject } from '../shared/dspace-object.model';
import { NormalizedAuthStatus } from '../auth/models/normalized-auth-status.model';
+import { MetadataSchema } from '../metadata/metadata-schema.model';
+import { MetadataField } from '../metadata/metadata-field.model';
/* tslint:disable:max-classes-per-file */
export class RestResponse {
diff --git a/src/app/core/config/config-response-parsing.service.spec.ts b/src/app/core/config/config-response-parsing.service.spec.ts
index 7c69f1bdb3..90dd1670b8 100644
--- a/src/app/core/config/config-response-parsing.service.spec.ts
+++ b/src/app/core/config/config-response-parsing.service.spec.ts
@@ -8,8 +8,8 @@ import { Store } from '@ngrx/store';
import { CoreState } from '../core.reducers';
import { PaginatedList } from '../data/paginated-list';
import { PageInfo } from '../shared/page-info.model';
-import { NormalizedSubmissionDefinitionsModel } from './models/normalized-config-submission-definitions.model';
import { NormalizedSubmissionSectionModel } from './models/normalized-config-submission-section.model';
+import { NormalizedSubmissionDefinitionModel } from './models/normalized-config-submission-definition.model';
describe('ConfigResponseParsingService', () => {
let service: ConfigResponseParsingService;
@@ -173,7 +173,7 @@ describe('ConfigResponseParsingService', () => {
self: 'https://rest.api/config/submissiondefinitions/traditional/sections'
});
const definitions =
- Object.assign(new NormalizedSubmissionDefinitionsModel(), {
+ Object.assign(new NormalizedSubmissionDefinitionModel(), {
isDefault: true,
name: 'traditional',
type: 'submissiondefinition',
diff --git a/src/app/core/config/config-response-parsing.service.ts b/src/app/core/config/config-response-parsing.service.ts
index b81dc07624..08fe581406 100644
--- a/src/app/core/config/config-response-parsing.service.ts
+++ b/src/app/core/config/config-response-parsing.service.ts
@@ -5,10 +5,8 @@ import { RestRequest } from '../data/request.models';
import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.model';
import { ConfigSuccessResponse, ErrorResponse, RestResponse } from '../cache/response.models';
import { isNotEmpty } from '../../shared/empty.util';
-import { ConfigObjectFactory } from './models/config-object-factory';
import { ConfigObject } from './models/config.model';
-import { ConfigType } from './models/config-type';
import { BaseResponseParsingService } from '../data/base-response-parsing.service';
import { GLOBAL_CONFIG } from '../../../config';
import { GlobalConfig } from '../../../config/global-config.interface';
@@ -16,8 +14,6 @@ import { ObjectCacheService } from '../cache/object-cache.service';
@Injectable()
export class ConfigResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
-
- protected objectFactory = ConfigObjectFactory;
protected toCache = false;
constructor(
@@ -28,7 +24,7 @@ export class ConfigResponseParsingService extends BaseResponseParsingService imp
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links) && (data.statusCode === 201 || data.statusCode === 200)) {
- const configDefinition = this.process(data.payload, request.uuid);
+ const configDefinition = this.process(data.payload, request.uuid);
return new ConfigSuccessResponse(configDefinition, data.statusCode, data.statusText, this.processPageInfo(data.payload));
} else {
return new ErrorResponse(
diff --git a/src/app/core/config/models/config-object-factory.ts b/src/app/core/config/models/config-object-factory.ts
deleted file mode 100644
index 44b2e377c4..0000000000
--- a/src/app/core/config/models/config-object-factory.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { GenericConstructor } from '../../shared/generic-constructor';
-import { ConfigType } from './config-type';
-import { ConfigObject } from './config.model';
-import { NormalizedSubmissionDefinitionsModel } from './normalized-config-submission-definitions.model';
-import { NormalizedSubmissionFormsModel } from './normalized-config-submission-forms.model';
-import { NormalizedSubmissionSectionModel } from './normalized-config-submission-section.model';
-import { NormalizedSubmissionUploadsModel } from './normalized-config-submission-uploads.model';
-
-/**
- * Class to return normalized models for config objects
- */
-export class ConfigObjectFactory {
- public static getConstructor(type): GenericConstructor {
- switch (type) {
- case ConfigType.SubmissionDefinition:
- case ConfigType.SubmissionDefinitions: {
- return NormalizedSubmissionDefinitionsModel
- }
- case ConfigType.SubmissionForm:
- case ConfigType.SubmissionForms: {
- return NormalizedSubmissionFormsModel
- }
- case ConfigType.SubmissionSection:
- case ConfigType.SubmissionSections: {
- return NormalizedSubmissionSectionModel
- }
- case ConfigType.SubmissionUpload:
- case ConfigType.SubmissionUploads: {
- return NormalizedSubmissionUploadsModel
- }
- default: {
- return undefined;
- }
- }
- }
-}
diff --git a/src/app/core/config/models/config-submission-definition.model.ts b/src/app/core/config/models/config-submission-definition.model.ts
new file mode 100644
index 0000000000..0449e6a964
--- /dev/null
+++ b/src/app/core/config/models/config-submission-definition.model.ts
@@ -0,0 +1,22 @@
+import { ConfigObject } from './config.model';
+import { SubmissionSectionModel } from './config-submission-section.model';
+import { PaginatedList } from '../../data/paginated-list';
+import { ResourceType } from '../../shared/resource-type';
+
+/**
+ * Class for the configuration describing the submission
+ */
+export class SubmissionDefinitionModel extends ConfigObject {
+ static type = new ResourceType('submissiondefinition');
+
+ /**
+ * A boolean representing if this submission definition is the default or not
+ */
+ isDefault: boolean;
+
+ /**
+ * A list of SubmissionSectionModel that are present in this submission definition
+ */
+ sections: PaginatedList;
+
+}
diff --git a/src/app/core/config/models/config-submission-definitions.model.ts b/src/app/core/config/models/config-submission-definitions.model.ts
index 8bbbc90056..d9892f542f 100644
--- a/src/app/core/config/models/config-submission-definitions.model.ts
+++ b/src/app/core/config/models/config-submission-definitions.model.ts
@@ -1,17 +1,7 @@
-import { ConfigObject } from './config.model';
-import { SubmissionSectionModel } from './config-submission-section.model';
-import { PaginatedList } from '../../data/paginated-list';
+import { SubmissionDefinitionModel } from './config-submission-definition.model';
+import { ResourceType } from '../../shared/resource-type';
-export class SubmissionDefinitionsModel extends ConfigObject {
-
- /**
- * A boolean representing if this submission definition is the default or not
- */
- isDefault: boolean;
-
- /**
- * A list of SubmissionSectionModel that are present in this submission definition
- */
- sections: PaginatedList;
+export class SubmissionDefinitionsModel extends SubmissionDefinitionModel {
+ static type = new ResourceType('submissiondefinitions');
}
diff --git a/src/app/core/config/models/config-submission-form.model.ts b/src/app/core/config/models/config-submission-form.model.ts
new file mode 100644
index 0000000000..a65d285c95
--- /dev/null
+++ b/src/app/core/config/models/config-submission-form.model.ts
@@ -0,0 +1,22 @@
+import { ConfigObject } from './config.model';
+import { FormFieldModel } from '../../../shared/form/builder/models/form-field.model';
+import { ResourceType } from '../../shared/resource-type';
+
+/**
+ * An interface that define a form row and its properties.
+ */
+export interface FormRowModel {
+ fields: FormFieldModel[];
+}
+
+/**
+ * A model class for a NormalizedObject.
+ */
+export class SubmissionFormModel extends ConfigObject {
+ static type = new ResourceType('submissionform');
+
+ /**
+ * An array of [FormRowModel] that are present in this form
+ */
+ rows: FormRowModel[];
+}
diff --git a/src/app/core/config/models/config-submission-forms.model.ts b/src/app/core/config/models/config-submission-forms.model.ts
index ee0962f0e9..017d7d68cc 100644
--- a/src/app/core/config/models/config-submission-forms.model.ts
+++ b/src/app/core/config/models/config-submission-forms.model.ts
@@ -1,20 +1,9 @@
-import { ConfigObject } from './config.model';
-import { FormFieldModel } from '../../../shared/form/builder/models/form-field.model';
-
-/**
- * An interface that define a form row and its properties.
- */
-export interface FormRowModel {
- fields: FormFieldModel[];
-}
+import { SubmissionFormModel } from './config-submission-form.model';
+import { ResourceType } from '../../shared/resource-type';
/**
* A model class for a NormalizedObject.
*/
-export class SubmissionFormsModel extends ConfigObject {
-
- /**
- * An array of [FormRowModel] that are present in this form
- */
- rows: FormRowModel[];
+export class SubmissionFormsModel extends SubmissionFormModel {
+ static type = new ResourceType('submissionforms');
}
diff --git a/src/app/core/config/models/config-submission-section.model.ts b/src/app/core/config/models/config-submission-section.model.ts
index 377a8869e1..4c560fa631 100644
--- a/src/app/core/config/models/config-submission-section.model.ts
+++ b/src/app/core/config/models/config-submission-section.model.ts
@@ -1,5 +1,6 @@
import { ConfigObject } from './config.model';
import { SectionsType } from '../../../submission/sections/sections-type';
+import { ResourceType } from '../../shared/resource-type';
/**
* An interface that define section visibility and its properties.
@@ -10,6 +11,7 @@ export interface SubmissionSectionVisibility {
}
export class SubmissionSectionModel extends ConfigObject {
+ static type = new ResourceType('submissionsection');
/**
* The header for this section
diff --git a/src/app/core/config/models/config-submission-sections.model.ts b/src/app/core/config/models/config-submission-sections.model.ts
new file mode 100644
index 0000000000..ae7b133391
--- /dev/null
+++ b/src/app/core/config/models/config-submission-sections.model.ts
@@ -0,0 +1,6 @@
+import { SubmissionSectionModel } from './config-submission-section.model';
+import { ResourceType } from '../../shared/resource-type';
+
+export class SubmissionSectionsModel extends SubmissionSectionModel {
+ static type = new ResourceType('submissionsections');
+}
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 8bb9ba7f1e..812a590041 100644
--- a/src/app/core/config/models/config-submission-uploads.model.ts
+++ b/src/app/core/config/models/config-submission-uploads.model.ts
@@ -1,9 +1,10 @@
import { ConfigObject } from './config.model';
import { AccessConditionOption } from './config-access-condition-option.model';
import { SubmissionFormsModel } from './config-submission-forms.model';
+import { ResourceType } from '../../shared/resource-type';
export class SubmissionUploadsModel extends ConfigObject {
-
+ static type = new ResourceType('submissionupload');
/**
* A list of available bitstream access conditions
*/
diff --git a/src/app/core/config/models/config.model.ts b/src/app/core/config/models/config.model.ts
index 81f20a0b3c..20d67ec69d 100644
--- a/src/app/core/config/models/config.model.ts
+++ b/src/app/core/config/models/config.model.ts
@@ -8,11 +8,6 @@ export abstract class ConfigObject implements CacheableObject {
*/
public name: string;
- /**
- * A string representing the kind of config object
- */
- public type: ResourceType;
-
/**
* The links to all related resources returned by the rest api.
*/
diff --git a/src/app/core/config/models/normalized-config-submission-definition.model.ts b/src/app/core/config/models/normalized-config-submission-definition.model.ts
new file mode 100644
index 0000000000..cb56e01acf
--- /dev/null
+++ b/src/app/core/config/models/normalized-config-submission-definition.model.ts
@@ -0,0 +1,28 @@
+import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
+import { SubmissionSectionModel } from './config-submission-section.model';
+import { PaginatedList } from '../../data/paginated-list';
+import { NormalizedConfigObject } from './normalized-config.model';
+import { SubmissionDefinitionsModel } from './config-submission-definitions.model';
+import { mapsTo } from '../../cache/builders/build-decorators';
+import { SubmissionDefinitionModel } from './config-submission-definition.model';
+
+/**
+ * Normalized class for the configuration describing the submission
+ */
+@mapsTo(SubmissionDefinitionModel)
+@inheritSerialization(NormalizedConfigObject)
+export class NormalizedSubmissionDefinitionModel extends NormalizedConfigObject {
+
+ /**
+ * A boolean representing if this submission definition is the default or not
+ */
+ @autoserialize
+ isDefault: boolean;
+
+ /**
+ * A list of SubmissionSectionModel that are present in this submission definition
+ */
+ @autoserializeAs(SubmissionSectionModel)
+ sections: PaginatedList;
+
+}
diff --git a/src/app/core/config/models/normalized-config-submission-definitions.model.ts b/src/app/core/config/models/normalized-config-submission-definitions.model.ts
index 3887c566c1..4c52d96458 100644
--- a/src/app/core/config/models/normalized-config-submission-definitions.model.ts
+++ b/src/app/core/config/models/normalized-config-submission-definitions.model.ts
@@ -1,25 +1,13 @@
-import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
-import { SubmissionSectionModel } from './config-submission-section.model';
-import { PaginatedList } from '../../data/paginated-list';
+import { inheritSerialization } from 'cerialize';
import { NormalizedConfigObject } from './normalized-config.model';
import { SubmissionDefinitionsModel } from './config-submission-definitions.model';
+import { mapsTo } from '../../cache/builders/build-decorators';
+import { NormalizedSubmissionDefinitionModel } from './normalized-config-submission-definition.model';
/**
* Normalized class for the configuration describing the submission
*/
+@mapsTo(SubmissionDefinitionsModel)
@inheritSerialization(NormalizedConfigObject)
-export class NormalizedSubmissionDefinitionsModel extends NormalizedConfigObject {
-
- /**
- * A boolean representing if this submission definition is the default or not
- */
- @autoserialize
- isDefault: boolean;
-
- /**
- * A list of SubmissionSectionModel that are present in this submission definition
- */
- @autoserializeAs(SubmissionSectionModel)
- sections: PaginatedList;
-
+export class NormalizedSubmissionDefinitionsModel extends NormalizedSubmissionDefinitionModel {
}
diff --git a/src/app/core/config/models/normalized-config-submission-form.model.ts b/src/app/core/config/models/normalized-config-submission-form.model.ts
new file mode 100644
index 0000000000..afdfef4818
--- /dev/null
+++ b/src/app/core/config/models/normalized-config-submission-form.model.ts
@@ -0,0 +1,18 @@
+import { autoserialize, inheritSerialization } from 'cerialize';
+import { NormalizedConfigObject } from './normalized-config.model';
+import { mapsTo } from '../../cache/builders/build-decorators';
+import { FormRowModel, SubmissionFormModel } from './config-submission-form.model';
+
+/**
+ * Normalized class for the configuration describing the submission form
+ */
+@mapsTo(SubmissionFormModel)
+@inheritSerialization(NormalizedConfigObject)
+export class NormalizedSubmissionFormModel extends NormalizedConfigObject {
+
+ /**
+ * An array of [FormRowModel] that are present in this form
+ */
+ @autoserialize
+ rows: FormRowModel[];
+}
diff --git a/src/app/core/config/models/normalized-config-submission-forms.model.ts b/src/app/core/config/models/normalized-config-submission-forms.model.ts
index a957e8c7fa..c040a94587 100644
--- a/src/app/core/config/models/normalized-config-submission-forms.model.ts
+++ b/src/app/core/config/models/normalized-config-submission-forms.model.ts
@@ -1,16 +1,12 @@
-import { autoserialize, inheritSerialization } from 'cerialize';
-import { NormalizedConfigObject } from './normalized-config.model';
-import { FormRowModel, SubmissionFormsModel } from './config-submission-forms.model';
+import { inheritSerialization } from 'cerialize';
+import { mapsTo } from '../../cache/builders/build-decorators';
+import { SubmissionFormsModel } from './config-submission-forms.model';
+import { NormalizedSubmissionFormModel } from './normalized-config-submission-form.model';
/**
* Normalized class for the configuration describing the submission form
*/
-@inheritSerialization(NormalizedConfigObject)
-export class NormalizedSubmissionFormsModel extends NormalizedConfigObject {
-
- /**
- * An array of [FormRowModel] that are present in this form
- */
- @autoserialize
- rows: FormRowModel[];
+@mapsTo(SubmissionFormsModel)
+@inheritSerialization(NormalizedSubmissionFormModel)
+export class NormalizedSubmissionFormsModel extends NormalizedSubmissionFormModel {
}
diff --git a/src/app/core/config/models/normalized-config-submission-section.model.ts b/src/app/core/config/models/normalized-config-submission-section.model.ts
index c876acf607..364a981060 100644
--- a/src/app/core/config/models/normalized-config-submission-section.model.ts
+++ b/src/app/core/config/models/normalized-config-submission-section.model.ts
@@ -1,14 +1,18 @@
import { autoserialize, inheritSerialization } from 'cerialize';
import { SectionsType } from '../../../submission/sections/sections-type';
import { NormalizedConfigObject } from './normalized-config.model';
-import { SubmissionFormsModel } from './config-submission-forms.model';
-import { SubmissionSectionVisibility } from './config-submission-section.model';
+import {
+ SubmissionSectionModel,
+ SubmissionSectionVisibility
+} from './config-submission-section.model';
+import { mapsTo } from '../../cache/builders/build-decorators';
/**
* Normalized class for the configuration describing the submission section
*/
+@mapsTo(SubmissionSectionModel)
@inheritSerialization(NormalizedConfigObject)
-export class NormalizedSubmissionSectionModel extends NormalizedConfigObject {
+export class NormalizedSubmissionSectionModel extends NormalizedConfigObject {
/**
* The header for this section
diff --git a/src/app/core/config/models/normalized-config-submission-sections.model.ts b/src/app/core/config/models/normalized-config-submission-sections.model.ts
new file mode 100644
index 0000000000..fb1e4c671a
--- /dev/null
+++ b/src/app/core/config/models/normalized-config-submission-sections.model.ts
@@ -0,0 +1,18 @@
+import { autoserialize, inheritSerialization } from 'cerialize';
+import { SectionsType } from '../../../submission/sections/sections-type';
+import { NormalizedConfigObject } from './normalized-config.model';
+import {
+ SubmissionSectionModel,
+ SubmissionSectionVisibility
+} from './config-submission-section.model';
+import { mapsTo } from '../../cache/builders/build-decorators';
+import { SubmissionSectionsModel } from './config-submission-sections.model';
+import { NormalizedSubmissionSectionModel } from './normalized-config-submission-section.model';
+
+/**
+ * Normalized class for the configuration describing the submission section
+ */
+@mapsTo(SubmissionSectionsModel)
+@inheritSerialization(NormalizedSubmissionSectionModel)
+export class NormalizedSubmissionSectionsModel extends NormalizedSubmissionSectionModel {
+}
diff --git a/src/app/core/config/models/normalized-config-submission-uploads.model.ts b/src/app/core/config/models/normalized-config-submission-uploads.model.ts
index e49171d6a7..7a21c15912 100644
--- a/src/app/core/config/models/normalized-config-submission-uploads.model.ts
+++ b/src/app/core/config/models/normalized-config-submission-uploads.model.ts
@@ -3,10 +3,12 @@ import { AccessConditionOption } from './config-access-condition-option.model';
import { SubmissionFormsModel } from './config-submission-forms.model';
import { NormalizedConfigObject } from './normalized-config.model';
import { SubmissionUploadsModel } from './config-submission-uploads.model';
+import { mapsTo } from '../../cache/builders/build-decorators';
/**
* Normalized class for the configuration describing the submission upload section
*/
+@mapsTo(SubmissionUploadsModel)
@inheritSerialization(NormalizedConfigObject)
export class NormalizedSubmissionUploadsModel extends NormalizedConfigObject {
diff --git a/src/app/core/config/models/normalized-config.model.ts b/src/app/core/config/models/normalized-config.model.ts
index 0b75158588..1bf4ffb826 100644
--- a/src/app/core/config/models/normalized-config.model.ts
+++ b/src/app/core/config/models/normalized-config.model.ts
@@ -1,6 +1,6 @@
import { autoserialize, inheritSerialization } from 'cerialize';
import { NormalizedObject } from '../../cache/models/normalized-object.model';
-import { CacheableObject } from '../../cache/object-cache.reducer';
+import { CacheableObject, TypedObject } from '../../cache/object-cache.reducer';
import { ResourceType } from '../../shared/resource-type';
/**
@@ -15,12 +15,6 @@ export abstract class NormalizedConfigObject implemen
@autoserialize
public name: string;
- /**
- * A string representing the kind of config object
- */
- @autoserialize
- public type: ResourceType;
-
/**
* The links to all related resources returned by the rest api.
*/
diff --git a/src/app/core/core.effects.ts b/src/app/core/core.effects.ts
index 9ade23e6c5..1aa5d2d0b1 100644
--- a/src/app/core/core.effects.ts
+++ b/src/app/core/core.effects.ts
@@ -1,4 +1,3 @@
-
import { ObjectCacheEffects } from './cache/object-cache.effects';
import { UUIDIndexEffects } from './index/index.effects';
import { RequestEffects } from './data/request.effects';
diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts
index 5bf6260dc7..60d1bce3b8 100644
--- a/src/app/core/core.module.ts
+++ b/src/app/core/core.module.ts
@@ -1,14 +1,13 @@
-import {
- ModuleWithProviders,
- NgModule,
- Optional,
- SkipSelf
-} from '@angular/core';
+import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
import { CommonModule } from '@angular/common';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
-import { DynamicFormLayoutService, DynamicFormService, DynamicFormValidationService } from '@ng-dynamic-forms/core';
+import {
+ DynamicFormLayoutService,
+ DynamicFormService,
+ DynamicFormValidationService
+} from '@ng-dynamic-forms/core';
import { coreEffects } from './core.effects';
import { coreReducers } from './core.reducers';
@@ -60,11 +59,12 @@ import { HALEndpointService } from './shared/hal-endpoint.service';
import { FacetValueResponseParsingService } from './data/facet-value-response-parsing.service';
import { FacetValueMapResponseParsingService } from './data/facet-value-map-response-parsing.service';
import { FacetConfigResponseParsingService } from './data/facet-config-response-parsing.service';
+import { ResourcePolicyService } from './data/resource-policy.service';
import { RegistryService } from './registry/registry.service';
import { RegistryMetadataschemasResponseParsingService } from './data/registry-metadataschemas-response-parsing.service';
import { RegistryMetadatafieldsResponseParsingService } from './data/registry-metadatafields-response-parsing.service';
import { RegistryBitstreamformatsResponseParsingService } from './data/registry-bitstreamformats-response-parsing.service';
-import { WorkflowitemDataService } from './submission/workflowitem-data.service';
+import { WorkflowItemDataService } from './submission/workflowitem-data.service';
import { NotificationsService } from '../shared/notifications/notifications.service';
import { UploaderService } from '../shared/uploader/uploader.service';
import { FileService } from './shared/file.service';
@@ -81,6 +81,26 @@ import { DSOChangeAnalyzer } from './data/dso-change-analyzer.service';
import { ObjectUpdatesService } from './data/object-updates/object-updates.service';
import { DefaultChangeAnalyzer } from './data/default-change-analyzer.service';
import { SearchService } from '../+search-page/search-service/search.service';
+import { NormalizedCollection } from './cache/models/normalized-collection.model';
+import { NormalizedCommunity } from './cache/models/normalized-community.model';
+import { NormalizedDSpaceObject } from './cache/models/normalized-dspace-object.model';
+import { NormalizedBitstream } from './cache/models/normalized-bitstream.model';
+import { NormalizedBundle } from './cache/models/normalized-bundle.model';
+import { NormalizedBitstreamFormat } from './cache/models/normalized-bitstream-format.model';
+import { NormalizedItem } from './cache/models/normalized-item.model';
+import { NormalizedEPerson } from './eperson/models/normalized-eperson.model';
+import { NormalizedGroup } from './eperson/models/normalized-group.model';
+import { NormalizedResourcePolicy } from './cache/models/normalized-resource-policy.model';
+import { NormalizedMetadataSchema } from './metadata/normalized-metadata-schema.model';
+import { NormalizedMetadataField } from './metadata/normalized-metadata-field.model';
+import { NormalizedLicense } from './cache/models/normalized-license.model';
+import { NormalizedWorkflowItem } from './submission/models/normalized-workflowitem.model';
+import { NormalizedWorkspaceItem } from './submission/models/normalized-workspaceitem.model';
+import { NormalizedSubmissionDefinitionsModel } from './config/models/normalized-config-submission-definitions.model';
+import { NormalizedSubmissionFormsModel } from './config/models/normalized-config-submission-forms.model';
+import { NormalizedSubmissionSectionModel } from './config/models/normalized-config-submission-section.model';
+import { NormalizedAuthStatus } from './auth/models/normalized-auth-status.model';
+import { NormalizedAuthorityValue } from './integration/models/normalized-authority-value.model';
import { RoleService } from './roles/role.service';
import { MyDSpaceGuard } from '../+my-dspace-page/my-dspace.guard';
import { MyDSpaceResponseParsingService } from './data/mydspace-response-parsing.service';
@@ -88,6 +108,16 @@ import { ClaimedTaskDataService } from './tasks/claimed-task-data.service';
import { PoolTaskDataService } from './tasks/pool-task-data.service';
import { TaskResponseParsingService } from './tasks/task-response-parsing.service';
import { BitstreamFormatDataService } from './data/bitstream-format-data.service';
+import { NormalizedClaimedTask } from './tasks/models/normalized-claimed-task-object.model';
+import { NormalizedTaskObject } from './tasks/models/normalized-task-object.model';
+import { NormalizedPoolTask } from './tasks/models/normalized-pool-task-object.model';
+import { NormalizedRelationship } from './cache/models/items/normalized-relationship.model';
+import { NormalizedRelationshipType } from './cache/models/items/normalized-relationship-type.model';
+import { NormalizedItemType } from './cache/models/items/normalized-item-type.model';
+import { MetadatafieldParsingService } from './data/metadatafield-parsing.service';
+import { NormalizedSubmissionUploadsModel } from './config/models/normalized-config-submission-uploads.model';
+import { NormalizedBrowseEntry } from './shared/normalized-browse-entry.model';
+import { BrowseDefinition } from './shared/browse-definition.model';
const IMPORTS = [
CommonModule,
@@ -95,13 +125,9 @@ const IMPORTS = [
EffectsModule.forFeature(coreEffects)
];
-const DECLARATIONS = [
+const DECLARATIONS = [];
-];
-
-const EXPORTS = [
-
-];
+const EXPORTS = [];
const PROVIDERS = [
ApiService,
@@ -126,6 +152,7 @@ const PROVIDERS = [
MetadataService,
ObjectCacheService,
PaginationComponentOptions,
+ ResourcePolicyService,
RegistryService,
BitstreamFormatDataService,
NormalizedObjectBuildService,
@@ -158,11 +185,12 @@ const PROVIDERS = [
AuthorityService,
IntegrationResponseParsingService,
MetadataschemaParsingService,
+ MetadatafieldParsingService,
UploaderService,
UUIDService,
NotificationsService,
WorkspaceitemDataService,
- WorkflowitemDataService,
+ WorkflowItemDataService,
UploaderService,
FileService,
DSpaceObjectDataService,
@@ -188,6 +216,42 @@ const PROVIDERS = [
{ provide: NativeWindowService, useFactory: NativeWindowFactory }
];
+/**
+ * Declaration needed to make sure all decorator functions are called in time
+ */
+export const normalizedModels =
+ [
+ NormalizedDSpaceObject,
+ NormalizedBundle,
+ NormalizedBitstream,
+ NormalizedBitstreamFormat,
+ NormalizedItem,
+ NormalizedCollection,
+ NormalizedCommunity,
+ NormalizedEPerson,
+ NormalizedGroup,
+ NormalizedResourcePolicy,
+ NormalizedMetadataSchema,
+ NormalizedMetadataField,
+ NormalizedLicense,
+ NormalizedWorkflowItem,
+ NormalizedWorkspaceItem,
+ NormalizedSubmissionDefinitionsModel,
+ NormalizedSubmissionFormsModel,
+ NormalizedSubmissionSectionModel,
+ NormalizedSubmissionUploadsModel,
+ NormalizedAuthStatus,
+ NormalizedAuthorityValue,
+ NormalizedBrowseEntry,
+ BrowseDefinition,
+ NormalizedClaimedTask,
+ NormalizedTaskObject,
+ NormalizedPoolTask,
+ NormalizedRelationship,
+ NormalizedRelationshipType,
+ NormalizedItemType
+ ];
+
@NgModule({
imports: [
...IMPORTS
@@ -202,8 +266,8 @@ const PROVIDERS = [
...PROVIDERS
]
})
-export class CoreModule {
+export class CoreModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: CoreModule,
@@ -213,10 +277,9 @@ export class CoreModule {
};
}
- constructor( @Optional() @SkipSelf() parentModule: CoreModule) {
+ constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
if (isNotEmpty(parentModule)) {
throw new Error('CoreModule is already loaded. Import it in the AppModule only');
}
}
-
}
diff --git a/src/app/core/data/base-response-parsing.service.ts b/src/app/core/data/base-response-parsing.service.ts
index 4ede02778c..0ed5dc363c 100644
--- a/src/app/core/data/base-response-parsing.service.ts
+++ b/src/app/core/data/base-response-parsing.service.ts
@@ -7,16 +7,16 @@ import { GlobalConfig } from '../../../config/global-config.interface';
import { GenericConstructor } from '../shared/generic-constructor';
import { PaginatedList } from './paginated-list';
import { isRestDataObject, isRestPaginatedList } from '../cache/builders/normalized-object-build.service';
-
+import { ResourceType } from '../shared/resource-type';
+import { getMapsToType } from '../cache/builders/build-decorators';
/* tslint:disable:max-classes-per-file */
export abstract class BaseResponseParsingService {
protected abstract EnvConfig: GlobalConfig;
protected abstract objectCache: ObjectCacheService;
- protected abstract objectFactory: any;
protected abstract toCache: boolean;
- protected process(data: any, requestUUID: string): any {
+ protected process(data: any, requestUUID: string): any {
if (isNotEmpty(data)) {
if (hasNoValue(data) || (typeof data !== 'object')) {
return data;
@@ -31,7 +31,7 @@ export abstract class BaseResponseParsingService {
.keys(data._embedded)
.filter((property) => data._embedded.hasOwnProperty(property))
.forEach((property) => {
- const parsedObj = this.process(data._embedded[property], requestUUID);
+ const parsedObj = this.process(data._embedded[property], requestUUID);
if (isNotEmpty(parsedObj)) {
if (isRestPaginatedList(data._embedded[property])) {
object[property] = parsedObj;
@@ -60,7 +60,7 @@ export abstract class BaseResponseParsingService {
}
}
- protected processPaginatedList(data: any, requestUUID: string): PaginatedList {
+ protected processPaginatedList(data: any, requestUUID: string): PaginatedList {
const pageInfo: PageInfo = this.processPageInfo(data);
let list = data._embedded;
@@ -74,7 +74,7 @@ export abstract class BaseResponseParsingService {
return new PaginatedList(pageInfo, page, );
}
- protected processArray(data: any, requestUUID: string): ObjectDomain[] {
+ protected processArray(data: any, requestUUID: string): ObjectDomain[] {
let array: ObjectDomain[] = [];
data.forEach((datum) => {
array = [...array, this.process(datum, requestUUID)];
@@ -83,10 +83,10 @@ export abstract class BaseResponseParsingService {
return array;
}
- protected deserialize(obj): any {
- const type: ObjectType = obj.type;
+ protected deserialize(obj): any {
+ const type: string = obj.type;
if (hasValue(type)) {
- const normObjConstructor = this.objectFactory.getConstructor(type) as GenericConstructor;
+ const normObjConstructor = getMapsToType(type) as GenericConstructor;
if (hasValue(normObjConstructor)) {
const serializer = new DSpaceRESTv2Serializer(normObjConstructor);
@@ -104,7 +104,7 @@ export abstract class BaseResponseParsingService {
}
}
- protected cache(obj, requestUUID) {
+ protected cache(obj, requestUUID) {
if (this.toCache) {
this.addToObjectCache(obj, requestUUID);
}
diff --git a/src/app/core/data/browse-entries-response-parsing.service.ts b/src/app/core/data/browse-entries-response-parsing.service.ts
index 4690d738ed..a2f5f21312 100644
--- a/src/app/core/data/browse-entries-response-parsing.service.ts
+++ b/src/app/core/data/browse-entries-response-parsing.service.ts
@@ -3,24 +3,17 @@ import { GLOBAL_CONFIG } from '../../../config';
import { GlobalConfig } from '../../../config/global-config.interface';
import { isNotEmpty } from '../../shared/empty.util';
import { ObjectCacheService } from '../cache/object-cache.service';
-import {
- ErrorResponse,
- GenericSuccessResponse,
- RestResponse
-} from '../cache/response.models';
+import { ErrorResponse, GenericSuccessResponse, RestResponse } from '../cache/response.models';
import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.model';
import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer';
-import { BrowseEntry } from '../shared/browse-entry.model';
import { BaseResponseParsingService } from './base-response-parsing.service';
import { ResponseParsingService } from './parsing.service';
import { RestRequest } from './request.models';
+import { NormalizedBrowseEntry } from '../shared/normalized-browse-entry.model';
@Injectable()
export class BrowseEntriesResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
- protected objectFactory = {
- getConstructor: () => BrowseEntry
- };
protected toCache = false;
constructor(
@@ -33,7 +26,7 @@ export class BrowseEntriesResponseParsingService extends BaseResponseParsingServ
if (isNotEmpty(data.payload)) {
let browseEntries = [];
if (isNotEmpty(data.payload._embedded) && Array.isArray(data.payload._embedded[Object.keys(data.payload._embedded)[0]])) {
- const serializer = new DSpaceRESTv2Serializer(BrowseEntry);
+ const serializer = new DSpaceRESTv2Serializer(NormalizedBrowseEntry);
browseEntries = serializer.deserializeArray(data.payload._embedded[Object.keys(data.payload._embedded)[0]]);
}
return new GenericSuccessResponse(browseEntries, data.statusCode, data.statusText, this.processPageInfo(data.payload));
diff --git a/src/app/core/data/browse-items-response-parsing-service.ts b/src/app/core/data/browse-items-response-parsing-service.ts
index fb950f6c68..324b36199a 100644
--- a/src/app/core/data/browse-items-response-parsing-service.ts
+++ b/src/app/core/data/browse-items-response-parsing-service.ts
@@ -18,10 +18,6 @@ import { NormalizedDSpaceObject } from '../cache/models/normalized-dspace-object
*/
@Injectable()
export class BrowseItemsResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
-
- protected objectFactory = {
- getConstructor: () => DSpaceObject
- };
protected toCache = false;
constructor(
diff --git a/src/app/core/data/browse-response-parsing.service.spec.ts b/src/app/core/data/browse-response-parsing.service.spec.ts
index c1b0566e0b..8d0fe7cd41 100644
--- a/src/app/core/data/browse-response-parsing.service.spec.ts
+++ b/src/app/core/data/browse-response-parsing.service.spec.ts
@@ -113,7 +113,6 @@ describe('BrowseResponseParsingService', () => {
}
],
defaultSortOrder: 'ASC',
- type: 'browse',
metadataKeys: [
'dc.date.issued'
],
@@ -139,7 +138,6 @@ describe('BrowseResponseParsingService', () => {
}
],
defaultSortOrder: 'ASC',
- type: 'browse',
metadataKeys: [
'dc.contributor.*',
'dc.creator'
@@ -173,6 +171,5 @@ describe('BrowseResponseParsingService', () => {
const response = service.parse(validRequest, validResponse);
expect((response as GenericSuccessResponse).payload).toEqual(definitions);
});
-
});
});
diff --git a/src/app/core/data/comcol-data.service.spec.ts b/src/app/core/data/comcol-data.service.spec.ts
index 7f628fc5b9..b5232b0bff 100644
--- a/src/app/core/data/comcol-data.service.spec.ts
+++ b/src/app/core/data/comcol-data.service.spec.ts
@@ -89,7 +89,7 @@ describe('ComColDataService', () => {
function initMockCommunityDataService(): CommunityDataService {
return jasmine.createSpyObj('responseCache', {
getEndpoint: hot('--a-', { a: communitiesEndpoint }),
- getIDHref: cold('b-', { b: communityEndpoint })
+ getIDHref: communityEndpoint
});
}
diff --git a/src/app/core/data/comcol-data.service.ts b/src/app/core/data/comcol-data.service.ts
index 9d82cc5047..68eb3e4880 100644
--- a/src/app/core/data/comcol-data.service.ts
+++ b/src/app/core/data/comcol-data.service.ts
@@ -31,7 +31,7 @@ export abstract class ComColDataService extends DataS
return this.halService.getEndpoint(linkPath);
} else {
const scopeCommunityHrefObs = this.cds.getEndpoint().pipe(
- mergeMap((endpoint: string) => this.cds.getIDHref(endpoint, options.scopeID)),
+ map((endpoint: string) => this.cds.getIDHref(endpoint, options.scopeID)),
filter((href: string) => isNotEmpty(href)),
take(1),
tap((href: string) => {
diff --git a/src/app/core/data/data.service.ts b/src/app/core/data/data.service.ts
index fc4da69a5c..ad0db51980 100644
--- a/src/app/core/data/data.service.ts
+++ b/src/app/core/data/data.service.ts
@@ -31,12 +31,12 @@ import { configureRequest, getResponseFromEntry } from '../shared/operators';
import { ErrorResponse, RestResponse } from '../cache/response.models';
import { NotificationOptions } from '../../shared/notifications/models/notification-options.model';
import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer';
-import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory';
import { CacheableObject } from '../cache/object-cache.reducer';
import { RequestEntry } from './request.reducer';
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
import { ChangeAnalyzer } from './change-analyzer';
import { RestRequestMethod } from './rest-request-method';
+import { getMapsToType } from '../cache/builders/build-decorators';
export abstract class DataService {
protected abstract requestService: RequestService;
@@ -243,7 +243,7 @@ export abstract class DataService {
);
const normalizedObject: NormalizedObject = this.dataBuildService.normalize(dso);
- const serializedDso = new DSpaceRESTv2Serializer(NormalizedObjectFactory.getConstructor(dso.type)).serialize(normalizedObject);
+ const serializedDso = new DSpaceRESTv2Serializer(getMapsToType((dso as any).type)).serialize(normalizedObject);
const request$ = endpoint$.pipe(
take(1),
diff --git a/src/app/core/data/dso-response-parsing.service.ts b/src/app/core/data/dso-response-parsing.service.ts
index eb95cdae8a..d6c3b2caa6 100644
--- a/src/app/core/data/dso-response-parsing.service.ts
+++ b/src/app/core/data/dso-response-parsing.service.ts
@@ -4,8 +4,6 @@ import { ObjectCacheService } from '../cache/object-cache.service';
import { GlobalConfig } from '../../../config/global-config.interface';
import { GLOBAL_CONFIG } from '../../../config';
import { NormalizedObject } from '../cache/models/normalized-object.model';
-import { ResourceType } from '../shared/resource-type';
-import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory';
import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.model';
import { RestResponse, DSOSuccessResponse } from '../cache/response.models';
import { RestRequest } from './request.models';
@@ -17,8 +15,6 @@ import { DSpaceObject } from '../shared/dspace-object.model';
@Injectable()
export class DSOResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
-
- protected objectFactory = NormalizedObjectFactory;
protected toCache = true;
constructor(
@@ -34,7 +30,7 @@ export class DSOResponseParsingService extends BaseResponseParsingService implem
if (hasValue(data.payload) && hasValue(data.payload.page) && data.payload.page.totalElements === 0) {
processRequestDTO = { page: [] };
} else {
- processRequestDTO = this.process, ResourceType>(data.payload, request.uuid);
+ processRequestDTO = this.process>(data.payload, request.uuid);
}
let objectList = processRequestDTO;
diff --git a/src/app/core/data/facet-config-response-parsing.service.ts b/src/app/core/data/facet-config-response-parsing.service.ts
index e65e317642..15f520b249 100644
--- a/src/app/core/data/facet-config-response-parsing.service.ts
+++ b/src/app/core/data/facet-config-response-parsing.service.ts
@@ -15,7 +15,6 @@ import { GLOBAL_CONFIG } from '../../../config';
@Injectable()
export class FacetConfigResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
- objectFactory = {};
toCache = false;
constructor(
@Inject(GLOBAL_CONFIG) protected EnvConfig: GlobalConfig,
diff --git a/src/app/core/data/facet-value-map-response-parsing.service.ts b/src/app/core/data/facet-value-map-response-parsing.service.ts
index e03c1a78df..b67cef97c0 100644
--- a/src/app/core/data/facet-value-map-response-parsing.service.ts
+++ b/src/app/core/data/facet-value-map-response-parsing.service.ts
@@ -17,7 +17,6 @@ import { GLOBAL_CONFIG } from '../../../config';
@Injectable()
export class FacetValueMapResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
- objectFactory = {};
toCache = false;
constructor(
diff --git a/src/app/core/data/facet-value-response-parsing.service.ts b/src/app/core/data/facet-value-response-parsing.service.ts
index e7665ebed2..49d72e0a01 100644
--- a/src/app/core/data/facet-value-response-parsing.service.ts
+++ b/src/app/core/data/facet-value-response-parsing.service.ts
@@ -12,7 +12,6 @@ import { GlobalConfig } from '../../../config/global-config.interface';
@Injectable()
export class FacetValueResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
- objectFactory = {};
toCache = false;
constructor(
@Inject(GLOBAL_CONFIG) protected EnvConfig: GlobalConfig,
diff --git a/src/app/core/data/metadata-schema-data.service.ts b/src/app/core/data/metadata-schema-data.service.ts
index 1d2bf3b221..4baca6e8ed 100644
--- a/src/app/core/data/metadata-schema-data.service.ts
+++ b/src/app/core/data/metadata-schema-data.service.ts
@@ -9,19 +9,42 @@ import { RequestService } from './request.service';
import { HALEndpointService } from '../shared/hal-endpoint.service';
import { FindAllOptions } from './request.models';
import { ObjectCacheService } from '../cache/object-cache.service';
-import { MetadataSchema } from '../metadata/metadataschema.model';
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
import { HttpClient } from '@angular/common/http';
import { NotificationsService } from '../../shared/notifications/notifications.service';
+import { ChangeAnalyzer } from './change-analyzer';
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
+import { MetadataSchema } from '../metadata/metadata-schema.model';
+
+/* tslint:disable:max-classes-per-file */
+class DataServiceImpl extends DataService {
+ protected linkPath = 'metadataschemas';
+ protected forceBypassCache = false;
+
+ constructor(
+ protected requestService: RequestService,
+ protected rdbService: RemoteDataBuildService,
+ protected dataBuildService: NormalizedObjectBuildService,
+ protected store: Store,
+ protected objectCache: ObjectCacheService,
+ protected halService: HALEndpointService,
+ protected notificationsService: NotificationsService,
+ protected http: HttpClient,
+ protected comparator: ChangeAnalyzer) {
+ super();
+ }
+
+ getBrowseEndpoint(options: FindAllOptions = {}, linkPath: string = this.linkPath): Observable {
+ return this.halService.getEndpoint(linkPath);
+ }
+}
/**
* A service responsible for fetching/sending data from/to the REST API on the metadataschemas endpoint
*/
@Injectable()
-export class MetadataSchemaDataService extends DataService {
- protected linkPath = 'metadataschemas';
- protected forceBypassCache = false;
+export class MetadataSchemaDataService {
+ private dataService: DataServiceImpl;
constructor(
protected requestService: RequestService,
@@ -33,17 +56,6 @@ export class MetadataSchemaDataService extends DataService {
protected dataBuildService: NormalizedObjectBuildService,
protected http: HttpClient,
protected notificationsService: NotificationsService) {
- super();
+ this.dataService = new DataServiceImpl(requestService, rdbService, dataBuildService, null, objectCache, halService, notificationsService, http, comparator);
}
-
- /**
- * Get the endpoint for browsing metadataschemas
- * @param {FindAllOptions} options
- * @returns {Observable}
- */
- public getBrowseEndpoint(options: FindAllOptions = {}, linkPath: string = this.linkPath): Observable {
-
- return null;
- }
-
}
diff --git a/src/app/core/data/metadatafield-parsing.service.ts b/src/app/core/data/metadatafield-parsing.service.ts
index f9582c394d..092285e9c5 100644
--- a/src/app/core/data/metadatafield-parsing.service.ts
+++ b/src/app/core/data/metadatafield-parsing.service.ts
@@ -3,8 +3,8 @@ import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.
import { RestRequest } from './request.models';
import { ResponseParsingService } from './parsing.service';
import { Injectable } from '@angular/core';
-import { MetadatafieldSuccessResponse, MetadataschemaSuccessResponse, RestResponse } from '../cache/response.models';
-import { MetadataField } from '../metadata/metadatafield.model';
+import { MetadatafieldSuccessResponse, RestResponse } from '../cache/response.models';
+import { MetadataField } from '../metadata/metadata-field.model';
/**
* A service responsible for parsing DSpaceRESTV2Response data related to a single MetadataField to a valid RestResponse
diff --git a/src/app/core/data/metadataschema-parsing.service.ts b/src/app/core/data/metadataschema-parsing.service.ts
index f76d6ed2e3..3e9fd257bb 100644
--- a/src/app/core/data/metadataschema-parsing.service.ts
+++ b/src/app/core/data/metadataschema-parsing.service.ts
@@ -1,10 +1,10 @@
-import { MetadataSchema } from '../metadata/metadataschema.model';
import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer';
import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.model';
import { RestRequest } from './request.models';
import { ResponseParsingService } from './parsing.service';
import { Injectable } from '@angular/core';
import { MetadataschemaSuccessResponse, RestResponse } from '../cache/response.models';
+import { MetadataSchema } from '../metadata/metadata-schema.model';
@Injectable()
export class MetadataschemaParsingService implements ResponseParsingService {
diff --git a/src/app/core/data/request.effects.ts b/src/app/core/data/request.effects.ts
index 5e7bec698b..9ef85bfe8b 100644
--- a/src/app/core/data/request.effects.ts
+++ b/src/app/core/data/request.effects.ts
@@ -17,10 +17,10 @@ import { RequestError, RestRequest } from './request.models';
import { RequestEntry } from './request.reducer';
import { RequestService } from './request.service';
import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer';
-import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory';
import { catchError, filter, flatMap, map, take, tap } from 'rxjs/operators';
import { ErrorResponse, RestResponse } from '../cache/response.models';
import { StoreActionTypes } from '../../store.actions';
+import { getMapsToType } from '../cache/builders/build-decorators';
export const addToResponseCacheAndCompleteAction = (request: RestRequest, envConfig: GlobalConfig) =>
(source: Observable): Observable =>
@@ -45,7 +45,7 @@ export class RequestEffects {
flatMap((request: RestRequest) => {
let body;
if (isNotEmpty(request.body)) {
- const serializer = new DSpaceRESTv2Serializer(NormalizedObjectFactory.getConstructor(request.body.type));
+ const serializer = new DSpaceRESTv2Serializer(getMapsToType(request.body.type));
body = serializer.serialize(request.body);
}
return this.restApi.request(request.method, request.href, body, request.options).pipe(
diff --git a/src/app/core/data/resource-policy.service.spec.ts b/src/app/core/data/resource-policy.service.spec.ts
new file mode 100644
index 0000000000..35d28684a7
--- /dev/null
+++ b/src/app/core/data/resource-policy.service.spec.ts
@@ -0,0 +1,77 @@
+import { cold, getTestScheduler } from 'jasmine-marbles';
+import { TestScheduler } from 'rxjs/testing';
+import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
+import { ResourcePolicy } from '../shared/resource-policy.model';
+import { HALEndpointService } from '../shared/hal-endpoint.service';
+import { GetRequest } from './request.models';
+import { RequestService } from './request.service';
+import { ResourcePolicyService } from './resource-policy.service';
+import { ObjectCacheService } from '../cache/object-cache.service';
+import { NotificationsService } from '../../shared/notifications/notifications.service';
+import { HttpClient } from '@angular/common/http';
+import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
+
+describe('ResourcePolicyService', () => {
+ let scheduler: TestScheduler;
+ let service: ResourcePolicyService;
+ let requestService: RequestService;
+ let rdbService: RemoteDataBuildService;
+ let objectCache: ObjectCacheService;
+ const testObject = {
+ uuid: '664184ee-b254-45e8-970d-220e5ccc060b'
+ } as ResourcePolicy;
+ const requestURL = `https://rest.api/rest/api/resourcepolicies/${testObject.uuid}`;
+ const requestUUID = '8b3c613a-5a4b-438b-9686-be1d5b4a1c5a';
+
+ beforeEach(() => {
+ scheduler = getTestScheduler();
+
+ requestService = jasmine.createSpyObj('requestService', {
+ generateRequestId: requestUUID,
+ configure: true
+ });
+ rdbService = jasmine.createSpyObj('rdbService', {
+ buildSingle: cold('a', {
+ a: {
+ payload: testObject
+ }
+ })
+ });
+ objectCache = {} as ObjectCacheService;
+ const halService = {} as HALEndpointService;
+ const notificationsService = {} as NotificationsService;
+ const http = {} as HttpClient;
+ const comparator = {} as any;
+ const dataBuildService = {} as NormalizedObjectBuildService;
+
+ service = new ResourcePolicyService(
+ requestService,
+ rdbService,
+ dataBuildService,
+ objectCache,
+ halService,
+ notificationsService,
+ http,
+ comparator
+ )
+ });
+
+ describe('findByHref', () => {
+ it('should configure the proper GetRequest', () => {
+ scheduler.schedule(() => service.findByHref(requestURL));
+ scheduler.flush();
+
+ expect(requestService.configure).toHaveBeenCalledWith(new GetRequest(requestUUID, requestURL, null), false);
+ });
+
+ it('should return a RemoteData for the object with the given URL', () => {
+ const result = service.findByHref(requestURL);
+ const expected = cold('a', {
+ a: {
+ payload: testObject
+ }
+ });
+ expect(result).toBeObservable(expected);
+ });
+ });
+});
diff --git a/src/app/core/data/resource-policy.service.ts b/src/app/core/data/resource-policy.service.ts
new file mode 100644
index 0000000000..1a6a1afedc
--- /dev/null
+++ b/src/app/core/data/resource-policy.service.ts
@@ -0,0 +1,67 @@
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+
+import { Store } from '@ngrx/store';
+import { Observable } from 'rxjs';
+
+import { DataService } from '../data/data.service';
+import { RequestService } from '../data/request.service';
+import { FindAllOptions } from '../data/request.models';
+import { HALEndpointService } from '../shared/hal-endpoint.service';
+import { ResourcePolicy } from '../shared/resource-policy.model';
+import { RemoteData } from '../data/remote-data';
+import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
+import { CoreState } from '../core.reducers';
+import { ObjectCacheService } from '../cache/object-cache.service';
+import { NotificationsService } from '../../shared/notifications/notifications.service';
+import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
+import { ChangeAnalyzer } from './change-analyzer';
+import { DefaultChangeAnalyzer } from '../data/default-change-analyzer.service';
+import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
+
+/* tslint:disable:max-classes-per-file */
+class DataServiceImpl extends DataService {
+ protected linkPath = 'resourcepolicies';
+ protected forceBypassCache = false;
+
+ constructor(
+ protected requestService: RequestService,
+ protected rdbService: RemoteDataBuildService,
+ protected dataBuildService: NormalizedObjectBuildService,
+ protected store: Store,
+ protected objectCache: ObjectCacheService,
+ protected halService: HALEndpointService,
+ protected notificationsService: NotificationsService,
+ protected http: HttpClient,
+ protected comparator: ChangeAnalyzer) {
+ super();
+ }
+
+ getBrowseEndpoint(options: FindAllOptions = {}, linkPath: string = this.linkPath): Observable {
+ return this.halService.getEndpoint(linkPath);
+ }
+}
+
+/**
+ * A service responsible for fetching/sending data from/to the REST API on the resourcepolicies endpoint
+ */
+@Injectable()
+export class ResourcePolicyService {
+ private dataService: DataServiceImpl;
+
+ constructor(
+ protected requestService: RequestService,
+ protected rdbService: RemoteDataBuildService,
+ protected dataBuildService: NormalizedObjectBuildService,
+ protected objectCache: ObjectCacheService,
+ protected halService: HALEndpointService,
+ protected notificationsService: NotificationsService,
+ protected http: HttpClient,
+ protected comparator: DefaultChangeAnalyzer) {
+ this.dataService = new DataServiceImpl(requestService, rdbService, dataBuildService, null, objectCache, halService, notificationsService, http, comparator);
+ }
+
+ findByHref(href: string, options?: HttpOptions): Observable> {
+ return this.dataService.findByHref(href, options);
+ }
+}
diff --git a/src/app/core/eperson/eperson-response-parsing.service.ts b/src/app/core/eperson/eperson-response-parsing.service.ts
index 6c591b0b99..481f37d1fa 100644
--- a/src/app/core/eperson/eperson-response-parsing.service.ts
+++ b/src/app/core/eperson/eperson-response-parsing.service.ts
@@ -9,8 +9,6 @@ import { BaseResponseParsingService } from '../data/base-response-parsing.servic
import { GLOBAL_CONFIG } from '../../../config';
import { GlobalConfig } from '../../../config/global-config.interface';
import { ObjectCacheService } from '../cache/object-cache.service';
-import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory';
-import { ResourceType } from '../shared/resource-type';
import { DSpaceObject } from '../shared/dspace-object.model';
/**
@@ -19,7 +17,6 @@ import { DSpaceObject } from '../shared/dspace-object.model';
@Injectable()
export class EpersonResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
- protected objectFactory = NormalizedObjectFactory;
protected toCache = false;
constructor(
@@ -31,7 +28,7 @@ export class EpersonResponseParsingService extends BaseResponseParsingService im
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links)) {
- const epersonDefinition = this.process(data.payload, request.href);
+ const epersonDefinition = this.process(data.payload, request.href);
return new EpersonSuccessResponse(epersonDefinition[Object.keys(epersonDefinition)[0]], data.statusCode, data.statusText, this.processPageInfo(data.payload));
} else {
return new ErrorResponse(
diff --git a/src/app/core/eperson/models/eperson.model.ts b/src/app/core/eperson/models/eperson.model.ts
index f8c11c1201..d99a059e8b 100644
--- a/src/app/core/eperson/models/eperson.model.ts
+++ b/src/app/core/eperson/models/eperson.model.ts
@@ -4,8 +4,10 @@ import { DSpaceObject } from '../../shared/dspace-object.model';
import { Group } from './group.model';
import { RemoteData } from '../../data/remote-data';
import { PaginatedList } from '../../data/paginated-list';
+import { ResourceType } from '../../shared/resource-type';
export class EPerson extends DSpaceObject {
+ static type = new ResourceType('eperson');
/**
* A string representing the unique handle of this Collection
diff --git a/src/app/core/eperson/models/group.model.ts b/src/app/core/eperson/models/group.model.ts
index 91ce5d90f3..9c14c20de7 100644
--- a/src/app/core/eperson/models/group.model.ts
+++ b/src/app/core/eperson/models/group.model.ts
@@ -3,8 +3,10 @@ import { Observable } from 'rxjs';
import { DSpaceObject } from '../../shared/dspace-object.model';
import { PaginatedList } from '../../data/paginated-list';
import { RemoteData } from '../../data/remote-data';
+import { ResourceType } from '../../shared/resource-type';
export class Group extends DSpaceObject {
+ static type = new ResourceType('group');
/**
* List of Groups that this Group belong to
diff --git a/src/app/core/eperson/models/normalized-eperson.model.ts b/src/app/core/eperson/models/normalized-eperson.model.ts
index ad4b20ee80..bf644a83ef 100644
--- a/src/app/core/eperson/models/normalized-eperson.model.ts
+++ b/src/app/core/eperson/models/normalized-eperson.model.ts
@@ -5,12 +5,11 @@ import { ListableObject } from '../../../shared/object-collection/shared/listabl
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
import { EPerson } from './eperson.model';
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
-import { ResourceType } from '../../shared/resource-type';
+import { Group } from './group.model';
@mapsTo(EPerson)
@inheritSerialization(NormalizedDSpaceObject)
export class NormalizedEPerson extends NormalizedDSpaceObject implements CacheableObject, ListableObject {
-
/**
* A string representing the unique handle of this EPerson
*/
@@ -21,7 +20,7 @@ export class NormalizedEPerson extends NormalizedDSpaceObject implement
* List of Groups that this EPerson belong to
*/
@deserialize
- @relationship(ResourceType.Group, true)
+ @relationship(Group, true)
groups: string[];
/**
diff --git a/src/app/core/eperson/models/normalized-group.model.ts b/src/app/core/eperson/models/normalized-group.model.ts
index f86bec8628..329ffb8adf 100644
--- a/src/app/core/eperson/models/normalized-group.model.ts
+++ b/src/app/core/eperson/models/normalized-group.model.ts
@@ -5,7 +5,6 @@ import { ListableObject } from '../../../shared/object-collection/shared/listabl
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
import { Group } from './group.model';
-import { ResourceType } from '../../shared/resource-type';
@mapsTo(Group)
@inheritSerialization(NormalizedDSpaceObject)
@@ -15,7 +14,7 @@ export class NormalizedGroup extends NormalizedDSpaceObject implements Ca
* List of Groups that this Group belong to
*/
@deserialize
- @relationship(ResourceType.Group, true)
+ @relationship(Group, true)
groups: string[];
/**
diff --git a/src/app/core/integration/integration-object-factory.ts b/src/app/core/integration/integration-object-factory.ts
deleted file mode 100644
index f66a070fdf..0000000000
--- a/src/app/core/integration/integration-object-factory.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { GenericConstructor } from '../shared/generic-constructor';
-import { IntegrationType } from './intergration-type';
-import { IntegrationModel } from './models/integration.model';
-import { NormalizedAuthorityValue } from './models/normalized-authority-value.model';
-
-export class IntegrationObjectFactory {
- public static getConstructor(type): GenericConstructor {
- switch (type) {
- case IntegrationType.Authority: {
- return NormalizedAuthorityValue;
- }
- default: {
- return undefined;
- }
- }
- }
-}
diff --git a/src/app/core/integration/integration-response-parsing.service.ts b/src/app/core/integration/integration-response-parsing.service.ts
index 2d3693cf3d..8cc0f8d252 100644
--- a/src/app/core/integration/integration-response-parsing.service.ts
+++ b/src/app/core/integration/integration-response-parsing.service.ts
@@ -2,27 +2,20 @@ import { Inject, Injectable } from '@angular/core';
import { RestRequest } from '../data/request.models';
import { ResponseParsingService } from '../data/parsing.service';
import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.model';
-import {
- ErrorResponse,
- IntegrationSuccessResponse,
- RestResponse
-} from '../cache/response.models';
+import { ErrorResponse, IntegrationSuccessResponse, RestResponse } from '../cache/response.models';
import { isNotEmpty } from '../../shared/empty.util';
-import { IntegrationObjectFactory } from './integration-object-factory';
import { BaseResponseParsingService } from '../data/base-response-parsing.service';
import { GLOBAL_CONFIG } from '../../../config';
import { GlobalConfig } from '../../../config/global-config.interface';
import { ObjectCacheService } from '../cache/object-cache.service';
import { IntegrationModel } from './models/integration.model';
-import { IntegrationType } from './intergration-type';
import { AuthorityValue } from './models/authority.value';
import { PaginatedList } from '../data/paginated-list';
@Injectable()
export class IntegrationResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
- protected objectFactory = IntegrationObjectFactory;
protected toCache = true;
constructor(
@@ -34,7 +27,7 @@ export class IntegrationResponseParsingService extends BaseResponseParsingServic
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links)) {
- const dataDefinition = this.process(data.payload, request.uuid);
+ const dataDefinition = this.process(data.payload, request.uuid);
return new IntegrationSuccessResponse(this.processResponse(dataDefinition), data.statusCode, data.statusText, this.processPageInfo(data.payload));
} else {
return new ErrorResponse(
@@ -49,7 +42,7 @@ export class IntegrationResponseParsingService extends BaseResponseParsingServic
protected processResponse(data: PaginatedList): any {
const returnList = Array.of();
data.page.forEach((item, index) => {
- if (item.type === IntegrationType.Authority) {
+ if (item.type === AuthorityValue.type.value) {
data.page[index] = Object.assign(new AuthorityValue(), item);
}
});
diff --git a/src/app/core/integration/intergration-type.ts b/src/app/core/integration/intergration-type.ts
deleted file mode 100644
index 882dc6d8ce..0000000000
--- a/src/app/core/integration/intergration-type.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-
-export enum IntegrationType {
- Authority = 'authority'
-}
diff --git a/src/app/core/integration/models/authority.value.ts b/src/app/core/integration/models/authority.value.ts
index 31cb0a5787..4c6a7c01cb 100644
--- a/src/app/core/integration/models/authority.value.ts
+++ b/src/app/core/integration/models/authority.value.ts
@@ -3,11 +3,13 @@ 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';
import { MetadataValueInterface } from '../../shared/metadata.models';
+import { ResourceType } from '../../shared/resource-type';
/**
* Class representing an authority object
*/
export class AuthorityValue extends IntegrationModel implements MetadataValueInterface {
+ static type = new ResourceType('authority');
/**
* The identifier of this authority
diff --git a/src/app/core/metadata/metadata-field.model.ts b/src/app/core/metadata/metadata-field.model.ts
new file mode 100644
index 0000000000..288934e52d
--- /dev/null
+++ b/src/app/core/metadata/metadata-field.model.ts
@@ -0,0 +1,53 @@
+import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
+import { isNotEmpty } from '../../shared/empty.util';
+import { MetadataSchema } from './metadata-schema.model';
+import { ResourceType } from '../shared/resource-type';
+
+/**
+ * Class the represents a metadata field
+ */
+export class MetadataField implements ListableObject {
+ static type = new ResourceType('metadatafield');
+
+ /**
+ * The identifier of this metadata field
+ */
+ id: number;
+
+ /**
+ * The self link of this metadata field
+ */
+ self: string;
+
+ /**
+ * The element of this metadata field
+ */
+ element: string;
+
+ /**
+ * The qualifier of this metadata field
+ */
+ qualifier: string;
+
+ /**
+ * The scope note of this metadata field
+ */
+ scopeNote: string;
+
+ /**
+ * The metadata schema object of this metadata field
+ */
+ schema: MetadataSchema;
+
+ /**
+ * Method to print this metadata field as a string
+ * @param separator The separator between the schema, element and qualifier in the string
+ */
+ toString(separator: string = '.'): string {
+ let key = this.schema.prefix + separator + this.element;
+ if (isNotEmpty(this.qualifier)) {
+ key += separator + this.qualifier;
+ }
+ return key;
+ }
+}
diff --git a/src/app/core/metadata/metadata-schema.model.ts b/src/app/core/metadata/metadata-schema.model.ts
new file mode 100644
index 0000000000..bc05e475cc
--- /dev/null
+++ b/src/app/core/metadata/metadata-schema.model.ts
@@ -0,0 +1,29 @@
+import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
+import { ResourceType } from '../shared/resource-type';
+
+/**
+ * Class that represents a metadata schema
+ */
+export class MetadataSchema implements ListableObject {
+ static type = new ResourceType('metadataschema');
+
+ /**
+ * The unique identifier for this metadata schema
+ */
+ id: number;
+
+ /**
+ * The REST link to itself
+ */
+ self: string;
+
+ /**
+ * A unique prefix that defines this schema
+ */
+ prefix: string;
+
+ /**
+ * The namespace of this metadata schema
+ */
+ namespace: string;
+}
diff --git a/src/app/core/metadata/metadata.service.spec.ts b/src/app/core/metadata/metadata.service.spec.ts
index cfb5a0751d..80ce33b370 100644
--- a/src/app/core/metadata/metadata.service.spec.ts
+++ b/src/app/core/metadata/metadata.service.spec.ts
@@ -38,6 +38,7 @@ import { EmptyError } from 'rxjs/internal-compatibility';
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
import { MetadataValue } from '../shared/metadata.models';
+import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
/* tslint:disable:max-classes-per-file */
@Component({
@@ -206,13 +207,7 @@ describe('MetadataService', () => {
});
const mockRemoteData = (mockItem: Item): Observable> => {
- return observableOf(new RemoteData
- (
- false,
- false,
- true,
- undefined,
- MockItem
- ));
+ return createSuccessfulRemoteDataObject$(MockItem);
};
const mockType = (mockItem: Item, type: string): Item => {
diff --git a/src/app/core/metadata/metadatafield.model.ts b/src/app/core/metadata/metadatafield.model.ts
deleted file mode 100644
index ba28b59d0e..0000000000
--- a/src/app/core/metadata/metadatafield.model.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { MetadataSchema } from './metadataschema.model';
-import { autoserialize } from 'cerialize';
-import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
-import { isNotEmpty } from '../../shared/empty.util';
-
-export class MetadataField implements ListableObject {
- @autoserialize
- id: number;
-
- @autoserialize
- self: string;
-
- @autoserialize
- element: string;
-
- @autoserialize
- qualifier: string;
-
- @autoserialize
- scopeNote: string;
-
- @autoserialize
- schema: MetadataSchema;
-
- toString(separator: string = '.'): string {
- let key = this.schema.prefix + separator + this.element;
- if (isNotEmpty(this.qualifier)) {
- key += separator + this.qualifier;
- }
- return key;
- }
-}
diff --git a/src/app/core/metadata/metadataschema.model.ts b/src/app/core/metadata/metadataschema.model.ts
deleted file mode 100644
index 13fb8e8b4e..0000000000
--- a/src/app/core/metadata/metadataschema.model.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { autoserialize } from 'cerialize';
-import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
-
-export class MetadataSchema implements ListableObject {
- @autoserialize
- id: number;
-
- @autoserialize
- self: string;
-
- @autoserialize
- prefix: string;
-
- @autoserialize
- namespace: string;
-}
diff --git a/src/app/core/metadata/normalized-metadata-field.model.ts b/src/app/core/metadata/normalized-metadata-field.model.ts
new file mode 100644
index 0000000000..c6b2ee32f8
--- /dev/null
+++ b/src/app/core/metadata/normalized-metadata-field.model.ts
@@ -0,0 +1,51 @@
+import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
+import { mapsTo, relationship } from '../cache/builders/build-decorators';
+import { MetadataField } from './metadata-field.model';
+import { NormalizedObject } from '../cache/models/normalized-object.model';
+import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
+import { MetadataSchema } from './metadata-schema.model';
+
+/**
+ * Class the represents a normalized metadata field
+ */
+@mapsTo(MetadataField)
+@inheritSerialization(NormalizedObject)
+export class NormalizedMetadataField extends NormalizedObject implements ListableObject {
+
+ /**
+ * The identifier of this normalized metadata field
+ */
+ @autoserialize
+ id: number;
+
+ /**
+ * The self link of this normalized metadata field
+ */
+ @autoserialize
+ self: string;
+
+ /**
+ * The element of this normalized metadata field
+ */
+ @autoserialize
+ element: string;
+
+ /**
+ * The qualifier of this normalized metadata field
+ */
+ @autoserialize
+ qualifier: string;
+
+ /**
+ * The scope note of this normalized metadata field
+ */
+ @autoserialize
+ scopeNote: string;
+
+ /**
+ * The link to the metadata schema of this normalized metadata field
+ */
+ @deserialize
+ @relationship(MetadataSchema)
+ schema: string;
+}
diff --git a/src/app/core/metadata/normalized-metadata-schema.model.ts b/src/app/core/metadata/normalized-metadata-schema.model.ts
index c121938940..47c7233d81 100644
--- a/src/app/core/metadata/normalized-metadata-schema.model.ts
+++ b/src/app/core/metadata/normalized-metadata-schema.model.ts
@@ -1,13 +1,14 @@
-import { autoserialize } from 'cerialize';
+import { autoserialize, inheritSerialization } from 'cerialize';
import { NormalizedObject } from '../cache/models/normalized-object.model';
import { mapsTo } from '../cache/builders/build-decorators';
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
-import { MetadataSchema } from './metadataschema.model';
+import { MetadataSchema } from './metadata-schema.model';
/**
* Normalized class for a DSpace MetadataSchema
*/
@mapsTo(MetadataSchema)
+@inheritSerialization(NormalizedObject)
export class NormalizedMetadataSchema extends NormalizedObject implements ListableObject {
/**
* The unique identifier for this schema
diff --git a/src/app/core/registry/registry-bitstreamformats-response.model.ts b/src/app/core/registry/registry-bitstreamformats-response.model.ts
index a0ebd542f8..ddf926f3be 100644
--- a/src/app/core/registry/registry-bitstreamformats-response.model.ts
+++ b/src/app/core/registry/registry-bitstreamformats-response.model.ts
@@ -1,10 +1,12 @@
-import { autoserialize, autoserializeAs } from 'cerialize';
+import { autoserialize, deserialize } from 'cerialize';
import { PageInfo } from '../shared/page-info.model';
-import { NormalizedBitstreamFormat } from '../cache/models/normalized-bitstream-format.model';
+import { BitstreamFormat } from '../shared/bitstream-format.model';
+import { relationship } from '../cache/builders/build-decorators';
export class RegistryBitstreamformatsResponse {
- @autoserializeAs(NormalizedBitstreamFormat)
- bitstreamformats: NormalizedBitstreamFormat[];
+ @deserialize
+ @relationship(BitstreamFormat, true)
+ bitstreamformats: BitstreamFormat[];
@autoserialize
page: PageInfo;
diff --git a/src/app/core/registry/registry-metadatafields-response.model.ts b/src/app/core/registry/registry-metadatafields-response.model.ts
index 19ec537dfb..984603e42e 100644
--- a/src/app/core/registry/registry-metadatafields-response.model.ts
+++ b/src/app/core/registry/registry-metadatafields-response.model.ts
@@ -1,14 +1,31 @@
import { PageInfo } from '../shared/page-info.model';
-import { autoserialize, autoserializeAs } from 'cerialize';
-import { MetadataField } from '../metadata/metadatafield.model';
+import { autoserialize, deserialize } from 'cerialize';
+import { ResourceType } from '../shared/resource-type';
+import { relationship } from '../cache/builders/build-decorators';
+import { NormalizedMetadataField } from '../metadata/normalized-metadata-field.model';
+import { MetadataField } from '../metadata/metadata-field.model';
+/**
+ * Class that represents a response with a registry's metadata fields
+ */
export class RegistryMetadatafieldsResponse {
- @autoserializeAs(MetadataField)
+ static type = new ResourceType('metadatafield');
+ /**
+ * List of metadata fields in the response
+ */
+ @deserialize
+ @relationship(MetadataField, true)
metadatafields: MetadataField[];
+ /**
+ * Page info of this response
+ */
@autoserialize
page: PageInfo;
+ /**
+ * The REST link to this response
+ */
@autoserialize
self: string;
}
diff --git a/src/app/core/registry/registry-metadataschemas-response.model.ts b/src/app/core/registry/registry-metadataschemas-response.model.ts
index 5f4799abd7..fc53b354a5 100644
--- a/src/app/core/registry/registry-metadataschemas-response.model.ts
+++ b/src/app/core/registry/registry-metadataschemas-response.model.ts
@@ -1,9 +1,11 @@
-import { MetadataSchema } from '../metadata/metadataschema.model';
import { PageInfo } from '../shared/page-info.model';
-import { autoserialize, autoserializeAs } from 'cerialize';
+import { autoserialize, deserialize } from 'cerialize';
+import { MetadataSchema } from '../metadata/metadata-schema.model';
+import { relationship } from '../cache/builders/build-decorators';
export class RegistryMetadataschemasResponse {
- @autoserializeAs(MetadataSchema)
+ @deserialize
+ @relationship(MetadataSchema, true)
metadataschemas: MetadataSchema[];
@autoserialize
diff --git a/src/app/core/registry/registry.service.spec.ts b/src/app/core/registry/registry.service.spec.ts
index 80e4e404c8..455a8043da 100644
--- a/src/app/core/registry/registry.service.spec.ts
+++ b/src/app/core/registry/registry.service.spec.ts
@@ -37,8 +37,10 @@ import {
MetadataRegistrySelectFieldAction,
MetadataRegistrySelectSchemaAction
} from '../../+admin/admin-registries/metadata-registry/metadata-registry.actions';
-import { MetadataSchema } from '../metadata/metadataschema.model';
-import { MetadataField } from '../metadata/metadatafield.model';
+import { ResourceType } from '../shared/resource-type';
+import { MetadataSchema } from '../metadata/metadata-schema.model';
+import { MetadataField } from '../metadata/metadata-field.model';
+import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
@Component({template: ''})
class DummyComponent {
@@ -57,13 +59,15 @@ describe('RegistryService', () => {
id: 1,
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
prefix: 'dc',
- namespace: 'http://dublincore.org/documents/dcmi-terms/'
- },
+ namespace: 'http://dublincore.org/documents/dcmi-terms/',
+ type: MetadataSchema.type
+},
{
id: 2,
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
prefix: 'mock',
- namespace: 'http://dspace.org/mockschema'
+ namespace: 'http://dspace.org/mockschema',
+ type: MetadataSchema.type
}
];
const mockFieldsList = [
@@ -73,7 +77,8 @@ describe('RegistryService', () => {
element: 'contributor',
qualifier: 'advisor',
scopeNote: null,
- schema: mockSchemasList[0]
+ schema: mockSchemasList[0],
+ type: MetadataField.type
},
{
id: 2,
@@ -81,7 +86,8 @@ describe('RegistryService', () => {
element: 'contributor',
qualifier: 'author',
scopeNote: null,
- schema: mockSchemasList[0]
+ schema: mockSchemasList[0],
+ type: MetadataField.type
},
{
id: 3,
@@ -89,7 +95,8 @@ describe('RegistryService', () => {
element: 'contributor',
qualifier: 'editor',
scopeNote: 'test scope note',
- schema: mockSchemasList[1]
+ schema: mockSchemasList[1],
+ type: MetadataField.type
},
{
id: 4,
@@ -97,7 +104,8 @@ describe('RegistryService', () => {
element: 'contributor',
qualifier: 'illustrator',
scopeNote: null,
- schema: mockSchemasList[1]
+ schema: mockSchemasList[1],
+ type: MetadataField.type
}
];
@@ -122,7 +130,7 @@ describe('RegistryService', () => {
);
},
aggregate: (input: Array>>): Observable> => {
- return observableOf(new RemoteData(false, false, true, null, []));
+ return createSuccessfulRemoteDataObject$([]);
}
};
diff --git a/src/app/core/registry/registry.service.ts b/src/app/core/registry/registry.service.ts
index 35706c3200..206426588e 100644
--- a/src/app/core/registry/registry.service.ts
+++ b/src/app/core/registry/registry.service.ts
@@ -3,8 +3,6 @@ import { Injectable } from '@angular/core';
import { RemoteData } from '../data/remote-data';
import { PaginatedList } from '../data/paginated-list';
import { PageInfo } from '../shared/page-info.model';
-import { MetadataSchema } from '../metadata/metadataschema.model';
-import { MetadataField } from '../metadata/metadatafield.model';
import {
CreateMetadataFieldRequest,
CreateMetadataSchemaRequest,
@@ -51,14 +49,15 @@ import {
} from '../../+admin/admin-registries/metadata-registry/metadata-registry.actions';
import { distinctUntilChanged, flatMap, map, take, tap } from 'rxjs/operators';
import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer';
-import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory';
-import { ResourceType } from '../shared/resource-type';
import { NormalizedMetadataSchema } from '../metadata/normalized-metadata-schema.model';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { NotificationOptions } from '../../shared/notifications/models/notification-options.model';
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
import { HttpHeaders } from '@angular/common/http';
import { TranslateService } from '@ngx-translate/core';
+import { MetadataSchema } from '../metadata/metadata-schema.model';
+import { MetadataField } from '../metadata/metadata-field.model';
+import { getMapsToType } from '../cache/builders/build-decorators';
const metadataRegistryStateSelector = (state: AppState) => state.metadataRegistry;
const editMetadataSchemaSelector = createSelector(metadataRegistryStateSelector, (metadataState: MetadataRegistryState) => metadataState.editSchema);
@@ -66,6 +65,9 @@ const selectedMetadataSchemasSelector = createSelector(metadataRegistryStateSele
const editMetadataFieldSelector = createSelector(metadataRegistryStateSelector, (metadataState: MetadataRegistryState) => metadataState.editField);
const selectedMetadataFieldsSelector = createSelector(metadataRegistryStateSelector, (metadataState: MetadataRegistryState) => metadataState.selectedFields);
+/**
+ * Service for registry related CRUD actions such as metadata schema, metadata field and bitstream format
+ */
@Injectable()
export class RegistryService {
@@ -83,6 +85,10 @@ export class RegistryService {
}
+ /**
+ * Retrieves all metadata schemas
+ * @param pagination The pagination info used to retrieve the schemas
+ */
public getMetadataSchemas(pagination: PaginationComponentOptions): Observable>> {
const requestObs = this.getMetadataSchemasRequestObs(pagination);
@@ -113,6 +119,10 @@ export class RegistryService {
return this.rdb.toRemoteDataObservable(requestEntryObs, payloadObs);
}
+ /**
+ * Retrieves a metadata schema by its name
+ * @param schemaName The name of the schema to find
+ */
public getMetadataSchemaByName(schemaName: string): Observable> {
// Temporary pagination to get ALL metadataschemas until there's a rest api endpoint for fetching a specific schema
const pagination: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
@@ -138,6 +148,11 @@ export class RegistryService {
return this.rdb.toRemoteDataObservable(requestEntryObs, metadataschemaObs);
}
+ /**
+ * retrieves all metadata fields that belong to a certain metadata schema
+ * @param schema The schema to filter by
+ * @param pagination The pagination info used to retrieve the fields
+ */
public getMetadataFieldsBySchema(schema: MetadataSchema, pagination: PaginationComponentOptions): Observable>> {
const requestObs = this.getMetadataFieldsBySchemaRequestObs(pagination, schema);
@@ -277,54 +292,93 @@ export class RegistryService {
this.store.dispatch(new MetadataRegistryEditSchemaAction(schema));
}
+ /**
+ * Method to cancel editing a metadata schema, dispatches a cancel schema action
+ */
public cancelEditMetadataSchema() {
this.store.dispatch(new MetadataRegistryCancelSchemaAction());
}
+ /**
+ * Method to retrieve the metadata schema that are currently being edited
+ */
public getActiveMetadataSchema(): Observable {
return this.store.pipe(select(editMetadataSchemaSelector));
}
+ /**
+ * Method to select a metadata schema, dispatches a select schema action
+ * @param schema The schema that's being selected
+ */
public selectMetadataSchema(schema: MetadataSchema) {
this.store.dispatch(new MetadataRegistrySelectSchemaAction(schema));
}
+ /**
+ * Method to deselect a metadata schema, dispatches a deselect schema action
+ * @param schema The schema that's it being deselected
+ */
public deselectMetadataSchema(schema: MetadataSchema) {
this.store.dispatch(new MetadataRegistryDeselectSchemaAction(schema));
}
+ /**
+ * Method to deselect all currently selected metadata schema, dispatches a deselect all schema action
+ */
public deselectAllMetadataSchema() {
this.store.dispatch(new MetadataRegistryDeselectAllSchemaAction());
}
+ /**
+ * Method to retrieve the metadata schemas that are currently selected
+ */
public getSelectedMetadataSchemas(): Observable {
return this.store.pipe(select(selectedMetadataSchemasSelector));
}
-
+ /**
+ * Method to start editing a metadata field, dispatches an edit field action
+ * @param field The field that's being edited
+ */
public editMetadataField(field: MetadataField) {
this.store.dispatch(new MetadataRegistryEditFieldAction(field));
}
+ /**
+ * Method to cancel editing a metadata field, dispatches a cancel field action
+ */
public cancelEditMetadataField() {
this.store.dispatch(new MetadataRegistryCancelFieldAction());
}
-
+ /**
+ * Method to retrieve the metadata field that are currently being edited
+ */
public getActiveMetadataField(): Observable {
return this.store.pipe(select(editMetadataFieldSelector));
}
-
+ /**
+ * Method to select a metadata field, dispatches a select field action
+ * @param field The field that's being selected
+ */
public selectMetadataField(field: MetadataField) {
this.store.dispatch(new MetadataRegistrySelectFieldAction(field));
}
-
+ /**
+ * Method to deselect a metadata field, dispatches a deselect field action
+ * @param field The field that's it being deselected
+ */
public deselectMetadataField(field: MetadataField) {
this.store.dispatch(new MetadataRegistryDeselectFieldAction(field));
}
-
+ /**
+ * Method to deselect all currently selected metadata fields, dispatches a deselect all field action
+ */
public deselectAllMetadataField() {
this.store.dispatch(new MetadataRegistryDeselectAllFieldAction());
}
+ /**
+ * Method to retrieve the metadata fields that are currently selected
+ */
public getSelectedMetadataFields(): Observable {
return this.store.pipe(select(selectedMetadataFieldsSelector));
}
@@ -346,7 +400,7 @@ export class RegistryService {
distinctUntilChanged()
);
- const serializedSchema = new DSpaceRESTv2Serializer(NormalizedObjectFactory.getConstructor(ResourceType.MetadataSchema)).serialize(schema as NormalizedMetadataSchema);
+ const serializedSchema = new DSpaceRESTv2Serializer(getMapsToType(MetadataSchema.type)).serialize(schema as NormalizedMetadataSchema);
const request$ = endpoint$.pipe(
take(1),
@@ -390,10 +444,17 @@ export class RegistryService {
);
}
+ /**
+ * Method to delete a metadata schema
+ * @param id The id of the metadata schema to delete
+ */
public deleteMetadataSchema(id: number): Observable {
return this.delete(this.metadataSchemasPath, id);
}
+ /**
+ * Method that clears a cached metadata schema request and returns its REST url
+ */
public clearMetadataSchemaRequests(): Observable {
return this.halService.getEndpoint(this.metadataSchemasPath).pipe(
tap((href: string) => this.requestService.removeByHrefSubstring(href))
@@ -460,10 +521,16 @@ export class RegistryService {
);
}
+ /**
+ * Method to delete a metadata field
+ * @param id The id of the metadata field to delete
+ */
public deleteMetadataField(id: number): Observable {
return this.delete(this.metadataFieldsPath, id);
}
-
+ /**
+ * Method that clears a cached metadata field request and returns its REST url
+ */
public clearMetadataFieldRequests(): Observable {
return this.halService.getEndpoint(this.metadataFieldsPath).pipe(
tap((href: string) => this.requestService.removeByHrefSubstring(href))
diff --git a/src/app/core/shared/bitstream-format.model.ts b/src/app/core/shared/bitstream-format.model.ts
index aa76f92b36..0e1279e978 100644
--- a/src/app/core/shared/bitstream-format.model.ts
+++ b/src/app/core/shared/bitstream-format.model.ts
@@ -1,4 +1,4 @@
-import { CacheableObject } from '../cache/object-cache.reducer';
+import { CacheableObject, TypedObject } from '../cache/object-cache.reducer';
import { ResourceType } from './resource-type';
import { BitstreamFormatSupportLevel } from './bitstream-format-support-level';
@@ -6,7 +6,9 @@ import { BitstreamFormatSupportLevel } from './bitstream-format-support-level';
* Model class for a Bitstream Format
*/
export class BitstreamFormat implements CacheableObject {
+ static type = new ResourceType('bitstreamformat');
+ bitstreamformat
/**
* Short description of this Bitstream Format
*/
@@ -42,11 +44,6 @@ export class BitstreamFormat implements CacheableObject {
*/
self: string;
- /**
- * A ResourceType representing the kind of Object of this BitstreamFormat
- */
- type: ResourceType;
-
/**
* Universally unique identifier for this Bitstream Format
*/
diff --git a/src/app/core/shared/bitstream.model.ts b/src/app/core/shared/bitstream.model.ts
index 794282e867..887f7d0843 100644
--- a/src/app/core/shared/bitstream.model.ts
+++ b/src/app/core/shared/bitstream.model.ts
@@ -3,8 +3,10 @@ import { RemoteData } from '../data/remote-data';
import { Item } from './item.model';
import { BitstreamFormat } from './bitstream-format.model';
import { Observable } from 'rxjs';
+import { ResourceType } from './resource-type';
export class Bitstream extends DSpaceObject {
+ static type = new ResourceType('bitstream');
/**
* The size of this bitstream in bytes
@@ -40,5 +42,4 @@ export class Bitstream extends DSpaceObject {
* The URL to retrieve this Bitstream's file
*/
content: string;
-
}
diff --git a/src/app/core/shared/browse-definition.model.ts b/src/app/core/shared/browse-definition.model.ts
index 05263858c6..9fafe7e321 100644
--- a/src/app/core/shared/browse-definition.model.ts
+++ b/src/app/core/shared/browse-definition.model.ts
@@ -1,7 +1,11 @@
import { autoserialize, autoserializeAs } from 'cerialize';
import { SortOption } from './sort-option.model';
+import { ResourceType } from './resource-type';
+import { TypedObject } from '../cache/object-cache.reducer';
+
+export class BrowseDefinition implements TypedObject {
+ static type = new ResourceType('browse');
-export class BrowseDefinition {
@autoserialize
id: string;
@@ -14,9 +18,6 @@ export class BrowseDefinition {
@autoserializeAs('order')
defaultSortOrder: string;
- @autoserialize
- type: string;
-
@autoserializeAs('metadata')
metadataKeys: string[];
diff --git a/src/app/core/shared/browse-entry.model.ts b/src/app/core/shared/browse-entry.model.ts
index 932c6946d1..d5d4093c81 100644
--- a/src/app/core/shared/browse-entry.model.ts
+++ b/src/app/core/shared/browse-entry.model.ts
@@ -1,21 +1,31 @@
-import { autoserialize, autoserializeAs } from 'cerialize';
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
+import { TypedObject } from '../cache/object-cache.reducer';
+import { ResourceType } from './resource-type';
-export class BrowseEntry implements ListableObject {
+/**
+ * Class object representing a browse entry
+ * This class is not normalized because browse entries do not have self links
+ */
+export class BrowseEntry implements ListableObject, TypedObject {
+ static type = new ResourceType('browseEntry');
- @autoserialize
- type: string;
-
- @autoserialize
+ /**
+ * The authority string of this browse entry
+ */
authority: string;
- @autoserialize
+ /**
+ * The value of this browse entry
+ */
value: string;
- @autoserializeAs('valueLang')
+ /**
+ * The language of the value of this browse entry
+ */
language: string;
- @autoserialize
+ /**
+ * The count of this browse entry
+ */
count: number;
-
}
diff --git a/src/app/core/shared/bundle.model.ts b/src/app/core/shared/bundle.model.ts
index 3f5b5df877..9b00f6efa0 100644
--- a/src/app/core/shared/bundle.model.ts
+++ b/src/app/core/shared/bundle.model.ts
@@ -3,8 +3,11 @@ import { Bitstream } from './bitstream.model';
import { Item } from './item.model';
import { RemoteData } from '../data/remote-data';
import { Observable } from 'rxjs';
+import { ResourceType } from './resource-type';
export class Bundle extends DSpaceObject {
+ static type = new ResourceType('bundle');
+
/**
* The primary bitstream of this Bundle
*/
diff --git a/src/app/core/shared/collection.model.ts b/src/app/core/shared/collection.model.ts
index 0471d1fbbb..642fe50736 100644
--- a/src/app/core/shared/collection.model.ts
+++ b/src/app/core/shared/collection.model.ts
@@ -6,8 +6,10 @@ import { Observable } from 'rxjs';
import { License } from './license.model';
import { ResourcePolicy } from './resource-policy.model';
import { PaginatedList } from '../data/paginated-list';
+import { ResourceType } from './resource-type';
export class Collection extends DSpaceObject {
+ static type = new ResourceType('collection');
/**
* A string representing the unique handle of this Collection
@@ -80,5 +82,4 @@ export class Collection extends DSpaceObject {
owner: Observable>;
items: Observable>;
-
}
diff --git a/src/app/core/shared/community.model.ts b/src/app/core/shared/community.model.ts
index c4e703fd7f..b61ddfd7f9 100644
--- a/src/app/core/shared/community.model.ts
+++ b/src/app/core/shared/community.model.ts
@@ -4,8 +4,10 @@ import { Collection } from './collection.model';
import { RemoteData } from '../data/remote-data';
import { Observable } from 'rxjs';
import { PaginatedList } from '../data/paginated-list';
+import { ResourceType } from './resource-type';
export class Community extends DSpaceObject {
+ static type = new ResourceType('community');
/**
* A string representing the unique handle of this Community
diff --git a/src/app/core/shared/dspace-object.model.ts b/src/app/core/shared/dspace-object.model.ts
index 063398b339..26f76c5ce2 100644
--- a/src/app/core/shared/dspace-object.model.ts
+++ b/src/app/core/shared/dspace-object.model.ts
@@ -1,18 +1,26 @@
import { Observable } from 'rxjs';
-import { MetadataMap, MetadataValue, MetadataValueFilter, MetadatumViewModel } from './metadata.models';
+import {
+ MetadataMap,
+ MetadataValue,
+ MetadataValueFilter,
+ MetadatumViewModel
+} from './metadata.models';
import { Metadata } from './metadata.utils';
-import { isUndefined } from '../../shared/empty.util';
+import { hasNoValue, isUndefined } from '../../shared/empty.util';
import { CacheableObject } from '../cache/object-cache.reducer';
import { RemoteData } from '../data/remote-data';
-import { ResourceType } from './resource-type';
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
-import { hasNoValue } from '../../shared/empty.util';
+import { ResourceType } from './resource-type';
/**
* An abstract model class for a DSpaceObject.
*/
export class DSpaceObject implements CacheableObject, ListableObject {
+ /**
+ * A string representing the kind of DSpaceObject, e.g. community, item, …
+ */
+ static type = new ResourceType('dspaceobject');
private _name: string;
@@ -28,11 +36,6 @@ export class DSpaceObject implements CacheableObject, ListableObject {
*/
uuid: string;
- /**
- * A string representing the kind of DSpaceObject, e.g. community, item, …
- */
- type: ResourceType;
-
/**
* The name for this DSpaceObject
*/
diff --git a/src/app/core/shared/item-relationships/item-type.model.ts b/src/app/core/shared/item-relationships/item-type.model.ts
index e4f98ab653..2635f154a8 100644
--- a/src/app/core/shared/item-relationships/item-type.model.ts
+++ b/src/app/core/shared/item-relationships/item-type.model.ts
@@ -5,6 +5,8 @@ import { ResourceType } from '../resource-type';
* Describes a type of Item
*/
export class ItemType implements CacheableObject {
+ static type = new ResourceType('entitytype');
+
/**
* The identifier of this ItemType
*/
@@ -15,11 +17,6 @@ export class ItemType implements CacheableObject {
*/
self: string;
- /**
- * The type of Resource this is
- */
- type: ResourceType;
-
/**
* The universally unique identifier of this ItemType
*/
diff --git a/src/app/core/shared/item-relationships/relationship-type.model.ts b/src/app/core/shared/item-relationships/relationship-type.model.ts
index 404d8cdb4b..98454bc000 100644
--- a/src/app/core/shared/item-relationships/relationship-type.model.ts
+++ b/src/app/core/shared/item-relationships/relationship-type.model.ts
@@ -8,16 +8,13 @@ import { ItemType } from './item-type.model';
* Describes a type of Relationship between multiple possible Items
*/
export class RelationshipType implements CacheableObject {
+ static type = new ResourceType('relationshiptype');
+
/**
* The link to the rest endpoint where this object can be found
*/
self: string;
- /**
- * The type of Resource this is
- */
- type: ResourceType;
-
/**
* The label that describes this RelationshipType
*/
diff --git a/src/app/core/shared/item-relationships/relationship.model.ts b/src/app/core/shared/item-relationships/relationship.model.ts
index 63fe7987ab..9ab9751489 100644
--- a/src/app/core/shared/item-relationships/relationship.model.ts
+++ b/src/app/core/shared/item-relationships/relationship.model.ts
@@ -9,16 +9,13 @@ import { Item } from '../item.model';
* Describes a Relationship between two Items
*/
export class Relationship implements CacheableObject {
+ static type = new ResourceType('relationship');
+
/**
* The link to the rest endpoint where this object can be found
*/
self: string;
- /**
- * The type of Resource this is
- */
- type: ResourceType;
-
/**
* The universally unique identifier of this Relationship
*/
diff --git a/src/app/core/shared/item.model.spec.ts b/src/app/core/shared/item.model.spec.ts
index 2e5388dc4d..f20fb3299a 100644
--- a/src/app/core/shared/item.model.spec.ts
+++ b/src/app/core/shared/item.model.spec.ts
@@ -1,10 +1,10 @@
import { Observable, of as observableOf } from 'rxjs';
import { Item } from './item.model';
-import { RemoteData } from '../data/remote-data';
import { Bitstream } from './bitstream.model';
import { isEmpty } from '../../shared/empty.util';
import { first, map } from 'rxjs/operators';
+import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
describe('Item', () => {
@@ -32,12 +32,11 @@ describe('Item', () => {
content: bitstream2Path
}];
- remoteDataThumbnail = createRemoteDataObject(thumbnail);
- remoteDataFiles = createRemoteDataObject(bitstreams);
- remoteDataAll = createRemoteDataObject([...bitstreams, thumbnail]);
+ remoteDataThumbnail = createSuccessfulRemoteDataObject$(thumbnail);
+ remoteDataFiles = createSuccessfulRemoteDataObject$(bitstreams);
+ remoteDataAll = createSuccessfulRemoteDataObject$([...bitstreams, thumbnail]);
// Create Bundles
-
const bundles =
[
{
@@ -51,7 +50,6 @@ describe('Item', () => {
}];
item = Object.assign(new Item(), { bitstreams: remoteDataAll });
-
});
it('should return the bitstreams related to this item with the specified bundle name', () => {
@@ -99,16 +97,4 @@ describe('Item', () => {
});
});
-
});
-
-function createRemoteDataObject(object: any) {
- return observableOf(new RemoteData(
- false,
- false,
- true,
- undefined,
- object
- ));
-
-}
diff --git a/src/app/core/shared/item.model.ts b/src/app/core/shared/item.model.ts
index 839103b9f5..515ea3cd69 100644
--- a/src/app/core/shared/item.model.ts
+++ b/src/app/core/shared/item.model.ts
@@ -8,8 +8,10 @@ import { Bitstream } from './bitstream.model';
import { hasValue, isNotEmpty, isNotUndefined } from '../../shared/empty.util';
import { PaginatedList } from '../data/paginated-list';
import { Relationship } from './item-relationships/relationship.model';
+import { ResourceType } from './resource-type';
export class Item extends DSpaceObject {
+ static type = new ResourceType('item');
/**
* A string representing the unique handle of this Item
diff --git a/src/app/core/shared/license.model.ts b/src/app/core/shared/license.model.ts
index a04422242a..fa49e1f430 100644
--- a/src/app/core/shared/license.model.ts
+++ b/src/app/core/shared/license.model.ts
@@ -1,6 +1,8 @@
import { DSpaceObject } from './dspace-object.model';
+import { ResourceType } from './resource-type';
export class License extends DSpaceObject {
+ static type = new ResourceType('license');
/**
* Is the license custom?
diff --git a/src/app/core/shared/normalized-browse-entry.model.ts b/src/app/core/shared/normalized-browse-entry.model.ts
new file mode 100644
index 0000000000..949758cb67
--- /dev/null
+++ b/src/app/core/shared/normalized-browse-entry.model.ts
@@ -0,0 +1,36 @@
+import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
+import { BrowseEntry } from './browse-entry.model';
+import { NormalizedObject } from '../cache/models/normalized-object.model';
+import { mapsTo } from '../cache/builders/build-decorators';
+
+/**
+ * Class object representing a browse entry
+ * This class is not normalized because browse entries do not have self links
+ */
+@mapsTo(BrowseEntry)
+@inheritSerialization(NormalizedObject)
+export class NormalizedBrowseEntry extends NormalizedObject {
+ /**
+ * The authority string of this browse entry
+ */
+ @autoserialize
+ authority: string;
+
+ /**
+ * The value of this browse entry
+ */
+ @autoserialize
+ value: string;
+
+ /**
+ * The language of the value of this browse entry
+ */
+ @autoserializeAs('valueLang')
+ language: string;
+
+ /**
+ * The count of this browse entry
+ */
+ @autoserialize
+ count: number;
+}
diff --git a/src/app/core/shared/operators.spec.ts b/src/app/core/shared/operators.spec.ts
index 564b0ff319..56b5d5db7e 100644
--- a/src/app/core/shared/operators.spec.ts
+++ b/src/app/core/shared/operators.spec.ts
@@ -18,6 +18,10 @@ import {
import { RemoteData } from '../data/remote-data';
import { RemoteDataError } from '../data/remote-data-error';
import { of as observableOf } from 'rxjs';
+import {
+ createFailedRemoteDataObject,
+ createSuccessfulRemoteDataObject
+} from '../../shared/testing/utils';
describe('Core Module - RxJS Operators', () => {
let scheduler: TestScheduler;
@@ -180,17 +184,17 @@ describe('Core Module - RxJS Operators', () => {
describe('getSucceededRemoteData', () => {
it('should return the first() hasSucceeded RemoteData Observable', () => {
const testRD = {
- a: new RemoteData(false, false, true, null, undefined),
- b: new RemoteData(false, false, false, null, 'b'),
+ a: createSuccessfulRemoteDataObject(undefined),
+ b: createFailedRemoteDataObject( 'b'),
c: new RemoteData(false, false, undefined, null, 'c'),
- d: new RemoteData(false, false, true, null, 'd'),
- e: new RemoteData(false, false, true, null, 'e'),
+ d: createSuccessfulRemoteDataObject('d'),
+ e: createSuccessfulRemoteDataObject('e'),
};
const source = hot('abcde', testRD);
const result = source.pipe(getSucceededRemoteData());
result.subscribe((value) => expect(value)
- .toEqual(new RemoteData(false, false, true, null, 'd')));
+ .toEqual(createSuccessfulRemoteDataObject('d')));
});
});
@@ -202,21 +206,21 @@ describe('Core Module - RxJS Operators', () => {
});
it('should call navigateByUrl to a 404 page, when the remote data contains a 404 error', () => {
- const testRD = new RemoteData(false, false, false, new RemoteDataError(404, 'Not Found', 'Object was not found'), undefined);
+ const testRD = createFailedRemoteDataObject(undefined, new RemoteDataError(404, 'Not Found', 'Object was not found'));
observableOf(testRD).pipe(redirectToPageNotFoundOn404(router)).subscribe();
expect(router.navigateByUrl).toHaveBeenCalledWith('/404', { skipLocationChange: true });
});
it('should not call navigateByUrl to a 404 page, when the remote data contains another error than a 404', () => {
- const testRD = new RemoteData(false, false, false, new RemoteDataError(500, 'Server Error', 'Something went wrong'), undefined);
+ const testRD = createFailedRemoteDataObject(undefined, new RemoteDataError(500, 'Server Error', 'Something went wrong'));
observableOf(testRD).pipe(redirectToPageNotFoundOn404(router)).subscribe();
expect(router.navigateByUrl).not.toHaveBeenCalled();
});
it('should not call navigateByUrl to a 404 page, when the remote data contains no error', () => {
- const testRD = new RemoteData(false, false, true, null, undefined);
+ const testRD = createSuccessfulRemoteDataObject(undefined);
observableOf(testRD).pipe(redirectToPageNotFoundOn404(router)).subscribe();
expect(router.navigateByUrl).not.toHaveBeenCalled();
@@ -242,11 +246,11 @@ describe('Core Module - RxJS Operators', () => {
describe('getAllSucceededRemoteData', () => {
it('should return all hasSucceeded RemoteData Observables', () => {
const testRD = {
- a: new RemoteData(false, false, true, null, undefined),
- b: new RemoteData(false, false, false, null, 'b'),
+ a: createSuccessfulRemoteDataObject(undefined),
+ b: createFailedRemoteDataObject('b'),
c: new RemoteData(false, false, undefined, null, 'c'),
- d: new RemoteData(false, false, true, null, 'd'),
- e: new RemoteData(false, false, true, null, 'e'),
+ d: createSuccessfulRemoteDataObject('d'),
+ e: createSuccessfulRemoteDataObject('e'),
};
const source = hot('abcde', testRD);
const result = source.pipe(getAllSucceededRemoteData());
diff --git a/src/app/core/shared/resource-policy.model.ts b/src/app/core/shared/resource-policy.model.ts
index ee3d5293f5..a80446a369 100644
--- a/src/app/core/shared/resource-policy.model.ts
+++ b/src/app/core/shared/resource-policy.model.ts
@@ -1,12 +1,13 @@
import { CacheableObject } from '../cache/object-cache.reducer';
import { ResourceType } from './resource-type';
-import { Group } from '../eperson/models/group.model';
import { ActionType } from '../cache/models/action-type.model';
/**
* Model class for a Resource Policy
*/
export class ResourcePolicy implements CacheableObject {
+ static type = new ResourceType('resourcePolicy');
+
/**
* The action that is allowed by this Resource Policy
*/
@@ -27,11 +28,6 @@ export class ResourcePolicy implements CacheableObject {
*/
self: string;
- /**
- * A ResourceType representing the kind of Object of this ResourcePolicy
- */
- type: ResourceType;
-
/**
* The universally unique identifier for this Resource Policy
*/
diff --git a/src/app/core/shared/resource-type.ts b/src/app/core/shared/resource-type.ts
index bdcc3a52f6..657837fbec 100644
--- a/src/app/core/shared/resource-type.ts
+++ b/src/app/core/shared/resource-type.ts
@@ -1,28 +1,7 @@
-export enum ResourceType {
- DSpaceObject = 'dspaceobject',
- Bundle = 'bundle',
- Bitstream = 'bitstream',
- BitstreamFormat = 'bitstreamformat',
- Item = 'item',
- Collection = 'collection',
- Community = 'community',
- EPerson = 'eperson',
- Group = 'group',
- ResourcePolicy = 'resourcePolicy',
- MetadataSchema = 'metadataschema',
- MetadataField = 'metadatafield',
- Relationship = 'relationship',
- RelationshipType = 'relationshiptype',
- ItemType = 'entitytype',
- License = 'license',
- Workflowitem = 'workflowitem',
- Workspaceitem = 'workspaceitem',
- SubmissionDefinitions = 'submissiondefinitions',
- SubmissionDefinition = 'submissiondefinition',
- SubmissionForm = 'submissionform',
- SubmissionForms = 'submissionforms',
- SubmissionSections = 'submissionsections',
- SubmissionSection = 'submissionsection',
- ClaimedTask = 'claimedtask',
- PoolTask = 'pooltask'
+/**
+ * Class that represents the type of an object as returned by the REST server
+ */
+export class ResourceType {
+ constructor(public value: string) {
+ }
}
diff --git a/src/app/core/submission/models/normalized-workflowitem.model.ts b/src/app/core/submission/models/normalized-workflowitem.model.ts
index a3fa8992a2..e96024b4ae 100644
--- a/src/app/core/submission/models/normalized-workflowitem.model.ts
+++ b/src/app/core/submission/models/normalized-workflowitem.model.ts
@@ -1,43 +1,46 @@
import { autoserialize, inheritSerialization } from 'cerialize';
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
-import { Workflowitem } from './workflowitem.model';
+import { WorkflowItem } from './workflowitem.model';
import { NormalizedSubmissionObject } from './normalized-submission-object.model';
-import { ResourceType } from '../../shared/resource-type';
+import { Collection } from '../../shared/collection.model';
+import { Item } from '../../shared/item.model';
+import { SubmissionDefinitionsModel } from '../../config/models/config-submission-definitions.model';
+import { EPerson } from '../../eperson/models/eperson.model';
/**
* An model class for a NormalizedWorkflowItem.
*/
-@mapsTo(Workflowitem)
+@mapsTo(WorkflowItem)
@inheritSerialization(NormalizedSubmissionObject)
-export class NormalizedWorkflowItem extends NormalizedSubmissionObject {
+export class NormalizedWorkflowItem extends NormalizedSubmissionObject {
/**
* The collection this workflowitem belonging to
*/
@autoserialize
- @relationship(ResourceType.Collection, false)
+ @relationship(Collection, false)
collection: string;
/**
* The item created with this workflowitem
*/
@autoserialize
- @relationship(ResourceType.Item, false)
+ @relationship(Item, false)
item: string;
/**
* The configuration object that define this workflowitem
*/
@autoserialize
- @relationship(ResourceType.SubmissionDefinition, false)
+ @relationship(SubmissionDefinitionsModel, false)
submissionDefinition: string;
/**
* The EPerson who submit this workflowitem
*/
@autoserialize
- @relationship(ResourceType.EPerson, false)
+ @relationship(EPerson, false)
submitter: string;
}
diff --git a/src/app/core/submission/models/normalized-workspaceitem.model.ts b/src/app/core/submission/models/normalized-workspaceitem.model.ts
index 7c15925c98..4275420191 100644
--- a/src/app/core/submission/models/normalized-workspaceitem.model.ts
+++ b/src/app/core/submission/models/normalized-workspaceitem.model.ts
@@ -1,45 +1,47 @@
import { autoserialize, inheritSerialization } from 'cerialize';
-import { Workspaceitem } from './workspaceitem.model';
+import { WorkspaceItem } from './workspaceitem.model';
import { NormalizedSubmissionObject } from './normalized-submission-object.model';
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
-import { ResourceType } from '../../shared/resource-type';
-import { Workflowitem } from './workflowitem.model';
+import { Item } from '../../shared/item.model';
+import { Collection } from '../../shared/collection.model';
+import { SubmissionDefinitionModel } from '../../config/models/config-submission-definition.model';
+import { EPerson } from '../../eperson/models/eperson.model';
/**
* An model class for a NormalizedWorkspaceItem.
*/
-@mapsTo(Workspaceitem)
+@mapsTo(WorkspaceItem)
@inheritSerialization(NormalizedDSpaceObject)
@inheritSerialization(NormalizedSubmissionObject)
-export class NormalizedWorkspaceItem extends NormalizedSubmissionObject {
+export class NormalizedWorkspaceItem extends NormalizedSubmissionObject {
/**
* The collection this workspaceitem belonging to
*/
@autoserialize
- @relationship(ResourceType.Collection, false)
+ @relationship(Collection, false)
collection: string;
/**
* The item created with this workspaceitem
*/
@autoserialize
- @relationship(ResourceType.Item, false)
+ @relationship(Item, false)
item: string;
/**
* The configuration object that define this workspaceitem
*/
@autoserialize
- @relationship(ResourceType.SubmissionDefinition, false)
+ @relationship(SubmissionDefinitionModel, false)
submissionDefinition: string;
/**
* The EPerson who submit this workspaceitem
*/
@autoserialize
- @relationship(ResourceType.EPerson, false)
+ @relationship(EPerson, false)
submitter: string;
}
diff --git a/src/app/core/submission/models/workflowitem.model.ts b/src/app/core/submission/models/workflowitem.model.ts
index f1a0467f43..4cfc4d7fa1 100644
--- a/src/app/core/submission/models/workflowitem.model.ts
+++ b/src/app/core/submission/models/workflowitem.model.ts
@@ -1,7 +1,9 @@
-import { Workspaceitem } from './workspaceitem.model';
+import { WorkspaceItem } from './workspaceitem.model';
+import { ResourceType } from '../../shared/resource-type';
/**
- * A model class for a Workflowitem.
+ * A model class for a WorkflowItem.
*/
-export class Workflowitem extends Workspaceitem {
+export class WorkflowItem extends WorkspaceItem {
+ static type = new ResourceType('workflowitem');
}
diff --git a/src/app/core/submission/models/workspaceitem.model.ts b/src/app/core/submission/models/workspaceitem.model.ts
index 6548191ba2..c4bb5b7520 100644
--- a/src/app/core/submission/models/workspaceitem.model.ts
+++ b/src/app/core/submission/models/workspaceitem.model.ts
@@ -1,8 +1,10 @@
import { SubmissionObject } from './submission-object.model';
+import { ResourceType } from '../../shared/resource-type';
/**
- * A model class for a Workspaceitem.
+ * A model class for a WorkspaceItem.
*/
-export class Workspaceitem extends SubmissionObject {
+export class WorkspaceItem extends SubmissionObject {
+ static type = new ResourceType('workspaceitem');
}
diff --git a/src/app/core/submission/submission-resource-type.ts b/src/app/core/submission/submission-resource-type.ts
deleted file mode 100644
index f5b8e2c423..0000000000
--- a/src/app/core/submission/submission-resource-type.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-export enum SubmissionResourceType {
- Bundle = 'bundle',
- Bitstream = 'bitstream',
- BitstreamFormat = 'bitstreamformat',
- Item = 'item',
- Collection = 'collection',
- Community = 'community',
- ResourcePolicy = 'resourcePolicy',
- License = 'license',
- EPerson = 'eperson',
- Group = 'group',
- WorkspaceItem = 'workspaceitem',
- WorkflowItem = 'workflowitem',
- SubmissionDefinitions = 'submissiondefinitions',
- SubmissionDefinition = 'submissiondefinition',
- SubmissionForm = 'submissionform',
- SubmissionForms = 'submissionforms',
- SubmissionSections = 'submissionsections',
- SubmissionSection = 'submissionsection',
- Authority = 'authority'
-}
diff --git a/src/app/core/submission/submission-response-parsing.service.ts b/src/app/core/submission/submission-response-parsing.service.ts
index 21135be463..a0811c8f2d 100644
--- a/src/app/core/submission/submission-response-parsing.service.ts
+++ b/src/app/core/submission/submission-response-parsing.service.ts
@@ -10,12 +10,10 @@ import { BaseResponseParsingService } from '../data/base-response-parsing.servic
import { GLOBAL_CONFIG } from '../../../config';
import { GlobalConfig } from '../../../config/global-config.interface';
import { ObjectCacheService } from '../cache/object-cache.service';
-import { SubmissionResourceType } from './submission-resource-type';
import { NormalizedWorkspaceItem } from './models/normalized-workspaceitem.model';
import { NormalizedWorkflowItem } from './models/normalized-workflowitem.model';
import { FormFieldMetadataValueObject } from '../../shared/form/builder/models/form-field-metadata-value.model';
import { SubmissionObject } from './models/submission-object.model';
-import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory';
/**
* Export a function to check if object has same properties of FormFieldMetadataValueObject
@@ -75,7 +73,6 @@ export function normalizeSectionData(obj: any, objIndex?: number) {
@Injectable()
export class SubmissionResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
- protected objectFactory = NormalizedObjectFactory;
protected toCache = false;
constructor(@Inject(GLOBAL_CONFIG) protected EnvConfig: GlobalConfig,
@@ -94,7 +91,7 @@ export class SubmissionResponseParsingService extends BaseResponseParsingService
if (isNotEmpty(data.payload)
&& isNotEmpty(data.payload._links)
&& this.isSuccessStatus(data.statusCode)) {
- const dataDefinition = this.processResponse(data.payload, request.href);
+ const dataDefinition = this.processResponse(data.payload, request.href);
return new SubmissionSuccessResponse(dataDefinition, data.statusCode, data.statusText, this.processPageInfo(data.payload));
} else if (isEmpty(data.payload) && this.isSuccessStatus(data.statusCode)) {
return new SubmissionSuccessResponse(null, data.statusCode, data.statusText);
@@ -115,8 +112,8 @@ export class SubmissionResponseParsingService extends BaseResponseParsingService
* @param {string} requestHref
* @returns {any[]}
*/
- protected processResponse(data: any, requestHref: string): any[] {
- const dataDefinition = this.process(data, requestHref);
+ protected processResponse(data: any, requestHref: string): any[] {
+ const dataDefinition = this.process(data, requestHref);
const normalizedDefinition = Array.of();
const processedList = Array.isArray(dataDefinition) ? dataDefinition : Array.of(dataDefinition);
diff --git a/src/app/core/submission/workflowitem-data.service.ts b/src/app/core/submission/workflowitem-data.service.ts
index e739a62e81..fd769745da 100644
--- a/src/app/core/submission/workflowitem-data.service.ts
+++ b/src/app/core/submission/workflowitem-data.service.ts
@@ -6,7 +6,7 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv
import { CoreState } from '../core.reducers';
import { DataService } from '../data/data.service';
import { RequestService } from '../data/request.service';
-import { Workflowitem } from './models/workflowitem.model';
+import { WorkflowItem } from './models/workflowitem.model';
import { HALEndpointService } from '../shared/hal-endpoint.service';
import { FindAllOptions } from '../data/request.models';
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
@@ -18,12 +18,12 @@ import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
* A service that provides methods to make REST requests with workflowitems endpoint.
*/
@Injectable()
-export class WorkflowitemDataService extends DataService {
+export class WorkflowItemDataService extends DataService {
protected linkPath = 'workflowitems';
protected forceBypassCache = true;
constructor(
- protected comparator: DSOChangeAnalyzer,
+ protected comparator: DSOChangeAnalyzer,
protected dataBuildService: NormalizedObjectBuildService,
protected halService: HALEndpointService,
protected http: HttpClient,
diff --git a/src/app/core/submission/workspaceitem-data.service.ts b/src/app/core/submission/workspaceitem-data.service.ts
index 3bb3eb1ee8..de671d57c7 100644
--- a/src/app/core/submission/workspaceitem-data.service.ts
+++ b/src/app/core/submission/workspaceitem-data.service.ts
@@ -6,24 +6,24 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv
import { CoreState } from '../core.reducers';
import { DataService } from '../data/data.service';
import { RequestService } from '../data/request.service';
-import { Workspaceitem } from './models/workspaceitem.model';
import { HALEndpointService } from '../shared/hal-endpoint.service';
import { FindAllOptions } from '../data/request.models';
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { ObjectCacheService } from '../cache/object-cache.service';
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
+import { WorkspaceItem } from './models/workspaceitem.model';
/**
* A service that provides methods to make REST requests with workspaceitems endpoint.
*/
@Injectable()
-export class WorkspaceitemDataService extends DataService {
+export class WorkspaceitemDataService extends DataService {
protected linkPath = 'workspaceitems';
protected forceBypassCache = true;
constructor(
- protected comparator: DSOChangeAnalyzer,
+ protected comparator: DSOChangeAnalyzer,
protected dataBuildService: NormalizedObjectBuildService,
protected halService: HALEndpointService,
protected http: HttpClient,
diff --git a/src/app/core/tasks/models/claimed-task-object.model.ts b/src/app/core/tasks/models/claimed-task-object.model.ts
index 212e75ed95..2f427f586f 100644
--- a/src/app/core/tasks/models/claimed-task-object.model.ts
+++ b/src/app/core/tasks/models/claimed-task-object.model.ts
@@ -1,8 +1,9 @@
import { TaskObject } from './task-object.model';
+import { ResourceType } from '../../shared/resource-type';
/**
* A model class for a ClaimedTask.
*/
export class ClaimedTask extends TaskObject {
-
+ static type = new ResourceType('claimedtask');
}
diff --git a/src/app/core/tasks/models/normalized-claimed-task-object.model.ts b/src/app/core/tasks/models/normalized-claimed-task-object.model.ts
index c2c3f12bc4..d43a277f02 100644
--- a/src/app/core/tasks/models/normalized-claimed-task-object.model.ts
+++ b/src/app/core/tasks/models/normalized-claimed-task-object.model.ts
@@ -2,7 +2,9 @@ import { NormalizedTaskObject } from './normalized-task-object.model';
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
import { autoserialize, inheritSerialization } from 'cerialize';
import { ClaimedTask } from './claimed-task-object.model';
-import { ResourceType } from '../../shared/resource-type';
+import { EPerson } from '../../eperson/models/eperson.model';
+import { Group } from '../../eperson/models/group.model';
+import { WorkflowItem } from '../../submission/models/workflowitem.model';
/**
* A normalized model class for a ClaimedTask.
@@ -10,7 +12,6 @@ import { ResourceType } from '../../shared/resource-type';
@mapsTo(ClaimedTask)
@inheritSerialization(NormalizedTaskObject)
export class NormalizedClaimedTask extends NormalizedTaskObject {
-
/**
* The task identifier
*/
@@ -29,11 +30,25 @@ export class NormalizedClaimedTask extends NormalizedTaskObject {
@autoserialize
action: string;
+ /**
+ * The eperson object for this task
+ */
+ @autoserialize
+ @relationship(EPerson, false)
+ eperson: string;
+
+ /**
+ * The group object for this task
+ */
+ @autoserialize
+ @relationship(Group, false)
+ group: string;
+
/**
* The workflowitem object whom this task is related
*/
@autoserialize
- @relationship(ResourceType.Workflowitem, false)
+ @relationship(WorkflowItem, false)
workflowitem: string;
}
diff --git a/src/app/core/tasks/models/normalized-pool-task-object.model.ts b/src/app/core/tasks/models/normalized-pool-task-object.model.ts
index 22cda6ff9c..bfc782f182 100644
--- a/src/app/core/tasks/models/normalized-pool-task-object.model.ts
+++ b/src/app/core/tasks/models/normalized-pool-task-object.model.ts
@@ -2,7 +2,8 @@ import { NormalizedTaskObject } from './normalized-task-object.model';
import { PoolTask } from './pool-task-object.model';
import { autoserialize, inheritSerialization } from 'cerialize';
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
-import { ResourceType } from '../../shared/resource-type';
+import { Group } from '../../eperson/models/group.model';
+import { WorkflowItem } from '../../submission/models/workflowitem.model';
/**
* A normalized model class for a PoolTask.
@@ -10,7 +11,6 @@ import { ResourceType } from '../../shared/resource-type';
@mapsTo(PoolTask)
@inheritSerialization(NormalizedTaskObject)
export class NormalizedPoolTask extends NormalizedTaskObject {
-
/**
* The task identifier
*/
@@ -29,10 +29,17 @@ export class NormalizedPoolTask extends NormalizedTaskObject {
@autoserialize
action: string;
+ /**
+ * The group object for this task
+ */
+ @autoserialize
+ @relationship(Group, false)
+ group: string;
+
/**
* The workflowitem object whom this task is related
*/
@autoserialize
- @relationship(ResourceType.Workflowitem, false)
+ @relationship(WorkflowItem, false)
workflowitem: string;
}
diff --git a/src/app/core/tasks/models/normalized-task-object.model.ts b/src/app/core/tasks/models/normalized-task-object.model.ts
index 52c274e3a8..2c96b95393 100644
--- a/src/app/core/tasks/models/normalized-task-object.model.ts
+++ b/src/app/core/tasks/models/normalized-task-object.model.ts
@@ -1,16 +1,18 @@
import { autoserialize, inheritSerialization } from 'cerialize';
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
-import { ResourceType } from '../../shared/resource-type';
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
import { TaskObject } from './task-object.model';
import { DSpaceObject } from '../../shared/dspace-object.model';
+import { Group } from '../../eperson/models/group.model';
+import { EPerson } from '../../eperson/models/eperson.model';
+import { WorkflowItem } from '../../submission/models/workflowitem.model';
/**
* An abstract normalized model class for a TaskObject.
*/
@mapsTo(TaskObject)
@inheritSerialization(NormalizedDSpaceObject)
-export abstract class NormalizedTaskObject extends NormalizedDSpaceObject {
+export class NormalizedTaskObject extends NormalizedDSpaceObject {
/**
* The task identifier
@@ -30,10 +32,24 @@ export abstract class NormalizedTaskObject extends Norma
@autoserialize
action: string;
+ /**
+ * The eperson object for this task
+ */
+ @autoserialize
+ @relationship(EPerson, false)
+ eperson: string;
+
+ /**
+ * The group object for this task
+ */
+ @autoserialize
+ @relationship(Group, false)
+ group: string;
+
/**
* The workflowitem object whom this task is related
*/
@autoserialize
- @relationship(ResourceType.Workflowitem, false)
+ @relationship(WorkflowItem, false)
workflowitem: string;
}
diff --git a/src/app/core/tasks/models/pool-task-object.model.ts b/src/app/core/tasks/models/pool-task-object.model.ts
index 8d98d3e1a5..876b62373d 100644
--- a/src/app/core/tasks/models/pool-task-object.model.ts
+++ b/src/app/core/tasks/models/pool-task-object.model.ts
@@ -1,8 +1,9 @@
import { TaskObject } from './task-object.model';
+import { ResourceType } from '../../shared/resource-type';
/**
* A model class for a PoolTask.
*/
export class PoolTask extends TaskObject {
-
+ static type = new ResourceType('pooltask');
}
diff --git a/src/app/core/tasks/models/task-object.model.ts b/src/app/core/tasks/models/task-object.model.ts
index 97a1c9f59e..14dbbd7301 100644
--- a/src/app/core/tasks/models/task-object.model.ts
+++ b/src/app/core/tasks/models/task-object.model.ts
@@ -4,12 +4,16 @@ import { CacheableObject } from '../../cache/object-cache.reducer';
import { DSpaceObject } from '../../shared/dspace-object.model';
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
import { RemoteData } from '../../data/remote-data';
-import { Workflowitem } from '../../submission/models/workflowitem.model';
+import { WorkflowItem } from '../../submission/models/workflowitem.model';
+import { Group } from '../../eperson/models/group.model';
+import { EPerson } from '../../eperson/models/eperson.model';
+import { ResourceType } from '../../shared/resource-type';
/**
* An abstract model class for a TaskObject.
*/
export class TaskObject extends DSpaceObject implements CacheableObject, ListableObject {
+ static type = new ResourceType('taskobject');
/**
* The task identifier
@@ -26,8 +30,18 @@ export class TaskObject extends DSpaceObject implements CacheableObject, Listabl
*/
action: string;
+ /**
+ * The group of this task
+ */
+ eperson: Observable>;
+
+ /**
+ * The group of this task
+ */
+ group: Observable>;
+
/**
* The workflowitem object whom this task is related
*/
- workflowitem: Observable> | Workflowitem;
+ workflowitem: Observable> | WorkflowItem;
}
diff --git a/src/app/core/tasks/task-response-parsing.service.ts b/src/app/core/tasks/task-response-parsing.service.ts
index 7445f9d267..090b67ccbb 100644
--- a/src/app/core/tasks/task-response-parsing.service.ts
+++ b/src/app/core/tasks/task-response-parsing.service.ts
@@ -8,7 +8,6 @@ import { BaseResponseParsingService } from '../data/base-response-parsing.servic
import { GLOBAL_CONFIG } from '../../../config';
import { GlobalConfig } from '../../../config/global-config.interface';
import { ObjectCacheService } from '../cache/object-cache.service';
-import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory';
import { ErrorResponse, RestResponse, TaskResponse } from '../cache/response.models';
/**
@@ -17,7 +16,6 @@ import { ErrorResponse, RestResponse, TaskResponse } from '../cache/response.mod
@Injectable()
export class TaskResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
- protected objectFactory = NormalizedObjectFactory;
protected toCache = false;
/**
diff --git a/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.html b/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.html
index 65a10ec1b7..030a26df39 100644
--- a/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.html
+++ b/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.html
@@ -4,14 +4,14 @@
[innerHTML]="firstMetadataValue('dc.title')">
- 0"
+ 0"
class="item-list-journal-issues">
-
+
- 0"
+ 0"
class="item-list-journal-issue-numbers">
-
+
-
diff --git a/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts
index c5757f3d51..24498088cb 100644
--- a/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts
+++ b/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts
@@ -20,13 +20,13 @@ const mockItemWithMetadata: Item = Object.assign(new Item(), {
value: 'This is just another title'
}
],
- 'journalvolume.identifier.volume': [
+ 'publicationvolume.volumeNumber': [
{
language: 'en_US',
value: '1234'
}
],
- 'journalissue.identifier.number': [
+ 'publicationissue.issueNumber': [
{
language: 'en_US',
value: '5678'
diff --git a/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.html b/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.html
index 7d7f0cf731..4e6e34d3d6 100644
--- a/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.html
+++ b/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.html
@@ -10,9 +10,9 @@
- 0"
+ 0"
class="item-list-journal-volume-identifiers">
-
+
()
diff --git a/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts
index 6ea5c80a5f..15f5424960 100644
--- a/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts
+++ b/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts
@@ -26,7 +26,7 @@ const mockItemWithMetadata: Item = Object.assign(new Item(), {
value: 'This is just another journal title'
}
],
- 'journalvolume.identifier.volume': [
+ 'publicationvolume.volumeNumber': [
{
language: 'en_US',
value: '1234'
diff --git a/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.html b/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.html
index 32c8074503..0e46e921bb 100644
--- a/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.html
+++ b/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.html
@@ -4,9 +4,9 @@
[innerHTML]="firstMetadataValue('dc.title')">
- 0"
+ 0"
class="item-list-journals">
-
+
diff --git a/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts
index ff419148c6..204672dfe9 100644
--- a/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts
+++ b/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts
@@ -20,7 +20,7 @@ const mockItemWithMetadata: Item = Object.assign(new Item(), {
value: 'This is just another title'
}
],
- 'journal.identifier.issn': [
+ 'creativeworkseries.issn': [
{
language: 'en_US',
value: '1234'
diff --git a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html
index 5d96abb82b..eebd3e03c8 100644
--- a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html
+++ b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html
@@ -7,11 +7,15 @@
+
+
@@ -34,11 +38,11 @@
[label]="'relationships.isPublicationOfJournalIssue' | translate">
diff --git a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.spec.ts b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.spec.ts
index 0711a67492..00403473a7 100644
--- a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.spec.ts
+++ b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.spec.ts
@@ -8,29 +8,30 @@ import {
createRelationshipsObservable,
getItemPageFieldsTest
} from '../../../../+item-page/simple/item-types/shared/item.component.spec';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: {
- 'journalissue.identifier.number': [
+ 'publicationissue.issueNumber': [
{
language: 'en_US',
value: '1234'
}
],
- 'journalissue.issuedate': [
+ 'creativework.datePublished': [
{
language: 'en_US',
value: '2018'
}
],
- 'journalissue.identifier.description': [
+ 'dc.description': [
{
language: 'en_US',
value: 'desc'
}
],
- 'journalissue.identifier.keyword': [
+ 'creativework.keywords': [
{
language: 'en_US',
value: 'keyword'
diff --git a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.ts b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.ts
index a355431100..b584fa3285 100644
--- a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.ts
+++ b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.ts
@@ -4,10 +4,7 @@ import { Item } from '../../../../core/shared/item.model';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
-import {
- filterRelationsByTypeLabel,
- relationsToItems
-} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
+import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
@rendersItemType('JournalIssue', ItemViewMode.Full)
@Component({
@@ -34,12 +31,10 @@ export class JournalIssueComponent extends ItemComponent {
if (isNotEmpty(this.resolvedRelsAndTypes$)) {
this.volumes$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isJournalVolumeOfIssue'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isJournalVolumeOfIssue')
);
this.publications$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isPublicationOfJournalIssue'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isPublicationOfJournalIssue')
);
}
}
diff --git a/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.html b/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.html
index 18bf1701fc..83626c7ae7 100644
--- a/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.html
+++ b/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.html
@@ -7,11 +7,11 @@
@@ -25,7 +25,7 @@
[label]="'relationships.isIssueOf' | translate">
diff --git a/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.spec.ts b/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.spec.ts
index 3beca0c17a..d2b3420b2a 100644
--- a/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.spec.ts
+++ b/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.spec.ts
@@ -8,23 +8,24 @@ import {
createRelationshipsObservable,
getItemPageFieldsTest
} from '../../../../+item-page/simple/item-types/shared/item.component.spec';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: {
- 'journalvolume.identifier.volume': [
+ 'publicationvolume.volumeNumber': [
{
language: 'en_US',
value: '1234'
}
],
- 'journalvolume.issuedate': [
+ 'creativework.datePublished': [
{
language: 'en_US',
value: '2018'
}
],
- 'journalvolume.identifier.description': [
+ 'dc.description': [
{
language: 'en_US',
value: 'desc'
diff --git a/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.ts b/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.ts
index a851bfebbe..66df0b8104 100644
--- a/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.ts
+++ b/src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.ts
@@ -4,10 +4,7 @@ import { Item } from '../../../../core/shared/item.model';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
-import {
- filterRelationsByTypeLabel,
- relationsToItems
-} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
+import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
@rendersItemType('JournalVolume', ItemViewMode.Full)
@Component({
@@ -34,12 +31,10 @@ export class JournalVolumeComponent extends ItemComponent {
if (isNotEmpty(this.resolvedRelsAndTypes$)) {
this.journals$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isJournalOfVolume'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isJournalOfVolume')
);
this.issues$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isIssueOfJournalVolume'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isIssueOfJournalVolume')
);
}
}
diff --git a/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.html b/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.html
index 2ab3430256..a82d3c5df6 100644
--- a/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.html
+++ b/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.html
@@ -7,15 +7,15 @@
@@ -25,7 +25,7 @@
[label]="'relationships.isVolumeOf' | translate">
diff --git a/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.spec.ts b/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.spec.ts
index 4189713cb9..c66c3a2462 100644
--- a/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.spec.ts
+++ b/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.spec.ts
@@ -15,26 +15,27 @@ import { isNotEmpty } from '../../../../shared/empty.util';
import { JournalComponent } from './journal.component';
import { of as observableOf } from 'rxjs';
import { GenericItemPageFieldComponent } from '../../../../+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
let comp: JournalComponent;
let fixture: ComponentFixture
;
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: {
- 'journal.identifier.issn': [
+ 'creativeworkseries.issn': [
{
language: 'en_US',
value: '1234'
}
],
- 'journal.publisher': [
+ 'creativework.publisher': [
{
language: 'en_US',
value: 'a publisher'
}
],
- 'journal.identifier.description': [
+ 'dc.description': [
{
language: 'en_US',
value: 'desc'
diff --git a/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.ts b/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.ts
index 99183651e1..a8f071d78a 100644
--- a/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.ts
+++ b/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.ts
@@ -4,10 +4,7 @@ import { Item } from '../../../../core/shared/item.model';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
-import {
- filterRelationsByTypeLabel,
- relationsToItems
-} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
+import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
@rendersItemType('Journal', ItemViewMode.Full)
@Component({
@@ -29,8 +26,7 @@ export class JournalComponent extends ItemComponent {
if (isNotEmpty(this.resolvedRelsAndTypes$)) {
this.volumes$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isVolumeOfJournal'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isVolumeOfJournal')
);
}
}
diff --git a/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.html b/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.html
index a809c0f655..8d312fb7c0 100644
--- a/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.html
+++ b/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.html
@@ -1,13 +1,13 @@
+ [innerHTML]="firstMetadataValue('organization.legalName')">
- 0"
+ 0"
class="item-list-orgunit-description">
+ [innerHTML]="firstMetadataValue('dc.description')">
diff --git a/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.spec.ts
index ef5d7a0b4e..dd2b138abb 100644
--- a/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.spec.ts
+++ b/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.spec.ts
@@ -20,7 +20,7 @@ const mockItemWithMetadata: Item = Object.assign(new Item(), {
value: 'This is just another title'
}
],
- 'orgunit.identifier.description': [
+ 'dc.description': [
{
language: 'en_US',
value: 'A description about the OrgUnit'
diff --git a/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-metadata-list-element.component.html b/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-metadata-list-element.component.html
index 463770c0ae..ea429e87c6 100644
--- a/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-metadata-list-element.component.html
+++ b/src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-metadata-list-element.component.html
@@ -1,13 +1,13 @@
- 0"
+ 0"
class="item-list-job-title">
-
+
diff --git a/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.html b/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.html
index 52b69453ce..c88b77083d 100644
--- a/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.html
+++ b/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.html
@@ -1,12 +1,12 @@
+ [innerHTML]="firstMetadataValue('person.familyName') + ', ' + firstMetadataValue('person.givenName')">
- 0"
+ 0"
class="item-list-job-title">
-
+
diff --git a/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts
index 7c5240da95..3b6aeae45b 100644
--- a/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts
+++ b/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts
@@ -20,7 +20,7 @@ const mockItemWithMetadata: Item = Object.assign(new Item(), {
value: 'This is just another title'
}
],
- 'person.identifier.jobtitle': [
+ 'person.jobTitle': [
{
language: 'en_US',
value: 'Developer'
diff --git a/src/app/entity-groups/research-entities/item-list-elements/person/person-metadata-list-element.component.html b/src/app/entity-groups/research-entities/item-list-elements/person/person-metadata-list-element.component.html
index 3dfe17debc..1125c2fb9b 100644
--- a/src/app/entity-groups/research-entities/item-list-elements/person/person-metadata-list-element.component.html
+++ b/src/app/entity-groups/research-entities/item-list-elements/person/person-metadata-list-element.component.html
@@ -1,8 +1,8 @@
- 0"
+ 0"
class="item-list-job-title">
-
+
@@ -10,6 +10,6 @@
diff --git a/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.html b/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.html
index 6f0faa90ef..3e979b4e4d 100644
--- a/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.html
+++ b/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.html
@@ -1,16 +1,16 @@
-
-
- 0"
- class="item-list-status">
-
-
-
-
-
-
+ [innerHTML]="firstMetadataValue('dc.title')">
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts
index f74d7931b0..02dc3f6d73 100644
--- a/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts
+++ b/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts
@@ -20,12 +20,12 @@ const mockItemWithMetadata: Item = Object.assign(new Item(), {
value: 'This is just another title'
}
],
- 'project.identifier.status': [
- {
- language: 'en_US',
- value: 'A status about the project'
- }
- ]
+ // 'project.identifier.status': [
+ // {
+ // language: 'en_US',
+ // value: 'A status about the project'
+ // }
+ // ]
}
});
const mockItemWithoutMetadata: Item = Object.assign(new Item(), {
@@ -61,27 +61,27 @@ describe('ProjectListElementComponent', () => {
}));
- describe('When the item has a status', () => {
- beforeEach(() => {
- projectListElementComponent.item = mockItemWithMetadata;
- fixture.detectChanges();
- });
-
- it('should show the status span', () => {
- const statusField = fixture.debugElement.query(By.css('span.item-list-status'));
- expect(statusField).not.toBeNull();
- });
- });
-
- describe('When the item has no status', () => {
- beforeEach(() => {
- projectListElementComponent.item = mockItemWithoutMetadata;
- fixture.detectChanges();
- });
-
- it('should not show the status span', () => {
- const statusField = fixture.debugElement.query(By.css('span.item-list-status'));
- expect(statusField).toBeNull();
- });
- });
+ // describe('When the item has a status', () => {
+ // beforeEach(() => {
+ // projectListElementComponent.item = mockItemWithMetadata;
+ // fixture.detectChanges();
+ // });
+ //
+ // it('should show the status span', () => {
+ // const statusField = fixture.debugElement.query(By.css('span.item-list-status'));
+ // expect(statusField).not.toBeNull();
+ // });
+ // });
+ //
+ // describe('When the item has no status', () => {
+ // beforeEach(() => {
+ // projectListElementComponent.item = mockItemWithoutMetadata;
+ // fixture.detectChanges();
+ // });
+ //
+ // it('should not show the status span', () => {
+ // const statusField = fixture.debugElement.query(By.css('span.item-list-status'));
+ // expect(statusField).toBeNull();
+ // });
+ // });
});
diff --git a/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.html b/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.html
index 0446ac6861..92ac3eac30 100644
--- a/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.html
+++ b/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.html
@@ -1,5 +1,5 @@
- {{'orgunit.page.titleprefix' | translate}}
+ {{'orgunit.page.titleprefix' | translate}}
@@ -7,19 +7,19 @@
@@ -37,7 +37,7 @@
[label]="'relationships.isPublicationOf' | translate">
diff --git a/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.spec.ts b/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.spec.ts
index 52caf69d72..a49105b2e3 100644
--- a/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.spec.ts
+++ b/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.spec.ts
@@ -8,35 +8,36 @@ import {
createRelationshipsObservable,
getItemPageFieldsTest
} from '../../../../+item-page/simple/item-types/shared/item.component.spec';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: {
- 'orgunit.identifier.dateestablished': [
+ 'organization.foundingDate': [
{
language: 'en_US',
value: '2018'
}
],
- 'orgunit.identifier.city': [
+ 'organization.address.addressLocality': [
{
language: 'en_US',
value: 'New York'
}
],
- 'orgunit.identifier.country': [
+ 'organization.adress.addressCountry': [
{
language: 'en_US',
value: 'USA'
}
],
- 'orgunit.identifier.id': [
+ 'dc.identifier': [
{
language: 'en_US',
value: '1'
}
],
- 'orgunit.identifier.description': [
+ 'dc.description': [
{
language: 'en_US',
value: 'desc'
diff --git a/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.ts b/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.ts
index 7101f05d35..031ca14ebb 100644
--- a/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.ts
+++ b/src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.ts
@@ -4,10 +4,7 @@ import { Item } from '../../../../core/shared/item.model';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
-import {
- filterRelationsByTypeLabel,
- relationsToItems
-} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
+import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
@rendersItemType('OrgUnit', ItemViewMode.Full)
@Component({
@@ -39,18 +36,15 @@ export class OrgunitComponent extends ItemComponent implements OnInit {
if (isNotEmpty(this.resolvedRelsAndTypes$)) {
this.people$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isPersonOfOrgUnit'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isPersonOfOrgUnit')
);
this.projects$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isProjectOfOrgUnit'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isProjectOfOrgUnit')
);
this.publications$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isPublicationOfOrgUnit'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isPublicationOfOrgUnit')
);
}
}}
diff --git a/src/app/entity-groups/research-entities/item-pages/person/person.component.html b/src/app/entity-groups/research-entities/item-pages/person/person.component.html
index 88cd647645..04d7b9e062 100644
--- a/src/app/entity-groups/research-entities/item-pages/person/person.component.html
+++ b/src/app/entity-groups/research-entities/item-pages/person/person.component.html
@@ -1,5 +1,5 @@
- {{'person.page.titleprefix' | translate}}
+ {{'person.page.titleprefix' | translate}}
@@ -7,21 +7,21 @@
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/src/app/entity-groups/research-entities/item-pages/person/person.component.spec.ts b/src/app/entity-groups/research-entities/item-pages/person/person.component.spec.ts
index beadbbef79..4c523b81cb 100644
--- a/src/app/entity-groups/research-entities/item-pages/person/person.component.spec.ts
+++ b/src/app/entity-groups/research-entities/item-pages/person/person.component.spec.ts
@@ -8,47 +8,48 @@ import {
createRelationshipsObservable,
getItemPageFieldsTest
} from '../../../../+item-page/simple/item-types/shared/item.component.spec';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: {
- 'person.identifier.email': [
+ 'person.email': [
{
language: 'en_US',
value: 'fake@email.com'
}
],
- 'person.identifier.orcid': [
- {
- language: 'en_US',
- value: 'ORCID-1'
- }
- ],
- 'person.identifier.birthdate': [
+ // 'person.identifier.orcid': [
+ // {
+ // language: 'en_US',
+ // value: 'ORCID-1'
+ // }
+ // ],
+ 'person.birthDate': [
{
language: 'en_US',
value: '1993'
}
],
- 'person.identifier.staffid': [
- {
- language: 'en_US',
- value: '1'
- }
- ],
- 'person.identifier.jobtitle': [
+ // 'person.identifier.staffid': [
+ // {
+ // language: 'en_US',
+ // value: '1'
+ // }
+ // ],
+ 'person.jobTitle': [
{
language: 'en_US',
value: 'Developer'
}
],
- 'person.identifier.lastname': [
+ 'person.familyName': [
{
language: 'en_US',
value: 'Doe'
}
],
- 'person.identifier.firstname': [
+ 'person.givenName': [
{
language: 'en_US',
value: 'John'
diff --git a/src/app/entity-groups/research-entities/item-pages/person/person.component.ts b/src/app/entity-groups/research-entities/item-pages/person/person.component.ts
index ec91561eb9..8b36175b96 100644
--- a/src/app/entity-groups/research-entities/item-pages/person/person.component.ts
+++ b/src/app/entity-groups/research-entities/item-pages/person/person.component.ts
@@ -6,10 +6,7 @@ import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.compo
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
-import {
- filterRelationsByTypeLabel,
- relationsToItems
-} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
+import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
@rendersItemType('Person', ItemViewMode.Full)
@Component({
@@ -57,18 +54,15 @@ export class PersonComponent extends ItemComponent {
if (isNotEmpty(this.resolvedRelsAndTypes$)) {
this.publications$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isPublicationOfAuthor'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isPublicationOfAuthor')
);
this.projects$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isProjectOfPerson'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isProjectOfPerson')
);
this.orgUnits$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isOrgUnitOfPerson'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isOrgUnitOfPerson')
);
this.fixedFilterQuery = this.fixedFilterService.getQueryByRelations('isAuthorOfPublication', this.item.id);
diff --git a/src/app/entity-groups/research-entities/item-pages/project/project.component.html b/src/app/entity-groups/research-entities/item-pages/project/project.component.html
index 08e386182b..4e9a130b8c 100644
--- a/src/app/entity-groups/research-entities/item-pages/project/project.component.html
+++ b/src/app/entity-groups/research-entities/item-pages/project/project.component.html
@@ -1,15 +1,15 @@
- {{'project.page.titleprefix' | translate}}
+ {{'project.page.titleprefix' | translate}}
-
-
+
+
+
+
@@ -19,13 +19,13 @@
[label]="'project.page.funder'">
-
-
+
+
+
+
diff --git a/src/app/entity-groups/research-entities/item-pages/project/project.component.spec.ts b/src/app/entity-groups/research-entities/item-pages/project/project.component.spec.ts
index 1e1fd42517..5185857494 100644
--- a/src/app/entity-groups/research-entities/item-pages/project/project.component.spec.ts
+++ b/src/app/entity-groups/research-entities/item-pages/project/project.component.spec.ts
@@ -8,35 +8,36 @@ import {
createRelationshipsObservable,
getItemPageFieldsTest
} from '../../../../+item-page/simple/item-types/shared/item.component.spec';
+import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: {
- 'project.identifier.status': [
- {
- language: 'en_US',
- value: 'published'
- }
- ],
- 'project.identifier.id': [
+ // 'project.identifier.status': [
+ // {
+ // language: 'en_US',
+ // value: 'published'
+ // }
+ // ],
+ 'dc.identifier': [
{
language: 'en_US',
value: '1'
}
],
- 'project.identifier.expectedcompletion': [
- {
- language: 'en_US',
- value: 'exp comp'
- }
- ],
- 'project.identifier.description': [
+ // 'project.identifier.expectedcompletion': [
+ // {
+ // language: 'en_US',
+ // value: 'exp comp'
+ // }
+ // ],
+ 'dc.description': [
{
language: 'en_US',
value: 'keyword'
}
],
- 'project.identifier.keyword': [
+ 'dc.subject': [
{
language: 'en_US',
value: 'keyword'
diff --git a/src/app/entity-groups/research-entities/item-pages/project/project.component.ts b/src/app/entity-groups/research-entities/item-pages/project/project.component.ts
index 46bc7c9f88..13c2b54ba4 100644
--- a/src/app/entity-groups/research-entities/item-pages/project/project.component.ts
+++ b/src/app/entity-groups/research-entities/item-pages/project/project.component.ts
@@ -5,10 +5,7 @@ import { MetadataRepresentation } from '../../../../core/shared/metadata-represe
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
-import {
- filterRelationsByTypeLabel,
- relationsToItems
-} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
+import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
@rendersItemType('Project', ItemViewMode.Full)
@Component({
@@ -47,18 +44,15 @@ export class ProjectComponent extends ItemComponent implements OnInit {
this.contributors$ = this.buildRepresentations('OrgUnit', 'project.contributor.other');
this.people$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isPersonOfProject'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isPersonOfProject')
);
this.publications$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isPublicationOfProject'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isPublicationOfProject')
);
this.orgUnits$ = this.resolvedRelsAndTypes$.pipe(
- filterRelationsByTypeLabel('isOrgUnitOfProject'),
- relationsToItems(this.item.id)
+ getRelatedItemsByTypeLabel(this.item.id, 'isOrgUnitOfProject')
);
}
}
diff --git a/src/app/footer/footer.component.scss b/src/app/footer/footer.component.scss
index bd141706da..51201774d5 100644
--- a/src/app/footer/footer.component.scss
+++ b/src/app/footer/footer.component.scss
@@ -1,4 +1,3 @@
-@import '../../styles/variables.scss';
$footer-bg: $gray-100;
$footer-border: 1px solid darken($footer-bg, 10%);
$footer-padding: $spacer * 1.5;
diff --git a/src/app/header-nav-wrapper/header-navbar-wrapper.component.scss b/src/app/header-nav-wrapper/header-navbar-wrapper.component.scss
index f514508385..c3eba35b79 100644
--- a/src/app/header-nav-wrapper/header-navbar-wrapper.component.scss
+++ b/src/app/header-nav-wrapper/header-navbar-wrapper.component.scss
@@ -1,5 +1,3 @@
-@import '../../styles/variables.scss';
-
@media screen and (max-width: map-get($grid-breakpoints, md)) {
:host.open {
background-color: $white;
diff --git a/src/app/header/header.component.scss b/src/app/header/header.component.scss
index df4c0b8fb8..4d25bd0d43 100644
--- a/src/app/header/header.component.scss
+++ b/src/app/header/header.component.scss
@@ -1,5 +1,3 @@
-@import '../../styles/variables.scss';
-
.navbar-brand img {
height: $header-logo-height;
@media screen and (max-width: map-get($grid-breakpoints, sm)) {
diff --git a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.scss b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.scss
index 1fb78bef0d..f724c3e751 100644
--- a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.scss
+++ b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.scss
@@ -1,5 +1,3 @@
-@import '../../../styles/variables.scss';
-
.dropdown-menu {
overflow: hidden;
min-width: 100%;
diff --git a/src/app/navbar/navbar.component.scss b/src/app/navbar/navbar.component.scss
index 947b785196..d0fa04991d 100644
--- a/src/app/navbar/navbar.component.scss
+++ b/src/app/navbar/navbar.component.scss
@@ -1,5 +1,3 @@
-@import '../../styles/variables.scss';
-
nav.navbar {
border-bottom: 1px $gray-400 solid;
align-items: baseline;
@@ -34,6 +32,4 @@ nav.navbar {
}
padding: 0;
}
-}
-
-
+}
\ No newline at end of file
diff --git a/src/app/navbar/navbar.component.spec.ts b/src/app/navbar/navbar.component.spec.ts
index 2d937fd84e..ca054a662b 100644
--- a/src/app/navbar/navbar.component.spec.ts
+++ b/src/app/navbar/navbar.component.spec.ts
@@ -11,6 +11,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { Injector, NO_ERRORS_SCHEMA } from '@angular/core';
import { MenuService } from '../shared/menu/menu.service';
import { MenuServiceStub } from '../shared/testing/menu-service-stub';
+import { ENV_CONFIG, GLOBAL_CONFIG } from '../../config';
let comp: NavbarComponent;
let fixture: ComponentFixture
;
@@ -30,6 +31,7 @@ describe('NavbarComponent', () => {
{ provide: Injector, useValue: {} },
{ provide: MenuService, useValue: menuService },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
+ { provide: GLOBAL_CONFIG, useValue: ENV_CONFIG }
],
schemas: [NO_ERRORS_SCHEMA]
})
diff --git a/src/app/navbar/navbar.component.ts b/src/app/navbar/navbar.component.ts
index 48b316af4b..4c7c3cd030 100644
--- a/src/app/navbar/navbar.component.ts
+++ b/src/app/navbar/navbar.component.ts
@@ -1,4 +1,4 @@
-import { Component, Injector, OnInit } from '@angular/core';
+import { Component, Inject, Injector, OnInit } from '@angular/core';
import { slideMobileNav } from '../shared/animations/slide';
import { MenuComponent } from '../shared/menu/menu.component';
import { MenuService } from '../shared/menu/menu.service';
@@ -6,14 +6,15 @@ import { MenuID, MenuItemType } from '../shared/menu/initial-menus-state';
import { TextMenuItemModel } from '../shared/menu/menu-item/models/text.model';
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
import { HostWindowService } from '../shared/host-window.service';
+import { GLOBAL_CONFIG, GlobalConfig } from '../../config';
/**
* Component representing the public navbar
*/
@Component({
selector: 'ds-navbar',
- styleUrls: ['navbar.component.scss'],
- templateUrl: 'navbar.component.html',
+ styleUrls: ['./navbar.component.scss'],
+ templateUrl: './navbar.component.html',
animations: [slideMobileNav]
})
export class NavbarComponent extends MenuComponent implements OnInit {
@@ -23,7 +24,8 @@ export class NavbarComponent extends MenuComponent implements OnInit {
*/
menuID = MenuID.PUBLIC;
- constructor(protected menuService: MenuService,
+ constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig,
+ protected menuService: MenuService,
protected injector: Injector,
public windowService: HostWindowService
) {
@@ -39,7 +41,7 @@ export class NavbarComponent extends MenuComponent implements OnInit {
* Initialize all menu sections and items for this menu
*/
createMenu() {
- const menuList = [
+ const menuList: any[] = [
/* News */
{
id: 'browse_global',
@@ -62,50 +64,6 @@ export class NavbarComponent extends MenuComponent implements OnInit {
// link: '#'
// } as LinkMenuItemModel,
// },
- {
- id: 'browse_global_global_by_title',
- parentID: 'browse_global',
- active: false,
- visible: true,
- model: {
- type: MenuItemType.LINK,
- text: 'menu.section.browse_global_by_title',
- link: '/browse/title'
- } as LinkMenuItemModel,
- },
- {
- id: 'browse_global_global_by_issue_date',
- parentID: 'browse_global',
- active: false,
- visible: true,
- model: {
- type: MenuItemType.LINK,
- text: 'menu.section.browse_global_by_issue_date',
- link: '/browse/dateissued'
- } as LinkMenuItemModel,
- },
- {
- id: 'browse_global_by_author',
- parentID: 'browse_global',
- active: false,
- visible: true,
- model: {
- type: MenuItemType.LINK,
- text: 'menu.section.browse_global_by_author',
- link: '/browse/author'
- } as LinkMenuItemModel,
- },
- {
- id: 'browse_global_by_subject',
- parentID: 'browse_global',
- active: false,
- visible: true,
- model: {
- type: MenuItemType.LINK,
- text: 'menu.section.browse_global_by_subject',
- link: '/browse/subject'
- } as LinkMenuItemModel,
- },
/* Statistics */
{
@@ -120,6 +78,21 @@ export class NavbarComponent extends MenuComponent implements OnInit {
index: 2
},
];
+ // Read the different Browse-By types from config and add them to the browse menu
+ const types = this.config.browseBy.types;
+ types.forEach((typeConfig) => {
+ menuList.push({
+ id: `browse_global_by_${typeConfig.id}`,
+ parentID: 'browse_global',
+ active: false,
+ visible: true,
+ model: {
+ type: MenuItemType.LINK,
+ text: `menu.section.browse_global_by_${typeConfig.id}`,
+ link: `/browse/${typeConfig.id}`
+ } as LinkMenuItemModel
+ });
+ });
menuList.forEach((menuSection) => this.menuService.addSection(this.menuID, menuSection));
}
diff --git a/src/app/pagenotfound/pagenotfound.component.scss b/src/app/pagenotfound/pagenotfound.component.scss
index da97dd7a62..e69de29bb2 100644
--- a/src/app/pagenotfound/pagenotfound.component.scss
+++ b/src/app/pagenotfound/pagenotfound.component.scss
@@ -1 +0,0 @@
-@import '../../styles/variables.scss';
diff --git a/src/app/shared/browse-by/browse-by.component.spec.ts b/src/app/shared/browse-by/browse-by.component.spec.ts
index bae345d009..5592b88c86 100644
--- a/src/app/shared/browse-by/browse-by.component.spec.ts
+++ b/src/app/shared/browse-by/browse-by.component.spec.ts
@@ -17,6 +17,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
+import { createSuccessfulRemoteDataObject$ } from '../testing/utils';
describe('BrowseByComponent', () => {
let comp: BrowseByComponent;
@@ -42,7 +43,7 @@ describe('BrowseByComponent', () => {
]
})
];
- const mockItemsRD$ = observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), mockItems)));
+ const mockItemsRD$ = createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), mockItems));
beforeEach(async(() => {
TestBed.configureTestingModule({
diff --git a/src/app/shared/chips/chips.component.scss b/src/app/shared/chips/chips.component.scss
index 9d7eae7edd..76be755920 100644
--- a/src/app/shared/chips/chips.component.scss
+++ b/src/app/shared/chips/chips.component.scss
@@ -1,5 +1,3 @@
-@import "../../../styles/variables";
-
.chip-selected {
background-color: map-get($theme-colors, info) !important;
}
diff --git a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.spec.ts b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.spec.ts
index 3f52f0e46a..1b44970402 100644
--- a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.spec.ts
+++ b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.spec.ts
@@ -103,7 +103,7 @@ describe('ComColFormComponent', () => {
...randomMD,
...abstractMD
},
- type: ResourceType.Community
+ type: Community.type
},
)
);
diff --git a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.ts b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.ts
index e24676a646..6a96892b06 100644
--- a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.ts
+++ b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.ts
@@ -10,7 +10,7 @@ import { TranslateService } from '@ngx-translate/core';
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { MetadataMap, MetadataValue } from '../../../core/shared/metadata.models';
import { isNotEmpty } from '../../empty.util';
-import { ResourceType } from '../../../core/shared/resource-type';
+import { Community } from '../../../core/shared/community.model';
/**
* A form for creating and editing Communities or Collections
@@ -99,7 +99,7 @@ export class ComColFormComponent implements OnInit {
...this.dso.metadata,
...formMetadata
},
- type: ResourceType.Community
+ type: Community.type
});
this.submitForm.emit(updatedDSO);
}
diff --git a/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.spec.ts b/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.spec.ts
index 4dad4a703f..08f15ad052 100644
--- a/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.spec.ts
+++ b/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.spec.ts
@@ -4,7 +4,6 @@ import { RouteService } from '../../services/route.service';
import { Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { of as observableOf } from 'rxjs';
-import { RemoteData } from '../../../core/data/remote-data';
import { Community } from '../../../core/shared/community.model';
import { SharedModule } from '../../shared.module';
import { CommonModule } from '@angular/common';
@@ -13,6 +12,10 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { CreateComColPageComponent } from './create-comcol-page.component';
import { DataService } from '../../../core/data/data.service';
+import {
+ createFailedRemoteDataObject$,
+ createSuccessfulRemoteDataObject$
+} from '../../testing/utils';
describe('CreateComColPageComponent', () => {
let comp: CreateComColPageComponent;
@@ -46,14 +49,14 @@ describe('CreateComColPageComponent', () => {
});
communityDataServiceStub = {
- findById: (uuid) => observableOf(new RemoteData(false, false, true, null, Object.assign(new Community(), {
+ findById: (uuid) => createSuccessfulRemoteDataObject$(Object.assign(new Community(), {
uuid: uuid,
metadata: [{
key: 'dc.title',
value: community.name
}]
- }))),
- create: (com, uuid?) => observableOf(new RemoteData(false, false, true, undefined, newCommunity))
+ })),
+ create: (com, uuid?) => createSuccessfulRemoteDataObject$(newCommunity)
};
@@ -109,7 +112,7 @@ describe('CreateComColPageComponent', () => {
it('should not navigate on failure', () => {
spyOn(router, 'navigate');
- spyOn(dsoDataService, 'create').and.returnValue(observableOf(new RemoteData(true, true, false, undefined, newCommunity)));
+ spyOn(dsoDataService, 'create').and.returnValue(createFailedRemoteDataObject$(newCommunity));
comp.onSubmit(data);
fixture.detectChanges();
expect(router.navigate).not.toHaveBeenCalled();
diff --git a/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.ts b/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.ts
index e2e73bae14..57c860e04f 100644
--- a/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.ts
+++ b/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.ts
@@ -47,10 +47,10 @@ export class DeleteComColPageComponent implements
.pipe(first())
.subscribe((success: boolean) => {
if (success) {
- const successMessage = this.translate.instant(dso.type + '.delete.notification.success');
+ const successMessage = this.translate.instant((dso as any).type + '.delete.notification.success');
this.notifications.success(successMessage)
} else {
- const errorMessage = this.translate.instant(dso.type + '.delete.notification.fail');
+ const errorMessage = this.translate.instant((dso as any).type + '.delete.notification.fail');
this.notifications.error(errorMessage)
}
this.router.navigate(['/']);
diff --git a/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts b/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts
index 75b7fe40e7..03f751599f 100644
--- a/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts
+++ b/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts
@@ -3,7 +3,6 @@ import { CommunityDataService } from '../../../core/data/community-data.service'
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { of as observableOf } from 'rxjs';
-import { RemoteData } from '../../../core/data/remote-data';
import { Community } from '../../../core/shared/community.model';
import { SharedModule } from '../../shared.module';
import { CommonModule } from '@angular/common';
@@ -12,6 +11,10 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { EditComColPageComponent } from './edit-comcol-page.component';
import { DataService } from '../../../core/data/data.service';
+import {
+ createFailedRemoteDataObject$,
+ createSuccessfulRemoteDataObject$
+} from '../../testing/utils';
describe('EditComColPageComponent', () => {
let comp: EditComColPageComponent;
@@ -43,7 +46,7 @@ describe('EditComColPageComponent', () => {
});
communityDataServiceStub = {
- update: (com, uuid?) => observableOf(new RemoteData(false, false, true, undefined, newCommunity))
+ update: (com, uuid?) => createSuccessfulRemoteDataObject$(newCommunity)
};
@@ -97,7 +100,7 @@ describe('EditComColPageComponent', () => {
it('should not navigate on failure', () => {
spyOn(router, 'navigate');
- spyOn(dsoDataService, 'update').and.returnValue(observableOf(new RemoteData(true, true, false, undefined, newCommunity)));
+ spyOn(dsoDataService, 'update').and.returnValue(createFailedRemoteDataObject$(newCommunity));
comp.onSubmit(data);
fixture.detectChanges();
expect(router.navigate).not.toHaveBeenCalled();
diff --git a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.html b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.html
index f9ef4e5232..1c73fbb3df 100644
--- a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.html
+++ b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.html
@@ -1,7 +1,6 @@
{{'browse.comcol.head' | translate}}
diff --git a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts
index 85d40a77e0..dcc7840bb4 100644
--- a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts
+++ b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts
@@ -1,4 +1,6 @@
-import { Component, Input } from '@angular/core';
+import { Component, Inject, Input, OnInit } from '@angular/core';
+import { GLOBAL_CONFIG, GlobalConfig } from '../../../config';
+import { BrowseByTypeConfig } from '../../../config/browse-by-type-config.interface';
/**
* A component to display the "Browse By" section of a Community or Collection page
@@ -8,9 +10,22 @@ import { Component, Input } from '@angular/core';
selector: 'ds-comcol-page-browse-by',
templateUrl: './comcol-page-browse-by.component.html',
})
-export class ComcolPageBrowseByComponent {
+export class ComcolPageBrowseByComponent implements OnInit {
/**
* The ID of the Community or Collection
*/
@Input() id: string;
+
+ /**
+ * List of currently active browse configurations
+ */
+ types: BrowseByTypeConfig[];
+
+ constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig) {
+ }
+
+ ngOnInit(): void {
+ this.types = this.config.browseBy.types;
+ }
+
}
diff --git a/src/app/shared/comcol-page-content/comcol-page-content.component.scss b/src/app/shared/comcol-page-content/comcol-page-content.component.scss
index ad84b72f8c..e69de29bb2 100644
--- a/src/app/shared/comcol-page-content/comcol-page-content.component.scss
+++ b/src/app/shared/comcol-page-content/comcol-page-content.component.scss
@@ -1 +0,0 @@
-@import '../../../styles/variables.scss';
\ No newline at end of file
diff --git a/src/app/shared/comcol-page-header/comcol-page-header.component.scss b/src/app/shared/comcol-page-header/comcol-page-header.component.scss
index ad84b72f8c..e69de29bb2 100644
--- a/src/app/shared/comcol-page-header/comcol-page-header.component.scss
+++ b/src/app/shared/comcol-page-header/comcol-page-header.component.scss
@@ -1 +0,0 @@
-@import '../../../styles/variables.scss';
\ No newline at end of file
diff --git a/src/app/shared/comcol-page-logo/comcol-page-logo.component.scss b/src/app/shared/comcol-page-logo/comcol-page-logo.component.scss
index 50be6f5ad0..e69de29bb2 100644
--- a/src/app/shared/comcol-page-logo/comcol-page-logo.component.scss
+++ b/src/app/shared/comcol-page-logo/comcol-page-logo.component.scss
@@ -1 +0,0 @@
-@import '../../../styles/variables.scss';
diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.spec.ts b/src/app/shared/dso-selector/dso-selector/dso-selector.component.spec.ts
index 5ec553222b..234f13f4b1 100644
--- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.spec.ts
+++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.spec.ts
@@ -5,12 +5,11 @@ import { DSOSelectorComponent } from './dso-selector.component';
import { SearchService } from '../../../+search-page/search-service/search.service';
import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
import { PaginatedSearchOptions } from '../../../+search-page/paginated-search-options.model';
-import { RemoteData } from '../../../core/data/remote-data';
import { ItemSearchResult } from '../../object-collection/shared/item-search-result.model';
import { Item } from '../../../core/shared/item.model';
-import { of as observableOf } from 'rxjs';
import { PaginatedList } from '../../../core/data/paginated-list';
import { MetadataValue } from '../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject$ } from '../../testing/utils';
describe('DSOSelectorComponent', () => {
let component: DSOSelectorComponent;
@@ -30,7 +29,7 @@ describe('DSOSelectorComponent', () => {
searchResult.indexableObject = item;
searchResult.hitHighlights = {};
const searchService = jasmine.createSpyObj('searchService', {
- search: observableOf(new RemoteData(false, false, true, undefined, new PaginatedList(undefined, [searchResult])))
+ search: createSuccessfulRemoteDataObject$(new PaginatedList(undefined, [searchResult]))
});
beforeEach(async(() => {
@@ -68,6 +67,4 @@ describe('DSOSelectorComponent', () => {
expect(searchService.search).toHaveBeenCalledWith(searchOptions);
});
-
-})
-;
+});
diff --git a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts
index 9efeddeeab..97957d5250 100644
--- a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts
+++ b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts
@@ -10,6 +10,7 @@ import * as collectionRouter from '../../../../+collection-page/collection-page-
import { Community } from '../../../../core/shared/community.model';
import { CreateCollectionParentSelectorComponent } from './create-collection-parent-selector.component';
import { MetadataValue } from '../../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
describe('CreateCollectionParentSelectorComponent', () => {
let component: CreateCollectionParentSelectorComponent;
@@ -26,7 +27,7 @@ describe('CreateCollectionParentSelectorComponent', () => {
})]
};
const router = new RouterStub();
- const communityRD = new RemoteData(false, false, true, undefined, community);
+ const communityRD = createSuccessfulRemoteDataObject(community);
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
const createPath = 'testCreatePath';
diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts
index e1bb9c7997..4871d74b98 100644
--- a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts
+++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts
@@ -10,6 +10,7 @@ import * as communityRouter from '../../../../+community-page/community-page-rou
import { Community } from '../../../../core/shared/community.model';
import { CreateCommunityParentSelectorComponent } from './create-community-parent-selector.component';
import { MetadataValue } from '../../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
describe('CreateCommunityParentSelectorComponent', () => {
let component: CreateCommunityParentSelectorComponent;
@@ -20,7 +21,7 @@ describe('CreateCommunityParentSelectorComponent', () => {
community.uuid = '1234-1234-1234-1234';
community.metadata = { 'dc.title': [Object.assign(new MetadataValue(), { value: 'Community title', language: undefined })] };
const router = new RouterStub();
- const communityRD = new RemoteData(false, false, true, undefined, community);
+ const communityRD = createSuccessfulRemoteDataObject(community);
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
const createPath = 'testCreatePath';
diff --git a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.spec.ts
index 19bb58eb5a..2c9b2499ab 100644
--- a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.spec.ts
+++ b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.spec.ts
@@ -9,6 +9,7 @@ import { RouterStub } from '../../../testing/router-stub';
import { Collection } from '../../../../core/shared/collection.model';
import { CreateItemParentSelectorComponent } from './create-item-parent-selector.component';
import { MetadataValue } from '../../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
describe('CreateItemParentSelectorComponent', () => {
let component: CreateItemParentSelectorComponent;
@@ -19,7 +20,7 @@ describe('CreateItemParentSelectorComponent', () => {
collection.uuid = '1234-1234-1234-1234';
collection.metadata = { 'dc.title': [Object.assign(new MetadataValue(), { value: 'Collection title', language: undefined })] };
const router = new RouterStub();
- const collectionRD = new RemoteData(false, false, true, undefined, collection);
+ const collectionRD = createSuccessfulRemoteDataObject(collection);
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
const createPath = 'testCreatePath';
diff --git a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts
index 4ceaeccb3a..15f23d1fe6 100644
--- a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts
+++ b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts
@@ -14,6 +14,7 @@ import { By } from '@angular/platform-browser';
import { DSOSelectorComponent } from '../dso-selector/dso-selector.component';
import { MockComponent } from 'ng-mocks';
import { MetadataValue } from '../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject } from '../../testing/utils';
describe('DSOSelectorModalWrapperComponent', () => {
let component: DSOSelectorModalWrapperComponent;
@@ -29,7 +30,7 @@ describe('DSOSelectorModalWrapperComponent', () => {
})]
};
- const itemRD = new RemoteData(false, false, true, undefined, item);
+ const itemRD = createSuccessfulRemoteDataObject(item);
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
beforeEach(async(() => {
diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts
index 5e60348527..cbb8fb654e 100644
--- a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts
+++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts
@@ -10,6 +10,7 @@ import * as collectionRouter from '../../../../+collection-page/collection-page-
import { EditCollectionSelectorComponent } from './edit-collection-selector.component';
import { Collection } from '../../../../core/shared/collection.model';
import { MetadataValue } from '../../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
describe('EditCollectionSelectorComponent', () => {
let component: EditCollectionSelectorComponent;
@@ -20,7 +21,7 @@ describe('EditCollectionSelectorComponent', () => {
collection.uuid = '1234-1234-1234-1234';
collection.metadata = { 'dc.title': [Object.assign(new MetadataValue(), { value: 'Collection title', language: undefined })] };
const router = new RouterStub();
- const collectionRD = new RemoteData(false, false, true, undefined, collection);
+ const collectionRD = createSuccessfulRemoteDataObject(collection);
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
const editPath = 'testEditPath';
diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts
index ac558a074a..46684e6cfb 100644
--- a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts
+++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts
@@ -10,6 +10,7 @@ import * as communityRouter from '../../../../+community-page/community-page-rou
import { EditCommunitySelectorComponent } from './edit-community-selector.component';
import { Community } from '../../../../core/shared/community.model';
import { MetadataValue } from '../../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
describe('EditCommunitySelectorComponent', () => {
let component: EditCommunitySelectorComponent;
@@ -20,7 +21,7 @@ describe('EditCommunitySelectorComponent', () => {
community.uuid = '1234-1234-1234-1234';
community.metadata = { 'dc.title': [Object.assign(new MetadataValue(), { value: 'Community title', language: undefined })] };
const router = new RouterStub();
- const communityRD = new RemoteData(false, false, true, undefined, community);
+ const communityRD = createSuccessfulRemoteDataObject(community);
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
const editPath = 'testEditPath';
diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.spec.ts
index 8ac04bb335..86066916a6 100644
--- a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.spec.ts
+++ b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.spec.ts
@@ -10,6 +10,7 @@ import { RemoteData } from '../../../../core/data/remote-data';
import { RouterStub } from '../../../testing/router-stub';
import * as itemRouter from '../../../../+item-page/item-page-routing.module';
import { MetadataValue } from '../../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
describe('EditItemSelectorComponent', () => {
let component: EditItemSelectorComponent;
@@ -20,7 +21,7 @@ describe('EditItemSelectorComponent', () => {
item.uuid = '1234-1234-1234-1234';
item.metadata = { 'dc.title': [Object.assign(new MetadataValue(), { value: 'Item title', language: undefined })] };
const router = new RouterStub();
- const itemRD = new RemoteData(false, false, true, undefined, item);
+ const itemRD = createSuccessfulRemoteDataObject(item);
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
const editPath = 'testEditPath';
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.scss b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.scss
index 3e6536110d..3af258db79 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.scss
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.scss
@@ -1,5 +1,3 @@
-@import "../../../../../../../styles/variables";
-
.dropdown-toggle::after {
display:none
}
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts
index 200cc08aae..6d5839f867 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts
@@ -8,7 +8,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { DsDynamicRelationGroupComponent } from './dynamic-relation-group.components';
import { DynamicRelationGroupModel, DynamicRelationGroupModelConfig } from './dynamic-relation-group.model';
-import { FormRowModel, SubmissionFormsModel } from '../../../../../../core/config/models/config-submission-forms.model';
+import { SubmissionFormsModel } from '../../../../../../core/config/models/config-submission-forms.model';
import { FormFieldModel } from '../../../models/form-field.model';
import { FormBuilderService } from '../../../form-builder.service';
import { FormService } from '../../../../form.service';
@@ -25,6 +25,7 @@ import { AuthorityServiceStub } from '../../../../../testing/authority-service-s
import { MOCK_SUBMISSION_CONFIG } from '../../../../../testing/mock-submission-config';
import { Store, StoreModule } from '@ngrx/store';
import { MockStore } from '../../../../../testing/mock-store';
+import { FormRowModel } from '../../../../../../core/config/models/config-submission-form.model';
export let FORM_GROUP_TEST_MODEL_CONFIG;
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.ts
index 7a357dfc31..e6d2b95afc 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.ts
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.ts
@@ -1,7 +1,7 @@
import { DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core';
-import { FormRowModel } from '../../../../../../core/config/models/config-submission-forms.model';
import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-input.model';
import { isEmpty, isNull } from '../../../../../empty.util';
+import { FormRowModel } from '../../../../../../core/config/models/config-submission-form.model';
export const DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP = 'RELATION';
export const PLACEHOLDER_PARENT_METADATA = '#PLACEHOLDER_PARENT_METADATA_VALUE#';
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.scss b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.scss
index 7d1160f450..a657d3eeb6 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.scss
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.scss
@@ -1,5 +1,3 @@
-@import "../../../../../../../styles/variables";
-
/* style fa-spin */
.fa-spin {
pointer-events: none;
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.scss b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.scss
index 7c58c0272f..fe20afe1ce 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.scss
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.scss
@@ -1,5 +1,3 @@
-@import "../../../../../../../styles/variables";
-
:host /deep/ .dropdown-menu {
width: 100% !important;
max-height: $dropdown-menu-max-height;
diff --git a/src/app/shared/form/builder/form-builder.service.spec.ts b/src/app/shared/form/builder/form-builder.service.spec.ts
index b092b87a5a..58a1696a92 100644
--- a/src/app/shared/form/builder/form-builder.service.spec.ts
+++ b/src/app/shared/form/builder/form-builder.service.spec.ts
@@ -39,7 +39,6 @@ import { DynamicListRadioGroupModel } from './ds-dynamic-form-ui/models/list/dyn
import { AuthorityOptions } from '../../../core/integration/models/authority-options.model';
import { FormFieldModel } from './models/form-field.model';
import {
- FormRowModel,
SubmissionFormsModel
} from '../../../core/config/models/config-submission-forms.model';
import { FormBuilderService } from './form-builder.service';
@@ -49,6 +48,7 @@ import { FormFieldMetadataValueObject } from './models/form-field-metadata-value
import { DynamicConcatModel } from './ds-dynamic-form-ui/models/ds-dynamic-concat.model';
import { DynamicLookupNameModel } from './ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model';
import { DynamicRowArrayModel } from './ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
+import { FormRowModel } from '../../../core/config/models/config-submission-form.model';
describe('FormBuilderService test suite', () => {
diff --git a/src/app/shared/form/builder/models/form-field.model.ts b/src/app/shared/form/builder/models/form-field.model.ts
index 439bf89f8f..39f2d6b9f8 100644
--- a/src/app/shared/form/builder/models/form-field.model.ts
+++ b/src/app/shared/form/builder/models/form-field.model.ts
@@ -1,7 +1,7 @@
import { autoserialize } from 'cerialize';
-import { FormRowModel } from '../../../../core/config/models/config-submission-forms.model';
import { LanguageCode } from './form-field-language-value.model';
import { FormFieldMetadataValueObject } from './form-field-metadata-value.model';
+import { FormRowModel } from '../../../../core/config/models/config-submission-form.model';
export class FormFieldModel {
diff --git a/src/app/shared/form/builder/parsers/relation-group-field-parser.ts b/src/app/shared/form/builder/parsers/relation-group-field-parser.ts
index ca0469ef1a..b3f6e749f3 100644
--- a/src/app/shared/form/builder/parsers/relation-group-field-parser.ts
+++ b/src/app/shared/form/builder/parsers/relation-group-field-parser.ts
@@ -3,12 +3,12 @@ import { FormFieldMetadataValueObject } from '../models/form-field-metadata-valu
import { FormFieldModel } from '../models/form-field.model';
import { isNotEmpty } from '../../../empty.util';
-import { FormRowModel } from '../../../../core/config/models/config-submission-forms.model';
import {
DynamicRelationGroupModel,
DynamicRelationGroupModelConfig,
PLACEHOLDER_PARENT_METADATA
} from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
+import { FormRowModel } from '../../../../core/config/models/config-submission-form.model';
export class RelationGroupFieldParser extends FieldParser {
diff --git a/src/app/shared/form/builder/parsers/row-parser.spec.ts b/src/app/shared/form/builder/parsers/row-parser.spec.ts
index 3f10b71279..58b1d1de99 100644
--- a/src/app/shared/form/builder/parsers/row-parser.spec.ts
+++ b/src/app/shared/form/builder/parsers/row-parser.spec.ts
@@ -1,8 +1,8 @@
import { FormFieldModel } from '../models/form-field.model';
-import { FormRowModel } from '../../../../core/config/models/config-submission-forms.model';
import { RowParser } from './row-parser';
import { DynamicRowGroupModel } from '../ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
import { DynamicRowArrayModel } from '../ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
+import { FormRowModel } from '../../../../core/config/models/config-submission-form.model';
describe('RowParser test suite', () => {
diff --git a/src/app/shared/form/form.component.scss b/src/app/shared/form/form.component.scss
index 1d5e034290..01cf09576f 100644
--- a/src/app/shared/form/form.component.scss
+++ b/src/app/shared/form/form.component.scss
@@ -1,5 +1,3 @@
-@import "../../../styles/_variables.scss";
-
.ds-form-input-addon {
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
diff --git a/src/app/shared/input-suggestions/input-suggestions.component.scss b/src/app/shared/input-suggestions/input-suggestions.component.scss
index f2587e1b6f..b04cef2adf 100644
--- a/src/app/shared/input-suggestions/input-suggestions.component.scss
+++ b/src/app/shared/input-suggestions/input-suggestions.component.scss
@@ -1,5 +1,3 @@
-@import "../../../styles/_variables.scss";
-
.autocomplete {
width: 100%;
.dropdown-item {
diff --git a/src/app/shared/items/switcher/item-type-switcher.component.spec.ts b/src/app/shared/items/switcher/item-type-switcher.component.spec.ts
index 3b13abf2ef..3f5b7c7f90 100644
--- a/src/app/shared/items/switcher/item-type-switcher.component.spec.ts
+++ b/src/app/shared/items/switcher/item-type-switcher.component.spec.ts
@@ -10,10 +10,11 @@ import * as decorator from '../item-type-decorator';
import { getComponentByItemType, ItemViewMode } from '../item-type-decorator';
import { ItemMetadataRepresentation } from '../../../core/shared/metadata-representation/item/item-metadata-representation.model';
import createSpy = jasmine.createSpy;
+import { createSuccessfulRemoteDataObject$ } from '../../testing/utils';
const relationType = 'type';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: {
'dc.title': [
{
diff --git a/src/app/shared/log-in/log-in.component.scss b/src/app/shared/log-in/log-in.component.scss
index 5e4393edaf..0eda382c0a 100644
--- a/src/app/shared/log-in/log-in.component.scss
+++ b/src/app/shared/log-in/log-in.component.scss
@@ -1,5 +1,3 @@
-@import '../../../styles/variables.scss';
-
.form-login .form-control:focus {
z-index: 2;
}
diff --git a/src/app/shared/mocks/mock-form-models.ts b/src/app/shared/mocks/mock-form-models.ts
index 5851da94be..f2fc38c420 100644
--- a/src/app/shared/mocks/mock-form-models.ts
+++ b/src/app/shared/mocks/mock-form-models.ts
@@ -5,7 +5,6 @@ import {
DynamicRowArrayModelConfig
} from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
import { DynamicSelectModel } from '@ng-dynamic-forms/core';
-import { FormRowModel } from '../../core/config/models/config-submission-forms.model';
import { SubmissionScopeType } from '../../core/submission/submission-scope-type';
import { DynamicRelationGroupModel } from '../form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
import { FormFieldModel } from '../form/builder/models/form-field.model';
@@ -13,6 +12,7 @@ import { AuthorityOptions } from '../../core/integration/models/authority-option
import { AuthorityValue } from '../../core/integration/models/authority.value';
import { FormFieldMetadataValueObject } from '../form/builder/models/form-field-metadata-value.model';
import { DynamicRowGroupModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
+import { FormRowModel } from '../../core/config/models/config-submission-form.model';
export const qualdropSelectConfig = {
name: 'dc.identifier_QUALDROP_METADATA',
diff --git a/src/app/shared/mocks/mock-remote-data-build.service.ts b/src/app/shared/mocks/mock-remote-data-build.service.ts
index 6a05c9bf36..888327bbda 100644
--- a/src/app/shared/mocks/mock-remote-data-build.service.ts
+++ b/src/app/shared/mocks/mock-remote-data-build.service.ts
@@ -5,6 +5,7 @@ import { RemoteData } from '../../core/data/remote-data';
import { RequestEntry } from '../../core/data/request.reducer';
import { hasValue } from '../empty.util';
import { NormalizedObject } from '../../core/cache/models/normalized-object.model';
+import { createSuccessfulRemoteDataObject$ } from '../testing/utils';
export function getMockRemoteDataBuildService(toRemoteDataObservable$?: Observable>): RemoteDataBuildService {
return {
@@ -18,7 +19,7 @@ export function getMockRemoteDataBuildService(toRemoteDataObservable$?: Observab
} as RemoteData)))
}
},
- buildSingle: (href$: string | Observable) => observableOf(new RemoteData(false, false, true, undefined, {})),
+ buildSingle: (href$: string | Observable) => createSuccessfulRemoteDataObject$({}),
build: (normalized: NormalizedObject) => Object.create({})
} as RemoteDataBuildService;
diff --git a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts
index 4144cb3760..5084b3e9fe 100644
--- a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts
+++ b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts
@@ -11,12 +11,13 @@ import { MockTranslateLoader } from '../../mocks/mock-translate-loader';
import { NotificationsService } from '../../notifications/notifications.service';
import { NotificationsServiceStub } from '../../testing/notifications-service-stub';
import { RouterStub } from '../../testing/router-stub';
-import { RemoteData } from '../../../core/data/remote-data';
import { Item } from '../../../core/shared/item.model';
import { ClaimedTaskDataService } from '../../../core/tasks/claimed-task-data.service';
import { ClaimedTaskActionsComponent } from './claimed-task-actions.component';
import { ClaimedTask } from '../../../core/tasks/models/claimed-task-object.model';
-import { Workflowitem } from '../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
+import { createSuccessfulRemoteDataObject } from '../../testing/utils';
+import { CoreModule } from '../../../core/core.module';
let component: ClaimedTaskActionsComponent;
let fixture: ComponentFixture;
@@ -25,7 +26,7 @@ let mockObject: ClaimedTask;
let notificationsServiceStub: NotificationsServiceStub;
let router: RouterStub;
-const mockDataService = jasmine.createSpyObj('PoolTaskDataService', {
+const mockDataService = jasmine.createSpyObj('ClaimedTaskDataService', {
approveTask: jasmine.createSpy('approveTask'),
rejectTask: jasmine.createSpy('rejectTask'),
returnToPoolTask: jasmine.createSpy('returnToPoolTask'),
@@ -60,9 +61,9 @@ const item = Object.assign(new Item(), {
]
}
});
-const rdItem = new RemoteData(false, false, true, null, item);
-const workflowitem = Object.assign(new Workflowitem(), { item: observableOf(rdItem) });
-const rdWorkflowitem = new RemoteData(false, false, true, null, workflowitem);
+const rdItem = createSuccessfulRemoteDataObject(item);
+const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
+const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
mockObject = Object.assign(new ClaimedTask(), { workflowitem: observableOf(rdWorkflowitem), id: '1234' });
describe('ClaimedTaskActionsComponent', () => {
diff --git a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.ts b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.ts
index 2a7669f5b1..0ddb24ec2f 100644
--- a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.ts
+++ b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.ts
@@ -9,10 +9,9 @@ import { ClaimedTaskDataService } from '../../../core/tasks/claimed-task-data.se
import { ClaimedTask } from '../../../core/tasks/models/claimed-task-object.model';
import { ProcessTaskResponse } from '../../../core/tasks/models/process-task-response';
import { isNotUndefined } from '../../empty.util';
-import { Workflowitem } from '../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
import { RemoteData } from '../../../core/data/remote-data';
import { MyDSpaceActionsComponent } from '../mydspace-actions';
-import { ResourceType } from '../../../core/shared/resource-type';
import { NotificationsService } from '../../notifications/notifications.service';
/**
@@ -33,7 +32,7 @@ export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent;
+ public workflowitem$: Observable;
/**
* A boolean representing if an approve operation is pending
@@ -62,7 +61,7 @@ export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent>).pipe(
- filter((rd: RemoteData) => ((!rd.isRequestPending) && isNotUndefined(rd.payload))),
- map((rd: RemoteData) => rd.payload));
+ this.workflowitem$ = (this.object.workflowitem as Observable>).pipe(
+ filter((rd: RemoteData) => ((!rd.isRequestPending) && isNotUndefined(rd.payload))),
+ map((rd: RemoteData) => rd.payload));
}
/**
diff --git a/src/app/shared/mydspace-actions/item/item-actions.component.ts b/src/app/shared/mydspace-actions/item/item-actions.component.ts
index 0760fe54e0..eeb6e49ad9 100644
--- a/src/app/shared/mydspace-actions/item/item-actions.component.ts
+++ b/src/app/shared/mydspace-actions/item/item-actions.component.ts
@@ -6,7 +6,6 @@ import { TranslateService } from '@ngx-translate/core';
import { MyDSpaceActionsComponent } from '../mydspace-actions';
import { ItemDataService } from '../../../core/data/item-data.service';
import { Item } from '../../../core/shared/item.model';
-import { ResourceType } from '../../../core/shared/resource-type';
import { NotificationsService } from '../../notifications/notifications.service';
/**
@@ -37,7 +36,7 @@ export class ItemActionsComponent extends MyDSpaceActionsComponent- > {
public getConstructor(type: ResourceType): TService {
switch (type) {
- case ResourceType.Item: {
+ case Item.type: {
return ItemDataService as any;
}
- case ResourceType.Workspaceitem: {
+ case WorkspaceItem.type: {
return WorkspaceitemDataService as any;
}
- case ResourceType.Workflowitem: {
- return WorkflowitemDataService as any;
+ case WorkflowItem.type: {
+ return WorkflowItemDataService as any;
}
- case ResourceType.ClaimedTask: {
+ case ClaimedTask.type: {
return ClaimedTaskDataService as any;
}
- case ResourceType.PoolTask: {
+ case PoolTask.type: {
return PoolTaskDataService as any;
}
default: {
diff --git a/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.spec.ts b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.spec.ts
index 1c0e8e71fa..c06cec3422 100644
--- a/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.spec.ts
+++ b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.spec.ts
@@ -11,12 +11,12 @@ import { MockTranslateLoader } from '../../mocks/mock-translate-loader';
import { NotificationsService } from '../../notifications/notifications.service';
import { NotificationsServiceStub } from '../../testing/notifications-service-stub';
import { RouterStub } from '../../testing/router-stub';
-import { RemoteData } from '../../../core/data/remote-data';
import { Item } from '../../../core/shared/item.model';
import { PoolTaskDataService } from '../../../core/tasks/pool-task-data.service';
import { PoolTaskActionsComponent } from './pool-task-actions.component';
import { PoolTask } from '../../../core/tasks/models/pool-task-object.model';
-import { Workflowitem } from '../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
+import { createSuccessfulRemoteDataObject } from '../../testing/utils';
let component: PoolTaskActionsComponent;
let fixture: ComponentFixture;
@@ -58,9 +58,9 @@ const item = Object.assign(new Item(), {
]
}
});
-const rdItem = new RemoteData(false, false, true, null, item);
-const workflowitem = Object.assign(new Workflowitem(), { item: observableOf(rdItem) });
-const rdWorkflowitem = new RemoteData(false, false, true, null, workflowitem);
+const rdItem = createSuccessfulRemoteDataObject(item);
+const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
+const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
mockObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem), id: '1234' });
describe('PoolTaskActionsComponent', () => {
diff --git a/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.ts b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.ts
index bd8f3f1a37..2124c0d9b6 100644
--- a/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.ts
+++ b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.ts
@@ -5,14 +5,13 @@ import { BehaviorSubject, Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
-import { Workflowitem } from '../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
import { ProcessTaskResponse } from '../../../core/tasks/models/process-task-response';
import { RemoteData } from '../../../core/data/remote-data';
import { PoolTask } from '../../../core/tasks/models/pool-task-object.model';
import { PoolTaskDataService } from '../../../core/tasks/pool-task-data.service';
import { isNotUndefined } from '../../empty.util';
import { MyDSpaceActionsComponent } from '../mydspace-actions';
-import { ResourceType } from '../../../core/shared/resource-type';
import { NotificationsService } from '../../notifications/notifications.service';
/**
@@ -39,7 +38,7 @@ export class PoolTaskActionsComponent extends MyDSpaceActionsComponent;
+ public workflowitem$: Observable;
/**
* Initialize instance variables
@@ -53,7 +52,7 @@ export class PoolTaskActionsComponent extends MyDSpaceActionsComponent>).pipe(
- filter((rd: RemoteData) => ((!rd.isRequestPending) && isNotUndefined(rd.payload))),
- map((rd: RemoteData) => rd.payload));
+ this.workflowitem$ = (this.object.workflowitem as Observable>).pipe(
+ filter((rd: RemoteData) => ((!rd.isRequestPending) && isNotUndefined(rd.payload))),
+ map((rd: RemoteData) => rd.payload));
}
/**
diff --git a/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.spec.ts b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.spec.ts
index 7533565afe..e2f0e49104 100644
--- a/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.spec.ts
+++ b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.spec.ts
@@ -9,16 +9,17 @@ import { MockTranslateLoader } from '../../mocks/mock-translate-loader';
import { RouterStub } from '../../testing/router-stub';
import { RemoteData } from '../../../core/data/remote-data';
import { Item } from '../../../core/shared/item.model';
-import { Workflowitem } from '../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
import { WorkflowitemActionsComponent } from './workflowitem-actions.component';
-import { WorkflowitemDataService } from '../../../core/submission/workflowitem-data.service';
+import { WorkflowItemDataService } from '../../../core/submission/workflowitem-data.service';
import { NotificationsService } from '../../notifications/notifications.service';
import { NotificationsServiceStub } from '../../testing/notifications-service-stub';
+import { createSuccessfulRemoteDataObject } from '../../testing/utils';
let component: WorkflowitemActionsComponent;
let fixture: ComponentFixture;
-let mockObject: Workflowitem;
+let mockObject: WorkflowItem;
const mockDataService = {};
@@ -51,8 +52,8 @@ const item = Object.assign(new Item(), {
]
}
});
-const rd = new RemoteData(false, false, true, null, item);
-mockObject = Object.assign(new Workflowitem(), { item: observableOf(rd), id: '1234', uuid: '1234' });
+const rd = createSuccessfulRemoteDataObject(item);
+mockObject = Object.assign(new WorkflowItem(), { item: observableOf(rd), id: '1234', uuid: '1234' });
describe('WorkflowitemActionsComponent', () => {
beforeEach(async(() => {
@@ -69,7 +70,7 @@ describe('WorkflowitemActionsComponent', () => {
providers: [
{ provide: Injector, useValue: {} },
{ provide: Router, useValue: new RouterStub() },
- { provide: WorkflowitemDataService, useValue: mockDataService },
+ { provide: WorkflowItemDataService, useValue: mockDataService },
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
],
schemas: [NO_ERRORS_SCHEMA]
diff --git a/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.ts b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.ts
index a6304bf5d4..71f854c5e7 100644
--- a/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.ts
+++ b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.ts
@@ -4,25 +4,24 @@ import { Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { MyDSpaceActionsComponent } from '../mydspace-actions';
-import { Workflowitem } from '../../../core/submission/models/workflowitem.model';
-import { WorkflowitemDataService } from '../../../core/submission/workflowitem-data.service';
-import { ResourceType } from '../../../core/shared/resource-type';
+import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
+import { WorkflowItemDataService } from '../../../core/submission/workflowitem-data.service';
import { NotificationsService } from '../../notifications/notifications.service';
/**
- * This component represents mydspace actions related to Workflowitem object.
+ * This component represents mydspace actions related to WorkflowItem object.
*/
@Component({
selector: 'ds-workflowitem-actions',
styleUrls: ['./workflowitem-actions.component.scss'],
templateUrl: './workflowitem-actions.component.html',
})
-export class WorkflowitemActionsComponent extends MyDSpaceActionsComponent {
+export class WorkflowitemActionsComponent extends MyDSpaceActionsComponent {
/**
- * The Workflowitem object
+ * The WorkflowItem object
*/
- @Input() object: Workflowitem;
+ @Input() object: WorkflowItem;
/**
* Initialize instance variables
@@ -36,15 +35,15 @@ export class WorkflowitemActionsComponent extends MyDSpaceActionsComponent;
-let mockObject: Workspaceitem;
+let mockObject: WorkspaceItem;
let notificationsServiceStub: NotificationsServiceStub;
const mockDataService = jasmine.createSpyObj('WorkspaceitemDataService', {
@@ -56,8 +57,8 @@ const item = Object.assign(new Item(), {
]
}
});
-const rd = new RemoteData(false, false, true, null, item);
-mockObject = Object.assign(new Workspaceitem(), { item: observableOf(rd), id: '1234', uuid: '1234' });
+const rd = createSuccessfulRemoteDataObject(item);
+mockObject = Object.assign(new WorkspaceItem(), { item: observableOf(rd), id: '1234', uuid: '1234' });
describe('WorkspaceitemActionsComponent', () => {
beforeEach(async(() => {
diff --git a/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.ts b/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.ts
index cea4c3746e..69214e800e 100644
--- a/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.ts
+++ b/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.ts
@@ -5,26 +5,26 @@ import { BehaviorSubject } from 'rxjs';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
-import { Workspaceitem } from '../../../core/submission/models/workspaceitem.model';
+import { WorkspaceItem } from '../../../core/submission/models/workspaceitem.model';
import { MyDSpaceActionsComponent } from '../mydspace-actions';
import { WorkspaceitemDataService } from '../../../core/submission/workspaceitem-data.service';
import { ResourceType } from '../../../core/shared/resource-type';
import { NotificationsService } from '../../notifications/notifications.service';
/**
- * This component represents mydspace actions related to Workspaceitem object.
+ * This component represents mydspace actions related to WorkspaceItem object.
*/
@Component({
selector: 'ds-workspaceitem-actions',
styleUrls: ['./workspaceitem-actions.component.scss'],
templateUrl: './workspaceitem-actions.component.html',
})
-export class WorkspaceitemActionsComponent extends MyDSpaceActionsComponent {
+export class WorkspaceitemActionsComponent extends MyDSpaceActionsComponent {
/**
* The workspaceitem object
*/
- @Input() object: Workspaceitem;
+ @Input() object: WorkspaceItem;
/**
* A boolean representing if a delete operation is pending
@@ -46,7 +46,7 @@ export class WorkspaceitemActionsComponent extends MyDSpaceActionsComponent;
let mockResultObject: PoolTask;
-const rdSumbitter = new RemoteData(false, false, true, null, EPersonMock);
-const workflowitem = Object.assign(new Workflowitem(), { submitter: observableOf(rdSumbitter) });
-const rdWorkflowitem = new RemoteData(false, false, true, null, workflowitem);
+const rdSumbitter = createSuccessfulRemoteDataObject(EPersonMock);
+const workflowitem = Object.assign(new WorkflowItem(), { submitter: observableOf(rdSumbitter) });
+const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
mockResultObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem) });
describe('MyDSpaceItemStatusComponent', () => {
diff --git a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.spec.ts b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.spec.ts
index 77460a3674..0641a79378 100644
--- a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.spec.ts
+++ b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.spec.ts
@@ -7,11 +7,12 @@ import { cold } from 'jasmine-marbles';
import { RemoteData } from '../../../../core/data/remote-data';
import { ItemSubmitterComponent } from './item-submitter.component';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
import { EPersonMock } from '../../../testing/eperson-mock';
import { MockTranslateLoader } from '../../../mocks/mock-translate-loader';
import { By } from '@angular/platform-browser';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
let component: ItemSubmitterComponent;
let fixture: ComponentFixture;
@@ -20,9 +21,9 @@ const compIndex = 1;
let mockResultObject: PoolTask;
-const rdSumbitter = new RemoteData(false, false, true, null, EPersonMock);
-const workflowitem = Object.assign(new Workflowitem(), { submitter: observableOf(rdSumbitter) });
-const rdWorkflowitem = new RemoteData(false, false, true, null, workflowitem);
+const rdSumbitter = createSuccessfulRemoteDataObject(EPersonMock);
+const workflowitem = Object.assign(new WorkflowItem(), { submitter: observableOf(rdSumbitter) });
+const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
mockResultObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem) });
describe('ItemSubmitterComponent', () => {
diff --git a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.ts b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.ts
index f752fa6f04..01c0dd9f35 100644
--- a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.ts
+++ b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.ts
@@ -6,7 +6,7 @@ import { filter, find, flatMap, map } from 'rxjs/operators';
import { EPerson } from '../../../../core/eperson/models/eperson.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { isNotEmpty, isNotUndefined } from '../../../empty.util';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
/**
* This component represents a badge with submitter information.
@@ -32,9 +32,9 @@ export class ItemSubmitterComponent implements OnInit {
* Initialize submitter object
*/
ngOnInit() {
- this.submitter$ = (this.object.workflowitem as Observable>).pipe(
- filter((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload))),
- flatMap((rd: RemoteData) => rd.payload.submitter as Observable>),
+ this.submitter$ = (this.object.workflowitem as Observable>).pipe(
+ filter((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload))),
+ flatMap((rd: RemoteData) => rd.payload.submitter as Observable>),
find((rd: RemoteData) => rd.hasSucceeded && isNotEmpty(rd.payload)),
map((rd: RemoteData) => rd.payload));
}
diff --git a/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.ts b/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.ts
index 89f6f351ad..d91c03b549 100644
--- a/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.ts
+++ b/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.ts
@@ -1,11 +1,11 @@
-import { Workflowitem } from '../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
import { SearchResult } from '../../../+search-page/search-result.model';
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
/**
- * Represents a search result object of a Workflowitem object
+ * Represents a search result object of a WorkflowItem object
*/
-@searchResultFor(Workflowitem, MyDSpaceConfigurationValueType.Workspace)
-export class WorkflowitemMyDSpaceResult extends SearchResult {
+@searchResultFor(WorkflowItem, MyDSpaceConfigurationValueType.Workspace)
+export class WorkflowitemMyDSpaceResult extends SearchResult {
}
diff --git a/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.ts b/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.ts
index 20474c9ad3..b7bd5e31d6 100644
--- a/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.ts
+++ b/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.ts
@@ -1,11 +1,11 @@
-import { Workspaceitem } from '../../../core/submission/models/workspaceitem.model';
+import { WorkspaceItem } from '../../../core/submission/models/workspaceitem.model';
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
import { SearchResult } from '../../../+search-page/search-result.model';
/**
- * Represents a search result object of a Workspaceitem object
+ * Represents a search result object of a WorkspaceItem object
*/
-@searchResultFor(Workspaceitem, MyDSpaceConfigurationValueType.Workspace)
-export class WorkspaceitemMyDSpaceResult extends SearchResult {
+@searchResultFor(WorkspaceItem, MyDSpaceConfigurationValueType.Workspace)
+export class WorkspaceitemMyDSpaceResult extends SearchResult {
}
diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.spec.ts
index d3307721ff..f57eb6420e 100644
--- a/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.spec.ts
+++ b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.spec.ts
@@ -10,7 +10,8 @@ import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/cla
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
let component: ClaimedMyDSpaceResultDetailElementComponent;
let fixture: ComponentFixture;
@@ -49,9 +50,9 @@ const item = Object.assign(new Item(), {
]
}
});
-const rdItem = new RemoteData(false, false, true, null, item);
-const workflowitem = Object.assign(new Workflowitem(), { item: observableOf(rdItem) });
-const rdWorkflowitem = new RemoteData(false, false, true, null, workflowitem);
+const rdItem = createSuccessfulRemoteDataObject(item);
+const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
+const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
mockResultObject.indexableObject = Object.assign(new ClaimedTask(), { workflowitem: observableOf(rdWorkflowitem) });
describe('ClaimedMyDSpaceResultDetailElementComponent', () => {
diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.ts
index 5f7b0aab55..581d52c05f 100644
--- a/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.ts
+++ b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.ts
@@ -8,7 +8,7 @@ import { RemoteData } from '../../../../core/data/remote-data';
import { ViewMode } from '../../../../core/shared/view-mode.model';
import { isNotUndefined } from '../../../empty.util';
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model';
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
@@ -41,7 +41,7 @@ export class ClaimedMyDSpaceResultDetailElementComponent extends MyDSpaceResultD
/**
* The workflowitem object that belonging to the result object
*/
- public workflowitem: Workflowitem;
+ public workflowitem: WorkflowItem;
constructor(@Inject('objectElementProvider') public listable: ListableObject) {
super(listable);
@@ -51,16 +51,16 @@ export class ClaimedMyDSpaceResultDetailElementComponent extends MyDSpaceResultD
* Initialize all instance variables
*/
ngOnInit() {
- this.initWorkflowItem(this.dso.workflowitem as Observable>);
+ this.initWorkflowItem(this.dso.workflowitem as Observable>);
}
/**
* Retrieve workflowitem from result object
*/
- initWorkflowItem(wfi$: Observable>) {
+ initWorkflowItem(wfi$: Observable>) {
wfi$.pipe(
- find((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
- ).subscribe((rd: RemoteData) => {
+ find((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
+ ).subscribe((rd: RemoteData) => {
this.workflowitem = rd.payload;
});
}
diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-element.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-element.component.spec.ts
index 0eea01aa1c..a031ac3a49 100644
--- a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-element.component.spec.ts
+++ b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-element.component.spec.ts
@@ -10,7 +10,8 @@ import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-t
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
let component: PoolMyDSpaceResultDetailElementComponent;
let fixture: ComponentFixture;
@@ -49,9 +50,9 @@ const item = Object.assign(new Item(), {
]
}
});
-const rdItem = new RemoteData(false, false, true, null, item);
-const workflowitem = Object.assign(new Workflowitem(), { item: observableOf(rdItem) });
-const rdWorkflowitem = new RemoteData(false, false, true, null, workflowitem);
+const rdItem = createSuccessfulRemoteDataObject(item);
+const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
+const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
mockResultObject.indexableObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem) });
describe('PoolMyDSpaceResultDetailElementComponent', () => {
diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.ts
index ef7bcadebf..0b5b6c6524 100644
--- a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.ts
+++ b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.ts
@@ -2,18 +2,16 @@ import { Component, Inject } from '@angular/core';
import { Observable } from 'rxjs';
import { find } from 'rxjs/operators';
-
-import { ViewMode } from '../../../../core/shared/view-mode.model';
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
import { RemoteData } from '../../../../core/data/remote-data';
import { isNotUndefined } from '../../../empty.util';
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-task-my-dspace-result.model';
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
import { SetViewMode } from '../../../view-mode';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
/**
* This component renders pool task object for the mydspace result in the detail view.
@@ -41,7 +39,7 @@ export class PoolMyDSpaceResultDetailElementComponent extends MyDSpaceResultDeta
/**
* The workflowitem object that belonging to the result object
*/
- public workflowitem: Workflowitem;
+ public workflowitem: WorkflowItem;
constructor(@Inject('objectElementProvider') public listable: ListableObject) {
super(listable);
@@ -51,16 +49,16 @@ export class PoolMyDSpaceResultDetailElementComponent extends MyDSpaceResultDeta
* Initialize all instance variables
*/
ngOnInit() {
- this.initWorkflowItem(this.dso.workflowitem as Observable>);
+ this.initWorkflowItem(this.dso.workflowitem as Observable>);
}
/**
* Retrieve workflowitem from result object
*/
- initWorkflowItem(wfi$: Observable>) {
+ initWorkflowItem(wfi$: Observable>) {
wfi$.pipe(
- find((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
- ).subscribe((rd: RemoteData) => {
+ find((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
+ ).subscribe((rd: RemoteData) => {
this.workflowitem = rd.payload;
});
}
diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.spec.ts
index f8bdbf9fd6..2a4b1321e2 100644
--- a/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.spec.ts
+++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.spec.ts
@@ -7,9 +7,10 @@ import { of as observableOf } from 'rxjs';
import { Item } from '../../../../core/shared/item.model';
import { WorkflowitemMyDSpaceResultDetailElementComponent } from './workflowitem-my-dspace-result-detail-element.component';
import { WorkflowitemMyDSpaceResult } from '../../../object-collection/shared/workflowitem-my-dspace-result.model';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
let component: WorkflowitemMyDSpaceResultDetailElementComponent;
let fixture: ComponentFixture;
@@ -48,8 +49,8 @@ const item = Object.assign(new Item(), {
]
}
});
-const rd = new RemoteData(false, false, true, null, item);
-mockResultObject.indexableObject = Object.assign(new Workflowitem(), { item: observableOf(rd) });
+const rd = createSuccessfulRemoteDataObject(item);
+mockResultObject.indexableObject = Object.assign(new WorkflowItem(), { item: observableOf(rd) });
describe('WorkflowitemMyDSpaceResultDetailElementComponent', () => {
beforeEach(async(() => {
diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.ts
index 1c4b0c668f..c28f044e6e 100644
--- a/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.ts
+++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.ts
@@ -5,7 +5,7 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
import { Item } from '../../../../core/shared/item.model';
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
import { WorkflowitemMyDSpaceResult } from '../../../object-collection/shared/workflowitem-my-dspace-result.model';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
import { Observable } from 'rxjs/internal/Observable';
@@ -24,8 +24,8 @@ import { SetViewMode } from '../../../view-mode';
})
@renderElementsFor(WorkflowitemMyDSpaceResult, SetViewMode.Detail)
-@renderElementsFor(Workflowitem, SetViewMode.Detail)
-export class WorkflowitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent {
+@renderElementsFor(WorkflowItem, SetViewMode.Detail)
+export class WorkflowitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent {
/**
* The item object that belonging to the result object
diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.spec.ts
index af67bf53ea..0e16b9c0f6 100644
--- a/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.spec.ts
+++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.spec.ts
@@ -7,9 +7,10 @@ import { of as observableOf } from 'rxjs';
import { Item } from '../../../../core/shared/item.model';
import { WorkspaceitemMyDSpaceResultDetailElementComponent } from './workspaceitem-my-dspace-result-detail-element.component';
import { WorkspaceitemMyDSpaceResult } from '../../../object-collection/shared/workspaceitem-my-dspace-result.model';
-import { Workspaceitem } from '../../../../core/submission/models/workspaceitem.model';
+import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
let component: WorkspaceitemMyDSpaceResultDetailElementComponent;
let fixture: ComponentFixture;
@@ -48,8 +49,8 @@ const item = Object.assign(new Item(), {
]
}
});
-const rd = new RemoteData(false, false, true, null, item);
-mockResultObject.indexableObject = Object.assign(new Workspaceitem(), { item: observableOf(rd) });
+const rd = createSuccessfulRemoteDataObject(item);
+mockResultObject.indexableObject = Object.assign(new WorkspaceItem(), { item: observableOf(rd) });
describe('WorkspaceitemMyDSpaceResultDetailElementComponent', () => {
beforeEach(async(() => {
diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.ts
index 390db7ec28..af735ecb1e 100644
--- a/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.ts
+++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.ts
@@ -4,8 +4,9 @@ import { Observable } from 'rxjs';
import { find } from 'rxjs/operators';
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
-import { ViewMode } from '../../../../core/shared/view-mode.model';
-import { Workspaceitem } from '../../../../core/submission/models/workspaceitem.model';
+import {
+ WorkspaceItem
+} from '../../../../core/submission/models/workspaceitem.model';
import { WorkspaceitemMyDSpaceResult } from '../../../object-collection/shared/workspaceitem-my-dspace-result.model';
import { Item } from '../../../../core/shared/item.model';
import { RemoteData } from '../../../../core/data/remote-data';
@@ -25,8 +26,8 @@ import { SetViewMode } from '../../../view-mode';
})
@renderElementsFor(WorkspaceitemMyDSpaceResult, SetViewMode.Detail)
-@renderElementsFor(Workspaceitem, SetViewMode.Detail)
-export class WorkspaceitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent {
+@renderElementsFor(WorkspaceItem, SetViewMode.Detail)
+export class WorkspaceitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent {
/**
* The item object that belonging to the result object
diff --git a/src/app/shared/object-detail/object-detail.component.spec.ts b/src/app/shared/object-detail/object-detail.component.spec.ts
index 9b81f1019f..651e6a89a8 100644
--- a/src/app/shared/object-detail/object-detail.component.spec.ts
+++ b/src/app/shared/object-detail/object-detail.component.spec.ts
@@ -8,6 +8,7 @@ import { RemoteData } from '../../core/data/remote-data';
import { PaginatedList } from '../../core/data/paginated-list';
import { PageInfo } from '../../core/shared/page-info.model';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
+import { createSuccessfulRemoteDataObject } from '../testing/utils';
describe('ObjectDetailComponent', () => {
let comp: ObjectDetailComponent;
@@ -27,7 +28,7 @@ describe('ObjectDetailComponent', () => {
{ ten: 10 }
];
const pageInfo = Object.assign(new PageInfo(), {elementsPerPage: 1, totalElements: 10, totalPages: 10, currentPage: 1})
- const mockRD = new RemoteData(false, false, true, null, new PaginatedList(pageInfo, testObjects));
+ const mockRD = createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, testObjects));
beforeEach(async(() => {
TestBed.configureTestingModule({
diff --git a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.scss b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.scss
index 51a7fc6a55..8b13789179 100644
--- a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.scss
+++ b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.scss
@@ -1,2 +1 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.scss b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.scss
index 51a7fc6a55..8b13789179 100644
--- a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.scss
+++ b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.scss
@@ -1,2 +1 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.scss b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.scss
index 45a533cd01..e69de29bb2 100644
--- a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.scss
+++ b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.scss
@@ -1 +0,0 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.scss b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.scss
index 51a7fc6a55..8b13789179 100644
--- a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.scss
+++ b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.scss
@@ -1,2 +1 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/object-grid/object-grid.component.scss b/src/app/shared/object-grid/object-grid.component.scss
index ff78634863..437dfc3b43 100644
--- a/src/app/shared/object-grid/object-grid.component.scss
+++ b/src/app/shared/object-grid/object-grid.component.scss
@@ -1,6 +1,3 @@
-@import '../../../styles/variables';
-@import '../../../styles/mixins';
-
$ds-wrapper-grid-spacing: $spacer/2;
ds-wrapper-grid-element ::ng-deep {
diff --git a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.scss b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.scss
index 1d0786105c..e69de29bb2 100644
--- a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.scss
+++ b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.scss
@@ -1 +0,0 @@
-@import '../../../../../styles/variables';
diff --git a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.scss b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.scss
index bd63aa6a3a..8b13789179 100644
--- a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.scss
+++ b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.scss
@@ -1,2 +1 @@
-@import '../../../../../styles/variables';
diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.scss b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.scss
index e2751279b6..d61f3ccf55 100644
--- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.scss
+++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../../styles/variables';
-
.card {
a > div {
position: relative;
diff --git a/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.scss b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.scss
index e8d681fb32..dc9f9b3969 100644
--- a/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.scss
+++ b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.scss
@@ -1,4 +1,3 @@
- @import '../../../../styles/variables';
:host {
/deep/ em {
font-weight: bold;
diff --git a/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.scss b/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.scss
index 51a7fc6a55..8b13789179 100644
--- a/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.scss
+++ b/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.scss
@@ -1,2 +1 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.scss b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.scss
index 45a533cd01..e69de29bb2 100644
--- a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.scss
+++ b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.scss
@@ -1 +0,0 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/object-list/collection-list-element/collection-list-element.component.scss b/src/app/shared/object-list/collection-list-element/collection-list-element.component.scss
index 45a533cd01..e69de29bb2 100644
--- a/src/app/shared/object-list/collection-list-element/collection-list-element.component.scss
+++ b/src/app/shared/object-list/collection-list-element/collection-list-element.component.scss
@@ -1 +0,0 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/object-list/community-list-element/community-list-element.component.scss b/src/app/shared/object-list/community-list-element/community-list-element.component.scss
index 45a533cd01..e69de29bb2 100644
--- a/src/app/shared/object-list/community-list-element/community-list-element.component.scss
+++ b/src/app/shared/object-list/community-list-element/community-list-element.component.scss
@@ -1 +0,0 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.scss b/src/app/shared/object-list/item-list-element/item-list-element.component.scss
index 45a533cd01..e69de29bb2 100644
--- a/src/app/shared/object-list/item-list-element/item-list-element.component.scss
+++ b/src/app/shared/object-list/item-list-element/item-list-element.component.scss
@@ -1 +0,0 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.spec.ts b/src/app/shared/object-list/item-list-element/item-list-element.component.spec.ts
index 11fdae7e6d..2c0c8b0aa2 100644
--- a/src/app/shared/object-list/item-list-element/item-list-element.component.spec.ts
+++ b/src/app/shared/object-list/item-list-element/item-list-element.component.spec.ts
@@ -8,9 +8,10 @@ import { PageInfo } from '../../../core/shared/page-info.model';
import { By } from '@angular/platform-browser';
import { createRelationshipsObservable } from '../../../+item-page/simple/item-types/shared/item.component.spec';
import { of as observableOf } from 'rxjs';
+import { createSuccessfulRemoteDataObject$ } from '../../testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: [],
relationships: createRelationshipsObservable()
});
diff --git a/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.html b/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.html
index aff19aec1d..d467edfb21 100644
--- a/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.html
+++ b/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.html
@@ -12,6 +12,7 @@
class="item-list-authors">
+ ;
diff --git a/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.spec.ts b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.spec.ts
index f320ff2efc..9adf255523 100644
--- a/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.spec.ts
+++ b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.spec.ts
@@ -12,9 +12,10 @@ import { ItemSearchResult } from '../../../object-collection/shared/item-search-
import { createRelationshipsObservable } from '../../../../+item-page/simple/item-types/shared/item.component.spec';
import { of as observableOf } from 'rxjs';
import { MetadataMap } from '../../../../core/shared/metadata.models';
+import { createSuccessfulRemoteDataObject$ } from '../../../testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
+ bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: [],
relationships: createRelationshipsObservable()
});
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.spec.ts
index 7c30b2ef8c..5815cd5401 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.spec.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.spec.ts
@@ -10,7 +10,8 @@ import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/cla
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
let component: ClaimedMyDSpaceResultListElementComponent;
let fixture: ComponentFixture;
@@ -49,9 +50,9 @@ const item = Object.assign(new Item(), {
]
}
});
-const rdItem = new RemoteData(false, false, true, null, item);
-const workflowitem = Object.assign(new Workflowitem(), { item: observableOf(rdItem) });
-const rdWorkflowitem = new RemoteData(false, false, true, null, workflowitem);
+const rdItem = createSuccessfulRemoteDataObject(item);
+const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
+const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
mockResultObject.indexableObject = Object.assign(new ClaimedTask(), { workflowitem: observableOf(rdWorkflowitem) });
describe('ClaimedMyDSpaceResultListElementComponent', () => {
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.ts
index 0725f98897..3423df7009 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.ts
@@ -9,7 +9,7 @@ import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-el
import { ViewMode } from '../../../../core/shared/view-mode.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { isNotUndefined } from '../../../empty.util';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
@@ -42,22 +42,22 @@ export class ClaimedMyDSpaceResultListElementComponent extends MyDSpaceResultLis
/**
* The workflowitem object that belonging to the result object
*/
- public workflowitem: Workflowitem;
+ public workflowitem: WorkflowItem;
/**
* Initialize all instance variables
*/
ngOnInit() {
- this.initWorkflowItem(this.dso.workflowitem as Observable>);
+ this.initWorkflowItem(this.dso.workflowitem as Observable>);
}
/**
* Retrieve workflowitem from result object
*/
- initWorkflowItem(wfi$: Observable>) {
+ initWorkflowItem(wfi$: Observable>) {
wfi$.pipe(
- find((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
- ).subscribe((rd: RemoteData) => {
+ find((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
+ ).subscribe((rd: RemoteData) => {
this.workflowitem = rd.payload;
});
}
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.spec.ts
index 36eb8f253a..22804a3a30 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.spec.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.spec.ts
@@ -10,7 +10,8 @@ import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-t
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
let component: PoolMyDSpaceResultListElementComponent;
let fixture: ComponentFixture;
@@ -49,9 +50,9 @@ const item = Object.assign(new Item(), {
]
}
});
-const rdItem = new RemoteData(false, false, true, null, item);
-const workflowitem = Object.assign(new Workflowitem(), { item: observableOf(rdItem) });
-const rdWorkflowitem = new RemoteData(false, false, true, null, workflowitem);
+const rdItem = createSuccessfulRemoteDataObject(item);
+const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
+const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
mockResultObject.indexableObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem) });
describe('PoolMyDSpaceResultListElementComponent', () => {
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.ts
index 2d78a7e2e8..0b60c60dc1 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.ts
@@ -9,7 +9,7 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { isNotUndefined } from '../../../empty.util';
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-task-my-dspace-result.model';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
@@ -41,7 +41,7 @@ export class PoolMyDSpaceResultListElementComponent extends MyDSpaceResultListEl
/**
* The workflowitem object that belonging to the result object
*/
- public workflowitem: Workflowitem;
+ public workflowitem: WorkflowItem;
constructor(@Inject('objectElementProvider') public listable: ListableObject,
@Inject('indexElementProvider') public index: number) {
@@ -52,16 +52,16 @@ export class PoolMyDSpaceResultListElementComponent extends MyDSpaceResultListEl
* Initialize all instance variables
*/
ngOnInit() {
- this.initWorkflowItem(this.dso.workflowitem as Observable>);
+ this.initWorkflowItem(this.dso.workflowitem as Observable>);
}
/**
* Retrieve workflowitem from result object
*/
- initWorkflowItem(wfi$: Observable>) {
+ initWorkflowItem(wfi$: Observable>) {
wfi$.pipe(
- find((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
- ).subscribe((rd: RemoteData) => {
+ find((rd: RemoteData) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
+ ).subscribe((rd: RemoteData) => {
this.workflowitem = rd.payload;
});
}
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.spec.ts
index 2bcd4d46b0..ab472b4014 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.spec.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.spec.ts
@@ -7,9 +7,10 @@ import { of as observableOf } from 'rxjs';
import { Item } from '../../../../core/shared/item.model';
import { WorkflowitemMyDSpaceResultListElementComponent } from './workflowitem-my-dspace-result-list-element.component';
import { WorkflowitemMyDSpaceResult } from '../../../object-collection/shared/workflowitem-my-dspace-result.model';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
let component: WorkflowitemMyDSpaceResultListElementComponent;
let fixture: ComponentFixture;
@@ -48,8 +49,8 @@ const item = Object.assign(new Item(), {
]
}
});
-const rd = new RemoteData(false, false, true, null, item);
-mockResultObject.indexableObject = Object.assign(new Workflowitem(), { item: observableOf(rd) });
+const rd = createSuccessfulRemoteDataObject(item);
+mockResultObject.indexableObject = Object.assign(new WorkflowItem(), { item: observableOf(rd) });
describe('WorkflowitemMyDSpaceResultListElementComponent', () => {
beforeEach(async(() => {
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.ts
index 9a5038225c..b5d11b8b13 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.ts
@@ -9,7 +9,7 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { isNotUndefined } from '../../../empty.util';
import { WorkflowitemMyDSpaceResult } from '../../../object-collection/shared/workflowitem-my-dspace-result.model';
-import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { Item } from '../../../../core/shared/item.model';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
import { SetViewMode } from '../../../view-mode';
@@ -24,8 +24,8 @@ import { SetViewMode } from '../../../view-mode';
})
@renderElementsFor(WorkflowitemMyDSpaceResult, SetViewMode.List)
-@renderElementsFor(Workflowitem, SetViewMode.List)
-export class WorkflowitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent {
+@renderElementsFor(WorkflowItem, SetViewMode.List)
+export class WorkflowitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent {
/**
* The item object that belonging to the result object
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.spec.ts
index 789b69da1b..a1c2472d27 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.spec.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.spec.ts
@@ -7,9 +7,10 @@ import { of as observableOf } from 'rxjs';
import { Item } from '../../../../core/shared/item.model';
import { WorkspaceitemMyDSpaceResultListElementComponent } from './workspaceitem-my-dspace-result-list-element.component';
import { WorkspaceitemMyDSpaceResult } from '../../../object-collection/shared/workspaceitem-my-dspace-result.model';
-import { Workspaceitem } from '../../../../core/submission/models/workspaceitem.model';
+import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
+import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
let component: WorkspaceitemMyDSpaceResultListElementComponent;
let fixture: ComponentFixture;
@@ -48,8 +49,8 @@ const item = Object.assign(new Item(), {
]
}
});
-const rd = new RemoteData(false, false, true, null, item);
-mockResultObject.indexableObject = Object.assign(new Workspaceitem(), { item: observableOf(rd) });
+const rd = createSuccessfulRemoteDataObject(item);
+mockResultObject.indexableObject = Object.assign(new WorkspaceItem(), { item: observableOf(rd) });
describe('WorkspaceitemMyDSpaceResultListElementComponent', () => {
beforeEach(async(() => {
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.ts
index 9ea647b4ba..118965c64a 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.ts
@@ -6,7 +6,7 @@ import { find } from 'rxjs/operators';
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
import { ViewMode } from '../../../../core/shared/view-mode.model';
-import { Workspaceitem } from '../../../../core/submission/models/workspaceitem.model';
+import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
import { WorkspaceitemMyDSpaceResult } from '../../../object-collection/shared/workspaceitem-my-dspace-result.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { isNotUndefined } from '../../../empty.util';
@@ -24,7 +24,7 @@ import { SetViewMode } from '../../../view-mode';
})
@renderElementsFor(WorkspaceitemMyDSpaceResult, SetViewMode.List)
-export class WorkspaceitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent {
+export class WorkspaceitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent {
/**
* The item object that belonging to the result object
diff --git a/src/app/shared/object-list/object-list.component.scss b/src/app/shared/object-list/object-list.component.scss
index 3d2af4d023..e69de29bb2 100644
--- a/src/app/shared/object-list/object-list.component.scss
+++ b/src/app/shared/object-list/object-list.component.scss
@@ -1 +0,0 @@
-@import '../../../styles/variables';
\ No newline at end of file
diff --git a/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.scss b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.scss
index 1d0786105c..e69de29bb2 100644
--- a/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.scss
+++ b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.scss
@@ -1 +0,0 @@
-@import '../../../../../styles/variables';
diff --git a/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.scss b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.scss
index 1d0786105c..e69de29bb2 100644
--- a/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.scss
+++ b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.scss
@@ -1 +0,0 @@
-@import '../../../../../styles/variables';
diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.scss b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.scss
index 1d0786105c..e69de29bb2 100644
--- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.scss
+++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.scss
@@ -1 +0,0 @@
-@import '../../../../../styles/variables';
diff --git a/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.scss b/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.scss
index 7134c43dad..efc4d3c414 100644
--- a/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.scss
+++ b/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.scss
@@ -1,4 +1,3 @@
-@import '../../../../styles/variables';
:host {
::ng-deep em {
font-weight: bold;
diff --git a/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.scss b/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.scss
index 51a7fc6a55..8b13789179 100644
--- a/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.scss
+++ b/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.scss
@@ -1,2 +1 @@
-@import '../../../../styles/variables';
diff --git a/src/app/shared/search-form/search-form.component.scss b/src/app/shared/search-form/search-form.component.scss
index d5811186e7..64b97aebd8 100644
--- a/src/app/shared/search-form/search-form.component.scss
+++ b/src/app/shared/search-form/search-form.component.scss
@@ -1,5 +1,3 @@
-@import '../../../styles/variables.scss';
-
// temporary fix for bootstrap 4 beta btn color issue
.btn-secondary {
background-color: $input-bg;
diff --git a/src/app/shared/search-form/search-form.component.spec.ts b/src/app/shared/search-form/search-form.component.spec.ts
index a60aeb8054..fb632c533a 100644
--- a/src/app/shared/search-form/search-form.component.spec.ts
+++ b/src/app/shared/search-form/search-form.component.spec.ts
@@ -128,7 +128,7 @@ export const objects: DSpaceObject[] = [
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
- type: ResourceType.Community,
+ type: Community.type,
metadata: {
'dc.description': [
{
@@ -182,7 +182,7 @@ export const objects: DSpaceObject[] = [
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/9076bd16-e69a-48d6-9e41-0238cb40d863',
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
- type: ResourceType.Community,
+ type: Community.type,
metadata: {
'dc.description': [
{
diff --git a/src/app/shared/search-form/search-form.component.ts b/src/app/shared/search-form/search-form.component.ts
index 10c3a3ede7..7414dd70e6 100644
--- a/src/app/shared/search-form/search-form.component.ts
+++ b/src/app/shared/search-form/search-form.component.ts
@@ -15,6 +15,7 @@ import { SearchService } from '../../+search-page/search-service/search.service'
@Component({
selector: 'ds-search-form',
styleUrls: ['./search-form.component.scss'],
+ // templateUrl: './search-form.component.html',
templateUrl: './search-form.component.html'
})
@@ -45,6 +46,16 @@ export class SearchFormComponent {
*/
@Input() scopes: DSpaceObject[];
+ /**
+ * Whether or not the search button should be displayed large
+ */
+ @Input() large = false;
+
+ /**
+ * The brand color of the search button
+ */
+ @Input() brandColor = 'primary';
+
constructor(private router: Router, private searchService: SearchService) {
}
diff --git a/src/app/shared/starts-with/date/starts-with-date.component.scss b/src/app/shared/starts-with/date/starts-with-date.component.scss
index ceec56c8c2..64b97aebd8 100644
--- a/src/app/shared/starts-with/date/starts-with-date.component.scss
+++ b/src/app/shared/starts-with/date/starts-with-date.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../styles/variables.scss';
-
// temporary fix for bootstrap 4 beta btn color issue
.btn-secondary {
background-color: $input-bg;
diff --git a/src/app/shared/starts-with/text/starts-with-text.component.scss b/src/app/shared/starts-with/text/starts-with-text.component.scss
index ceec56c8c2..64b97aebd8 100644
--- a/src/app/shared/starts-with/text/starts-with-text.component.scss
+++ b/src/app/shared/starts-with/text/starts-with-text.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../styles/variables.scss';
-
// temporary fix for bootstrap 4 beta btn color issue
.btn-secondary {
background-color: $input-bg;
diff --git a/src/app/shared/testing/auth-request-service-stub.ts b/src/app/shared/testing/auth-request-service-stub.ts
index 7f4c171bff..82ce682a9b 100644
--- a/src/app/shared/testing/auth-request-service-stub.ts
+++ b/src/app/shared/testing/auth-request-service-stub.ts
@@ -6,6 +6,7 @@ import { EPerson } from '../../core/eperson/models/eperson.model';
import { isNotEmpty } from '../empty.util';
import { EPersonMock } from './eperson-mock';
import { RemoteData } from '../../core/data/remote-data';
+import { createSuccessfulRemoteDataObject$ } from './utils';
export class AuthRequestServiceStub {
protected mockUser: EPerson = EPersonMock;
@@ -27,7 +28,7 @@ export class AuthRequestServiceStub {
if (this.validateToken(token)) {
authStatusStub.authenticated = true;
authStatusStub.token = this.mockTokenInfo;
- authStatusStub.eperson = observableOf(new RemoteData(false, false, true, undefined, this.mockUser));
+ authStatusStub.eperson = createSuccessfulRemoteDataObject$(this.mockUser);
} else {
authStatusStub.authenticated = false;
}
@@ -46,7 +47,7 @@ export class AuthRequestServiceStub {
if (this.validateToken(token)) {
authStatusStub.authenticated = true;
authStatusStub.token = this.mockTokenInfo;
- authStatusStub.eperson = observableOf(new RemoteData(false, false, true, undefined, this.mockUser));
+ authStatusStub.eperson = createSuccessfulRemoteDataObject$(this.mockUser);
} else {
authStatusStub.authenticated = false;
}
diff --git a/src/app/shared/testing/auth-service-stub.ts b/src/app/shared/testing/auth-service-stub.ts
index fa263da31f..a65923dcab 100644
--- a/src/app/shared/testing/auth-service-stub.ts
+++ b/src/app/shared/testing/auth-service-stub.ts
@@ -4,6 +4,7 @@ import { AuthTokenInfo } from '../../core/auth/models/auth-token-info.model';
import { EPersonMock } from './eperson-mock';
import { EPerson } from '../../core/eperson/models/eperson.model';
import { RemoteData } from '../../core/data/remote-data';
+import { createSuccessfulRemoteDataObject$ } from './utils';
export class AuthServiceStub {
@@ -20,7 +21,7 @@ export class AuthServiceStub {
authStatus.okay = true;
authStatus.authenticated = true;
authStatus.token = this.token;
- authStatus.eperson = observableOf(new RemoteData(false, false, true, undefined, EPersonMock));
+ authStatus.eperson = createSuccessfulRemoteDataObject$(EPersonMock);
return observableOf(authStatus);
} else {
console.log('error');
diff --git a/src/app/shared/testing/utils.ts b/src/app/shared/testing/utils.ts
index 770a554439..4a551582ee 100644
--- a/src/app/shared/testing/utils.ts
+++ b/src/app/shared/testing/utils.ts
@@ -1,4 +1,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { RemoteData } from '../../core/data/remote-data';
+import { Observable, of as observableOf } from 'rxjs';
+import { RemoteDataError } from '../../core/data/remote-data-error';
/**
* Returns true if a Native Element has a specified css class.
@@ -23,7 +26,7 @@ export const hasClass = (element: any, className: string): boolean => {
*/
export const createTestComponent = (html: string, type: { new(...args: any[]): T }): ComponentFixture => {
TestBed.overrideComponent(type, {
- set: {template: html}
+ set: { template: html }
});
const fixture = TestBed.createComponent(type);
@@ -50,3 +53,71 @@ export function spyOnOperator(obj: any, prop: string): any {
return spyOn(obj, prop);
}
+
+/**
+ * Method to create a remote data object that has succeeded
+ * @param object The object to wrap
+ */
+export function createSuccessfulRemoteDataObject(object: T): RemoteData {
+ return new RemoteData(
+ false,
+ false,
+ true,
+ undefined,
+ object
+ );
+}
+
+/**
+ * Method to create a remote data object that has succeeded, wrapped in an observable
+ * @param object The object to wrap
+ */
+export function createSuccessfulRemoteDataObject$(object: T): Observable> {
+ return observableOf(createSuccessfulRemoteDataObject(object));
+}
+
+/**
+ * Method to create a remote data object that has failed
+ * @param object The object to wrap
+ * @param error The RemoteDataError that caused the failure
+ */
+export function createFailedRemoteDataObject(object?: T, error?: RemoteDataError): RemoteData {
+ return new RemoteData(
+ false,
+ false,
+ false,
+ error,
+ object
+ );
+}
+
+/**
+ * Method to create a remote data object that has failed, wrapped in an observable
+ * @param object The object to wrap
+ * @param error The RemoteDataError that caused the failure
+ */
+export function createFailedRemoteDataObject$(object?: T, error?: RemoteDataError): Observable> {
+ return observableOf(createFailedRemoteDataObject(object, error));
+}
+
+/**
+ * Method to create a remote data object that is still pending
+ * @param object The object to wrap
+ */
+export function createPendingRemoteDataObject(object?: T): RemoteData {
+ return new RemoteData(
+ true,
+ true,
+ true,
+ null,
+ object
+ );
+}
+
+/**
+ * Method to create a remote data object that is still pending, wrapped in an observable
+ * @param object The object to wrap
+ */
+export function createPendingRemoteDataObject$(object?: T): Observable> {
+ return observableOf(createPendingRemoteDataObject(object));
+}
diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss
index 133328fec1..68b6772465 100644
--- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss
+++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss
@@ -1,6 +1,3 @@
-@import '../../../../styles/variables';
-@import '../../../../styles/mixins';
-
@mixin clamp($lines, $size-factor: 1, $line-height: $line-height-base) {
$height: $line-height * $font-size-base * $size-factor;
&.fixedHeight {
diff --git a/src/app/shared/uploader/uploader.component.scss b/src/app/shared/uploader/uploader.component.scss
index 370c3ea280..8835b87b1e 100644
--- a/src/app/shared/uploader/uploader.component.scss
+++ b/src/app/shared/uploader/uploader.component.scss
@@ -1,5 +1,3 @@
-@import '../../../styles/_variables.scss';
-
.ds-base-drop-zone {
border: 2px dashed $gray-600;
}
diff --git a/src/app/shared/view-mode-switch/view-mode-switch.component.scss b/src/app/shared/view-mode-switch/view-mode-switch.component.scss
index ad84b72f8c..e69de29bb2 100644
--- a/src/app/shared/view-mode-switch/view-mode-switch.component.scss
+++ b/src/app/shared/view-mode-switch/view-mode-switch.component.scss
@@ -1 +0,0 @@
-@import '../../../styles/variables.scss';
\ No newline at end of file
diff --git a/src/app/submission/edit/submission-edit.component.spec.ts b/src/app/submission/edit/submission-edit.component.spec.ts
index 5c9a247aa2..115016d2fe 100644
--- a/src/app/submission/edit/submission-edit.component.spec.ts
+++ b/src/app/submission/edit/submission-edit.component.spec.ts
@@ -16,7 +16,7 @@ import { getMockTranslateService } from '../../shared/mocks/mock-translate.servi
import { RouterStub } from '../../shared/testing/router-stub';
import { ActivatedRouteStub } from '../../shared/testing/active-router-stub';
import { mockSubmissionObject } from '../../shared/mocks/mock-submission';
-import { RemoteData } from '../../core/data/remote-data';
+import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
describe('SubmissionEditComponent Component', () => {
@@ -66,14 +66,9 @@ describe('SubmissionEditComponent Component', () => {
it('should init properly when a valid SubmissionObject has been retrieved', fakeAsync(() => {
route.testParams = { id: submissionId };
- submissionServiceStub.retrieveSubmission.and.returnValue(observableOf(
- new RemoteData(
- false,
- false,
- true,
- null,
- submissionObject)
- ));
+ submissionServiceStub.retrieveSubmission.and.returnValue(
+ createSuccessfulRemoteDataObject$(submissionObject)
+ );
fixture.detectChanges();
@@ -88,14 +83,8 @@ describe('SubmissionEditComponent Component', () => {
it('should redirect to mydspace when an empty SubmissionObject has been retrieved', fakeAsync(() => {
route.testParams = { id: submissionId };
- submissionServiceStub.retrieveSubmission.and.returnValue(observableOf(
- new RemoteData(
- false,
- false,
- true,
- null,
- {})
- ));
+ submissionServiceStub.retrieveSubmission.and.returnValue(createSuccessfulRemoteDataObject$({})
+ );
fixture.detectChanges();
diff --git a/src/app/submission/form/collection/submission-form-collection.component.scss b/src/app/submission/form/collection/submission-form-collection.component.scss
index f91f85677d..deecc39510 100644
--- a/src/app/submission/form/collection/submission-form-collection.component.scss
+++ b/src/app/submission/form/collection/submission-form-collection.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../styles/variables';
-
.scrollable-menu {
height: auto;
max-height: $dropdown-menu-max-height;
diff --git a/src/app/submission/form/collection/submission-form-collection.component.spec.ts b/src/app/submission/form/collection/submission-form-collection.component.spec.ts
index 679500a670..93f185af10 100644
--- a/src/app/submission/form/collection/submission-form-collection.component.spec.ts
+++ b/src/app/submission/form/collection/submission-form-collection.component.spec.ts
@@ -1,4 +1,10 @@
-import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA, DebugElement, SimpleChange } from '@angular/core';
+import {
+ ChangeDetectorRef,
+ Component,
+ CUSTOM_ELEMENTS_SCHEMA,
+ DebugElement,
+ SimpleChange
+} from '@angular/core';
import { async, ComponentFixture, fakeAsync, inject, TestBed, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -10,7 +16,10 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { Store } from '@ngrx/store';
import { SubmissionServiceStub } from '../../../shared/testing/submission-service-stub';
-import { mockSubmissionId, mockSubmissionRestResponse } from '../../../shared/mocks/mock-submission';
+import {
+ mockSubmissionId,
+ mockSubmissionRestResponse
+} from '../../../shared/mocks/mock-submission';
import { SubmissionService } from '../../submission.service';
import { SubmissionFormCollectionComponent } from './submission-form-collection.component';
import { CommunityDataService } from '../../../core/data/community-data.service';
@@ -18,35 +27,16 @@ import { SubmissionJsonPatchOperationsService } from '../../../core/submission/s
import { SubmissionJsonPatchOperationsServiceStub } from '../../../shared/testing/submission-json-patch-operations-service-stub';
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
-import { Community } from '../../../core/shared/community.model';
-import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list';
import { PageInfo } from '../../../core/shared/page-info.model';
import { Collection } from '../../../core/shared/collection.model';
-import { createTestComponent } from '../../../shared/testing/utils';
+import {
+ createTestComponent
+} from '../../../shared/testing/utils';
import { cold } from 'jasmine-marbles';
-
-const subcommunities = [Object.assign(new Community(), {
- name: 'SubCommunity 1',
- id: '123456789-1',
- metadata: [
- {
- key: 'dc.title',
- language: 'en_US',
- value: 'SubCommunity 1'
- }]
-}),
- Object.assign(new Community(), {
- name: 'SubCommunity 1',
- id: '123456789s-1',
- metadata: [
- {
- key: 'dc.title',
- language: 'en_US',
- value: 'SubCommunity 1'
- }]
- })
-];
+import { SearchResult } from '../../../+search-page/search-result.model';
+import { SearchService } from '../../../+search-page/search-service/search.service';
+import { RemoteData } from '../../../core/data/remote-data';
const mockCommunity1Collection1 = Object.assign(new Collection(), {
name: 'Community 1-Collection 1',
@@ -92,45 +82,20 @@ const mockCommunity2Collection2 = Object.assign(new Collection(), {
}]
});
-const mockCommunity = Object.assign(new Community(), {
- name: 'Community 1',
- id: '123456789-1',
- metadata: [
- {
- key: 'dc.title',
- language: 'en_US',
- value: 'Community 1'
- }],
- collections: observableOf(new RemoteData(true, true, true,
- undefined, new PaginatedList(new PageInfo(), [mockCommunity1Collection1, mockCommunity1Collection2]))),
- subcommunities: observableOf(new RemoteData(true, true, true,
- undefined, new PaginatedList(new PageInfo(), subcommunities))),
-});
-
-const mockCommunity2 = Object.assign(new Community(), {
- name: 'Community 2',
- id: '123456789-2',
- metadata: [
- {
- key: 'dc.title',
- language: 'en_US',
- value: 'Community 2'
- }],
- collections: observableOf(new RemoteData(true, true, true,
- undefined, new PaginatedList(new PageInfo(), [mockCommunity2Collection1, mockCommunity2Collection2]))),
- subcommunities: observableOf(new RemoteData(true, true, true,
- undefined, new PaginatedList(new PageInfo(), []))),
-});
-
-const mockCommunityList = observableOf(new RemoteData(true, true, true,
- undefined, new PaginatedList(new PageInfo(), [mockCommunity, mockCommunity2])));
+const collectionResults = [mockCommunity1Collection1, mockCommunity1Collection2, mockCommunity2Collection1, mockCommunity2Collection2].map((collection: Collection) => Object.assign(new SearchResult(), { indexableObject: collection }));
+const searchService = {
+ search: () => {
+ return observableOf(new RemoteData(true, true, true,
+ undefined, new PaginatedList(new PageInfo(), collectionResults)))
+ }
+};
const mockCollectionList = [
{
communities: [
{
- id: '123456789-1',
- name: 'Community 1'
+ id: 'c0e4de93-f506-4990-a840-d406f6f2ada7',
+ name: 'Submission test'
}
],
collection: {
@@ -141,8 +106,8 @@ const mockCollectionList = [
{
communities: [
{
- id: '123456789-1',
- name: 'Community 1'
+ id: 'c0e4de93-f506-4990-a840-d406f6f2ada7',
+ name: 'Submission test'
}
],
collection: {
@@ -153,8 +118,8 @@ const mockCollectionList = [
{
communities: [
{
- id: '123456789-2',
- name: 'Community 2'
+ id: 'c0e4de93-f506-4990-a840-d406f6f2ada7',
+ name: 'Submission test'
}
],
collection: {
@@ -165,8 +130,8 @@ const mockCollectionList = [
{
communities: [
{
- id: '123456789-2',
- name: 'Community 2'
+ id: 'c0e4de93-f506-4990-a840-d406f6f2ada7',
+ name: 'Submission test'
}
],
collection: {
@@ -214,11 +179,15 @@ describe('SubmissionFormCollectionComponent Component', () => {
TestComponent
],
providers: [
- { provide: SubmissionJsonPatchOperationsService, useClass: SubmissionJsonPatchOperationsServiceStub },
+ {
+ provide: SubmissionJsonPatchOperationsService,
+ useClass: SubmissionJsonPatchOperationsServiceStub
+ },
{ provide: SubmissionService, useClass: SubmissionServiceStub },
{ provide: CommunityDataService, useValue: communityDataService },
{ provide: JsonPatchOperationsBuilder, useValue: jsonPatchOpBuilder },
{ provide: Store, useValue: store },
+ { provide: SearchService, useValue: searchService },
ChangeDetectorRef,
SubmissionFormCollectionComponent
],
@@ -283,14 +252,11 @@ describe('SubmissionFormCollectionComponent Component', () => {
});
it('should init collection list properly', () => {
- communityDataService.findAll.and.returnValue(mockCommunityList);
-
comp.ngOnChanges({
currentCollectionId: new SimpleChange(null, collectionId, true)
});
- expect(comp.searchListCollection$).toBeObservable(cold('(ab)', {
- a: [],
+ expect(comp.searchListCollection$).toBeObservable(cold('(b)', {
b: mockCollectionList
}));
@@ -428,6 +394,8 @@ class TestComponent {
definitionId = 'traditional';
submissionId = mockSubmissionId;
- onCollectionChange = () => { return; }
+ onCollectionChange = () => {
+ return;
+ }
}
diff --git a/src/app/submission/form/collection/submission-form-collection.component.ts b/src/app/submission/form/collection/submission-form-collection.component.ts
index b576834091..e9832985fe 100644
--- a/src/app/submission/form/collection/submission-form-collection.component.ts
+++ b/src/app/submission/form/collection/submission-form-collection.component.ts
@@ -17,16 +17,13 @@ import {
distinctUntilChanged,
filter,
find,
- flatMap,
map,
mergeMap,
- reduce,
startWith
} from 'rxjs/operators';
import { Collection } from '../../../core/shared/collection.model';
import { CommunityDataService } from '../../../core/data/community-data.service';
-import { Community } from '../../../core/shared/community.model';
import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util';
import { RemoteData } from '../../../core/data/remote-data';
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
@@ -35,6 +32,12 @@ import { PaginatedList } from '../../../core/data/paginated-list';
import { SubmissionService } from '../../submission.service';
import { SubmissionObject } from '../../../core/submission/models/submission-object.model';
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
+import { SearchService } from '../../../+search-page/search-service/search.service';
+import { PaginatedSearchOptions } from '../../../+search-page/paginated-search-options.model';
+import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
+import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
+import { getSucceededRemoteData } from '../../../core/shared/operators';
+import { SearchResult } from '../../../+search-page/search-result.model';
/**
* An interface to represent a collection entry
@@ -148,12 +151,14 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
* @param {JsonPatchOperationsBuilder} operationsBuilder
* @param {SubmissionJsonPatchOperationsService} operationsService
* @param {SubmissionService} submissionService
+ * @param {SearchService} searchService
*/
constructor(protected cdr: ChangeDetectorRef,
private communityDataService: CommunityDataService,
private operationsBuilder: JsonPatchOperationsBuilder,
private operationsService: SubmissionJsonPatchOperationsService,
- private submissionService: SubmissionService) {
+ private submissionService: SubmissionService,
+ private searchService: SearchService) {
}
/**
@@ -190,38 +195,39 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
&& hasValue(changes.currentCollectionId.currentValue)) {
this.selectedCollectionId = this.currentCollectionId;
- // @TODO replace with search/top browse endpoint
- // @TODO implement community/subcommunity hierarchy
- const communities$ = this.communityDataService.findAll().pipe(
- find((communities: RemoteData>) => isNotEmpty(communities.payload)),
- mergeMap((communities: RemoteData>) => communities.payload.page));
+ // // @TODO replace with search/top browse endpoint
+ // // @TODO implement community/subcommunity hierarchy
+ // const communities$ = this.communityDataService.findAll().pipe(
+ // find((communities: RemoteData>) => isNotEmpty(communities.payload)),
+ // mergeMap((communities: RemoteData>) => communities.payload.page));
- const listCollection$ = communities$.pipe(
- flatMap((communityData: Community) => {
- return communityData.collections.pipe(
- find((collections: RemoteData>) => !collections.isResponsePending && collections.hasSucceeded),
- mergeMap((collections: RemoteData>) => collections.payload.page),
- filter((collectionData: Collection) => isNotEmpty(collectionData)),
- map((collectionData: Collection) => ({
- communities: [{ id: communityData.id, name: communityData.name }],
- collection: { id: collectionData.id, name: collectionData.name }
- }))
- );
- }),
- reduce((acc: any, value: any) => [...acc, ...value], []),
- startWith([])
+ const listCollection$: Observable = this.searchService.search(
+ new PaginatedSearchOptions({
+ dsoType: DSpaceObjectType.COLLECTION,
+ pagination: new PaginationComponentOptions(),
+ scope: 'c0e4de93-f506-4990-a840-d406f6f2ada7'
+ })
+ ).pipe(
+ getSucceededRemoteData(),
+ map((collections: RemoteData>>) => collections.payload.page),
+ filter((collectionData: Array>) => isNotEmpty(collectionData)),
+ map((collectionData: Array>) => {
+ return collectionData.map((collection: SearchResult) => {
+ return {
+ communities: [{
+ id: 'c0e4de93-f506-4990-a840-d406f6f2ada7',
+ name: 'Submission test'
+ }],
+ collection: { id: collection.indexableObject.id, name: collection.indexableObject.name }
+ }
+ })
+ })
);
- this.selectedCollectionName$ = communities$.pipe(
- flatMap((communityData: Community) => {
- return communityData.collections.pipe(
- find((collections: RemoteData>) => !collections.isResponsePending && collections.hasSucceeded),
- mergeMap((collections: RemoteData>) => collections.payload.page),
- filter((collectionData: Collection) => isNotEmpty(collectionData)),
- filter((collectionData: Collection) => collectionData.id === this.selectedCollectionId),
- map((collectionData: Collection) => collectionData.name)
- );
- }),
+ this.selectedCollectionName$ = listCollection$.pipe(
+ map((collectionData: CollectionListEntry[]) => collectionData.find((entry: CollectionListEntry) => entry.collection.id === this.selectedCollectionId)),
+ filter((entry: CollectionListEntry) => hasValue(entry.collection)),
+ map((entry: CollectionListEntry) => entry.collection.name),
startWith('')
);
diff --git a/src/app/submission/form/section-add/submission-form-section-add.component.scss b/src/app/submission/form/section-add/submission-form-section-add.component.scss
index 628f0f5633..c8fd2073d1 100644
--- a/src/app/submission/form/section-add/submission-form-section-add.component.scss
+++ b/src/app/submission/form/section-add/submission-form-section-add.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../styles/variables';
-
.dropdown-toggle::after {
display:none
}
diff --git a/src/app/submission/form/submission-form.component.scss b/src/app/submission/form/submission-form.component.scss
index c9b6872146..44551162cc 100644
--- a/src/app/submission/form/submission-form.component.scss
+++ b/src/app/submission/form/submission-form.component.scss
@@ -1,5 +1,3 @@
-@import '../../../styles/variables';
-
.submission-form-header {
background-color: rgba($white, .97);
padding: ($spacer / 2) 0 ($spacer / 2) 0;
diff --git a/src/app/submission/form/submission-upload-files/submission-upload-files.component.ts b/src/app/submission/form/submission-upload-files/submission-upload-files.component.ts
index be3e6b5c8c..dfa1c58f9b 100644
--- a/src/app/submission/form/submission-upload-files/submission-upload-files.component.ts
+++ b/src/app/submission/form/submission-upload-files/submission-upload-files.component.ts
@@ -6,13 +6,13 @@ import { first } from 'rxjs/operators';
import { SectionsService } from '../../sections/sections.service';
import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util';
-import { Workspaceitem } from '../../../core/submission/models/workspaceitem.model';
import { normalizeSectionData } from '../../../core/submission/submission-response-parsing.service';
import { SubmissionService } from '../../submission.service';
import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { UploaderOptions } from '../../../shared/uploader/uploader-options.model';
import parseSectionErrors from '../../utils/parseSectionErrors';
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
+import { WorkspaceItem } from '../../../core/submission/models/workspaceitem.model';
/**
* This component represents the drop zone that provides to add files to the submission.
@@ -119,7 +119,7 @@ export class SubmissionUploadFilesComponent implements OnChanges {
* @param workspaceitem
* The submission object retrieved from REST
*/
- public onCompleteItem(workspaceitem: Workspaceitem) {
+ public onCompleteItem(workspaceitem: WorkspaceItem) {
// Checks if upload section is enabled so do upload
this.subs.push(
this.uploadEnabled
diff --git a/src/app/submission/objects/submission-objects.effects.ts b/src/app/submission/objects/submission-objects.effects.ts
index f5c8887320..ba82fe1e65 100644
--- a/src/app/submission/objects/submission-objects.effects.ts
+++ b/src/app/submission/objects/submission-objects.effects.ts
@@ -30,9 +30,9 @@ import {
} from './submission-objects.actions';
import { SectionsService } from '../sections/sections.service';
import { isEmpty, isNotEmpty, isNotUndefined } from '../../shared/empty.util';
-import { Workspaceitem } from '../../core/submission/models/workspaceitem.model';
+import { WorkspaceItem } from '../../core/submission/models/workspaceitem.model';
import { SubmissionService } from '../submission.service';
-import { Workflowitem } from '../../core/submission/models/workflowitem.model';
+import { WorkflowItem } from '../../core/submission/models/workflowitem.model';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { SubmissionObject } from '../../core/submission/models/submission-object.model';
import { TranslateService } from '@ngx-translate/core';
@@ -265,7 +265,7 @@ export class SubmissionObjectEffects {
let canDeposit = true;
if (isNotEmpty(response)) {
- response.forEach((item: Workspaceitem | Workflowitem) => {
+ response.forEach((item: WorkspaceItem | WorkflowItem) => {
const {errors} = item;
if (errors && !isEmpty(errors)) {
@@ -303,7 +303,7 @@ export class SubmissionObjectEffects {
this.notificationsService.success(null, this.translate.get('submission.sections.general.save_success_notice'));
}
- response.forEach((item: Workspaceitem | Workflowitem) => {
+ response.forEach((item: WorkspaceItem | WorkflowItem) => {
let errorsList = Object.create({});
const {errors} = item;
diff --git a/src/app/submission/sections/container/section-container.component.scss b/src/app/submission/sections/container/section-container.component.scss
index 2e17794e42..3917280f8c 100644
--- a/src/app/submission/sections/container/section-container.component.scss
+++ b/src/app/submission/sections/container/section-container.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../styles/variables';
-
:host /deep/ .card {
margin-bottom: $submission-sections-margin-bottom;
overflow: unset;
diff --git a/src/app/submission/sections/form/section-form.component.spec.ts b/src/app/submission/sections/form/section-form.component.spec.ts
index 477d42a0a1..eb56a92113 100644
--- a/src/app/submission/sections/form/section-form.component.spec.ts
+++ b/src/app/submission/sections/form/section-form.component.spec.ts
@@ -34,7 +34,6 @@ import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { FormComponent } from '../../../shared/form/form.component';
import { FormFieldModel } from '../../../shared/form/builder/models/form-field.model';
-import { FormRowModel } from '../../../core/config/models/config-submission-forms.model';
import { ConfigData } from '../../../core/config/config-data';
import { PageInfo } from '../../../core/shared/page-info.model';
import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model';
@@ -43,6 +42,7 @@ import { DsDynamicInputModel } from '../../../shared/form/builder/ds-dynamic-for
import { SubmissionSectionError } from '../../objects/submission-objects.reducer';
import { DynamicFormControlEvent, DynamicFormControlEventType } from '@ng-dynamic-forms/core';
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
+import { FormRowModel } from '../../../core/config/models/config-submission-form.model';
function getMockSubmissionFormsConfigService(): SubmissionFormsConfigService {
return jasmine.createSpyObj('FormOperationsService', {
diff --git a/src/app/submission/sections/license/section-license.component.spec.ts b/src/app/submission/sections/license/section-license.component.spec.ts
index 6d8f82c0f8..a9a72f0a51 100644
--- a/src/app/submission/sections/license/section-license.component.spec.ts
+++ b/src/app/submission/sections/license/section-license.component.spec.ts
@@ -6,9 +6,13 @@ import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'
import { of as observableOf } from 'rxjs';
import { TranslateModule } from '@ngx-translate/core';
-import { DynamicCheckboxModel, DynamicFormControlEvent, DynamicFormControlEventType } from '@ng-dynamic-forms/core';
+import {
+ DynamicCheckboxModel,
+ DynamicFormControlEvent,
+ DynamicFormControlEventType
+} from '@ng-dynamic-forms/core';
-import { createTestComponent } from '../../../shared/testing/utils';
+import { createSuccessfulRemoteDataObject$, createTestComponent } from '../../../shared/testing/utils';
import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
import { SubmissionService } from '../../submission.service';
@@ -109,8 +113,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
language: 'en_US',
value: 'Community 1-Collection 1'
}],
- license: observableOf(new RemoteData(false, false, true,
- undefined, Object.assign(new License(), { text: licenseText })))
+ license: createSuccessfulRemoteDataObject$(Object.assign(new License(), { text: licenseText }))
});
beforeEach(async(() => {
@@ -193,8 +196,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
});
it('should init section properly', () => {
- collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
- undefined, mockCollection)));
+ collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf([]));
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
spyOn(compAsAny, 'getSectionStatus');
@@ -219,8 +221,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
granted: true
} as any;
- collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
- undefined, mockCollection)));
+ collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf([]));
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
spyOn(compAsAny, 'getSectionStatus');
@@ -239,8 +240,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
});
it('should set section errors properly', () => {
- collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
- undefined, mockCollection)));
+ collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf(mockLicenseParsedErrors.license));
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
@@ -259,8 +259,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
granted: true
} as any;
- collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
- undefined, mockCollection)));
+ collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf(mockLicenseParsedErrors.license));
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
@@ -272,8 +271,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
it('should have status true when checkbox is selected', () => {
- collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
- undefined, mockCollection)));
+ collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf([]));
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
@@ -289,8 +287,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
it('should have status false when checkbox is not selected', () => {
- collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
- undefined, mockCollection)));
+ collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf([]));
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.scss b/src/app/submission/sections/upload/file/section-upload-file.component.scss
index ce67ef98df..7596652dc2 100644
--- a/src/app/submission/sections/upload/file/section-upload-file.component.scss
+++ b/src/app/submission/sections/upload/file/section-upload-file.component.scss
@@ -1,5 +1,3 @@
-@import '../../../../../styles/variables';
-
.sticky-buttons {
position: sticky;
top: $dropdown-item-padding-x * 3;
diff --git a/src/app/submission/sections/upload/section-upload.component.spec.ts b/src/app/submission/sections/upload/section-upload.component.spec.ts
index be8f096964..fd9f88d939 100644
--- a/src/app/submission/sections/upload/section-upload.component.spec.ts
+++ b/src/app/submission/sections/upload/section-upload.component.spec.ts
@@ -4,7 +4,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { of as observableOf } from 'rxjs';
-import { createTestComponent } from '../../../shared/testing/utils';
+import { createSuccessfulRemoteDataObject$, createTestComponent } from '../../../shared/testing/utils';
import { SubmissionService } from '../../submission.service';
import { SubmissionServiceStub } from '../../../shared/testing/submission-service-stub';
import { SectionsService } from '../sections.service';
@@ -30,6 +30,7 @@ import { GroupEpersonService } from '../../../core/eperson/group-eperson.service
import { cold, hot } from 'jasmine-marbles';
import { Collection } from '../../../core/shared/collection.model';
import { ResourcePolicy } from '../../../core/shared/resource-policy.model';
+import { ResourcePolicyService } from '../../../core/data/resource-policy.service';
import { RemoteData } from '../../../core/data/remote-data';
import { ConfigData } from '../../../core/config/config-data';
import { PageInfo } from '../../../core/shared/page-info.model';
@@ -47,8 +48,7 @@ function getMockSubmissionUploadsConfigService(): SubmissionFormsConfigService {
function getMockCollectionDataService(): CollectionDataService {
return jasmine.createSpyObj('CollectionDataService', {
- findById: jasmine.createSpy('findById'),
- findByHref: jasmine.createSpy('findByHref')
+ findById: jasmine.createSpy('findById')
});
}
@@ -59,6 +59,12 @@ function getMockGroupEpersonService(): GroupEpersonService {
});
}
+function getMockResourcePolicyService(): ResourcePolicyService {
+ return jasmine.createSpyObj('ResourcePolicyService', {
+ findByHref: jasmine.createSpy('findByHref')
+ });
+}
+
const sectionObject: SectionDataObject = {
config: 'https://dspace7.4science.it/or2018/api/config/submissionforms/upload',
mandatory: true,
@@ -80,6 +86,7 @@ describe('SubmissionSectionUploadComponent test suite', () => {
let sectionsServiceStub: SectionsServiceStub;
let collectionDataService: any;
let groupService: any;
+ let resourcePolicyService: any;
let uploadsConfigService: any;
let bitstreamService: any;
@@ -120,6 +127,7 @@ describe('SubmissionSectionUploadComponent test suite', () => {
providers: [
{ provide: CollectionDataService, useValue: getMockCollectionDataService() },
{ provide: GroupEpersonService, useValue: getMockGroupEpersonService() },
+ { provide: ResourcePolicyService, useValue: getMockResourcePolicyService() },
{ provide: SubmissionUploadsConfigService, useValue: getMockSubmissionUploadsConfigService() },
{ provide: SectionsService, useClass: SectionsServiceStub },
{ provide: SubmissionService, useClass: SubmissionServiceStub },
@@ -166,6 +174,7 @@ describe('SubmissionSectionUploadComponent test suite', () => {
sectionsServiceStub = TestBed.get(SectionsService);
collectionDataService = TestBed.get(CollectionDataService);
groupService = TestBed.get(GroupEpersonService);
+ resourcePolicyService = TestBed.get(ResourcePolicyService);
uploadsConfigService = TestBed.get(SubmissionUploadsConfigService);
bitstreamService = TestBed.get(SectionUploadService);
});
@@ -180,24 +189,17 @@ describe('SubmissionSectionUploadComponent test suite', () => {
submissionServiceStub.getSubmissionObject.and.returnValue(observableOf(submissionState));
- collectionDataService.findById.and.returnValue(observableOf(
- new RemoteData(false, false, true,
- undefined, mockCollection)));
+ collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
- collectionDataService.findByHref.and.returnValue(observableOf(
- new RemoteData(false, false, true,
- undefined, mockDefaultAccessCondition)
- ));
+ resourcePolicyService.findByHref.and.returnValue(createSuccessfulRemoteDataObject$(mockDefaultAccessCondition));
uploadsConfigService.getConfigByHref.and.returnValue(observableOf(
new ConfigData(new PageInfo(), mockUploadConfigResponse as any)
));
groupService.findById.and.returnValues(
- observableOf(new RemoteData(false, false, true,
- undefined, Object.assign(new Group(), mockGroup))),
- observableOf(new RemoteData(false, false, true,
- undefined, Object.assign(new Group(), mockGroup)))
+ createSuccessfulRemoteDataObject$(Object.assign(new Group(), mockGroup)),
+ createSuccessfulRemoteDataObject$(Object.assign(new Group(), mockGroup))
);
bitstreamService.getUploadedFileList.and.returnValue(observableOf([]));
@@ -226,24 +228,17 @@ describe('SubmissionSectionUploadComponent test suite', () => {
submissionServiceStub.getSubmissionObject.and.returnValue(observableOf(submissionState));
- collectionDataService.findById.and.returnValue(observableOf(
- new RemoteData(false, false, true,
- undefined, mockCollection)));
+ collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
- collectionDataService.findByHref.and.returnValue(observableOf(
- new RemoteData(false, false, true,
- undefined, mockDefaultAccessCondition)
- ));
+ resourcePolicyService.findByHref.and.returnValue(createSuccessfulRemoteDataObject$(mockDefaultAccessCondition));
uploadsConfigService.getConfigByHref.and.returnValue(observableOf(
new ConfigData(new PageInfo(), mockUploadConfigResponse as any)
));
groupService.findById.and.returnValues(
- observableOf(new RemoteData(false, false, true,
- undefined, Object.assign(new Group(), mockGroup))),
- observableOf(new RemoteData(false, false, true,
- undefined, Object.assign(new Group(), mockGroup)))
+ createSuccessfulRemoteDataObject$(Object.assign(new Group(), mockGroup)),
+ createSuccessfulRemoteDataObject$(Object.assign(new Group(), mockGroup))
);
bitstreamService.getUploadedFileList.and.returnValue(observableOf(mockUploadFiles));
diff --git a/src/app/submission/sections/upload/section-upload.component.ts b/src/app/submission/sections/upload/section-upload.component.ts
index 3a79a670ad..826385af45 100644
--- a/src/app/submission/sections/upload/section-upload.component.ts
+++ b/src/app/submission/sections/upload/section-upload.component.ts
@@ -8,6 +8,7 @@ import { hasValue, isNotEmpty, isNotUndefined, isUndefined } from '../../../shar
import { SectionUploadService } from './section-upload.service';
import { CollectionDataService } from '../../../core/data/collection-data.service';
import { GroupEpersonService } from '../../../core/eperson/group-eperson.service';
+import { ResourcePolicyService } from '../../../core/data/resource-policy.service';
import { SubmissionUploadsConfigService } from '../../../core/config/submission-uploads-config.service';
import { SubmissionUploadsModel } from '../../../core/config/models/config-submission-uploads.model';
import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model';
@@ -116,6 +117,7 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
* @param {ChangeDetectorRef} changeDetectorRef
* @param {CollectionDataService} collectionDataService
* @param {GroupEpersonService} groupService
+ * @param {ResourcePolicyService} resourcePolicyService
* @param {SectionsService} sectionService
* @param {SubmissionService} submissionService
* @param {SubmissionUploadsConfigService} uploadsConfigService
@@ -126,6 +128,7 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
private changeDetectorRef: ChangeDetectorRef,
private collectionDataService: CollectionDataService,
private groupService: GroupEpersonService,
+ private resourcePolicyService: ResourcePolicyService,
protected sectionService: SectionsService,
private submissionService: SubmissionService,
private uploadsConfigService: SubmissionUploadsConfigService,
@@ -155,7 +158,7 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
find((rd: RemoteData) => isNotUndefined((rd.payload))),
tap((collectionRemoteData: RemoteData) => this.collectionName = collectionRemoteData.payload.name),
flatMap((collectionRemoteData: RemoteData) => {
- return this.collectionDataService.findByHref(
+ return this.resourcePolicyService.findByHref(
(collectionRemoteData.payload as any)._links.defaultAccessConditions
);
}),
diff --git a/src/app/submission/submission.service.spec.ts b/src/app/submission/submission.service.spec.ts
index d764f09538..7906198702 100644
--- a/src/app/submission/submission.service.spec.ts
+++ b/src/app/submission/submission.service.spec.ts
@@ -18,7 +18,10 @@ import { MockActivatedRoute } from '../shared/mocks/mock-active-router';
import { GLOBAL_CONFIG } from '../../config';
import { HttpOptions } from '../core/dspace-rest-v2/dspace-rest-v2.service';
import { SubmissionScopeType } from '../core/submission/submission-scope-type';
-import { mockSubmissionDefinition, mockSubmissionRestResponse } from '../shared/mocks/mock-submission';
+import {
+ mockSubmissionDefinition,
+ mockSubmissionRestResponse
+} from '../shared/mocks/mock-submission';
import { NotificationsService } from '../shared/notifications/notifications.service';
import { MockTranslateLoader } from '../shared/mocks/mock-translate-loader';
import { MOCK_SUBMISSION_CONFIG } from '../shared/testing/mock-submission-config';
@@ -37,6 +40,11 @@ import {
import { RemoteData } from '../core/data/remote-data';
import { RemoteDataError } from '../core/data/remote-data-error';
import { throwError as observableThrowError } from 'rxjs/internal/observable/throwError';
+import {
+ createFailedRemoteDataObject,
+ createSuccessfulRemoteDataObject,
+ createSuccessfulRemoteDataObject$
+} from '../shared/testing/utils';
describe('SubmissionService test suite', () => {
const config = MOCK_SUBMISSION_CONFIG;
@@ -344,7 +352,7 @@ describe('SubmissionService test suite', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
- StoreModule.forRoot({submissionReducers} as any),
+ StoreModule.forRoot({ submissionReducers } as any),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
@@ -353,10 +361,10 @@ describe('SubmissionService test suite', () => {
})
],
providers: [
- {provide: GLOBAL_CONFIG, useValue: config},
- {provide: Router, useValue: router},
- {provide: SubmissionRestService, useValue: restService},
- {provide: ActivatedRoute, useValue: new MockActivatedRoute()},
+ { provide: GLOBAL_CONFIG, useValue: config },
+ { provide: Router, useValue: router },
+ { provide: SubmissionRestService, useValue: restService },
+ { provide: ActivatedRoute, useValue: new MockActivatedRoute() },
NotificationsService,
RouteService,
SubmissionService,
@@ -482,7 +490,7 @@ describe('SubmissionService test suite', () => {
}));
const result = service.getSubmissionObject('826');
- const expected = cold('b', {b: subState.objects[826]});
+ const expected = cold('b', { b: subState.objects[826] });
expect(result).toBeObservable(expected);
});
@@ -495,7 +503,7 @@ describe('SubmissionService test suite', () => {
}));
const result = service.getActiveSectionId('826');
- const expected = cold('b', {b: 'keyinformation'});
+ const expected = cold('b', { b: 'keyinformation' });
expect(result).toBeObservable(expected);
@@ -747,7 +755,7 @@ describe('SubmissionService test suite', () => {
describe('isSubmissionLoading', () => {
it('should return true/false when section is loading/not loading', () => {
- const spy = spyOn(service, 'getSubmissionObject').and.returnValue(observableOf({isLoading: true}));
+ const spy = spyOn(service, 'getSubmissionObject').and.returnValue(observableOf({ isLoading: true }));
let expected = cold('(b|)', {
b: true
@@ -755,7 +763,7 @@ describe('SubmissionService test suite', () => {
expect(service.isSubmissionLoading(submissionId)).toBeObservable(expected);
- spy.and.returnValue(observableOf({isLoading: false}));
+ spy.and.returnValue(observableOf({ isLoading: false }));
expected = cold('(b|)', {
b: false
@@ -841,11 +849,7 @@ describe('SubmissionService test suite', () => {
const result = service.retrieveSubmission('826');
const expected = cold('(b|)', {
- b: new RemoteData(
- false,
- false,
- true,
- null,
+ b: createSuccessfulRemoteDataObject(
mockSubmissionRestResponse[0])
});
@@ -862,12 +866,8 @@ describe('SubmissionService test suite', () => {
);
service.retrieveSubmission('826').subscribe((r) => {
- expect(r).toEqual(new RemoteData(
- false,
- false,
- false,
- new RemoteDataError(500, 'Internal Server Error', 'Error message'),
- null
+ expect(r).toEqual(createFailedRemoteDataObject(null,
+ new RemoteDataError(500, 'Internal Server Error', 'Error message')
))
});
});
diff --git a/src/app/submission/submission.service.ts b/src/app/submission/submission.service.ts
index 82185a8eae..386fa7efae 100644
--- a/src/app/submission/submission.service.ts
+++ b/src/app/submission/submission.service.ts
@@ -3,7 +3,15 @@ import { HttpHeaders } from '@angular/common/http';
import { Router } from '@angular/router';
import { Observable, of as observableOf, Subscription, timer as observableTimer } from 'rxjs';
-import { catchError, distinctUntilChanged, filter, find, first, map, startWith } from 'rxjs/operators';
+import {
+ catchError,
+ distinctUntilChanged,
+ filter,
+ find,
+ first,
+ map,
+ startWith
+} from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { TranslateService } from '@ngx-translate/core';
@@ -43,6 +51,11 @@ import { WorkspaceitemSectionsObject } from '../core/submission/models/workspace
import { RemoteData } from '../core/data/remote-data';
import { ErrorResponse } from '../core/cache/response.models';
import { RemoteDataError } from '../core/data/remote-data-error';
+import {
+ createFailedRemoteDataObject$,
+ createSuccessfulRemoteDataObject,
+ createSuccessfulRemoteDataObject$
+} from '../shared/testing/utils';
/**
* A service that provides methods used in submission process.
@@ -495,20 +508,12 @@ export class SubmissionService {
retrieveSubmission(submissionId): Observable> {
return this.restService.getDataById(this.getSubmissionObjectLinkName(), submissionId).pipe(
find((submissionObjects: SubmissionObject[]) => isNotUndefined(submissionObjects)),
- map((submissionObjects: SubmissionObject[]) => new RemoteData(
- false,
- false,
- true,
- null,
+ map((submissionObjects: SubmissionObject[]) => createSuccessfulRemoteDataObject(
submissionObjects[0])),
catchError((errorResponse: ErrorResponse) => {
- return observableOf(new RemoteData(
- false,
- false,
- false,
- new RemoteDataError(errorResponse.statusCode, errorResponse.statusText, errorResponse.errorMessage),
- null
- ))
+ return createFailedRemoteDataObject$(null,
+ new RemoteDataError(errorResponse.statusCode, errorResponse.statusText, errorResponse.errorMessage)
+ )
})
);
}
diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts
index 9700e01821..e31e907b47 100644
--- a/src/app/thumbnail/thumbnail.component.ts
+++ b/src/app/thumbnail/thumbnail.component.ts
@@ -20,7 +20,7 @@ export class ThumbnailComponent implements OnInit {
/**
* The default 'holder.js' image
*/
- @Input() defaultImage? = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2293%22%20height%3D%22120%22%20viewBox%3D%220%200%2093%20120%22%20preserveAspectRatio%3D%22none%22%3E%3C!--%0ASource%20URL%3A%20holder.js%2F93x120%3Ftext%3DNo%20Thumbnail%0ACreated%20with%20Holder.js%202.8.2.%0ALearn%20more%20at%20http%3A%2F%2Fholderjs.com%0A(c)%202012-2015%20Ivan%20Malopinsky%20-%20http%3A%2F%2Fimsky.co%0A--%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%3C!%5BCDATA%5B%23holder_1543e460b05%20text%20%7B%20fill%3A%23AAAAAA%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A10pt%20%7D%20%5D%5D%3E%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_1543e460b05%22%3E%3Crect%20width%3D%2293%22%20height%3D%22120%22%20fill%3D%22%23EEEEEE%22%2F%3E%3Cg%3E%3Ctext%20x%3D%2235.6171875%22%20y%3D%2257%22%3ENo%3C%2Ftext%3E%3Ctext%20x%3D%2210.8125%22%20y%3D%2272%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E';
+ @Input() defaultImage? = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2293%22%20height%3D%22120%22%20viewBox%3D%220%200%2093%20120%22%20preserveAspectRatio%3D%22none%22%3E%3C!--%0ASource%20URL%3A%20holder.js%2F93x120%3Ftext%3DNo%20Thumbnail%0ACreated%20with%20Holder.js%202.8.2.%0ALearn%20more%20at%20http%3A%2F%2Fholderjs.com%0A(c)%202012-2015%20Ivan%20Malopinsky%20-%20http%3A%2F%2Fimsky.co%0A--%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%3C!%5BCDATA%5B%23holder_1543e460b05%20text%20%7B%20fill%3A%23AAAAAA%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A10pt%20%7D%20%5D%5D%3E%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_1543e460b05%22%3E%3Crect%20width%3D%2293%22%20height%3D%22120%22%20fill%3D%22%23FFFFFF%22%2F%3E%3Cg%3E%3Ctext%20x%3D%2235.6171875%22%20y%3D%2257%22%3ENo%3C%2Ftext%3E%3Ctext%20x%3D%2210.8125%22%20y%3D%2272%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E';
src: string;
errorHandler(event) {
diff --git a/src/config.js b/src/config.js
new file mode 100644
index 0000000000..269277643c
--- /dev/null
+++ b/src/config.js
@@ -0,0 +1,150 @@
+const path = require('path');
+
+let production = false;
+
+let mergedConfig;
+
+let envConfigOverride;
+
+let envConfigFile;
+
+__webpack
+
+// check process.env.NODE_ENV to determine which environment config to use
+// process.env.NODE_ENV is defined by webpack, else assume development
+switch (process.env.NODE_ENV) {
+ case 'prod':
+ case 'production':
+ // webpack.prod.dspace-angular-config.ts defines process.env.NODE_ENV = 'production'
+ envConfigFile = './environment.prod.js';
+ production = true;
+ break;
+ case 'test':
+ // webpack.test.dspace-angular-config.ts defines process.env.NODE_ENV = 'test'
+ envConfigFile = './environment.test.js';
+ break;
+ default:
+ // if not using webpack.prod.dspace-angular-config.ts or webpack.test.dspace-angular-config.ts, it must be development
+ envConfigFile = './environment.dev.js';
+}
+
+try {
+ mergedConfig = require(path.resolve(__dirname, '..', 'config', 'environment.default.js'));
+} catch (e) {
+ console.log('e', e);
+ throw new Error('Cannot find file config/environment.default.js');
+}
+
+// if envConfigFile set try to get configs
+if (envConfigFile) {
+ try {
+ envConfigOverride = require(path.resolve(__dirname, '..', 'config', envConfigFile));
+ } catch (e) {
+ console.log('e', e);
+ console.warn('Cannot find file ' + envConfigFile.substring(2, envConfigFile.length), 'Using default environment');
+ }
+ try {
+ merge(envConfigOverride);
+ } catch (e) {
+ console.warn('Unable to merge the default environment');
+ }
+}
+
+// allow to override a few important options by environment variables
+function createServerConfig(host, port, nameSpace, ssl) {
+ const result = { host, nameSpace };
+
+ if (port !== null && port !== undefined) {
+ result.port = port * 1;
+ }
+
+ if (ssl !== null && ssl !== undefined) {
+ result.ssl = ssl.trim().match(/^(true|1|yes)$/i) ? true : false;
+ }
+
+ return result;
+}
+
+const processEnv = {
+ ui: createServerConfig(
+ process.env.DSPACE_HOST,
+ process.env.DSPACE_PORT,
+ process.env.DSPACE_NAMESPACE,
+ process.env.DSPACE_SSL),
+ rest: createServerConfig(
+ process.env.DSPACE_REST_HOST,
+ process.env.DSPACE_REST_PORT,
+ process.env.DSPACE_REST_NAMESPACE,
+ process.env.DSPACE_REST_SSL)
+};
+
+// merge the environment variables with our configuration.
+try {
+ merge(processEnv)
+} catch (e) {
+ console.warn('Unable to merge environment variable into the configuration')
+}
+
+buildBaseUrls();
+
+// set config for whether running in production
+mergedConfig.production = production;
+
+function merge(config) {
+ innerMerge(mergedConfig, config);
+}
+
+function innerMerge(globalConfig, config) {
+ for (const key in config) {
+ if (config.hasOwnProperty(key)) {
+ if (isObject(config[key])) {
+ innerMerge(globalConfig[key], config[key]);
+ } else {
+ if (isDefined(config[key])) {
+ globalConfig[key] = config[key];
+ }
+ }
+ }
+ }
+}
+
+function buildBaseUrls() {
+ for (const key in mergedConfig) {
+ if (mergedConfig.hasOwnProperty(key) && mergedConfig[key].host) {
+ mergedConfig[key].baseUrl = [
+ getProtocol(mergedConfig[key].ssl),
+ getHost(mergedConfig[key].host),
+ getPort(mergedConfig[key].port),
+ getNameSpace(mergedConfig[key].nameSpace)
+ ].join('');
+ }
+ }
+}
+
+function getProtocol(ssl) {
+ return ssl ? 'https://' : 'http://';
+}
+
+function getHost(host) {
+ return host;
+}
+
+function getPort(port) {
+ return port ? (port !== 80 && port !== 443) ? ':' + port : '' : '';
+}
+
+function getNameSpace(nameSpace) {
+ return nameSpace ? nameSpace.charAt(0) === '/' ? nameSpace : '/' + nameSpace : '';
+}
+
+function isDefined(value) {
+ return typeof value !== 'undefined' && value !== null;
+}
+
+function isObject(item) {
+ return item && typeof item === 'object' && !Array.isArray(item);
+}
+
+module.exports = {
+ mergedConfig: mergedConfig
+};
diff --git a/src/config/browse-by-config.interface.ts b/src/config/browse-by-config.interface.ts
index 6adba66b92..719e127b4b 100644
--- a/src/config/browse-by-config.interface.ts
+++ b/src/config/browse-by-config.interface.ts
@@ -1,4 +1,5 @@
import { Config } from './config.interface';
+import { BrowseByTypeConfig } from './browse-by-type-config.interface';
/**
* Config that determines how the dropdown list of years are created for browse-by-date components
@@ -18,4 +19,9 @@ export interface BrowseByConfig extends Config {
* The absolute lowest year to display in the dropdown when no lowest date can be found for all items
*/
defaultLowerLimit: number;
+
+ /**
+ * A list of all the active Browse-By pages
+ */
+ types: BrowseByTypeConfig[];
}
diff --git a/src/config/browse-by-type-config.interface.ts b/src/config/browse-by-type-config.interface.ts
new file mode 100644
index 0000000000..97d3acbe25
--- /dev/null
+++ b/src/config/browse-by-type-config.interface.ts
@@ -0,0 +1,23 @@
+import { Config } from './config.interface';
+import { BrowseByType } from '../app/+browse-by/+browse-by-switcher/browse-by-decorator';
+
+/**
+ * Config used for rendering Browse-By pages and links
+ */
+export interface BrowseByTypeConfig extends Config {
+ /**
+ * The browse id used for fetching browse data from the rest api
+ * e.g. author
+ */
+ id: string;
+
+ /**
+ * The type of Browse-By page to render
+ */
+ type: BrowseByType;
+
+ /**
+ * The metadata field to use for rendering starts-with options (only necessary when type is set to BrowseByType.Date)
+ */
+ metadataField: string;
+}
diff --git a/src/config/global-config.interface.ts b/src/config/global-config.interface.ts
index d83ec6e4d8..22b4b0500f 100644
--- a/src/config/global-config.interface.ts
+++ b/src/config/global-config.interface.ts
@@ -8,6 +8,7 @@ import { FormConfig } from './form-config.interfaces';
import {LangConfig} from './lang-config.interface';
import { BrowseByConfig } from './browse-by-config.interface';
import { ItemPageConfig } from './item-page-config.interface';
+import { Theme } from './theme.inferface';
export interface GlobalConfig extends Config {
ui: ServerConfig;
@@ -25,4 +26,5 @@ export interface GlobalConfig extends Config {
languages: LangConfig[];
browseBy: BrowseByConfig;
item: ItemPageConfig;
+ themes: Theme[];
}
diff --git a/src/config/theme.inferface.ts b/src/config/theme.inferface.ts
new file mode 100644
index 0000000000..d0cf1d77d8
--- /dev/null
+++ b/src/config/theme.inferface.ts
@@ -0,0 +1,5 @@
+import { Config } from './config.interface';
+
+export interface Theme extends Config {
+ name: string;
+}
diff --git a/src/modules/app/browser-app.module.ts b/src/modules/app/browser-app.module.ts
index b20894880b..ee826c680d 100644
--- a/src/modules/app/browser-app.module.ts
+++ b/src/modules/app/browser-app.module.ts
@@ -20,7 +20,6 @@ import { CookieService } from '../../app/shared/services/cookie.service';
import { AuthService } from '../../app/core/auth/auth.service';
import { Angulartics2Module } from 'angulartics2';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
-import { ServerSubmissionService } from '../../app/submission/server-submission.service';
import { SubmissionService } from '../../app/submission/submission.service';
export const REQ_KEY = makeStateKey('req');
diff --git a/src/styles/_bootstrap_variables.scss b/src/styles/_bootstrap_variables.scss
index 7be76ff5d3..5258365cfd 100644
--- a/src/styles/_bootstrap_variables.scss
+++ b/src/styles/_bootstrap_variables.scss
@@ -1,3 +1,5 @@
+@import '_themed_bootstrap_variables.scss';
+
/** Help Variables **/
$fa-fixed-width: 1.25rem;
$icon-padding: 1rem;
diff --git a/src/styles/_custom_variables.scss b/src/styles/_custom_variables.scss
index be03d719c5..8ca2067a2e 100644
--- a/src/styles/_custom_variables.scss
+++ b/src/styles/_custom_variables.scss
@@ -1,3 +1,5 @@
+@import '_themed_custom_variables.scss';
+
$content-spacing: $spacer * 1.5;
$button-height: $input-btn-padding-y * 2 + $input-btn-line-height + calculateRem($input-btn-border-width*2);
@@ -20,9 +22,9 @@ $sidebar-z-index: 20;
$header-logo-height: 80px;
$header-logo-height-xs: 50px;
-$admin-sidebar-bg: $dark;
-$admin-sidebar-active-bg: darken($dark, 3%);
-$admin-sidebar-header-bg: darken($dark, 7%);
+$admin-sidebar-bg: darken(#2B4E72, 17%);
+$admin-sidebar-active-bg: darken($admin-sidebar-bg, 3%);
+$admin-sidebar-header-bg: darken($admin-sidebar-bg, 7%);
$dark-scrollbar-background: $admin-sidebar-active-bg;
$dark-scrollbar-foreground: #47495d;
@@ -32,3 +34,5 @@ $submission-sections-margin-bottom: .5rem !default;
$edit-item-button-min-width: 100px;
$edit-item-metadata-field-width: 190px;
$edit-item-language-field-width: 43px;
+
+$thumbnail-max-width: 175px;
diff --git a/src/styles/_exposed_variables.scss b/src/styles/_exposed_variables.scss
index 5f0f2d2654..1ab67e709d 100644
--- a/src/styles/_exposed_variables.scss
+++ b/src/styles/_exposed_variables.scss
@@ -9,4 +9,4 @@
sidebarItemsWidth: $sidebar-items-width;
collapsedSidebarWidth: $collapsed-sidebar-width;
totalSidebarWidth: $total-sidebar-width;
-}
\ No newline at end of file
+}
diff --git a/src/styles/_mixins.scss b/src/styles/_mixins.scss
index 40bb9b8f3e..e72af304cd 100644
--- a/src/styles/_mixins.scss
+++ b/src/styles/_mixins.scss
@@ -1,6 +1,5 @@
@import '../../node_modules/bootstrap/scss/functions.scss';
@import '../../node_modules/bootstrap/scss/mixins.scss';
-@import 'variables.scss';
@mixin word-wrap() {
overflow-wrap: break-word;
@@ -39,5 +38,4 @@
&::-webkit-resizer {
background-color: $dark-scrollbar-background;
}
-
}
diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss
index 33a3f0b1fa..2632dbfd09 100644
--- a/src/styles/_variables.scss
+++ b/src/styles/_variables.scss
@@ -1,5 +1,7 @@
@import '_functions.scss';
@import '../../node_modules/bootstrap/scss/functions.scss';
-@import 'bootstrap_variables.scss';
+
+@import '_bootstrap_variables.scss';
@import '../../node_modules/bootstrap/scss/variables.scss';
-@import 'custom_variables.scss';
\ No newline at end of file
+
+@import '_custom_variables.scss';
diff --git a/themes/default/styles/_themed_bootstrap_variables.scss b/themes/default/styles/_themed_bootstrap_variables.scss
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/themes/default/styles/_themed_custom_variables.scss b/themes/default/styles/_themed_custom_variables.scss
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/themes/mantis/app/+home-page/home-news/home-news.component.html b/themes/mantis/app/+home-page/home-news/home-news.component.html
new file mode 100644
index 0000000000..4da3ae12f7
--- /dev/null
+++ b/themes/mantis/app/+home-page/home-news/home-news.component.html
@@ -0,0 +1,21 @@
+
+
+
+
DSpace 7
+
DSpace is the world leading open source repository platform that enables
+ organisations to:
+
+
+
+ - easily ingest documents, audio, video, datasets and their corresponding Dublin Core
+ metadata
+
+ - open up this content to local and global audiences, thanks to the OAI-PMH interface and
+ Google Scholar optimizations
+
+ - issue permanent urls and trustworthy identifiers, including optional integrations with
+ handle.net and DataCite DOI
+
+
+
Join an international community of leading institutions using DSpace.
+
diff --git a/themes/mantis/app/+home-page/home-news/home-news.component.scss b/themes/mantis/app/+home-page/home-news/home-news.component.scss
new file mode 100644
index 0000000000..c693e9a493
--- /dev/null
+++ b/themes/mantis/app/+home-page/home-news/home-news.component.scss
@@ -0,0 +1,15 @@
+@import 'src/app/+home-page/home-news/home-news.component.scss';
+$home-news-link-color: $green !default;
+$home-news-link-color: darken($home-news-link-color, 15%) !default;
+
+.jumbotron {
+ background-color: transparent;
+}
+
+a {
+ color: $home-news-link-color;
+
+ @include hover {
+ color: $home-news-link-color;
+ }
+}
diff --git a/themes/mantis/app/+home-page/home-page.component.html b/themes/mantis/app/+home-page/home-page.component.html
new file mode 100644
index 0000000000..43edbee9ca
--- /dev/null
+++ b/themes/mantis/app/+home-page/home-page.component.html
@@ -0,0 +1,10 @@
+
+
+
+
diff --git a/themes/mantis/app/+home-page/home-page.component.scss b/themes/mantis/app/+home-page/home-page.component.scss
new file mode 100644
index 0000000000..64bd786cd5
--- /dev/null
+++ b/themes/mantis/app/+home-page/home-page.component.scss
@@ -0,0 +1,52 @@
+@import 'src/app/+home-page/home-page.component.scss';
+
+div.background-image {
+ color: white;
+ background-color: $info;
+ position: relative;
+ background-position-y: -200px;
+ background-image: url('/assets/images/banner.jpg');
+ background-size: cover;
+ @media screen and (max-width: map-get($grid-breakpoints, lg)) {
+ background-position-y: 0;
+ }
+
+ .container {
+ position: relative;
+ text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
+
+ &:before, &:after {
+ content: '';
+ display: block;
+ width: $banner-background-gradient-width;
+ height: 100%;
+ top: 0;
+ position: absolute;
+ }
+
+ &:before {
+ background: linear-gradient(to left, $banner-text-background, transparent);
+ left: -$banner-background-gradient-width;
+
+ }
+
+ &:after {
+ background: linear-gradient(to right, $banner-text-background, transparent);
+ right: -$banner-background-gradient-width;
+ }
+
+ background-color: $banner-text-background;
+ }
+
+
+ small.credits {
+ a {
+ color: inherit;
+ }
+
+ opacity: 0.3;
+ position: absolute;
+ right: $spacer;
+ bottom: 0;
+ }
+}
diff --git a/themes/mantis/app/+item-page/simple/item-page.component.html b/themes/mantis/app/+item-page/simple/item-page.component.html
new file mode 100644
index 0000000000..472df7c78e
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-page.component.html
@@ -0,0 +1,9 @@
+
diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.html b/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.html
new file mode 100644
index 0000000000..a25a474eb0
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.html
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+ {{'journalissue.page.titleprefix' | translate}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss b/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss
new file mode 100644
index 0000000000..7ce24acc15
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss
@@ -0,0 +1,30 @@
+@import 'src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss';
+
+:host {
+ > * {
+ display: block;
+ padding-top: $content-spacing;
+ padding-bottom: $content-spacing;
+ }
+
+ .top-item-page {
+ background-color: $gray-100;
+ margin-top: -$content-spacing;
+ }
+
+ .relationships-item-page {
+ padding-bottom: $content-spacing - $spacer;
+ }
+
+ ds-metadata-field-wrapper {
+ @media screen and (max-width: map-get($grid-breakpoints, md)) {
+ flex: 1;
+ padding-right: $spacer/2;
+ }
+
+ ds-thumbnail {
+ display: block;
+ max-width: $thumbnail-max-width;
+ }
+ }
+}
diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.html b/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.html
new file mode 100644
index 0000000000..c20e9a775a
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.html
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+ {{'journalvolume.page.titleprefix' | translate}}
+
+
+
+
+
+
+
+
diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss b/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss
new file mode 100644
index 0000000000..ab1bc700b1
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss
@@ -0,0 +1,30 @@
+@import 'src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss';
+
+:host {
+ > * {
+ display: block;
+ padding-top: $content-spacing;
+ padding-bottom: $content-spacing;
+ }
+
+ .top-item-page {
+ background-color: $gray-100;
+ margin-top: -$content-spacing;
+ }
+
+ .relationships-item-page {
+ padding-bottom: $content-spacing - $spacer;
+ }
+
+ ds-metadata-field-wrapper {
+ @media screen and (max-width: map-get($grid-breakpoints, md)) {
+ flex: 1;
+ padding-right: $spacer/2;
+ }
+
+ ds-thumbnail {
+ display: block;
+ max-width: $thumbnail-max-width;
+ }
+ }
+}
diff --git a/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.html b/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.html
new file mode 100644
index 0000000000..ef827af590
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.html
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+ {{'journal.page.titleprefix' | translate}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{"item.page.journal.search.title" | translate}}
+
+
+
+
diff --git a/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss b/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss
new file mode 100644
index 0000000000..6d97cbf5c3
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss
@@ -0,0 +1,38 @@
+@import 'src/app/+item-page/simple/item-types/journal/journal.component.scss';
+
+:host {
+ > * {
+ display: block;
+ padding-top: $content-spacing;
+ padding-bottom: $content-spacing;
+ }
+
+ .top-item-page {
+ background-color: $gray-100;
+ margin-top: -$content-spacing;
+ }
+
+ .relationships-item-page {
+ padding-bottom: $content-spacing - $spacer;
+ }
+
+ ds-metadata-field-wrapper {
+ @media screen and (max-width: map-get($grid-breakpoints, md)) {
+ flex: 1;
+ padding-right: $spacer/2;
+ }
+
+ ds-thumbnail {
+ display: block;
+ max-width: $thumbnail-max-width;
+ }
+ }
+
+ .search-container {
+ margin-bottom: $spacer;
+ @media screen and (max-width: map-get($grid-breakpoints, lg)) {
+ width: 100%;
+ max-width: none;
+ }
+ }
+}
diff --git a/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.html b/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.html
new file mode 100644
index 0000000000..6bb925c93f
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.html
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+ {{'orgunit.page.titleprefix' | translate}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss b/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss
new file mode 100644
index 0000000000..5b2bdb0382
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss
@@ -0,0 +1,30 @@
+@import 'src/app/+item-page/simple/item-types/orgunit/orgunit.component.scss';
+
+:host {
+ > * {
+ display: block;
+ padding-top: $content-spacing;
+ padding-bottom: $content-spacing;
+ }
+
+ .top-item-page {
+ background-color: $gray-100;
+ margin-top: -$content-spacing;
+ }
+
+ .relationships-item-page {
+ padding-bottom: $content-spacing - $spacer;
+ }
+
+ ds-metadata-field-wrapper {
+ @media screen and (max-width: map-get($grid-breakpoints, md)) {
+ flex: 1;
+ padding-right: $spacer/2;
+ }
+
+ ds-thumbnail {
+ display: block;
+ max-width: $thumbnail-max-width;
+ }
+ }
+}
diff --git a/themes/mantis/app/+item-page/simple/item-types/person/person.component.html b/themes/mantis/app/+item-page/simple/item-types/person/person.component.html
new file mode 100644
index 0000000000..54d7962b97
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/person/person.component.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+ {{'person.page.titleprefix' | translate}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{"item.page.person.search.title" | translate}}
+
+
+
+
diff --git a/themes/mantis/app/+item-page/simple/item-types/person/person.component.scss b/themes/mantis/app/+item-page/simple/item-types/person/person.component.scss
new file mode 100644
index 0000000000..3b454aab0e
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/person/person.component.scss
@@ -0,0 +1,38 @@
+@import 'src/app/+item-page/simple/item-types/person/person.component.scss';
+
+:host {
+ > * {
+ display: block;
+ padding-top: $content-spacing;
+ padding-bottom: $content-spacing;
+ }
+
+ .top-item-page {
+ background-color: $gray-100;
+ margin-top: -$content-spacing;
+ }
+
+ .relationships-item-page {
+ padding-bottom: $content-spacing - $spacer;
+ }
+
+ ds-metadata-field-wrapper {
+ @media screen and (max-width: map-get($grid-breakpoints, md)) {
+ flex: 1;
+ padding-right: $spacer/2;
+ }
+
+ ds-thumbnail {
+ display: block;
+ max-width: $thumbnail-max-width;
+ }
+ }
+
+ .search-container {
+ margin-bottom: $spacer;
+ @media screen and (max-width: map-get($grid-breakpoints, lg)) {
+ width: 100%;
+ max-width: none;
+ }
+ }
+}
diff --git a/themes/mantis/app/+item-page/simple/item-types/project/project.component.html b/themes/mantis/app/+item-page/simple/item-types/project/project.component.html
new file mode 100644
index 0000000000..aa4a107247
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/project/project.component.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+ {{'project.page.titleprefix' | translate}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/themes/mantis/app/+item-page/simple/item-types/project/project.component.scss b/themes/mantis/app/+item-page/simple/item-types/project/project.component.scss
new file mode 100644
index 0000000000..9c9aa9c629
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/project/project.component.scss
@@ -0,0 +1,30 @@
+@import 'src/app/+item-page/simple/item-types/project/project.component.scss';
+
+:host {
+ > * {
+ display: block;
+ padding-top: $content-spacing;
+ padding-bottom: $content-spacing;
+ }
+
+ .top-item-page {
+ background-color: $gray-100;
+ margin-top: -$content-spacing;
+ }
+
+ .relationships-item-page {
+ padding-bottom: $content-spacing - $spacer;
+ }
+
+ ds-metadata-field-wrapper {
+ @media screen and (max-width: map-get($grid-breakpoints, md)) {
+ flex: 1;
+ padding-right: $spacer/2;
+ }
+
+ ds-thumbnail {
+ display: block;
+ max-width: $thumbnail-max-width;
+ }
+ }
+}
diff --git a/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.html b/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.html
new file mode 100644
index 0000000000..6b6f484183
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.html
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.scss b/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.scss
new file mode 100644
index 0000000000..f65d9a00d5
--- /dev/null
+++ b/themes/mantis/app/+item-page/simple/item-types/publication/publication.component.scss
@@ -0,0 +1,30 @@
+@import 'src/app/+item-page/simple/item-types/publication/publication.component.scss';
+
+:host {
+ > * {
+ display: block;
+ padding-top: $content-spacing;
+ padding-bottom: $content-spacing;
+ }
+
+ .top-item-page {
+ background-color: $gray-100;
+ margin-top: -$content-spacing;
+ }
+
+ .relationships-item-page {
+ padding-bottom: $content-spacing - $spacer;
+ }
+
+ ds-metadata-field-wrapper {
+ @media screen and (max-width: map-get($grid-breakpoints, md)) {
+ flex: 1;
+ padding-right: $spacer/2;
+ }
+
+ ds-thumbnail {
+ display: block;
+ max-width: $thumbnail-max-width;
+ }
+ }
+}
diff --git a/themes/mantis/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.html b/themes/mantis/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.html
new file mode 100644
index 0000000000..86076dfd10
--- /dev/null
+++ b/themes/mantis/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.html
@@ -0,0 +1,9 @@
+
+
+ {{filterValue.value}}
+
+ {{filterValue.count}}
+
+
\ No newline at end of file
diff --git a/themes/mantis/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.html b/themes/mantis/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.html
new file mode 100644
index 0000000000..bdb37cb52d
--- /dev/null
+++ b/themes/mantis/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.html
@@ -0,0 +1,8 @@
+
+ {{filterValue.value}}
+
+ {{filterValue.count}}
+
+
\ No newline at end of file
diff --git a/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.html b/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.html
new file mode 100644
index 0000000000..850447a39e
--- /dev/null
+++ b/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.html
@@ -0,0 +1,7 @@
+
+
{{'search.filters.filter.' + filter.name + '.head'| translate}}
+
+
+
+
diff --git a/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.scss b/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.scss
new file mode 100644
index 0000000000..8e9b1d32b1
--- /dev/null
+++ b/themes/mantis/app/+search-page/search-filters/search-filter/search-filter.component.scss
@@ -0,0 +1,10 @@
+@import 'src/app/+search-page/search-filters/search-filter/search-filter.component.scss';
+
+.facet-filter {
+ background-color: map-get($theme-colors, light);
+ border-radius: $border-radius;
+
+ h5 {
+ font-size: 1.1rem
+ }
+}
diff --git a/themes/mantis/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss b/themes/mantis/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss
new file mode 100644
index 0000000000..42b8e0205b
--- /dev/null
+++ b/themes/mantis/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss
@@ -0,0 +1,5 @@
+@import 'src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.scss';
+
+::ng-deep .noUi-connect {
+ background: $info;
+}
diff --git a/themes/mantis/app/+search-page/search-filters/search-filters.component.html b/themes/mantis/app/+search-page/search-filters/search-filters.component.html
new file mode 100644
index 0000000000..b7bb1bf50f
--- /dev/null
+++ b/themes/mantis/app/+search-page/search-filters/search-filters.component.html
@@ -0,0 +1,7 @@
+{{"search.filters.head" | translate}}
+
+{{"search.filters.reset" | translate}}
diff --git a/themes/mantis/app/+search-page/search-settings/search-settings.component.html b/themes/mantis/app/+search-page/search-settings/search-settings.component.html
new file mode 100644
index 0000000000..1321ced928
--- /dev/null
+++ b/themes/mantis/app/+search-page/search-settings/search-settings.component.html
@@ -0,0 +1,24 @@
+
+ {{ 'search.sidebar.settings.title' | translate}}
+
+
{{ 'search.sidebar.settings.sort-by' | translate}}
+
+
+
+
+
{{ 'search.sidebar.settings.rpp' | translate}}
+
+
+
\ No newline at end of file
diff --git a/themes/mantis/app/+search-page/search-settings/search-settings.component.scss b/themes/mantis/app/+search-page/search-settings/search-settings.component.scss
new file mode 100644
index 0000000000..602c8ca4c3
--- /dev/null
+++ b/themes/mantis/app/+search-page/search-settings/search-settings.component.scss
@@ -0,0 +1,10 @@
+@import 'src/app/+search-page/search-settings/search-settings.component.scss';
+
+.setting-option {
+ background-color: map-get($theme-colors, light);
+ border-radius: $border-radius;
+ h5 {
+ font-size: 1.1rem
+ }
+}
+
diff --git a/themes/mantis/app/navbar/navbar.component.html b/themes/mantis/app/navbar/navbar.component.html
new file mode 100644
index 0000000000..d06eceb222
--- /dev/null
+++ b/themes/mantis/app/navbar/navbar.component.html
@@ -0,0 +1,16 @@
+
diff --git a/themes/mantis/app/navbar/navbar.component.scss b/themes/mantis/app/navbar/navbar.component.scss
new file mode 100644
index 0000000000..1417acff59
--- /dev/null
+++ b/themes/mantis/app/navbar/navbar.component.scss
@@ -0,0 +1,7 @@
+@import 'src/app/navbar/navbar.component.scss';
+
+nav.navbar {
+ border-bottom: 5px $green solid;
+}
+
+
diff --git a/themes/mantis/app/shared/search-form/search-form.component.html b/themes/mantis/app/shared/search-form/search-form.component.html
new file mode 100644
index 0000000000..ea2f54813e
--- /dev/null
+++ b/themes/mantis/app/shared/search-form/search-form.component.html
@@ -0,0 +1,21 @@
+
diff --git a/themes/mantis/styles/_themed_bootstrap_variables.scss b/themes/mantis/styles/_themed_bootstrap_variables.scss
new file mode 100644
index 0000000000..e606502e09
--- /dev/null
+++ b/themes/mantis/styles/_themed_bootstrap_variables.scss
@@ -0,0 +1,19 @@
+@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,200i,300,300i,400,400i,600,600i,700,700i,900,900i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese');
+
+$font-family-sans-serif: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+$gray-100: #e8ebf3 !default; // #eee
+$gray-800: #444444 !default; // #444
+
+$navbar-dark-color: #FFFFFF;
+
+/* Reassign color vars to semantic color scheme */
+$blue: #43515f !default;
+$green: #92C642 !default;
+$cyan: #2e80a3 !default;
+$yellow: #ec9433 !default;
+$red: #CF4444 !default;
+$dark: #43515f !default;
+
+$body-color: $gray-800 !default;
+
+$yiq-contrasted-threshold: 170 !default;
diff --git a/themes/mantis/styles/_themed_custom_variables.scss b/themes/mantis/styles/_themed_custom_variables.scss
new file mode 100644
index 0000000000..1be25e953f
--- /dev/null
+++ b/themes/mantis/styles/_themed_custom_variables.scss
@@ -0,0 +1,2 @@
+$banner-text-background: rgba(0, 0, 0, 0.35);
+$banner-background-gradient-width: 300px;
diff --git a/webpack.config.js b/webpack.config.js
index 6312cf3605..78ca2d98dc 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,46 +1,45 @@
const webpackMerge = require('webpack-merge');
-const commonPartial = require('./webpack/webpack.common');
-const clientPartial = require('./webpack/webpack.client');
-const { getServerWebpackPartial } = require('./webpack/webpack.server');
+
const prodPartial = require('./webpack/webpack.prod');
-const {
- getAotPlugin
-} = require('./webpack/webpack.aot');
-
-module.exports = function(env, options) {
+module.exports = function (env, options) {
env = env || {};
- if (env.aot) {
- console.log(`Running build for ${env.client ? 'client' : 'server'} with AoT Compilation`)
- }
+ const commonPartial = require('./webpack/webpack.common')(env);
+ const clientPartial = require('./webpack/webpack.client')(env);
+ const {getAotPlugin} = require('./webpack/webpack.aot')(env);
+ const {getServerWebpackPartial} = require('./webpack/webpack.server')(env);
- let serverPartial = getServerWebpackPartial(env.aot);
+ if (env.aot) {
+ console.log(`Running build for ${env.client ? 'client' : 'server'} with AoT Compilation`)
+ }
- let serverConfig = webpackMerge({}, commonPartial, serverPartial, {
- plugins: [
- getAotPlugin('server', !!env.aot)
- ]
- });
+ let serverPartial = getServerWebpackPartial(env.aot);
- let clientConfig = webpackMerge({}, commonPartial, clientPartial, {
- plugins: [
- getAotPlugin('client', !!env.aot)
- ]
- });
- if (options.mode === 'production') {
- serverConfig = webpackMerge({}, serverConfig, prodPartial);
- clientConfig = webpackMerge({}, clientConfig, prodPartial);
- }
+ let serverConfig = webpackMerge({}, commonPartial, serverPartial, {
+ plugins: [
+ getAotPlugin('server', !!env.aot)
+ ]
+ });
- const configs = [];
+ let clientConfig = webpackMerge({}, commonPartial, clientPartial, {
+ plugins: [
+ getAotPlugin('client', !!env.aot)
+ ]
+ });
+ if (options.mode === 'production') {
+ serverConfig = webpackMerge({}, serverConfig, prodPartial);
+ clientConfig = webpackMerge({}, clientConfig, prodPartial);
+ }
- if (!env.aot) {
- configs.push(clientConfig, serverConfig);
- } else if (env.client) {
- configs.push(clientConfig);
- } else if (env.server) {
- configs.push(serverConfig);
- }
+ const configs = [];
- return configs;
+ if (!env.aot) {
+ configs.push(clientConfig, serverConfig);
+ } else if (env.client) {
+ configs.push(clientConfig);
+ } else if (env.server) {
+ configs.push(serverConfig);
+ }
+
+ return configs;
};
diff --git a/webpack/helpers.js b/webpack/helpers.js
index fdc005f189..fafbbaff5e 100644
--- a/webpack/helpers.js
+++ b/webpack/helpers.js
@@ -1,13 +1,109 @@
-const {
- join,
- resolve
-} = require('path');
+const path = require('path');
+const fs = require('fs');
-function root(path) {
- return resolve(__dirname, '..', path);
+
+const projectRoot = (relativePath) => {
+ return path.resolve(__dirname, '..', relativePath);
+};
+
+const srcPath = projectRoot('src');
+
+const buildRoot = (relativePath, env) => {
+ if (env.aot) {
+ return path.resolve(projectRoot('./build'), relativePath);
+ } else {
+ return path.resolve(projectRoot('src'), relativePath);
+ }
+};
+
+//TODO refactor to share between this and config.ts.
+const getThemeName = () => {
+ let defaultCfg = require(projectRoot('config/environment.default.js'));
+ let envConfigFile;
+ let envConfigOverride = {};
+
+ switch (process.env.NODE_ENV) {
+ case 'prod':
+ case 'production':
+ // webpack.prod.dspace-angular-config.ts defines process.env.NODE_ENV = 'production'
+ envConfigFile = projectRoot('config/environment.prod.js');
+ break;
+ case 'test':
+ // webpack.test.dspace-angular-config.ts defines process.env.NODE_ENV = 'test'
+ envConfigFile = projectRoot('config/environment.test.js');
+ break;
+ default:
+ // if not using webpack.prod.dspace-angular-config.ts or webpack.test.dspace-angular-config.ts, it must be development
+ envConfigFile = projectRoot('config/environment.dev.js');
+ }
+
+ if (envConfigFile) {
+ try {
+ envConfigOverride = require(envConfigFile);
+ } catch (e) {
+ }
+ }
+
+ return Object.assign({}, defaultCfg.theme, envConfigOverride.theme).name;
}
-module.exports = {
- root: root,
- join: join
+const theme = getThemeName();
+
+let themePath;
+
+if (theme !== null && theme !== undefined) {
+ themePath = path.normalize(path.join(__dirname, '..', 'themes', theme));
+}
+else {
+ themePath = srcPath;
+}
+
+const globalCSSImports = (env) => { return [
+ buildRoot('styles/_variables.scss', env),
+ buildRoot('styles/_mixins.scss', env),
+]};
+
+const getThemedPath = (componentPath, ext) => {
+ const parsedPath = path.parse(componentPath);
+ const relativePath = path.relative(srcPath, parsedPath.dir);
+ return path.join(themePath, relativePath, `${parsedPath.name}.${ext}`);
+};
+
+const themedTest = (origPath, extension) => {
+ if (/\.component.ts$/.test(origPath)) { // only match components
+ const themedPath = getThemedPath(origPath, extension);
+ return fs.existsSync(themedPath);
+ } else {
+ return false;
+ }
+};
+
+const themedUse = (resource, extension) => {
+ const origPath = path.parse(resource);
+ let themedPath = getThemedPath(resource, extension);
+
+ /* Make sure backslashes are escaped twice, because the replace unescapes those again */
+ themedPath = themedPath.replace(/\\/g, '\\\\');
+
+ return [
+ {
+ loader: 'string-replace-loader',
+ options: {
+ search: `\.\/${origPath.name}\.${extension}`,
+ replace: themedPath,
+ flags: 'g'
+ }
+ }
+ ]
+};
+
+module.exports = {
+ projectRoot,
+ buildRoot,
+ theme: theme,
+ themePath,
+ getThemedPath,
+ themedTest,
+ themedUse,
+ globalCSSImports
};
diff --git a/webpack/webpack.aot.js b/webpack/webpack.aot.js
index 2c2366a23e..c4b970892f 100644
--- a/webpack/webpack.aot.js
+++ b/webpack/webpack.aot.js
@@ -1,35 +1,37 @@
const {
- root
+ buildRoot
} = require('./helpers');
const {
- AngularCompilerPlugin
+ AngularCompilerPlugin
} = require('@ngtools/webpack');
-const tsconfigs = {
- client: root('./src/tsconfig.browser.json'),
- server: root('./src/tsconfig.server.json')
-};
+module.exports = (env) => {
+ const tsconfigs = {
+ client: buildRoot('./tsconfig.browser.json', env),
+ server: buildRoot('./tsconfig.server.json', env)
+ };
-const aotTsconfigs = {
- client: root('./src/tsconfig.browser.json'),
- server: root('./src/tsconfig.server.aot.json')
-};
+ const aotTsconfigs = {
+ client: buildRoot('./tsconfig.browser.json', env),
+ server: buildRoot('./tsconfig.server.aot.json', env)
+ };
-/**
- * Generates a AotPlugin for @ngtools/webpack
- *
- * @param {string} platform Should either be client or server
- * @param {boolean} aot Enables/Disables AoT Compilation
- * @returns {AotPlugin} Configuration of AotPlugin
- */
-function getAotPlugin(platform, aot) {
- return new AngularCompilerPlugin({
- tsConfigPath: aot ? aotTsconfigs[platform] : tsconfigs[platform],
- skipCodeGeneration: !aot
- });
-}
+ /**
+ * Generates a AotPlugin for @ngtools/webpack
+ *
+ * @param {string} platform Should either be client or server
+ * @param {boolean} aot Enables/Disables AoT Compilation
+ * @returns {AotPlugin} Configuration of AotPlugin
+ */
+ function getAotPlugin(platform, aot) {
+ return new AngularCompilerPlugin({
+ tsConfigPath: aot ? aotTsconfigs[platform] : tsconfigs[platform],
+ skipCodeGeneration: !aot
+ });
+ }
-module.exports = {
- getAotPlugin: getAotPlugin
+ return {
+ getAotPlugin: getAotPlugin
+ }
};
diff --git a/webpack/webpack.client.js b/webpack/webpack.client.js
index 20dcbddb20..ce49f60ed0 100644
--- a/webpack/webpack.client.js
+++ b/webpack/webpack.client.js
@@ -2,23 +2,26 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const ScriptExtPlugin = require('script-ext-html-webpack-plugin');
const {
- root
+ projectRoot,
+ buildRoot
} = require('./helpers');
-module.exports = {
- entry: root('./src/main.browser.ts'),
- output: {
- filename: 'client.js'
- },
- target: 'web',
- plugins: [
- new HtmlWebpackPlugin({
- template: root('./src/index.html'),
- output: root('dist'),
- inject: 'head'
- }),
- new ScriptExtPlugin({
- defaultAttribute: 'defer'
- })
- ]
-};
+module.exports = (env) => {
+ return {
+ entry: buildRoot('./main.browser.ts', env),
+ output: {
+ filename: 'client.js'
+ },
+ target: 'web',
+ plugins: [
+ new HtmlWebpackPlugin({
+ template: buildRoot('./index.html', env),
+ output: projectRoot('dist'),
+ inject: 'head'
+ }),
+ new ScriptExtPlugin({
+ defaultAttribute: 'defer'
+ })
+ ]
+ };
+}
diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js
index 7fb4656a15..028815d958 100644
--- a/webpack/webpack.common.js
+++ b/webpack/webpack.common.js
@@ -1,110 +1,173 @@
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
+const fs = require('fs');
const {
- root,
- join
+ projectRoot,
+ buildRoot,
+ globalCSSImports,
+ theme,
+ themePath,
+ themedTest,
+ themedUse
} = require('./helpers');
-module.exports = {
+module.exports = (env) => {
+ let copyWebpackOptions = [{
+ from: path.join(__dirname, '..', 'node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
+ to: path.join('assets', 'fonts')
+ }, {
+ from: path.join(__dirname, '..', 'resources', 'images'),
+ to: path.join('assets', 'images')
+ }, {
+ from: path.join(__dirname, '..', 'resources', 'i18n'),
+ to: path.join('assets', 'i18n')
+ }
+ ];
+
+ const themeImages = path.join(themePath, 'resources', 'images');
+ if(theme && fs.existsSync(themeImages)) {
+ copyWebpackOptions.push({
+ from: themeImages,
+ to: path.join('assets', 'images') ,
+ force: true,
+ });
+ }
+
+ return {
mode: 'development',
devtool: 'source-map',
- resolve: {
- extensions: ['.ts', '.js', '.json']
- },
- output: {
- path: root('dist')
- },
- watchOptions: {
- aggregateTimeout: 50,
- },
- node: {
- fs: "empty",
- module: "empty"
- },
- module: {
- rules: [{
- test: /\.ts$/,
- loader: '@ngtools/webpack'
+ resolve: {
+ extensions: ['.ts', '.js', '.json']
},
- {
- test: /\.css$/,
- use: [{
- loader: 'to-string-loader',
- options: {
- sourceMap: true
- }
+ output: {
+ path: projectRoot('dist')
+ },
+ watchOptions: {
+ aggregateTimeout: 50,
+ },
+ node: {
+ fs: "empty",
+ module: "empty"
+ },
+ module: {
+ rules: [
+ {
+ test: (filePath) => themedTest(filePath, 'scss'),
+ use: (info) => themedUse(info.resource, 'scss')
},
- {
- loader: 'css-loader',
- options: {
- sourceMap: true,
- modules: true
- }
- },
- {
- loader: 'postcss-loader',
- options: {
- sourceMap: true
- }
- }
- ]
- },
- {
- test: /\.scss$/,
- exclude: [/node_modules/,
- path.resolve(__dirname, '..', 'src/styles/_exposed_variables.scss')
- ],
- use: [{
- loader: 'to-string-loader',
- options: {
- sourceMap: true
- }
- }, {
- loader: 'raw-loader',
- options: {
- sourceMap: true
- }
+ {
+ test: (filePath) => themedTest(filePath, 'html'),
+ use: (info) => themedUse(info.resource, 'html')
},
- {
- loader: 'resolve-url-loader',
- options: {
- sourceMap: true
+ {
+ test: /\.ts$/,
+ loader: '@ngtools/webpack'
+ },
+ {
+ test: /\.css$/,
+ use: [
+ {
+ loader: 'to-string-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'css-loader',
+ options: {
+ sourceMap: true,
+ modules: true
+ }
+ },
+ {
+ loader: 'postcss-loader',
+ options: {
+ sourceMap: true
+ }
}
- },
- {
- loader: 'sass-loader',
- options: {
- sourceMap: true
+ ]
+ },
+ {
+ test: /\.scss$/,
+ exclude: [
+ /node_modules/,
+ buildRoot('styles/_exposed_variables.scss', env),
+ buildRoot('styles/_variables.scss', env)
+ ],
+ use: [
+ {
+ loader: 'raw-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'postcss-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'resolve-url-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'sass-loader',
+ options: {
+ sourceMap: true,
+ includePaths: [projectRoot('./'), path.join(themePath, 'styles')]
+ }
+ },
+ {
+ loader: 'sass-resources-loader',
+ options: {
+ resources: globalCSSImports(env)
+ },
}
- }
- ]
- },
- {
- test: /_exposed_variables.scss$/,
- exclude: /node_modules/,
- use: [{
- loader: "css-loader" // translates CSS into CommonJS
- }, {
- loader: "sass-loader" // compiles Sass to CSS
- }]
- },
- {
- test: /\.html$/,
- loader: 'raw-loader'
- }
+ ]
+ },
+ {
+ test: /(_exposed)?_variables.scss$/,
+ exclude: [/node_modules/],
+ use: [
+ {
+ loader: 'css-loader',
+ options: {
+ sourceMap: true,
+ modules: true
+ }
+ },
+ {
+ loader: 'postcss-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'resolve-url-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'sass-loader',
+ options: {
+ sourceMap: true,
+ includePaths: [projectRoot('./'), path.join(themePath, 'styles')]
+ }
+ }
+ ]
+ },
+ {
+ test: /\.html$/,
+ loader: 'raw-loader'
+ }
+ ]
+ },
+ plugins: [
+ new CopyWebpackPlugin(copyWebpackOptions)
]
- },
- plugins: [
- new CopyWebpackPlugin([{
- from: join(__dirname, '..', 'node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
- to: join('assets', 'fonts')
- }, {
- from: join(__dirname, '..', 'resources', 'images'),
- to: join('assets', 'images')
- }, {
- from: join(__dirname, '..', 'resources', 'i18n'),
- to: join('assets', 'i18n')
- }])
- ]
-
+ }
};
diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js
index 35a683bb96..df0d6274d9 100644
--- a/webpack/webpack.prod.js
+++ b/webpack/webpack.prod.js
@@ -6,70 +6,70 @@ const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const cssnano = require("cssnano");
const {
- root
+ projectRoot
} = require('./helpers');
module.exports = {
- mode: 'production',
- recordsOutputPath: root('webpack.records.json'),
- plugins: [
- new webpack.EnvironmentPlugin({
- 'process.env': {
- 'NODE_ENV': JSON.stringify('production'),
- 'AOT': true
- }
- }),
+ mode: 'production',
+ recordsOutputPath: projectRoot('webpack.records.json'),
+ plugins: [
+ new webpack.EnvironmentPlugin({
+ 'process.env': {
+ 'NODE_ENV': JSON.stringify('production'),
+ 'AOT': true
+ }
+ }),
- new BundleAnalyzerPlugin({
- analyzerMode: 'disabled', // change it to `server` to view bundle stats
- reportFilename: 'report.html',
- generateStatsFile: true,
- statsFilename: 'stats.json',
- }),
+ new BundleAnalyzerPlugin({
+ analyzerMode: 'disabled', // change it to `server` to view bundle stats
+ reportFilename: 'report.html',
+ generateStatsFile: true,
+ statsFilename: 'stats.json',
+ }),
- new CompressionPlugin({
- asset: "[path].gz[query]",
- algorithm: "gzip",
- test: /\.js$|\.css$|\.html$/,
- threshold: 10240,
- minRatio: 0.8
- })
+ new CompressionPlugin({
+ asset: "[path].gz[query]",
+ algorithm: "gzip",
+ test: /\.js$|\.css$|\.html$/,
+ threshold: 10240,
+ minRatio: 0.8
+ })
- ],
- optimization: {
- minimizer: [
- new UglifyJsPlugin({
- uglifyOptions: {
- beautify: false,
- mangle: false,
- output: {
- comments: false
- },
- compress: {
- warnings: false,
- conditionals: false,
- unused: true,
- comparisons: true,
- sequences: true,
- dead_code: true,
- evaluate: true,
- if_return: true,
- join_vars: true,
- negate_iife: true
- },
- sourceMap: true
- }
- }),
- new OptimizeCSSAssetsPlugin({
- cssProcessor: cssnano,
- cssProcessorOptions: {
- discardComments: {
- removeAll: true,
- }
- },
- safe: true
- })
- ]
- },
+ ],
+ optimization: {
+ minimizer: [
+ new UglifyJsPlugin({
+ uglifyOptions: {
+ beautify: false,
+ mangle: false,
+ output: {
+ comments: false
+ },
+ compress: {
+ warnings: false,
+ conditionals: false,
+ unused: true,
+ comparisons: true,
+ sequences: true,
+ dead_code: true,
+ evaluate: true,
+ if_return: true,
+ join_vars: true,
+ negate_iife: true
+ },
+ sourceMap: true
+ }
+ }),
+ new OptimizeCSSAssetsPlugin({
+ cssProcessor: cssnano,
+ cssProcessorOptions: {
+ discardComments: {
+ removeAll: true,
+ }
+ },
+ safe: true
+ })
+ ]
+ },
};
diff --git a/webpack/webpack.server.js b/webpack/webpack.server.js
index ce0c52602a..5e80a286a0 100644
--- a/webpack/webpack.server.js
+++ b/webpack/webpack.server.js
@@ -1,28 +1,30 @@
var nodeExternals = require('webpack-node-externals');
const {
- root
+ buildRoot
} = require('./helpers');
-module.exports = {
- getServerWebpackPartial: function (aot) {
- const entry = aot ? root('./src/main.server.aot.ts') : root('./src/main.server.ts');
- return {
- entry: entry,
- output: {
- filename: 'server.js'
- },
- target: 'node',
- externals: [nodeExternals({
- whitelist: [
- /@angular/,
- /@ng/,
- /angular2-text-mask/,
- /ng2-file-upload/,
- /angular-sortablejs/,
- /sortablejs/,
- /ngx/]
- })],
+module.exports = (env) => {
+ return {
+ getServerWebpackPartial: function (aot) {
+ const entry = aot ? buildRoot('./main.server.aot.ts', env) : buildRoot('./main.server.ts', env);
+ return {
+ entry: entry,
+ output: {
+ filename: 'server.js'
+ },
+ target: 'node',
+ externals: [nodeExternals({
+ whitelist: [
+ /@angular/,
+ /@ng/,
+ /angular2-text-mask/,
+ /ng2-file-upload/,
+ /angular-sortablejs/,
+ /sortablejs/,
+ /ngx/]
+ })],
+ }
}
}
};
diff --git a/webpack/webpack.test.js b/webpack/webpack.test.js
index 8c6760e377..83e6e44e79 100644
--- a/webpack/webpack.test.js
+++ b/webpack/webpack.test.js
@@ -1,6 +1,12 @@
const {
- root
+ projectRoot,
+ buildRoot,
+ themedTest,
+ themedUse,
+ themePath,
+ globalCSSImports
} = require('./helpers');
+const path = require('path');
/**
* Webpack Plugins
@@ -23,250 +29,288 @@ const ENV = process.env.ENV = process.env.NODE_ENV = 'test';
*
* See: http://webpack.github.io/docs/configuration.html#cli
*/
-module.exports = function (options) {
- return {
- mode: 'development',
- /**
- * Source map for Karma from the help of karma-sourcemap-loader & karma-webpack
- *
- * Do not change, leave as is or it wont work.
- * See: https://github.com/webpack/karma-webpack#source-maps
- */
- devtool: 'source-map',
-
- /**
- * Options affecting the resolving of modules.
- *
- * See: http://webpack.github.io/docs/configuration.html#resolve
- */
- resolve: {
-
- /**
- * An array of extensions that should be used to resolve modules.
- *
- * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
- */
- extensions: ['.ts', '.js', '.json'],
-
- /**
- * Make sure root is src
- */
- modules: [root('src'), 'node_modules']
-
- },
-
- /**
- * Options affecting the normal modules.
- *
- * See: http://webpack.github.io/docs/configuration.html#module
- *
- * 'use:' revered back to 'loader:' as a temp. workaround for #1188
- * See: https://github.com/AngularClass/angular2-webpack-starter/issues/1188#issuecomment-262872034
- */
- module: {
-
- rules: [
+module.exports = function (env) {
+ return {
+ mode: 'development',
+ /**
+ * Source map for Karma from the help of karma-sourcemap-loader & karma-webpack
+ *
+ * Do not change, leave as is or it wont work.
+ * See: https://github.com/webpack/karma-webpack#source-maps
+ */
+ devtool: 'source-map',
/**
- * Source map loader support for *.js files
- * Extracts SourceMaps for source files that as added as sourceMappingURL comment.
+ * Options affecting the resolving of modules.
*
- * See: https://github.com/webpack/source-map-loader
+ * See: http://webpack.github.io/docs/configuration.html#resolve
*/
- {
- enforce: 'pre',
- test: /\.js$/,
- loader: 'source-map-loader',
- exclude: [/node_modules/],
+ resolve: {
+
+ /**
+ * An array of extensions that should be used to resolve modules.
+ *
+ * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
+ */
+ extensions: ['.ts', '.js', '.json'],
+
+ /**
+ * Make sure root is src
+ */
+ modules: [projectRoot('src'), 'node_modules']
},
/**
- * Typescript loader support for .ts and Angular 2 async routes via .async.ts
+ * Options affecting the normal modules.
*
- * See: https://github.com/TypeStrong/ts-loader
+ * See: http://webpack.github.io/docs/configuration.html#module
+ *
+ * 'use:' revered back to 'loader:' as a temp. workaround for #1188
+ * See: https://github.com/AngularClass/angular2-webpack-starter/issues/1188#issuecomment-262872034
*/
- {
- test: /\.tsx?$/,
- loaders: [{
- loader: 'ts-loader',
- options: {
- configFile: root('src/tsconfig.test.json'),
- transpileOnly: true
- }
- },
- 'angular2-template-loader'
- ],
- exclude: [/\.e2e\.ts$/]
+ module: {
+
+ rules: [
+
+ /**
+ * Source map loader support for *.js files
+ * Extracts SourceMaps for source files that as added as sourceMappingURL comment.
+ *
+ * See: https://github.com/webpack/source-map-loader
+ */
+ {
+ test: (filePath) => themedTest(filePath, 'scss'),
+ use: (info) => themedUse(info.resource, 'scss')
+ },
+ {
+ test: (filePath) => themedTest(filePath, 'html'),
+ use: (info) => themedUse(info.resource, 'html')
+ },
+ /**
+ * Typescript loader support for .ts and Angular 2 async routes via .async.ts
+ *
+ * See: https://github.com/TypeStrong/ts-loader
+ */
+ {
+ test: /\.tsx?$/,
+ loaders: [{
+ loader: 'ts-loader',
+ options: {
+ configFile: projectRoot('src/tsconfig.test.json'),
+ transpileOnly: true
+ }
+ },
+ 'angular2-template-loader'
+ ],
+ exclude: [/\.e2e\.ts$/]
+ },
+
+ /**
+ * CSS loader support for *.css files
+ * Returns file content as string
+ *
+ * See: https://github.com/webpack/css-loader
+ */
+ {
+ test: /\.css$/,
+ use: [{
+ loader: 'to-string-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'css-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'postcss-loader',
+ options: {
+ sourceMap: true
+ }
+ }
+ ],
+ },
+
+ /**
+ * SASS loader support for *.css files
+ * Returns file content as string
+ *
+ */
+ {
+ test: /\.scss$/,
+ exclude: [
+ /node_modules/,
+ buildRoot('styles/_exposed_variables.scss', env),
+ buildRoot('styles/_variables.scss', env)
+ ],
+ use: [
+ {
+ loader: 'raw-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'postcss-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'resolve-url-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'sass-loader',
+ options: {
+ sourceMap: true,
+ includePaths: [projectRoot('./'), path.join(themePath, 'styles')]
+ }
+ },
+ {
+ loader: 'sass-resources-loader',
+ options: {
+ resources: globalCSSImports(env)
+ },
+ }
+ ]
+ },
+ {
+ test: /(_exposed)?_variables.scss$/,
+ exclude: [/node_modules/],
+ use: [
+ {
+ loader: 'css-loader',
+ options: {
+ sourceMap: true,
+ modules: true
+ }
+ },
+ {
+ loader: 'postcss-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'resolve-url-loader',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'sass-loader',
+ options: {
+ sourceMap: true,
+ includePaths: [projectRoot('./'), path.join(themePath, 'styles')]
+ }
+ }
+ ]
+ },
+
+ /**
+ * Raw loader support for *.html
+ * Returns file content as string
+ *
+ * See: https://github.com/webpack/raw-loader
+ */
+ {
+ test: /\.html$/,
+ loader: 'raw-loader',
+ exclude: [projectRoot('src/index.html')]
+ },
+
+ /**
+ * Instruments JS files with Istanbul for subsequent code coverage reporting.
+ * Instrument only testing sources.
+ *
+ * See: https://github.com/deepsweet/istanbul-instrumenter-loader
+ */
+ {
+ enforce: 'post',
+ test: /\.(js|ts)$/,
+ loader: 'istanbul-instrumenter-loader',
+ query: {
+ esModules: true
+ },
+ include: projectRoot('src'),
+ exclude: [
+ /\.(e2e|spec)\.ts$/,
+ /node_modules/
+ ]
+ }
+
+ ]
},
/**
- * CSS loader support for *.css files
- * Returns file content as string
+ * Add additional plugins to the compiler.
*
- * See: https://github.com/webpack/css-loader
+ * See: http://webpack.github.io/docs/configuration.html#plugins
*/
- {
- test: /\.css$/,
- use: [{
- loader: 'to-string-loader',
- options: {
- sourceMap: true
- }
- },
- {
- loader: 'css-loader',
- options: {
- sourceMap: true
- }
- },
- {
- loader: 'postcss-loader',
- options: {
- sourceMap: true
- }
- }
- ],
- exclude: [root('src/index.html')]
+ plugins: [
+
+ new ContextReplacementPlugin(
+ /angular(\\|\/)core(\\|\/)@angular/,
+ projectRoot('./src'), {}
+ ),
+ // Workaround for https://github.com/angular/angular/issues/20357
+ new ContextReplacementPlugin(
+ /\@angular(\\|\/)core(\\|\/)esm5/,
+ projectRoot('./src'), {}
+ ),
+
+ /**
+ * Plugin: DefinePlugin
+ * Description: Define free variables.
+ * Useful for having development builds with debug logging or adding global constants.
+ *
+ * Environment helpers
+ *
+ * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
+ */
+ // NOTE: when adding more properties make sure you include them in custom-typings.d.ts
+ new DefinePlugin({
+ 'ENV': JSON.stringify(ENV),
+ 'HMR': false,
+ 'process.env': {
+ 'ENV': JSON.stringify(ENV),
+ 'NODE_ENV': JSON.stringify(ENV),
+ 'HMR': false,
+ }
+ }),
+ new ForkTsCheckerWebpackPlugin()
+ ],
+
+ /**
+ * Disable performance hints
+ *
+ * See: https://github.com/a-tarasyuk/rr-boilerplate/blob/master/webpack/dev.config.babel.js#L41
+ */
+ performance: {
+ hints: false
},
/**
- * SASS loader support for *.css files
- * Returns file content as string
+ * Include polyfills or mocks for various node stuff
+ * Description: Node configuration
*
+ * See: https://webpack.github.io/docs/configuration.html#node
*/
- {
- test: /\.scss$/,
- use: [{
- loader: 'to-string-loader',
- options: {
- sourceMap: true
- }
- }, {
- loader: 'raw-loader',
- options: {
- sourceMap: true
- }
- },
- {
- loader: 'postcss-loader',
- options: {
- sourceMap: true
- }
- },
- {
- loader: 'resolve-url-loader',
- options: {
- sourceMap: true
- }
- },
- {
- loader: 'sass-loader',
- options: {
- sourceMap: true
- }
- }
- ],
- exclude: [root('src/index.html')]
- },
-
- /**
- * Raw loader support for *.html
- * Returns file content as string
- *
- * See: https://github.com/webpack/raw-loader
- */
- {
- test: /\.html$/,
- loader: 'raw-loader',
- exclude: [root('src/index.html')]
- },
-
- /**
- * Instruments JS files with Istanbul for subsequent code coverage reporting.
- * Instrument only testing sources.
- *
- * See: https://github.com/deepsweet/istanbul-instrumenter-loader
- */
- {
- enforce: 'post',
- test: /\.(js|ts)$/,
- loader: 'istanbul-instrumenter-loader',
- query: {
- esModules: true
- },
- include: root('src'),
- exclude: [
- /\.(e2e|spec)\.ts$/,
- /node_modules/
- ]
+ node: {
+ global: true,
+ process: false,
+ crypto: 'empty',
+ module: false,
+ clearImmediate: false,
+ setImmediate: false
}
- ]
- },
-
- /**
- * Add additional plugins to the compiler.
- *
- * See: http://webpack.github.io/docs/configuration.html#plugins
- */
- plugins: [
-
- new ContextReplacementPlugin(
- /angular(\\|\/)core(\\|\/)@angular/,
- root('./src'), {}
- ),
- // Workaround for https://github.com/angular/angular/issues/20357
- new ContextReplacementPlugin(
- /\@angular(\\|\/)core(\\|\/)esm5/,
- root('./src'), {}
- ),
-
- /**
- * Plugin: DefinePlugin
- * Description: Define free variables.
- * Useful for having development builds with debug logging or adding global constants.
- *
- * Environment helpers
- *
- * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
- */
- // NOTE: when adding more properties make sure you include them in custom-typings.d.ts
- new DefinePlugin({
- 'ENV': JSON.stringify(ENV),
- 'HMR': false,
- 'process.env': {
- 'ENV': JSON.stringify(ENV),
- 'NODE_ENV': JSON.stringify(ENV),
- 'HMR': false,
- }
- }),
- new ForkTsCheckerWebpackPlugin()
- ],
-
- /**
- * Disable performance hints
- *
- * See: https://github.com/a-tarasyuk/rr-boilerplate/blob/master/webpack/dev.config.babel.js#L41
- */
- performance: {
- hints: false
- },
-
- /**
- * Include polyfills or mocks for various node stuff
- * Description: Node configuration
- *
- * See: https://webpack.github.io/docs/configuration.html#node
- */
- node: {
- global: true,
- process: false,
- crypto: 'empty',
- module: false,
- clearImmediate: false,
- setImmediate: false
- }
-
- };
+ };
};
diff --git a/yarn.lock b/yarn.lock
index 9a4f96e805..cc8244dd35 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -411,11 +411,6 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.4.tgz#0f4cb2dc7c1de6096055357f70179043c33e9897"
integrity sha512-fCHV45gS+m3hH17zgkgADUSi2RR1Vht6wOZ0jyHP8rjiQra9f+mIcgwPQHllmDocYOstIEbKlxbFDYlgrTPYqw==
-"@types/node@^6.0.46":
- version "6.0.116"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.116.tgz#2f9cd62b4ecc4927e3942e2655c182eecf5b45f1"
- integrity sha512-vToa8YEeulfyYg1gSOeHjvvIRqrokng62VMSj2hoZrwZNcYrp2h3AWo6KeBVuymIklQUaY5zgVJvVsC4KiiLkQ==
-
"@types/q@^0.0.32":
version "0.0.32"
resolved "https://registry.yarnpkg.com/@types/q/-/q-0.0.32.tgz#bd284e57c84f1325da702babfc82a5328190c0c5"
@@ -755,15 +750,6 @@ ajv@~6.4.0:
json-schema-traverse "^0.3.0"
uri-js "^3.0.2"
-align-text@^0.1.1, align-text@^0.1.3:
- version "0.1.4"
- resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117"
- integrity sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=
- dependencies:
- kind-of "^3.0.2"
- longest "^1.0.1"
- repeat-string "^1.5.2"
-
alphanum-sort@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3"
@@ -1107,7 +1093,7 @@ async-limiter@~1.0.0:
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==
-async@1.x, async@^1.4.0, async@^1.5.2:
+async@1.x, async@^1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=
@@ -1126,6 +1112,12 @@ async@^2.0.0, async@^2.5.0:
dependencies:
lodash "^4.17.10"
+async@^2.1.4:
+ version "2.6.2"
+ resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381"
+ dependencies:
+ lodash "^4.17.11"
+
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
@@ -1352,6 +1344,10 @@ big.js@^3.1.3:
resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e"
integrity sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==
+big.js@^5.2.2:
+ version "5.2.2"
+ resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
+
binary-extensions@^1.0.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205"
@@ -1797,7 +1793,7 @@ camelcase-keys@^2.0.0:
camelcase "^2.0.0"
map-obj "^1.0.0"
-camelcase@^1.0.2, camelcase@^1.2.1:
+camelcase@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
integrity sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=
@@ -1857,14 +1853,6 @@ caseless@~0.12.0:
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
-center-align@^0.1.1:
- version "0.1.3"
- resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad"
- integrity sha1-qg0yYptu6XIgBBHL1EYckHvCt60=
- dependencies:
- align-text "^0.1.3"
- lazy-cache "^1.0.3"
-
cerialize@0.1.18:
version "0.1.18"
resolved "https://registry.yarnpkg.com/cerialize/-/cerialize-0.1.18.tgz#d0f4f1b61cec7e4ed16a3eda0cac2bc99787414d"
@@ -2017,15 +2005,6 @@ cli-width@^2.0.0:
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"
integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=
-cliui@^2.1.0:
- version "2.1.0"
- resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"
- integrity sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=
- dependencies:
- center-align "^0.1.1"
- right-align "^0.1.1"
- wordwrap "0.0.2"
-
cliui@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
@@ -2202,7 +2181,7 @@ commander@2.17.x, commander@~2.17.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
-commander@^2.12.1, commander@^2.18.0:
+commander@^2.12.1, commander@^2.18.0, commander@~2.20.0:
version "2.20.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
@@ -2426,6 +2405,18 @@ copy-webpack-plugin@^4.4.1:
p-limit "^1.0.0"
serialize-javascript "^1.4.0"
+copyfiles@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.1.0.tgz#0e2a4188162d6b2f3c5adfe34e9c0bd564d23164"
+ integrity sha512-cAeDE0vL/koE9WSEGxqPpSyvU638Kgfu6wfrnj7kqp9FWa1CWsU54Coo6sdYZP4GstWa39tL/wIVJWfXcujgNA==
+ dependencies:
+ glob "^7.0.5"
+ minimatch "^3.0.3"
+ mkdirp "^0.5.1"
+ noms "0.0.0"
+ through2 "^2.0.1"
+ yargs "^11.0.0"
+
core-js@^2.2.0, core-js@^2.4.0, core-js@^2.5.7:
version "2.5.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e"
@@ -2860,6 +2851,12 @@ dateformat@^1.0.11, dateformat@^1.0.6:
get-stdin "^4.0.1"
meow "^3.3.0"
+debug-loader@^0.0.1:
+ version "0.0.1"
+ resolved "https://registry.yarnpkg.com/debug-loader/-/debug-loader-0.0.1.tgz#44dc37e09e3c39e6af334681960f70a534a9d056"
+ dependencies:
+ loader-utils "^0.2.12"
+
debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@@ -2874,7 +2871,7 @@ debug@^3.1.0, debug@~3.1.0:
dependencies:
ms "2.0.0"
-decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
+decamelize@^1.1.1, decamelize@^1.1.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
@@ -3198,9 +3195,9 @@ ecc-jsbn@~0.1.1:
safer-buffer "^2.1.0"
ecstatic@^3.0.0:
- version "3.2.2"
- resolved "https://registry.yarnpkg.com/ecstatic/-/ecstatic-3.2.2.tgz#4cc37c80ea88c021ca7cde66a15606ceaa9348e7"
- integrity sha512-khJlPch7aw/Gx+cKabpt0l2kVychBpGuwVKVMb8rhui00kHWwETDN000Z2CxJl1XaZI4xEkoPD/uezmP28c0/Q==
+ version "3.3.2"
+ resolved "https://registry.yarnpkg.com/ecstatic/-/ecstatic-3.3.2.tgz#6d1dd49814d00594682c652adb66076a69d46c48"
+ integrity sha512-fLf9l1hnwrHI2xn9mEDT7KIi22UDqA2jaCwyCbSUJh9a1V+LEUSL/JO/6TIz/QyuBURWUHrFL5Kg2TtO1bkkog==
dependencies:
he "^1.1.1"
mime "^1.6.0"
@@ -3420,6 +3417,11 @@ es6-promisify@^5.0.0:
dependencies:
es6-promise "^4.0.3"
+es6-promisify@^6.0.0:
+ version "6.0.1"
+ resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-6.0.1.tgz#6edaa45f3bd570ffe08febce66f7116be4b1cdb6"
+ integrity sha512-J3ZkwbEnnO+fGAKrjVpeUAnZshAdfZvbhQpqfIH9kSAspReRC4nJnu8ewm55b4y9ElyeuhCTzJD0XiH8Tsbhlw==
+
es6-symbol@^3.1.1, es6-symbol@~3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"
@@ -4429,15 +4431,15 @@ handle-thing@^1.2.5:
integrity sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=
handlebars@^4.0.1, handlebars@^4.0.6:
- version "4.0.11"
- resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc"
- integrity sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=
+ version "4.1.2"
+ resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67"
+ integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==
dependencies:
- async "^1.4.0"
+ neo-async "^2.6.0"
optimist "^0.6.1"
- source-map "^0.4.4"
+ source-map "^0.6.1"
optionalDependencies:
- uglify-js "^2.6"
+ uglify-js "^3.1.4"
har-schema@^2.0.0:
version "2.0.0"
@@ -4578,11 +4580,16 @@ hawk@~6.0.2:
hoek "4.x.x"
sntp "2.x.x"
-he@1.1.x, he@^1.1.1:
+he@1.1.x:
version "1.1.1"
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0=
+he@^1.1.1:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
+ integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
+
hex-color-regex@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
@@ -5546,18 +5553,10 @@ js-tokens@^3.0.2:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls=
-js-yaml@3.x, js-yaml@^3.6.1, js-yaml@^3.7.0, js-yaml@^3.9.0:
- version "3.12.0"
- resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
- integrity sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==
- dependencies:
- argparse "^1.0.7"
- esprima "^4.0.0"
-
-js-yaml@^3.12.0:
- version "3.12.2"
- resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.2.tgz#ef1d067c5a9d9cb65bd72f285b5d8105c77f14fc"
- integrity sha512-QHn/Lh/7HhZ/Twc7vJYQTkjuCa0kaCcDcjK5Zlk2rvnUpy7DxMJ23+Jc2dcyvltwQVg1nygAVlB2oRDFHoRS5Q==
+js-yaml@3.x, js-yaml@^3.12.0, js-yaml@^3.6.1, js-yaml@^3.7.0, js-yaml@^3.9.0:
+ version "3.13.1"
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
+ integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"
@@ -5617,6 +5616,12 @@ json5@^0.5.0:
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=
+json5@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
+ dependencies:
+ minimist "^1.2.0"
+
jsonfile@^2.1.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8"
@@ -5857,11 +5862,6 @@ latest-version@^3.0.0:
dependencies:
package-json "^4.0.0"
-lazy-cache@^1.0.3:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
- integrity sha1-odePw6UEdMuAhF07O24dpJpEbo4=
-
lazystream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4"
@@ -5922,7 +5922,7 @@ loader-runner@^2.3.0:
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2"
integrity sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=
-loader-utils@^0.2.15, loader-utils@^0.2.16:
+loader-utils@^0.2.12, loader-utils@^0.2.15, loader-utils@^0.2.16:
version "0.2.17"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348"
integrity sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=
@@ -5941,6 +5941,14 @@ loader-utils@^1.0.0, loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1
emojis-list "^2.0.0"
json5 "^0.5.0"
+loader-utils@^1.0.4:
+ version "1.2.3"
+ resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7"
+ dependencies:
+ big.js "^5.2.2"
+ emojis-list "^2.0.0"
+ json5 "^1.0.1"
+
locate-path@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
@@ -6118,9 +6126,9 @@ lodash.memoize@^4.1.2:
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=
lodash.mergewith@^4.6.0:
- version "4.6.1"
- resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927"
- integrity sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==
+ version "4.6.2"
+ resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55"
+ integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==
lodash.restparam@^3.0.0:
version "3.6.1"
@@ -6185,6 +6193,10 @@ lodash@4.17.10, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.13.1, lodash@^4.17.0, lo
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
integrity sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==
+lodash@^4.17.11:
+ version "4.17.11"
+ resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
+
log-driver@^1.2.5:
version "1.2.7"
resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8"
@@ -6231,11 +6243,6 @@ long@^3.2.0:
resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b"
integrity sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=
-longest@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
- integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=
-
loose-envify@^1.0.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
@@ -6691,6 +6698,11 @@ nanomatch@^1.2.9:
snapdragon "^0.8.1"
to-regex "^3.0.1"
+ncp@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3"
+ integrity sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=
+
needle@^2.2.1:
version "2.2.2"
resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.2.tgz#1120ca4c41f2fcc6976fd28a8968afe239929418"
@@ -6710,10 +6722,10 @@ negotiator@0.6.2:
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==
-neo-async@^2.5.0:
- version "2.5.2"
- resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.2.tgz#489105ce7bc54e709d736b195f82135048c50fcc"
- integrity sha512-vdqTKI9GBIYcAEbFAcpKPErKINfPF5zIuz3/niBfq8WUZjpT2tytLlFVrBgWdOtqI4uaA/Rb6No0hux39XXDuw==
+neo-async@^2.5.0, neo-async@^2.6.0:
+ version "2.6.1"
+ resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
+ integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==
next-tick@1:
version "1.0.0"
@@ -6909,6 +6921,14 @@ nodemon@^1.15.0:
undefsafe "^2.0.2"
update-notifier "^2.3.0"
+noms@0.0.0:
+ version "0.0.0"
+ resolved "https://registry.yarnpkg.com/noms/-/noms-0.0.0.tgz#da8ebd9f3af9d6760919b27d9cdc8092a7332859"
+ integrity sha1-2o69nzr51nYJGbJ9nNyAkqczKFk=
+ dependencies:
+ inherits "^2.0.1"
+ readable-stream "~1.0.31"
+
"nopt@2 || 3", nopt@3.x:
version "3.0.6"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
@@ -7537,15 +7557,15 @@ pbkdf2@^3.0.3:
safe-buffer "^5.0.1"
sha.js "^2.4.8"
-pem@1.12.3:
- version "1.12.3"
- resolved "https://registry.yarnpkg.com/pem/-/pem-1.12.3.tgz#b1fb5c8b79da8d18146c27fee79b0d4ddf9905b3"
- integrity sha512-hT7GwvQL35+0iqgYUl8vn5I5pAVR0HcJas07TXL8bNaR4c5kAFRquk4ZqQk1F9YMcQOr6WjGdY5OnDC0RBnzig==
+pem@1.13.2:
+ version "1.13.2"
+ resolved "https://registry.yarnpkg.com/pem/-/pem-1.13.2.tgz#7b68acbb590fdc13772bca487983cb84cd7b443e"
+ integrity sha512-MPJWuEb/r6AG+GpZi2JnfNtGAZDeL/8+ERKwXEWRuST5i+4lq/Uy36B352OWIUSPQGH+HR1HEDcIDi+8cKxXNg==
dependencies:
+ es6-promisify "^6.0.0"
md5 "^2.2.1"
os-tmpdir "^1.0.1"
- safe-buffer "^5.1.1"
- which "^1.2.4"
+ which "^1.3.1"
pend@~1.2.0:
version "1.2.0"
@@ -8426,12 +8446,11 @@ protractor-istanbul-plugin@2.0.0:
q "^1.4.1"
uuid "^2.0.1"
-protractor@^5.3.0:
- version "5.4.0"
- resolved "https://registry.yarnpkg.com/protractor/-/protractor-5.4.0.tgz#e71c9c1f5cf6c5e9bdbcdb71e7f31b17ffd2878f"
- integrity sha512-6TSYqMhUUzxr4/wN0ttSISqPMKvcVRXF4k8jOEpGWD8OioLak4KLgfzHK9FJ49IrjzRrZ+Mx1q2Op8Rk0zEcnQ==
+protractor@^5.4.2:
+ version "5.4.2"
+ resolved "https://registry.yarnpkg.com/protractor/-/protractor-5.4.2.tgz#329efe37f48b2141ab9467799be2d4d12eb48c13"
+ integrity sha512-zlIj64Cr6IOWP7RwxVeD8O4UskLYPoyIcg0HboWJL9T79F1F0VWtKkGTr/9GN6BKL+/Q/GmM7C9kFVCfDbP5sA==
dependencies:
- "@types/node" "^6.0.46"
"@types/q" "^0.0.32"
"@types/selenium-webdriver" "^3.0.0"
blocking-proxy "^1.0.0"
@@ -8445,7 +8464,7 @@ protractor@^5.3.0:
saucelabs "^1.5.0"
selenium-webdriver "3.6.0"
source-map-support "~0.4.0"
- webdriver-js-extender "2.0.0"
+ webdriver-js-extender "2.1.0"
webdriver-manager "^12.0.6"
proxy-addr@~2.0.2:
@@ -8703,7 +8722,7 @@ read-pkg@^3.0.0:
normalize-package-data "^2.3.2"
path-type "^3.0.0"
-"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6:
+"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6:
version "2.3.6"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==
@@ -8716,7 +8735,7 @@ read-pkg@^3.0.0:
string_decoder "~1.1.1"
util-deprecate "~1.0.1"
-readable-stream@1.0:
+readable-stream@1.0, readable-stream@~1.0.31:
version "1.0.34"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=
@@ -9126,13 +9145,6 @@ rgba-regex@^1.0.0:
resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3"
integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=
-right-align@^0.1.1:
- version "0.1.3"
- resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef"
- integrity sha1-YTObci/mo1FWiSENJOFMlhSGE+8=
- dependencies:
- align-text "^0.1.1"
-
rimraf@2, rimraf@2.6.2, rimraf@^2.2.8, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.0, rimraf@^2.6.1, rimraf@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36"
@@ -9285,6 +9297,15 @@ sass-loader@7.1.0:
pify "^3.0.0"
semver "^5.5.0"
+sass-resources-loader@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/sass-resources-loader/-/sass-resources-loader-2.0.0.tgz#88569c542fbf1f18f33a6578b77cc5b36c56911d"
+ dependencies:
+ async "^2.1.4"
+ chalk "^1.1.3"
+ glob "^7.1.1"
+ loader-utils "^1.0.4"
+
saucelabs@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/saucelabs/-/saucelabs-1.5.0.tgz#9405a73c360d449b232839919a86c396d379fd9d"
@@ -9764,14 +9785,14 @@ source-map@^0.1.38:
dependencies:
amdefine ">=0.0.4"
-source-map@^0.4.2, source-map@^0.4.4:
+source-map@^0.4.2:
version "0.4.4"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
integrity sha1-66T12pwNyZneaAMti092FzZSA2s=
dependencies:
amdefine ">=0.0.4"
-source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1:
+source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
@@ -9983,7 +10004,7 @@ streamroller@0.7.0:
mkdirp "^0.5.1"
readable-stream "^2.3.0"
-string-replace-loader@2.1.1:
+string-replace-loader@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/string-replace-loader/-/string-replace-loader-2.1.1.tgz#b72e7b57b6ef04efe615aff0ad989b5c14ca63d1"
integrity sha512-0Nvw1LDclF45AFNuYPcD2Jvkv0mwb/dQSnJZMvhqGrT+zzmrpG3OJFD600qfQfNUd5aqfp7fCm2mQMfF7zLbyQ==
@@ -10231,6 +10252,14 @@ through2@^2.0.0:
readable-stream "^2.1.5"
xtend "~4.0.1"
+through2@^2.0.1:
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
+ integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==
+ dependencies:
+ readable-stream "~2.3.6"
+ xtend "~4.0.1"
+
through@2, through@X.X.X, through@^2.3.6, through@~2.3, through@~2.3.1:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
@@ -10570,20 +10599,13 @@ uglify-js@3.4.x:
commander "~2.17.1"
source-map "~0.6.1"
-uglify-js@^2.6:
- version "2.8.29"
- resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd"
- integrity sha1-KcVzMUgFe7Th913zW3qcty5qWd0=
+uglify-js@^3.1.4:
+ version "3.6.0"
+ resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5"
+ integrity sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==
dependencies:
- source-map "~0.5.1"
- yargs "~3.10.0"
- optionalDependencies:
- uglify-to-browserify "~1.0.0"
-
-uglify-to-browserify@~1.0.0:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
- integrity sha1-bgkk1r2mta/jSeOabWMoUKD4grc=
+ commander "~2.20.0"
+ source-map "~0.6.1"
uglifyjs-webpack-plugin@^1.2.4:
version "1.3.0"
@@ -10956,10 +10978,10 @@ wd@^1.0.0:
request "2.85.0"
vargs "0.1.0"
-webdriver-js-extender@2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/webdriver-js-extender/-/webdriver-js-extender-2.0.0.tgz#b27fc1ed1afbf78f0ac57e4c878f31b10e57f146"
- integrity sha512-fbyKiVu3azzIc5d4+26YfuPQcFTlgFQV5yQ/0OQj4Ybkl4g1YQuIPskf5v5wqwRJhHJnPHthB6tqCjWHOKLWag==
+webdriver-js-extender@2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/webdriver-js-extender/-/webdriver-js-extender-2.1.0.tgz#57d7a93c00db4cc8d556e4d3db4b5db0a80c3bb7"
+ integrity sha512-lcUKrjbBfCK6MNsh7xaY2UAUmZwe+/ib03AjVOpFobX4O7+83BUveSrLfU0Qsyb1DaKJdQRbuU+kM9aZ6QUhiQ==
dependencies:
"@types/selenium-webdriver" "^3.0.0"
selenium-webdriver "^3.0.1"
@@ -10981,6 +11003,23 @@ webdriver-manager@^12.0.6:
semver "^5.3.0"
xml2js "^0.4.17"
+webdriver-manager@^12.1.6:
+ version "12.1.6"
+ resolved "https://registry.yarnpkg.com/webdriver-manager/-/webdriver-manager-12.1.6.tgz#9e5410c506d1a7e0a7aa6af91ba3d5bb37f362b6"
+ integrity sha512-B1mOycNCrbk7xODw7Jgq/mdD3qzPxMaTsnKIQDy2nXlQoyjTrJTTD0vRpEZI9b8RibPEyQvh9zIZ0M1mpOxS3w==
+ dependencies:
+ adm-zip "^0.4.9"
+ chalk "^1.1.1"
+ del "^2.2.0"
+ glob "^7.0.3"
+ ini "^1.3.4"
+ minimist "^1.2.0"
+ q "^1.4.1"
+ request "^2.87.0"
+ rimraf "^2.5.2"
+ semver "^5.3.0"
+ xml2js "^0.4.17"
+
webfontloader@1.6.28:
version "1.6.28"
resolved "https://registry.yarnpkg.com/webfontloader/-/webfontloader-1.6.28.tgz#db786129253cb6e8eae54c2fb05f870af6675bae"
@@ -11082,6 +11121,12 @@ webpack-dev-server@^3.1.5:
webpack-log "^2.0.0"
yargs "12.0.1"
+webpack-import-glob-loader@^1.6.3:
+ version "1.6.3"
+ resolved "https://registry.yarnpkg.com/webpack-import-glob-loader/-/webpack-import-glob-loader-1.6.3.tgz#1b1de573f49c2c2afdb814dc13b44b2111b2ea7b"
+ dependencies:
+ glob "^5.0.15"
+
webpack-log@^1.0.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/webpack-log/-/webpack-log-1.2.0.tgz#a4b34cda6b22b518dbb0ab32e567962d5c72a43d"
@@ -11174,7 +11219,7 @@ which-module@^2.0.0:
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
-which@1, which@^1.1.1, which@^1.2.1, which@^1.2.10, which@^1.2.4, which@^1.2.9:
+which@1, which@^1.1.1, which@^1.2.1, which@^1.2.10, which@^1.2.9, which@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
@@ -11195,16 +11240,6 @@ widest-line@^2.0.0:
dependencies:
string-width "^2.1.1"
-window-size@0.1.0:
- version "0.1.0"
- resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
- integrity sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=
-
-wordwrap@0.0.2:
- version "0.0.2"
- resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
- integrity sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=
-
wordwrap@^1.0.0, wordwrap@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
@@ -11332,6 +11367,13 @@ yargs-parser@^5.0.0:
dependencies:
camelcase "^3.0.0"
+yargs-parser@^9.0.2:
+ version "9.0.2"
+ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077"
+ integrity sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=
+ dependencies:
+ camelcase "^4.1.0"
+
yargs@12.0.1, yargs@^12.0.1:
version "12.0.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.1.tgz#6432e56123bb4e7c3562115401e98374060261c2"
@@ -11350,6 +11392,24 @@ yargs@12.0.1, yargs@^12.0.1:
y18n "^3.2.1 || ^4.0.0"
yargs-parser "^10.1.0"
+yargs@^11.0.0:
+ version "11.1.0"
+ resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.0.tgz#90b869934ed6e871115ea2ff58b03f4724ed2d77"
+ integrity sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==
+ dependencies:
+ cliui "^4.0.0"
+ decamelize "^1.1.1"
+ find-up "^2.1.0"
+ get-caller-file "^1.0.1"
+ os-locale "^2.0.0"
+ require-directory "^2.1.1"
+ require-main-filename "^1.0.1"
+ set-blocking "^2.0.0"
+ string-width "^2.0.0"
+ which-module "^2.0.0"
+ y18n "^3.2.1"
+ yargs-parser "^9.0.2"
+
yargs@^7.0.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8"
@@ -11369,16 +11429,6 @@ yargs@^7.0.0:
y18n "^3.2.1"
yargs-parser "^5.0.0"
-yargs@~3.10.0:
- version "3.10.0"
- resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"
- integrity sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=
- dependencies:
- camelcase "^1.0.2"
- cliui "^2.1.0"
- decamelize "^1.0.0"
- window-size "0.1.0"
-
yauzl@2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.4.1.tgz#9528f442dab1b2284e58b4379bb194e22e0c4005"