diff --git a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html index e25c3c204f..03040ce8e0 100644 --- a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html +++ b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html @@ -1,6 +1,6 @@
- +
diff --git a/src/app/+item-page/simple/item-page.component.html b/src/app/+item-page/simple/item-page.component.html index b6de496dc4..501e3e161e 100644 --- a/src/app/+item-page/simple/item-page.component.html +++ b/src/app/+item-page/simple/item-page.component.html @@ -1,7 +1,7 @@
- +
diff --git a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.html b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.html index 48eabf8451..0bc7d51244 100644 --- a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.html +++ b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.html @@ -1,5 +1,5 @@ - - + diff --git a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts index f02625e8c7..dcdfc1ccea 100644 --- a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts +++ b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts @@ -33,7 +33,7 @@ describe('MetadataRepresentationListComponent', () => { })); it(`should load ${representations.length} item-type-switcher components`, () => { - const fields = fixture.debugElement.queryAll(By.css('ds-item-type-switcher')); + const fields = fixture.debugElement.queryAll(By.css('ds-listable-object-component-loader')); expect(fields.length).toBe(representations.length); }); diff --git a/src/app/+item-page/simple/related-items/related-items.component.html b/src/app/+item-page/simple/related-items/related-items.component.html index 4b284ad63c..0ff4742873 100644 --- a/src/app/+item-page/simple/related-items/related-items.component.html +++ b/src/app/+item-page/simple/related-items/related-items.component.html @@ -1,5 +1,5 @@ - - + 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 1896f46015..90e4cadc93 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 @@ -45,7 +45,7 @@ describe('RelatedItemsComponent', () => { })); it(`should load ${mockItems.length} item-type-switcher components`, () => { - const fields = fixture.debugElement.queryAll(By.css('ds-item-type-switcher')); + const fields = fixture.debugElement.queryAll(By.css('ds-listable-object-component-loader')); expect(fields.length).toBe(mockItems.length); }); diff --git a/src/app/+my-dspace-page/my-dspace-result.model.ts b/src/app/+my-dspace-page/my-dspace-result.model.ts index d300ed0bc8..1737aaec0a 100644 --- a/src/app/+my-dspace-page/my-dspace-result.model.ts +++ b/src/app/+my-dspace-page/my-dspace-result.model.ts @@ -16,4 +16,7 @@ export class MyDSpaceResult implements ListableObject { */ hitHighlights: MetadataMap; + getRenderType(): string { + return this.indexableObject.getRenderType() + 'MyDSpaceResult'; + } } diff --git a/src/app/+search-page/normalized-search-result.model.ts b/src/app/+search-page/normalized-search-result.model.ts index abb5f21250..8b1c015fef 100644 --- a/src/app/+search-page/normalized-search-result.model.ts +++ b/src/app/+search-page/normalized-search-result.model.ts @@ -1,13 +1,12 @@ 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 { +export class NormalizedSearchResult { /** * The UUID of the DSpaceObject that was found */ @@ -19,5 +18,4 @@ export class NormalizedSearchResult implements ListableObject { */ @autoserialize hitHighlights: MetadataMap; - } diff --git a/src/app/+search-page/search-page.module.ts b/src/app/+search-page/search-page.module.ts index 816633ec38..940ac45442 100644 --- a/src/app/+search-page/search-page.module.ts +++ b/src/app/+search-page/search-page.module.ts @@ -5,7 +5,6 @@ import { SharedModule } from '../shared/shared.module'; import { SearchPageRoutingModule } from './search-page-routing.module'; import { SearchPageComponent } from './search-page.component'; import { SearchResultsComponent } from './search-results/search-results.component'; -import { ItemSearchResultGridElementComponent } from '../shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component'; import { CommunitySearchResultGridElementComponent } from '../shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component' import { CollectionSearchResultGridElementComponent } from '../shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component'; import { SearchSidebarComponent } from './search-sidebar/search-sidebar.component'; @@ -44,7 +43,6 @@ const components = [ SearchResultsComponent, SearchSidebarComponent, SearchSettingsComponent, - ItemSearchResultGridElementComponent, CollectionSearchResultGridElementComponent, CommunitySearchResultGridElementComponent, SearchFiltersComponent, @@ -85,7 +83,6 @@ const components = [ SearchConfigurationService ], entryComponents: [ - ItemSearchResultGridElementComponent, CollectionSearchResultGridElementComponent, CommunitySearchResultGridElementComponent, SearchFacetFilterComponent, diff --git a/src/app/+search-page/search-result.model.ts b/src/app/+search-page/search-result.model.ts index 0354edbc6b..0006426119 100644 --- a/src/app/+search-page/search-result.model.ts +++ b/src/app/+search-page/search-result.model.ts @@ -16,4 +16,7 @@ export class SearchResult implements ListableObject { */ hitHighlights: MetadataMap; + getRenderType(): string { + return this.indexableObject.getRenderType() + 'SearchResult'; + } } diff --git a/src/app/core/eperson/models/normalized-eperson.model.ts b/src/app/core/eperson/models/normalized-eperson.model.ts index bf644a83ef..28cdf12ee9 100644 --- a/src/app/core/eperson/models/normalized-eperson.model.ts +++ b/src/app/core/eperson/models/normalized-eperson.model.ts @@ -9,7 +9,7 @@ import { Group } from './group.model'; @mapsTo(EPerson) @inheritSerialization(NormalizedDSpaceObject) -export class NormalizedEPerson extends NormalizedDSpaceObject implements CacheableObject, ListableObject { +export class NormalizedEPerson extends NormalizedDSpaceObject implements CacheableObject { /** * A string representing the unique handle of this EPerson */ diff --git a/src/app/core/eperson/models/normalized-group.model.ts b/src/app/core/eperson/models/normalized-group.model.ts index 329ffb8adf..6530915154 100644 --- a/src/app/core/eperson/models/normalized-group.model.ts +++ b/src/app/core/eperson/models/normalized-group.model.ts @@ -8,7 +8,7 @@ import { Group } from './group.model'; @mapsTo(Group) @inheritSerialization(NormalizedDSpaceObject) -export class NormalizedGroup extends NormalizedDSpaceObject implements CacheableObject, ListableObject { +export class NormalizedGroup extends NormalizedDSpaceObject implements CacheableObject { /** * List of Groups that this Group belong to diff --git a/src/app/core/metadata/metadata-field.model.ts b/src/app/core/metadata/metadata-field.model.ts index 288934e52d..e451398fab 100644 --- a/src/app/core/metadata/metadata-field.model.ts +++ b/src/app/core/metadata/metadata-field.model.ts @@ -50,4 +50,8 @@ export class MetadataField implements ListableObject { } return key; } + + getRenderType(): string { + return this.constructor.name; + } } diff --git a/src/app/core/metadata/metadata-schema.model.ts b/src/app/core/metadata/metadata-schema.model.ts index bc05e475cc..6859f580c0 100644 --- a/src/app/core/metadata/metadata-schema.model.ts +++ b/src/app/core/metadata/metadata-schema.model.ts @@ -26,4 +26,8 @@ export class MetadataSchema implements ListableObject { * The namespace of this metadata schema */ namespace: string; + + getRenderType(): string { + return this.constructor.name; + } } diff --git a/src/app/core/metadata/normalized-metadata-field.model.ts b/src/app/core/metadata/normalized-metadata-field.model.ts index c6b2ee32f8..075dda79d2 100644 --- a/src/app/core/metadata/normalized-metadata-field.model.ts +++ b/src/app/core/metadata/normalized-metadata-field.model.ts @@ -10,7 +10,7 @@ import { MetadataSchema } from './metadata-schema.model'; */ @mapsTo(MetadataField) @inheritSerialization(NormalizedObject) -export class NormalizedMetadataField extends NormalizedObject implements ListableObject { +export class NormalizedMetadataField extends NormalizedObject { /** * The identifier of this normalized metadata field diff --git a/src/app/core/metadata/normalized-metadata-schema.model.ts b/src/app/core/metadata/normalized-metadata-schema.model.ts index 47c7233d81..1aa5609090 100644 --- a/src/app/core/metadata/normalized-metadata-schema.model.ts +++ b/src/app/core/metadata/normalized-metadata-schema.model.ts @@ -9,7 +9,7 @@ import { MetadataSchema } from './metadata-schema.model'; */ @mapsTo(MetadataSchema) @inheritSerialization(NormalizedObject) -export class NormalizedMetadataSchema extends NormalizedObject implements ListableObject { +export class NormalizedMetadataSchema extends NormalizedObject { /** * The unique identifier for this schema */ diff --git a/src/app/core/registry/registry.service.ts b/src/app/core/registry/registry.service.ts index 206426588e..3c6de36492 100644 --- a/src/app/core/registry/registry.service.ts +++ b/src/app/core/registry/registry.service.ts @@ -400,7 +400,7 @@ export class RegistryService { distinctUntilChanged() ); - const serializedSchema = new DSpaceRESTv2Serializer(getMapsToType(MetadataSchema.type)).serialize(schema as NormalizedMetadataSchema); + const serializedSchema = new DSpaceRESTv2Serializer(getMapsToType(MetadataSchema.type)).serialize(schema); const request$ = endpoint$.pipe( take(1), diff --git a/src/app/core/shared/browse-entry.model.ts b/src/app/core/shared/browse-entry.model.ts index d5d4093c81..067fac2bff 100644 --- a/src/app/core/shared/browse-entry.model.ts +++ b/src/app/core/shared/browse-entry.model.ts @@ -6,7 +6,7 @@ import { ResourceType } from './resource-type'; * 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 { +export class BrowseEntry implements ListableObject { static type = new ResourceType('browseEntry'); /** @@ -28,4 +28,8 @@ export class BrowseEntry implements ListableObject, TypedObject { * The count of this browse entry */ count: number; + + getRenderType(): string { + return (this as any).type.value; + } } diff --git a/src/app/core/shared/dspace-object.model.ts b/src/app/core/shared/dspace-object.model.ts index 26f76c5ce2..0a22315598 100644 --- a/src/app/core/shared/dspace-object.model.ts +++ b/src/app/core/shared/dspace-object.model.ts @@ -146,4 +146,7 @@ export class DSpaceObject implements CacheableObject, ListableObject { }); } + getRenderType(): string { + return this.constructor.name; + } } diff --git a/src/app/core/shared/item.model.ts b/src/app/core/shared/item.model.ts index a3e625c022..28a889a18f 100644 --- a/src/app/core/shared/item.model.ts +++ b/src/app/core/shared/item.model.ts @@ -110,4 +110,11 @@ export class Item extends DSpaceObject { })); } + getRenderType(): string { + const entityType = this.firstMetadataValue('relationship.type'); + if (isNotEmpty(entityType)) { + return entityType; + } + return 'Publication'; + } } diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-issue/journal-issue-search-result-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-issue/journal-issue-search-result-grid-element.component.spec.ts index db13b3592c..6619694f88 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-issue/journal-issue-search-result-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-issue/journal-issue-search-result-grid-element.component.spec.ts @@ -1,11 +1,10 @@ -import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; -import { Item } from '../../../../core/shared/item.model'; -import { of as observableOf } from 'rxjs/internal/observable/of'; -import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; -import { JournalIssueSearchResultGridElementComponent } from './journal-issue-grid-element.component'; -import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils'; -import { PaginatedList } from '../../../../core/data/paginated-list'; -import { PageInfo } from '../../../../core/shared/page-info.model'; +import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../../core/shared/item.model'; +import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils'; +import { PaginatedList } from '../../../../../core/data/paginated-list'; +import { PageInfo } from '../../../../../core/shared/page-info.model'; +import { getEntityGridElementTestComponent } from '../../../../../shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec'; +import { JournalIssueSearchResultGridElementComponent } from './journal-issue-search-result-grid-element.component'; const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); mockItemWithMetadata.hitHighlights = {}; diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.spec.ts index 07ffc7bdc0..bcdde289e0 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.spec.ts @@ -1,11 +1,10 @@ -import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; -import { Item } from '../../../../core/shared/item.model'; -import { of as observableOf } from 'rxjs/internal/observable/of'; -import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; -import { JournalVolumeSearchResultGridElementComponent } from './journal-volume-grid-element.component'; -import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils'; -import { PaginatedList } from '../../../../core/data/paginated-list'; -import { PageInfo } from '../../../../core/shared/page-info.model'; +import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../../core/shared/item.model'; +import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils'; +import { PaginatedList } from '../../../../../core/data/paginated-list'; +import { PageInfo } from '../../../../../core/shared/page-info.model'; +import { getEntityGridElementTestComponent } from '../../../../../shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec'; +import { JournalVolumeSearchResultGridElementComponent } from './journal-volume-search-result-grid-element.component'; const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); mockItemWithMetadata.hitHighlights = {}; diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.spec.ts index 94e2e7fd68..1ce0aa2436 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.spec.ts @@ -1,11 +1,10 @@ -import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; -import { Item } from '../../../../core/shared/item.model'; -import { of as observableOf } from 'rxjs/internal/observable/of'; -import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; -import { JournalSearchResultGridElementComponent } from './journal-grid-element.component'; -import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils'; -import { PaginatedList } from '../../../../core/data/paginated-list'; -import { PageInfo } from '../../../../core/shared/page-info.model'; +import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../../core/shared/item.model'; +import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils'; +import { PaginatedList } from '../../../../../core/data/paginated-list'; +import { PageInfo } from '../../../../../core/shared/page-info.model'; +import { getEntityGridElementTestComponent } from '../../../../../shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec'; +import { JournalSearchResultGridElementComponent } from './journal-search-result-grid-element.component'; const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); mockItemWithMetadata.hitHighlights = {}; 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 ec61615c9a..d1cf67a07e 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 @@ -5,7 +5,6 @@ import { JournalIssueListElementComponent } from './journal-issue-list-element.c import { of as observableOf } from 'rxjs'; import { Item } from '../../../../core/shared/item.model'; import { TruncatePipe } from '../../../../shared/utils/truncate.pipe'; -import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component'; import { TruncatableService } from '../../../../shared/truncatable/truncatable.service'; let journalIssueListElementComponent: JournalIssueListElementComponent; @@ -51,7 +50,6 @@ describe('JournalIssueListElementComponent', () => { TestBed.configureTestingModule({ declarations: [ JournalIssueListElementComponent , TruncatePipe], providers: [ - { provide: ITEM, useValue: mockItemWithMetadata}, { provide: TruncatableService, useValue: {} } ], 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 21d28c7fe8..2ab4c1eaed 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 @@ -5,7 +5,6 @@ import { JournalVolumeListElementComponent } from './journal-volume-list-element import { of as observableOf } from 'rxjs'; import { Item } from '../../../../core/shared/item.model'; import { TruncatePipe } from '../../../../shared/utils/truncate.pipe'; -import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component'; import { TruncatableService } from '../../../../shared/truncatable/truncatable.service'; let journalVolumeListElementComponent: JournalVolumeListElementComponent; @@ -51,7 +50,6 @@ describe('JournalVolumeListElementComponent', () => { TestBed.configureTestingModule({ declarations: [ JournalVolumeListElementComponent , TruncatePipe], providers: [ - { provide: ITEM, useValue: mockItemWithMetadata}, { provide: TruncatableService, useValue: {} } ], diff --git a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-issue/journal-issue-search-result-list-element.component.html b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-issue/journal-issue-search-result-list-element.component.html index 2d9faadcdc..e0d6e4053a 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-issue/journal-issue-search-result-list-element.component.html +++ b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-issue/journal-issue-search-result-list-element.component.html @@ -1,4 +1,5 @@ + ; -const mockItemWithMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' +const mockItemWithMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'publicationvolume.volumeNumber': [ + { + language: 'en_US', + value: '1234' + } + ], + 'publicationissue.issueNumber': [ + { + language: 'en_US', + value: '5678' + } + ] } - ], - 'publicationvolume.volumeNumber': [ - { - language: 'en_US', - value: '1234' + }) + }); + +const mockItemWithoutMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] } - ], - 'publicationissue.issueNumber': [ - { - language: 'en_US', - value: '5678' - } - ] - } -}); -const mockItemWithoutMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' - } - ] - } -}); + }) + }); describe('JournalIssueListElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ JournalIssueSearchResultListElementComponent , TruncatePipe], + declarations: [JournalIssueSearchResultListElementComponent, TruncatePipe], providers: [ - { provide: ITEM, useValue: mockItemWithMetadata}, { provide: TruncatableService, useValue: {} } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(JournalIssueSearchResultListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); diff --git a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-volume/journal-volume-search-result-list-element.component.html b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-volume/journal-volume-search-result-list-element.component.html index 8a1ae65a22..f3c0173bde 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-volume/journal-volume-search-result-list-element.component.html +++ b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-volume/journal-volume-search-result-list-element.component.html @@ -1,4 +1,5 @@ + ; -const mockItemWithMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' +const mockItemWithMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'journal.title': [ + { + language: 'en_US', + value: 'This is just another journal title' + } + ], + 'publicationvolume.volumeNumber': [ + { + language: 'en_US', + value: '1234' + } + ] } - ], - 'journal.title': [ - { - language: 'en_US', - value: 'This is just another journal title' + }) + }); +const mockItemWithoutMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] } - ], - 'publicationvolume.volumeNumber': [ - { - language: 'en_US', - value: '1234' - } - ] - } -}); -const mockItemWithoutMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' - } - ] - } -}); + }) + }); describe('JournalVolumeListElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ JournalVolumeSearchResultListElementComponent , TruncatePipe], + declarations: [JournalVolumeSearchResultListElementComponent, TruncatePipe], providers: [ - { provide: ITEM, useValue: mockItemWithMetadata}, { provide: TruncatableService, useValue: {} } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(JournalVolumeSearchResultListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); diff --git a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal/journal-search-result-list-element.component.html b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal/journal-search-result-list-element.component.html index d1dfff123a..629149b197 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal/journal-search-result-list-element.component.html +++ b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal/journal-search-result-list-element.component.html @@ -1,4 +1,5 @@ + ; -const mockItemWithMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' +const mockItemWithMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'creativeworkseries.issn': [ + { + language: 'en_US', + value: '1234' + } + ] } - ], - 'creativeworkseries.issn': [ - { - language: 'en_US', - value: '1234' + }) + }); + +const mockItemWithoutMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] } - ] + }) } -}); -const mockItemWithoutMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' - } - ] - } -}); +); describe('JournalListElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ JournalSearchResultListElementComponent , TruncatePipe], + declarations: [JournalSearchResultListElementComponent, TruncatePipe], providers: [ - { provide: ITEM, useValue: mockItemWithMetadata}, { provide: TruncatableService, useValue: {} } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(JournalSearchResultListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); diff --git a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/orgunit/orgunit-search-result-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/orgunit/orgunit-search-result-grid-element.component.spec.ts index f854eaa273..579161f940 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/orgunit/orgunit-search-result-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/orgunit/orgunit-search-result-grid-element.component.spec.ts @@ -1,11 +1,10 @@ -import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; -import { Item } from '../../../../core/shared/item.model'; -import { of as observableOf } from 'rxjs/internal/observable/of'; -import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; -import { OrgunitSearchResultGridElementComponent } from './orgunit-grid-element.component'; -import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils'; -import { PaginatedList } from '../../../../core/data/paginated-list'; -import { PageInfo } from '../../../../core/shared/page-info.model'; +import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../../core/shared/item.model'; +import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils'; +import { PaginatedList } from '../../../../../core/data/paginated-list'; +import { PageInfo } from '../../../../../core/shared/page-info.model'; +import { OrgunitSearchResultGridElementComponent } from './orgunit-search-result-grid-element.component'; +import { getEntityGridElementTestComponent } from '../../../../../shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec'; const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); mockItemWithMetadata.hitHighlights = {}; diff --git a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component.spec.ts index 752630c7b9..6a5c79c770 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component.spec.ts @@ -1,11 +1,10 @@ -import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; -import { Item } from '../../../../core/shared/item.model'; -import { of as observableOf } from 'rxjs/internal/observable/of'; -import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; -import { PersonSearchResultGridElementComponent } from './person-grid-element.component'; -import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils'; -import { PaginatedList } from '../../../../core/data/paginated-list'; -import { PageInfo } from '../../../../core/shared/page-info.model'; +import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../../core/shared/item.model'; +import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils'; +import { PaginatedList } from '../../../../../core/data/paginated-list'; +import { PageInfo } from '../../../../../core/shared/page-info.model'; +import { getEntityGridElementTestComponent } from '../../../../../shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec'; +import { PersonSearchResultGridElementComponent } from './person-search-result-grid-element.component'; const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); mockItemWithMetadata.hitHighlights = {}; diff --git a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.spec.ts index acf52224be..64fedf155d 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.spec.ts @@ -1,11 +1,10 @@ -import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; -import { Item } from '../../../../core/shared/item.model'; -import { of as observableOf } from 'rxjs/internal/observable/of'; -import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; -import { ProjectSearchResultGridElementComponent } from './project-grid-element.component'; -import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils'; -import { PaginatedList } from '../../../../core/data/paginated-list'; -import { PageInfo } from '../../../../core/shared/page-info.model'; +import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../../core/shared/item.model'; +import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils'; +import { PaginatedList } from '../../../../../core/data/paginated-list'; +import { PageInfo } from '../../../../../core/shared/page-info.model'; +import { getEntityGridElementTestComponent } from '../../../../../shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec'; +import { ProjectSearchResultGridElementComponent } from './project-search-result-grid-element.component'; const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); mockItemWithMetadata.hitHighlights = {}; diff --git a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/orgunit/orgunit-search-result-list-element.component.html b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/orgunit/orgunit-search-result-list-element.component.html index 0bb94c7d24..b833fa735b 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/orgunit/orgunit-search-result-list-element.component.html +++ b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/orgunit/orgunit-search-result-list-element.component.html @@ -1,4 +1,5 @@ + ; -const mockItemWithMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' +const mockItemWithMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'dc.description': [ + { + language: 'en_US', + value: 'A description about the OrgUnit' + } + ] } - ], - 'dc.description': [ - { - language: 'en_US', - value: 'A description about the OrgUnit' + }) + }); +const mockItemWithoutMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] } - ] - } -}); -const mockItemWithoutMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' - } - ] - } -}); + }) + }); describe('OrgUnitListElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ OrgunitSearchResultListElementComponent , TruncatePipe], providers: [ - { provide: ITEM, useValue: mockItemWithMetadata}, { provide: TruncatableService, useValue: {} } ], diff --git a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.html b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.html index 77f29d25ff..3e1bbbcc2b 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.html +++ b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.html @@ -1,4 +1,5 @@ + ; -const mockItemWithMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' +const mockItemWithMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'person.jobTitle': [ + { + language: 'en_US', + value: 'Developer' + } + ] } - ], - 'person.jobTitle': [ - { - language: 'en_US', - value: 'Developer' + }) + }); +const mockItemWithoutMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] } - ] - } -}); -const mockItemWithoutMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' - } - ] - } -}); + }) + }); describe('PersonListElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ PersonSearchResultListElementComponent , TruncatePipe], + declarations: [PersonSearchResultListElementComponent, TruncatePipe], providers: [ { provide: TruncatableService, useValue: {} } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(PersonSearchResultListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); diff --git a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.html b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.html index fab5971f9e..1715c7eb2e 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.html +++ b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.html @@ -1,16 +1,18 @@ - - - - - - - - - - + + + + + + + + + + + + - - - + + + \ No newline at end of file diff --git a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.scss b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.scss index 1d0786105c..e69de29bb2 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.scss +++ b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.scss @@ -1 +0,0 @@ -@import '../../../../../styles/variables'; diff --git a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.spec.ts index 816467727e..e08e25eb69 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.spec.ts @@ -1,55 +1,62 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { By } from '@angular/platform-browser'; -import { ProjectSearchResultListElementComponent } from './project-list-element.component'; import { of as observableOf } from 'rxjs'; -import { Item } from '../../../../core/shared/item.model'; -import { TruncatePipe } from '../../../../shared/utils/truncate.pipe'; -import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component'; -import { TruncatableService } from '../../../../shared/truncatable/truncatable.service'; +import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; +import { ProjectSearchResultListElementComponent } from './project-search-result-list-element.component'; +import { Item } from '../../../../../core/shared/item.model'; +import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe'; +import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service'; let projectListElementComponent: ProjectSearchResultListElementComponent; let fixture: ComponentFixture; -const mockItemWithMetadata: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' +const mockItemWithMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + 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(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' + }) + }); + +const mockItemWithoutMetadata: ItemSearchResult = Object.assign( + new ItemSearchResult(), + { + indexableObject: Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] } - ] - } -}); + }) + }); describe('ProjectListElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ProjectSearchResultListElementComponent , TruncatePipe], + declarations: [ProjectSearchResultListElementComponent, TruncatePipe], providers: [ - { provide: ITEM, useValue: mockItemWithMetadata}, { provide: TruncatableService, useValue: {} } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ProjectSearchResultListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); diff --git a/src/app/shared/browse-by/browse-by.component.html b/src/app/shared/browse-by/browse-by.component.html index bad9f3fe8c..f7cd7e0d35 100644 --- a/src/app/shared/browse-by/browse-by.component.html +++ b/src/app/shared/browse-by/browse-by.component.html @@ -25,7 +25,7 @@
  • - +
diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.html b/src/app/shared/dso-selector/dso-selector/dso-selector.component.html index 662144823d..e2eda4dcfd 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.html +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.html @@ -15,6 +15,6 @@ class="list-group-item list-group-item-action border-0 list-entry" title="{{ listEntry.indexableObject.name }}" (click)="onSelect.emit(listEntry.indexableObject)" #listEntryElement> - +
diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts index 04501e4923..32149e29dc 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts @@ -19,6 +19,7 @@ import { RemoteData } from '../../../core/data/remote-data'; import { PaginatedList } from '../../../core/data/paginated-list'; import { SearchResult } from '../../../+search-page/search-result.model'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; +import { ViewMode } from '../../../core/shared/view-mode.model'; @Component({ selector: 'ds-dso-selector', @@ -31,7 +32,7 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model'; * The user can search the list by using the input field */ export class DSOSelectorComponent implements OnInit { - + viewMode = ViewMode.ListElement; /** * The initially selected DSO's uuid */ diff --git a/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.html b/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.html index 2b605ccdc6..3e304d9eb3 100644 --- a/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.html +++ b/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.html @@ -16,7 +16,7 @@
diff --git a/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.ts b/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.ts index bb1272f076..e1e9d18c8f 100644 --- a/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.ts +++ b/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.ts @@ -2,6 +2,7 @@ import { Component, forwardRef, Input } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { InputSuggestionsComponent } from '../input-suggestions.component'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; +import { ViewMode } from '../../../core/shared/view-mode.model'; @Component({ selector: 'ds-dso-input-suggestions', @@ -22,6 +23,7 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model'; * Component representing a form with a autocomplete functionality for DSpaceObjects */ export class DsoInputSuggestionsComponent extends InputSuggestionsComponent { + viewMode = ViewMode.ListElement; /** * The suggestions that should be shown */ diff --git a/src/app/shared/object-collection/shared/item-my-dspace-result.model.ts b/src/app/shared/object-collection/shared/item-my-dspace-result.model.ts index 92724a762f..e77b9295df 100644 --- a/src/app/shared/object-collection/shared/item-my-dspace-result.model.ts +++ b/src/app/shared/object-collection/shared/item-my-dspace-result.model.ts @@ -8,4 +8,7 @@ import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspa */ @searchResultFor(Item, MyDSpaceConfigurationValueType.Workspace) export class ItemMyDSpaceResult extends SearchResult { + getRenderType(): string { + return ItemMyDSpaceResult.name; + } } diff --git a/src/app/shared/object-collection/shared/listable-object.model.ts b/src/app/shared/object-collection/shared/listable-object.model.ts index 07c626cda2..62ab24ae33 100644 --- a/src/app/shared/object-collection/shared/listable-object.model.ts +++ b/src/app/shared/object-collection/shared/listable-object.model.ts @@ -1 +1,5 @@ -export interface ListableObject {} +import { TypedObject } from '../../../core/cache/object-cache.reducer'; + +export interface ListableObject extends TypedObject { + getRenderType(): string; +} diff --git a/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.html b/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.html index d41303d462..ef9a817424 100644 --- a/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.html +++ b/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.ts b/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.ts index 149425c157..4651a342ac 100644 --- a/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.ts +++ b/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.ts @@ -5,24 +5,23 @@ import { Context } from '../../../../core/shared/context.model'; import { getListableObjectComponent } from './listable-object.decorator'; import { GenericConstructor } from '../../../../core/shared/generic-constructor'; import { ListableObjectDirective } from './listable-object.directive'; -import { hasValue, isNotEmpty } from '../../../empty.util'; @Component({ selector: 'ds-listable-object-component-loader', - styleUrls: ['./listable-object-component-loader.component.scss'], + // styleUrls: ['./listable-object-component-loader.component.scss'], templateUrl: './listable-object-component-loader.component.html' }) /** * Component for determining what component to use depending on the item's relationship type (relationship.type) */ export class ListableObjectComponentLoaderComponent implements OnInit { - - @Input() type?: string; /** * The item or metadata to determine the component for */ @Input() object: ListableObject; + //TODO DO SOMETHING WITH THIS + @Input() index: number; /** * The preferred view-mode to display */ @@ -49,9 +48,6 @@ export class ListableObjectComponentLoaderComponent implements OnInit { * @returns {string} */ private getComponent(): GenericConstructor { - if (isNotEmpty(this.type)) { - return getListableObjectComponent(this.type, this.viewMode) - } - return getListableObjectComponent(this.object.constructor as GenericConstructor, this.viewMode); + return getListableObjectComponent(this.object.getRenderType(), this.viewMode) } } diff --git a/src/app/shared/object-collection/shared/listable-object/listable-object.decorator.ts b/src/app/shared/object-collection/shared/listable-object/listable-object.decorator.ts index 2e30c0b761..092bf8068f 100644 --- a/src/app/shared/object-collection/shared/listable-object/listable-object.decorator.ts +++ b/src/app/shared/object-collection/shared/listable-object/listable-object.decorator.ts @@ -16,7 +16,7 @@ const listElementMap = new Map(); * @param type * @param viewMode */ -export function listableObjectComponent(objectType: GenericConstructor | string, viewMode: ViewMode, context: Context = DEFAULT_CONTEXT) { +export function listableObjectComponent(objectType: string, viewMode: ViewMode, context: Context = DEFAULT_CONTEXT) { return function decorator(component: any) { if (hasNoValue(objectType)) { return; diff --git a/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.ts b/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.ts index f72d1c9e51..d6819b04da 100644 --- a/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.ts +++ b/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.ts @@ -1,10 +1,11 @@ import { Component, Inject, Input } from '@angular/core'; import { ListableObject } from '../listable-object.model'; +import { ViewMode } from '../../../../core/shared/view-mode.model'; @Component({ selector: 'ds-abstract-object-element', template: ``, }) -export class AbstractListableElementComponent { +export class AbstractListableElementComponent { @Input() object: T; } 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 0c47a239cc..91ddbaf09a 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 @@ -13,6 +13,7 @@ import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/cla import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component'; import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator'; +import { Context } from '../../../../core/shared/context.model'; /** * This component renders claimed task object for the mydspace result in the detail view. @@ -23,8 +24,8 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: './claimed-my-dspace-result-detail-element.component.html' }) -@listableObjectComponent(ClaimedTaskMyDSpaceResult, ViewMode.DetailedListElement) -@listableObjectComponent(ClaimedTask, ViewMode.DetailedListElement) +@listableObjectComponent(ClaimedTaskMyDSpaceResult.name, ViewMode.DetailedListElement) +@listableObjectComponent(ClaimedTask.name, ViewMode.DetailedListElement) export class ClaimedMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent { /** diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.ts index 2b50dd0819..3788a0da4c 100644 --- a/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.ts +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.ts @@ -16,7 +16,7 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: './item-my-dspace-result-detail-element.component.html' }) -@listableObjectComponent(ItemMyDSpaceResult, ViewMode.DetailedListElement) +@listableObjectComponent(ItemMyDSpaceResult.name, ViewMode.DetailedListElement) export class ItemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent { /** diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-element.component.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-element.component.ts index 20fe3dcb2c..e9ff84b7cf 100644 --- a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-element.component.ts +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-element.component.ts @@ -22,8 +22,8 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: './pool-my-dspace-result-detail-element.component.html', }) -@listableObjectComponent(PoolTaskMyDSpaceResult, ViewMode.DetailedListElement) -@listableObjectComponent(PoolTask, ViewMode.DetailedListElement) +@listableObjectComponent(PoolTaskMyDSpaceResult.name, ViewMode.DetailedListElement) +@listableObjectComponent(PoolTask.name, ViewMode.DetailedListElement) export class PoolMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent { /** 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 ec83c7f6d0..4d6b047f56 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 @@ -22,8 +22,8 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: './workflowitem-my-dspace-result-detail-element.component.html', }) -@listableObjectComponent(WorkflowitemMyDSpaceResult, ViewMode.DetailedListElement) -@listableObjectComponent(WorkflowItem, ViewMode.DetailedListElement) +@listableObjectComponent(WorkflowitemMyDSpaceResult.name, ViewMode.DetailedListElement) +@listableObjectComponent(WorkflowItem.name, ViewMode.DetailedListElement) export class WorkflowitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent { /** 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 afb3107fa4..e9cc6967e6 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 @@ -10,7 +10,6 @@ import { WorkspaceitemMyDSpaceResult } from '../../../object-collection/shared/w import { Item } from '../../../../core/shared/item.model'; import { RemoteData } from '../../../../core/data/remote-data'; import { isNotUndefined } from '../../../empty.util'; -import { ListableObject } from '../../../object-collection/shared/listable-object.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 { ViewMode } from '../../../../core/shared/view-mode.model'; @@ -25,8 +24,8 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: './workspaceitem-my-dspace-result-detail-element.component.html', }) -@listableObjectComponent(WorkspaceitemMyDSpaceResult, ViewMode.DetailedListElement) -@listableObjectComponent(WorkspaceItem, ViewMode.DetailedListElement) +@listableObjectComponent(WorkspaceitemMyDSpaceResult.name, ViewMode.DetailedListElement) +@listableObjectComponent(WorkspaceItem.name, ViewMode.DetailedListElement) export class WorkspaceitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent { /** diff --git a/src/app/shared/object-detail/object-detail.component.html b/src/app/shared/object-detail/object-detail.component.html index a57a23027e..400781b6d2 100644 --- a/src/app/shared/object-detail/object-detail.component.html +++ b/src/app/shared/object-detail/object-detail.component.html @@ -14,7 +14,7 @@
- +
diff --git a/src/app/shared/object-detail/object-detail.component.ts b/src/app/shared/object-detail/object-detail.component.ts index 3187a2cd1b..24df1bf504 100644 --- a/src/app/shared/object-detail/object-detail.component.ts +++ b/src/app/shared/object-detail/object-detail.component.ts @@ -15,6 +15,7 @@ import { fadeIn } from '../animations/fade'; import { ListableObject } from '../object-collection/shared/listable-object.model'; import { PaginationComponentOptions } from '../pagination/pagination-component-options.model'; +import { ViewMode } from '../../core/shared/view-mode.model'; /** * This component renders a paginated set of results in the detail view. @@ -28,6 +29,7 @@ import { PaginationComponentOptions } from '../pagination/pagination-component-o animations: [fadeIn] }) export class ObjectDetailComponent { + viewMode = ViewMode.DetailedListElement; /** * Pagination options object diff --git a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.ts b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.ts index 1261cd6dfd..a113e0dffd 100644 --- a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.ts +++ b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.ts @@ -11,5 +11,5 @@ import { listableObjectComponent } from '../../object-collection/shared/listable templateUrl: './collection-grid-element.component.html' }) -@listableObjectComponent(Collection, ViewMode.GridElement) +@listableObjectComponent(Collection.name, ViewMode.GridElement) export class CollectionGridElementComponent extends AbstractListableElementComponent {} diff --git a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.ts b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.ts index 67d4ac663c..498222466d 100644 --- a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.ts +++ b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.ts @@ -11,5 +11,5 @@ import { listableObjectComponent } from '../../object-collection/shared/listable templateUrl: './community-grid-element.component.html' }) -@listableObjectComponent(Community, ViewMode.GridElement) +@listableObjectComponent(Community.name, ViewMode.GridElement) export class CommunityGridElementComponent extends AbstractListableElementComponent {} diff --git a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.html b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.html deleted file mode 100644 index 21ee7968ca..0000000000 --- a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.html +++ /dev/null @@ -1 +0,0 @@ - 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 deleted file mode 100644 index 8b13789179..0000000000 --- a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.scss +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.spec.ts b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.spec.ts deleted file mode 100644 index 7b286cc415..0000000000 --- a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.spec.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { ItemGridElementComponent } from './item-grid-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { By } from '@angular/platform-browser'; -import { TruncatePipe } from '../../utils/truncate.pipe'; -import { Item } from '../../../core/shared/item.model'; -import { of as observableOf } from 'rxjs'; - -let itemGridElementComponent: ItemGridElementComponent; -let fixture: ComponentFixture; - -const mockItemWithAuthorAndDate: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.contributor.author': [ - { - language: 'en_US', - value: 'Smith, Donald' - } - ], - 'dc.date.issued': [ - { - language: null, - value: '2015-06-26' - } - ] - } -}); -const mockItemWithoutAuthorAndDate: Item = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' - } - ], - 'dc.type': [ - { - language: null, - value: 'Article' - } - ] - } -}); - -describe('ItemGridElementComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ItemGridElementComponent , TruncatePipe], - providers: [ - { provide: 'objectElementProvider', useValue: {mockItemWithAuthorAndDate}} - ], - - schemas: [ NO_ERRORS_SCHEMA ] - }).overrideComponent(ItemGridElementComponent, { - set: { changeDetection: ChangeDetectionStrategy.Default } - }).compileComponents(); - })); - - beforeEach(async(() => { - fixture = TestBed.createComponent(ItemGridElementComponent); - itemGridElementComponent = fixture.componentInstance; - - })); - - describe('When the item has an author', () => { - beforeEach(() => { - itemGridElementComponent.object = mockItemWithAuthorAndDate; - fixture.detectChanges(); - }); - - it('should show the author paragraph', () => { - const itemAuthorField = fixture.debugElement.query(By.css('p.item-authors')); - expect(itemAuthorField).not.toBeNull(); - }); - }); - - describe('When the item has no author', () => { - beforeEach(() => { - itemGridElementComponent.object = mockItemWithoutAuthorAndDate; - fixture.detectChanges(); - }); - - it('should not show the author paragraph', () => { - const itemAuthorField = fixture.debugElement.query(By.css('p.item-authors')); - expect(itemAuthorField).toBeNull(); - }); - }); - - describe('When the item has an issuedate', () => { - beforeEach(() => { - itemGridElementComponent.object = mockItemWithAuthorAndDate; - fixture.detectChanges(); - }); - - it('should show the issuedate span', () => { - const itemAuthorField = fixture.debugElement.query(By.css('span.item-date')); - expect(itemAuthorField).not.toBeNull(); - }); - }); - - describe('When the item has no issuedate', () => { - beforeEach(() => { - itemGridElementComponent.object = mockItemWithoutAuthorAndDate; - fixture.detectChanges(); - }); - - it('should not show the issuedate span', () => { - const dateField = fixture.debugElement.query(By.css('span.item-date')); - expect(dateField).toBeNull(); - }); - }); -}); diff --git a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.ts b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.ts deleted file mode 100644 index e146370752..0000000000 --- a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component } from '@angular/core'; - -import { Item } from '../../../core/shared/item.model'; -import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; -import { ViewMode } from '../../../core/shared/view-mode.model'; -import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator'; - -@Component({ - selector: 'ds-item-grid-element', - styleUrls: ['./item-grid-element.component.scss'], - templateUrl: './item-grid-element.component.html' -}) - -@listableObjectComponent(Item, ViewMode.GridElement) -export class ItemGridElementComponent extends AbstractListableElementComponent {} diff --git a/src/app/shared/object-grid/object-grid.component.html b/src/app/shared/object-grid/object-grid.component.html index 9d1f8f5ea2..c5cd34608f 100644 --- a/src/app/shared/object-grid/object-grid.component.html +++ b/src/app/shared/object-grid/object-grid.component.html @@ -13,7 +13,7 @@
- +
diff --git a/src/app/shared/object-grid/object-grid.component.ts b/src/app/shared/object-grid/object-grid.component.ts index e539ca5714..d3bfbb8e58 100644 --- a/src/app/shared/object-grid/object-grid.component.ts +++ b/src/app/shared/object-grid/object-grid.component.ts @@ -20,6 +20,7 @@ import { HostWindowService, WidthCategory } from '../host-window.service'; import { ListableObject } from '../object-collection/shared/listable-object.model'; import { PaginationComponentOptions } from '../pagination/pagination-component-options.model'; +import { ViewMode } from '../../core/shared/view-mode.model'; @Component({ changeDetection: ChangeDetectionStrategy.Default, @@ -31,6 +32,7 @@ import { PaginationComponentOptions } from '../pagination/pagination-component-o }) export class ObjectGridComponent implements OnInit { + viewMode = ViewMode.ListElement; @Input() config: PaginationComponentOptions; @Input() sortConfig: SortOptions; diff --git a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.ts b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.ts index 1d0f47b70b..983b895e9c 100644 --- a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.ts +++ b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.ts @@ -12,5 +12,5 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: 'collection-search-result-grid-element.component.html' }) -@listableObjectComponent(CollectionSearchResult, ViewMode.GridElement) +@listableObjectComponent(CollectionSearchResult.name, ViewMode.GridElement) export class CollectionSearchResultGridElementComponent extends SearchResultGridElementComponent {} diff --git a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.ts b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.ts index 806e6a44e3..e8e19c27d8 100644 --- a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.ts +++ b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.ts @@ -11,7 +11,7 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: 'community-search-result-grid-element.component.html' }) -@listableObjectComponent(CommunitySearchResult, ViewMode.GridElement) +@listableObjectComponent(CommunitySearchResult.name, ViewMode.GridElement) export class CommunitySearchResultGridElementComponent extends SearchResultGridElementComponent { } diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.html b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.html deleted file mode 100644 index 36740cf48f..0000000000 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.html +++ /dev/null @@ -1 +0,0 @@ - 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 deleted file mode 100644 index d61f3ccf55..0000000000 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.scss +++ /dev/null @@ -1,12 +0,0 @@ -.card { - a > div { - position: relative; - .thumbnail-overlay { - height: 100%; - position: absolute; - top: 0; - width: 100%; - background-color: map-get($theme-colors, primary); - } - } -} diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts deleted file mode 100644 index d757e87583..0000000000 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { ItemSearchResultGridElementComponent } from './item-search-result-grid-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { of as observableOf } from 'rxjs'; -import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { By } from '@angular/platform-browser'; -import { TruncatePipe } from '../../../utils/truncate.pipe'; -import { Item } from '../../../../core/shared/item.model'; -import { TruncatableService } from '../../../truncatable/truncatable.service'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; -import { ViewMode } from '../../../../core/shared/view-mode.model'; - -let itemSearchResultGridElementComponent: ItemSearchResultGridElementComponent; -let fixture: ComponentFixture; - -const truncatableServiceStub: any = { - isCollapsed: (id: number) => observableOf(true), -}; - -const type = 'authorOfPublication'; - -const mockItemWithRelationshipType: ItemSearchResult = new ItemSearchResult(); -mockItemWithRelationshipType.hitHighlights = {}; -mockItemWithRelationshipType.indexableObject = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'relationship.type': [ - { - language: 'en_US', - value: type - } - ] - } -}); - -describe('ItemSearchResultGridElementComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [NoopAnimationsModule], - declarations: [ItemSearchResultGridElementComponent, TruncatePipe], - providers: [ - { provide: TruncatableService, useValue: truncatableServiceStub }, - { provide: 'objectElementProvider', useValue: (mockItemWithRelationshipType) } - ], - schemas: [NO_ERRORS_SCHEMA] - }).overrideComponent(ItemSearchResultGridElementComponent, { - set: { changeDetection: ChangeDetectionStrategy.Default } - }).compileComponents(); - })); - - beforeEach(async(() => { - fixture = TestBed.createComponent(ItemSearchResultGridElementComponent); - itemSearchResultGridElementComponent = fixture.componentInstance; - })); - - it('should show send the object to item-type-switcher using viewMode "Card"', () => { - const itemTypeSwitcherComp = fixture.debugElement.query(By.css('ds-item-type-switcher')).componentInstance; - expect(itemTypeSwitcherComp.object).toBe(mockItemWithRelationshipType); - expect(itemTypeSwitcherComp.viewMode).toEqual(ViewMode.GridElement); - }); -}); diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.ts b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.ts deleted file mode 100644 index f90a9f6799..0000000000 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Component } from '@angular/core'; - -import { SearchResultGridElementComponent } from '../search-result-grid-element.component'; -import { Item } from '../../../../core/shared/item.model'; -import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; -import { focusShadow } from '../../../animations/focus'; -import { ViewMode } from '../../../../core/shared/view-mode.model'; -import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator'; - -@Component({ - selector: 'ds-item-search-result-grid-element', - styleUrls: ['../search-result-grid-element.component.scss', 'item-search-result-grid-element.component.scss'], - templateUrl: 'item-search-result-grid-element.component.html', - animations: [focusShadow], -}) - -@listableObjectComponent(ItemSearchResult, ViewMode.GridElement) -export class ItemSearchResultGridElementComponent extends SearchResultGridElementComponent { - viewMode = ViewMode.GridElement; -} \ No newline at end of file diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec.ts index 0245e0699e..63ee848aa0 100644 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec.ts @@ -4,14 +4,13 @@ import { TruncatePipe } from '../../../../utils/truncate.pipe'; import { TruncatableService } from '../../../../truncatable/truncatable.service'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; -import { PublicationSearchResultGridElementComponent } from './publication-grid-element.component'; import { of as observableOf } from 'rxjs/internal/observable/of'; import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model'; import { Item } from '../../../../../core/shared/item.model'; -import { ITEM } from '../../../../items/switcher/listable-object-component-loader.component'; import { createSuccessfulRemoteDataObject$ } from '../../../../testing/utils'; import { PaginatedList } from '../../../../../core/data/paginated-list'; import { PageInfo } from '../../../../../core/shared/page-info.model'; +import { PublicationSearchResultGridElementComponent } from './publication-search-result-grid-element.component'; const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); mockItemWithMetadata.hitHighlights = {}; @@ -85,7 +84,6 @@ export function getEntityGridElementTestComponent(component, searchResultWithMet declarations: [component, TruncatePipe], providers: [ { provide: TruncatableService, useValue: truncatableServiceStub }, - {provide: ITEM, useValue: searchResultWithoutMetadata} ], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(component, { diff --git a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.ts b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.ts index 2ebfc2713e..ed61badbbd 100644 --- a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.ts +++ b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.ts @@ -14,5 +14,5 @@ import { listableObjectComponent } from '../../object-collection/shared/listable /** * This component is automatically used to create a list view for BrowseEntry objects when used in ObjectCollectionComponent */ -@listableObjectComponent(BrowseEntry, ViewMode.ListElement) +@listableObjectComponent(BrowseEntry.name, ViewMode.ListElement) export class BrowseEntryListElementComponent extends AbstractListableElementComponent {} diff --git a/src/app/shared/object-list/collection-list-element/collection-list-element.component.ts b/src/app/shared/object-list/collection-list-element/collection-list-element.component.ts index 685a990409..7d57044ba4 100644 --- a/src/app/shared/object-list/collection-list-element/collection-list-element.component.ts +++ b/src/app/shared/object-list/collection-list-element/collection-list-element.component.ts @@ -11,5 +11,5 @@ import { listableObjectComponent } from '../../object-collection/shared/listable templateUrl: './collection-list-element.component.html' }) -@listableObjectComponent(Collection, ViewMode.ListElement) +@listableObjectComponent(Collection.name, ViewMode.ListElement) export class CollectionListElementComponent extends AbstractListableElementComponent {} diff --git a/src/app/shared/object-list/community-list-element/community-list-element.component.ts b/src/app/shared/object-list/community-list-element/community-list-element.component.ts index 4581c2c0da..4c3e8bbd6f 100644 --- a/src/app/shared/object-list/community-list-element/community-list-element.component.ts +++ b/src/app/shared/object-list/community-list-element/community-list-element.component.ts @@ -11,5 +11,5 @@ import { listableObjectComponent } from '../../object-collection/shared/listable templateUrl: './community-list-element.component.html' }) -@listableObjectComponent(Community, ViewMode.ListElement) +@listableObjectComponent(Community.name, ViewMode.ListElement) export class CommunityListElementComponent extends AbstractListableElementComponent {} diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.html b/src/app/shared/object-list/item-list-element/item-list-element.component.html deleted file mode 100644 index 21ee7968ca..0000000000 --- a/src/app/shared/object-list/item-list-element/item-list-element.component.html +++ /dev/null @@ -1 +0,0 @@ - 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 deleted file mode 100644 index e69de29bb2..0000000000 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 deleted file mode 100644 index 2c0c8b0aa2..0000000000 --- a/src/app/shared/object-list/item-list-element/item-list-element.component.spec.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { ItemListElementComponent } from './item-list-element.component'; -import { Item } from '../../../core/shared/item.model'; -import { RemoteData } from '../../../core/data/remote-data'; -import { PaginatedList } from '../../../core/data/paginated-list'; -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: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])), - metadata: [], - relationships: createRelationshipsObservable() -}); - -describe('ItemListElementComponent', () => { - let comp: ItemListElementComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [], - declarations: [ItemListElementComponent], - providers: [ - { provide: 'objectElementProvider', useValue: mockItem } - ], - schemas: [NO_ERRORS_SCHEMA] - }).overrideComponent(ItemListElementComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} - }).compileComponents(); - })); - - beforeEach(async(() => { - fixture = TestBed.createComponent(ItemListElementComponent); - comp = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should call an item-type-switcher component and pass the item', () => { - const itemTypeSwitcher = fixture.debugElement.query(By.css('ds-item-type-switcher')).componentInstance; - expect(itemTypeSwitcher.object).toBe(mockItem); - }); - -}); diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-list-element.component.ts deleted file mode 100644 index e41a92f36d..0000000000 --- a/src/app/shared/object-list/item-list-element/item-list-element.component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Component } from '@angular/core'; - -import { Item } from '../../../core/shared/item.model'; -import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; -import { ViewMode } from '../../../core/shared/view-mode.model'; -import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator'; - -@Component({ - selector: 'ds-item-list-element', - styleUrls: ['./item-list-element.component.scss'], - templateUrl: './item-list-element.component.html' -}) - -/** - * The component used to list items depending on type - * Uses item-type-switcher to determine which components to use for displaying the list - */ -@listableObjectComponent(Item, ViewMode.ListElement) -export class ItemListElementComponent extends AbstractListableElementComponent { - viewMode = ViewMode.ListElement; -} diff --git a/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts b/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts index 9ffba33758..a4e12959f4 100644 --- a/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts +++ b/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts @@ -8,5 +8,5 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model'; templateUrl: './item-type-badge.component.html' }) export class ItemTypeBadgeComponent { - @Input() object: SearchResult; + @Input() object: DSpaceObject; } diff --git a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.html b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.html index 764fdc1064..4ecb8c0c51 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.html +++ b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.html @@ -1,2 +1,2 @@ - - + + diff --git a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.spec.ts b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.spec.ts index 2aa54bae64..e89602775e 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.spec.ts +++ b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.spec.ts @@ -31,7 +31,7 @@ describe('ItemMetadataListElementComponent', () => { })); it('should call an item-type-switcher component and pass the item-metadata-representation', () => { - const itemTypeSwitcher = fixture.debugElement.query(By.css('ds-item-type-switcher')).nativeElement; + const itemTypeSwitcher = fixture.debugElement.query(By.css('ds-listable-object-component-loader')).nativeElement; expect(itemTypeSwitcher.object).toBe(mockItemMetadataRepresentation); }); 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 68eb27c93a..bef18a5c1a 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 @@ -24,8 +24,8 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista providers: [Location, { provide: LocationStrategy, useClass: PathLocationStrategy }] }) -@listableObjectComponent(ClaimedTaskMyDSpaceResult, ViewMode.ListElement) -@listableObjectComponent(ClaimedTask, ViewMode.ListElement) +@listableObjectComponent(ClaimedTaskMyDSpaceResult.name, ViewMode.ListElement) +@listableObjectComponent(ClaimedTask.name, ViewMode.ListElement) export class ClaimedMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent { /** diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.ts index 8d3fd00eaa..5304138587 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.ts @@ -6,6 +6,7 @@ import { ItemMyDSpaceResult } from '../../../object-collection/shared/item-my-ds import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; import { ViewMode } from '../../../../core/shared/view-mode.model'; import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator'; +import { Context } from '../../../../core/shared/context.model'; /** * This component renders item object for the mydspace result in the list view. @@ -16,7 +17,7 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: './item-my-dspace-result-list-element.component.html' }) -@listableObjectComponent(ItemMyDSpaceResult, ViewMode.ListElement) +@listableObjectComponent('PublicationSearchResult', ViewMode.ListElement, Context.Submission) export class ItemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent { /** 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 1f9499f6aa..46dfd583e0 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 @@ -13,6 +13,7 @@ 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'; import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator'; +import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model'; /** * This component renders pool task object for the mydspace result in the list view. @@ -23,8 +24,8 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: './pool-my-dspace-result-list-element.component.html', }) -@listableObjectComponent(PoolTaskMyDSpaceResult, ViewMode.ListElement) -@listableObjectComponent(PoolTask, ViewMode.ListElement) +@listableObjectComponent(PoolTaskMyDSpaceResult.name, ViewMode.ListElement) +@listableObjectComponent(PoolTask.name, ViewMode.ListElement) export class PoolMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent implements OnInit { /** 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 5ec7572984..97c1695c29 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 @@ -22,8 +22,8 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: './workflowitem-my-dspace-result-list-element.component.html', }) -@listableObjectComponent(WorkflowitemMyDSpaceResult, ViewMode.ListElement) -@listableObjectComponent(WorkflowItem, ViewMode.ListElement) +@listableObjectComponent(WorkflowitemMyDSpaceResult.name, ViewMode.ListElement) +@listableObjectComponent(WorkflowItem.name, ViewMode.ListElement) export class WorkflowitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent { /** 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 e88ea54703..a886e90737 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 @@ -22,7 +22,7 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: './workspaceitem-my-dspace-result-list-element.component.html', }) -@listableObjectComponent(WorkspaceitemMyDSpaceResult, ViewMode.ListElement) +@listableObjectComponent(WorkspaceitemMyDSpaceResult.name, ViewMode.ListElement) export class WorkspaceitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent { /** diff --git a/src/app/shared/object-list/object-list.component.html b/src/app/shared/object-list/object-list.component.html index 1fdc06d5bf..b19daa035a 100644 --- a/src/app/shared/object-list/object-list.component.html +++ b/src/app/shared/object-list/object-list.component.html @@ -12,7 +12,7 @@ (paginationChange)="onPaginationChange($event)">
  • - +
diff --git a/src/app/shared/object-list/object-list.component.ts b/src/app/shared/object-list/object-list.component.ts index afc376034f..cf4728464a 100644 --- a/src/app/shared/object-list/object-list.component.ts +++ b/src/app/shared/object-list/object-list.component.ts @@ -12,6 +12,7 @@ import { RemoteData } from '../../core/data/remote-data'; import { fadeIn } from '../animations/fade'; import { ListableObject } from '../object-collection/shared/listable-object.model'; import { PaginationComponentOptions } from '../pagination/pagination-component-options.model'; +import { ViewMode } from '../../core/shared/view-mode.model'; @Component({ changeDetection: ChangeDetectionStrategy.Default, @@ -22,7 +23,7 @@ import { PaginationComponentOptions } from '../pagination/pagination-component-o animations: [fadeIn] }) export class ObjectListComponent { - + viewMode = ViewMode.ListElement; @Input() config: PaginationComponentOptions; @Input() sortConfig: SortOptions; @Input() hasBorder = false; diff --git a/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.ts b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.ts index 384e1c1f81..1a678dddb7 100644 --- a/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.ts +++ b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.ts @@ -6,6 +6,7 @@ import { Collection } from '../../../../core/shared/collection.model'; import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model'; import { ViewMode } from '../../../../core/shared/view-mode.model'; import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator'; +import { BrowseEntry } from '../../../../core/shared/browse-entry.model'; @Component({ selector: 'ds-collection-search-result-list-element', @@ -13,5 +14,5 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: 'collection-search-result-list-element.component.html' }) -@listableObjectComponent(CollectionSearchResult, ViewMode.ListElement) +@listableObjectComponent(CollectionSearchResult.name, ViewMode.ListElement) export class CollectionSearchResultListElementComponent extends SearchResultListElementComponent {} diff --git a/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.ts b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.ts index 3281e380e4..fd3bba85e9 100644 --- a/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.ts +++ b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.ts @@ -6,6 +6,7 @@ import { Community } from '../../../../core/shared/community.model'; import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model'; import { ViewMode } from '../../../../core/shared/view-mode.model'; import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator'; +import { BrowseEntry } from '../../../../core/shared/browse-entry.model'; @Component({ selector: 'ds-community-search-result-list-element', @@ -13,7 +14,7 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista templateUrl: 'community-search-result-list-element.component.html' }) -@listableObjectComponent(CommunitySearchResult, ViewMode.ListElement) +@listableObjectComponent(CommunitySearchResult.name, ViewMode.ListElement) export class CommunitySearchResultListElementComponent extends SearchResultListElementComponent { } diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html deleted file mode 100644 index 901ce441bf..0000000000 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html +++ /dev/null @@ -1,2 +0,0 @@ - - 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 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.spec.ts b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.spec.ts deleted file mode 100644 index 8f41018404..0000000000 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.spec.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { ItemSearchResultListElementComponent } from './item-search-result-list-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { of as observableOf } from 'rxjs'; -import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { By } from '@angular/platform-browser'; -import { TruncatePipe } from '../../../utils/truncate.pipe'; -import { Item } from '../../../../core/shared/item.model'; -import { TruncatableService } from '../../../truncatable/truncatable.service'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; -import { TranslateModule } from '@ngx-translate/core'; - -let itemSearchResultListElementComponent: ItemSearchResultListElementComponent; -let fixture: ComponentFixture; - -const truncatableServiceStub: any = { - isCollapsed: (id: number) => observableOf(true), -}; - -const type = 'authorOfPublication'; - -const mockItemWithRelationshipType: ItemSearchResult = new ItemSearchResult(); -mockItemWithRelationshipType.hitHighlights = {}; -mockItemWithRelationshipType.indexableObject = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'relationship.type': [ - { - language: 'en_US', - value: type - } - ] - } -}); - -describe('ItemSearchResultListElementComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), NoopAnimationsModule], - declarations: [ItemSearchResultListElementComponent, TruncatePipe], - providers: [ - { provide: TruncatableService, useValue: truncatableServiceStub }, - { provide: 'objectElementProvider', useValue: (mockItemWithRelationshipType) } - ], - schemas: [NO_ERRORS_SCHEMA] - }).overrideComponent(ItemSearchResultListElementComponent, { - set: { changeDetection: ChangeDetectionStrategy.Default } - }).compileComponents(); - })); - - beforeEach(async(() => { - fixture = TestBed.createComponent(ItemSearchResultListElementComponent); - itemSearchResultListElementComponent = fixture.componentInstance; - })); - - it('should show a badge on top of the list element', () => { - const badge = fixture.debugElement.query(By.css('ds-item-type-badge')).componentInstance; - expect(badge.object).toBe(mockItemWithRelationshipType); - }); -}); diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts deleted file mode 100644 index 0b25443454..0000000000 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component } from '@angular/core'; -import { Item } from '../../../../core/shared/item.model'; -import { focusBackground } from '../../../animations/focus'; - -import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; -import { SearchResultListElementComponent } from '../search-result-list-element.component'; -import { ViewMode } from '../../../../core/shared/view-mode.model'; -import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator'; - -@Component({ - selector: 'ds-item-search-result-list-element', - styleUrls: ['../search-result-list-element.component.scss', 'item-search-result-list-element.component.scss'], - templateUrl: 'item-search-result-list-element.component.html', - animations: [focusBackground], - -}) - -@listableObjectComponent(ItemSearchResult, ViewMode.ListElement) -export class ItemSearchResultListElementComponent extends SearchResultListElementComponent { - viewMode = ViewMode.ListElement; - -} diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/publication/publication-search-result-list-element.component.html b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/publication/publication-search-result-list-element.component.html index 2d42fb611d..7fbb2c3c79 100644 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/publication/publication-search-result-list-element.component.html +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/publication/publication-search-result-list-element.component.html @@ -1,12 +1,14 @@ - - - + + + + + (, , ) -
- - -
-
+
+ + +
+
\ No newline at end of file diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 8aa5bf0fdd..187de7726c 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -22,12 +22,10 @@ import { ConsolePipe } from './utils/console.pipe'; import { CollectionListElementComponent } from './object-list/collection-list-element/collection-list-element.component'; import { CommunityListElementComponent } from './object-list/community-list-element/community-list-element.component'; -import { ItemListElementComponent } from './object-list/item-list-element/item-list-element.component'; import { SearchResultListElementComponent } from './object-list/search-result-list-element/search-result-list-element.component'; import { ObjectListComponent } from './object-list/object-list.component'; import { CollectionGridElementComponent } from './object-grid/collection-grid-element/collection-grid-element.component'; import { CommunityGridElementComponent } from './object-grid/community-grid-element/community-grid-element.component'; -import { ItemGridElementComponent } from './object-grid/item-grid-element/item-grid-element.component'; import { AbstractListableElementComponent } from './object-collection/shared/object-collection-element/abstract-listable-element.component'; import { ObjectGridComponent } from './object-grid/object-grid.component'; import { ObjectCollectionComponent } from './object-collection/object-collection.component'; @@ -122,7 +120,6 @@ import { CreateItemParentSelectorComponent } from './dso-selector/modal-wrappers import { CreateCollectionParentSelectorComponent } from './dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component'; import { CommunitySearchResultListElementComponent } from './object-list/search-result-list-element/community-search-result/community-search-result-list-element.component'; import { CollectionSearchResultListElementComponent } from './object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component'; -import { ItemSearchResultListElementComponent } from './object-list/search-result-list-element/item-search-result/item-search-result-list-element.component'; import { EditItemSelectorComponent } from './dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component'; import { EditCommunitySelectorComponent } from './dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component'; import { EditCollectionSelectorComponent } from './dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component'; @@ -142,6 +139,7 @@ import { MetadataRepresentationDirective } from './metadata-representation/metad import { ListableObjectComponentLoaderComponent } from './object-collection/shared/listable-object/listable-object-component-loader.component'; import { PublicationSearchResultListElementComponent } from './object-list/search-result-list-element/item-search-result/item-types/publication/publication-search-result-list-element.component'; import { PublicationSearchResultGridElementComponent } from './object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component'; +import { ListableObjectDirective } from './object-collection/shared/listable-object/listable-object.directive'; const MODULES = [ // Do NOT include UniversalModule, HttpModule, or JsonpModule here @@ -256,7 +254,6 @@ const COMPONENTS = [ EditItemSelectorComponent, CommunitySearchResultListElementComponent, CollectionSearchResultListElementComponent, - ItemSearchResultListElementComponent, ListableObjectComponentLoaderComponent, BrowseByComponent, ItemTypeBadgeComponent, @@ -265,15 +262,12 @@ const COMPONENTS = [ const ENTRY_COMPONENTS = [ // put shared entry components (components that are created dynamically) here - ItemListElementComponent, CollectionListElementComponent, CommunityListElementComponent, MyDSpaceResultListElementComponent, SearchResultListElementComponent, CommunitySearchResultListElementComponent, CollectionSearchResultListElementComponent, - ItemSearchResultListElementComponent, - ItemGridElementComponent, CollectionGridElementComponent, CommunityGridElementComponent, SearchResultGridElementComponent, @@ -332,7 +326,8 @@ const DIRECTIVES = [ InListValidator, AutoFocusDirective, RoleDirective, - MetadataRepresentationDirective + MetadataRepresentationDirective, + ListableObjectDirective ]; @NgModule({ diff --git a/themes/mantis/app/+item-page/simple/item-page.component.html b/themes/mantis/app/+item-page/simple/item-page.component.html index 472df7c78e..83f910e0cd 100644 --- a/themes/mantis/app/+item-page/simple/item-page.component.html +++ b/themes/mantis/app/+item-page/simple/item-page.component.html @@ -1,7 +1,7 @@
- +