diff --git a/src/app/core/shared/collection.model.ts b/src/app/core/shared/collection.model.ts
index d1c49c8d4b..c97c61eceb 100644
--- a/src/app/core/shared/collection.model.ts
+++ b/src/app/core/shared/collection.model.ts
@@ -1,4 +1,4 @@
-import { deserialize, inheritSerialization } from 'cerialize';
+import {autoserialize, deserialize, inheritSerialization} from 'cerialize';
import { Observable } from 'rxjs';
import { link, typedObject } from '../cache/builders/build-decorators';
import { PaginatedList } from '../data/paginated-list.model';
@@ -16,12 +16,17 @@ import { COMMUNITY } from './community.resource-type';
import { Community } from './community.model';
import { ChildHALResource } from './child-hal-resource.model';
import { HandleObject } from './handle-object.model';
+import { excludeFromEquals } from '../utilities/equals.decorators';
@typedObject
@inheritSerialization(DSpaceObject)
export class Collection extends DSpaceObject implements ChildHALResource, HandleObject {
static type = COLLECTION;
+ @excludeFromEquals
+ @autoserialize
+ archivedItemsCount: number;
+
/**
* The {@link HALLink}s for this Collection
*/
diff --git a/src/app/core/shared/community.model.ts b/src/app/core/shared/community.model.ts
index f16aad9645..03b47fb024 100644
--- a/src/app/core/shared/community.model.ts
+++ b/src/app/core/shared/community.model.ts
@@ -1,4 +1,4 @@
-import { deserialize, inheritSerialization } from 'cerialize';
+import {autoserialize, deserialize, inheritSerialization} from 'cerialize';
import { Observable } from 'rxjs';
import { link, typedObject } from '../cache/builders/build-decorators';
import { PaginatedList } from '../data/paginated-list.model';
@@ -12,12 +12,17 @@ import { DSpaceObject } from './dspace-object.model';
import { HALLink } from './hal-link.model';
import { ChildHALResource } from './child-hal-resource.model';
import { HandleObject } from './handle-object.model';
+import {excludeFromEquals} from '../utilities/equals.decorators';
@typedObject
@inheritSerialization(DSpaceObject)
export class Community extends DSpaceObject implements ChildHALResource, HandleObject {
static type = COMMUNITY;
+ @excludeFromEquals
+ @autoserialize
+ archivedItemsCount: number;
+
/**
* The {@link HALLink}s for this Community
*/
diff --git a/src/app/shared/object-list/collection-list-element/collection-list-element.component.html b/src/app/shared/object-list/collection-list-element/collection-list-element.component.html
index 6c2cff5215..83d88b6a63 100644
--- a/src/app/shared/object-list/collection-list-element/collection-list-element.component.html
+++ b/src/app/shared/object-list/collection-list-element/collection-list-element.component.html
@@ -4,6 +4,7 @@
{{ dsoNameService.getName(object) }}
+= 0" class="lead archived-items-lead">[{{object.archivedItemsCount}}]
{{object.shortDescription}}
diff --git a/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts b/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts
index 04715983c9..97f9eb88c2 100644
--- a/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts
+++ b/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts
@@ -9,6 +9,29 @@ import { DSONameServiceMock } from '../../mocks/dso-name.service.mock';
let collectionListElementComponent: CollectionListElementComponent;
let fixture: ComponentFixture;
+const mockCollectionWithArchivedItems: Collection = Object.assign(new Collection(), {
+ metadata: {
+ 'dc.title': [
+ {
+ language: 'en_US',
+ value: 'Test title'
+ }
+ ]
+ }, archivedItemsCount: 1
+});
+
+const mockCollectionWithArchivedItemsDisabledAtBackend: Collection = Object.assign(new Collection(), {
+ metadata: {
+ 'dc.title': [
+ {
+ language: 'en_US',
+ value: 'Test title'
+ }
+ ]
+ }, archivedItemsCount: -1
+});
+
+
const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
metadata: {
'dc.description.abstract': [
@@ -17,7 +40,7 @@ const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
value: 'Short description'
}
]
- }
+ }, archivedItemsCount: 1
});
const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection(), {
@@ -28,7 +51,7 @@ const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection()
value: 'Test title'
}
]
- }
+ }, archivedItemsCount: 1
});
describe('CollectionListElementComponent', () => {
@@ -74,4 +97,29 @@ describe('CollectionListElementComponent', () => {
expect(collectionAbstractField).toBeNull();
});
});
+
+
+ describe('When the collection has archived items', () => {
+ beforeEach(() => {
+ collectionListElementComponent.object = mockCollectionWithArchivedItems;
+ fixture.detectChanges();
+ });
+
+ it('should show the archived items paragraph', () => {
+ const field = fixture.debugElement.query(By.css('span.archived-items-lead'));
+ expect(field).not.toBeNull();
+ });
+ });
+
+ describe('When the collection archived items are disabled at backend', () => {
+ beforeEach(() => {
+ collectionListElementComponent.object = mockCollectionWithArchivedItemsDisabledAtBackend;
+ fixture.detectChanges();
+ });
+
+ it('should not show the archived items paragraph', () => {
+ const field = fixture.debugElement.query(By.css('span.archived-items-lead'));
+ expect(field).toBeNull();
+ });
+ });
});
diff --git a/src/app/shared/object-list/community-list-element/community-list-element.component.html b/src/app/shared/object-list/community-list-element/community-list-element.component.html
index 462db7be91..8ade44a4df 100644
--- a/src/app/shared/object-list/community-list-element/community-list-element.component.html
+++ b/src/app/shared/object-list/community-list-element/community-list-element.component.html
@@ -4,6 +4,7 @@
{{ dsoNameService.getName(object) }}
+= 0" class="lead archived-items-lead">[{{object.archivedItemsCount}}]
{{object.shortDescription}}