mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge pull request #1055 from tdonohue/entity_type_storage
(Angular UI) Rename / move 'relationship.type' metadata field to 'dspace.entity.type'
This commit is contained in:
@@ -61,7 +61,7 @@ export class ItemAdminSearchResultGridElementComponent extends SearchResultGridE
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the component depending on the item's relationship type, view mode and context
|
||||
* Fetch the component depending on the item's entity type, view mode and context
|
||||
* @returns {GenericConstructor<Component>}
|
||||
*/
|
||||
private getComponent(): GenericConstructor<Component> {
|
||||
|
@@ -96,7 +96,7 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the component depending on the item's relationship type, view mode and context
|
||||
* Fetch the component depending on the item's entity type, view mode and context
|
||||
* @returns {GenericConstructor<Component>}
|
||||
*/
|
||||
private getComponent(item: Item): GenericConstructor<Component> {
|
||||
|
@@ -112,7 +112,7 @@ export class ItemDeleteComponent
|
||||
super.ngOnInit();
|
||||
this.url = this.router.url;
|
||||
|
||||
const label = this.item.firstMetadataValue('relationship.type');
|
||||
const label = this.item.firstMetadataValue('dspace.entity.type');
|
||||
if (label !== undefined) {
|
||||
this.types$ = this.entityTypeService.getEntityTypeByLabel(label).pipe(
|
||||
getFirstSucceededRemoteData(),
|
||||
|
@@ -75,7 +75,7 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent {
|
||||
*/
|
||||
public initializeUpdates(): void {
|
||||
|
||||
const label = this.item.firstMetadataValue('relationship.type');
|
||||
const label = this.item.firstMetadataValue('dspace.entity.type');
|
||||
if (label !== undefined) {
|
||||
|
||||
this.entityType$ = this.entityTypeService.getEntityTypeByLabel(label).pipe(
|
||||
|
@@ -10,11 +10,11 @@ export function getItemModuleRoute() {
|
||||
|
||||
/**
|
||||
* Get the route to an item's page
|
||||
* Depending on the item's relationship type, the route will either start with /items or /entities
|
||||
* Depending on the item's entity type, the route will either start with /items or /entities
|
||||
* @param item The item to retrieve the route for
|
||||
*/
|
||||
export function getItemPageRoute(item: Item) {
|
||||
const type = item.firstMetadataValue('relationship.type');
|
||||
const type = item.firstMetadataValue('dspace.entity.type');
|
||||
return getEntityPageRoute(type, item.uuid);
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<h2 class="item-page-title-field">
|
||||
<div *ngIf="item.firstMetadataValue('relationship.type') as type">
|
||||
<div *ngIf="item.firstMetadataValue('dspace.entity.type') as type">
|
||||
{{ type.toLowerCase() + '.page.titleprefix' | translate }}
|
||||
</div>
|
||||
<ds-metadata-values [mdValues]="item?.allMetadata(fields)"></ds-metadata-values>
|
||||
|
@@ -120,7 +120,7 @@ describe('DsoRedirectDataService', () => {
|
||||
it('should navigate to entities route with the corresponding entity type', () => {
|
||||
remoteData.payload.type = 'item';
|
||||
remoteData.payload.metadata = {
|
||||
'relationship.type': [
|
||||
'dspace.entity.type': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'Publication'
|
||||
|
@@ -104,7 +104,7 @@ export class Item extends DSpaceObject implements ChildHALResource {
|
||||
* Method that returns as which type of object this object should be rendered
|
||||
*/
|
||||
getRenderTypes(): (string | GenericConstructor<ListableObject>)[] {
|
||||
const entityType = this.firstMetadataValue('relationship.type');
|
||||
const entityType = this.firstMetadataValue('dspace.entity.type');
|
||||
if (isEmpty(entityType)) {
|
||||
return super.getRenderTypes();
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ describe('ItemMetadataRepresentation', () => {
|
||||
for (const metadataField of Object.keys(item.metadata)) {
|
||||
describe(`when creating an ItemMetadataRepresentation`, () => {
|
||||
beforeEach(() => {
|
||||
item.metadata['relationship.type'] = [
|
||||
item.metadata['dspace.entity.type'] = [
|
||||
Object.assign(new MetadataValue(), {
|
||||
value: itemType
|
||||
})
|
||||
@@ -41,7 +41,7 @@ describe('ItemMetadataRepresentation', () => {
|
||||
});
|
||||
|
||||
it('should return the correct item type', () => {
|
||||
expect(itemMetadataRepresentation.itemType).toEqual(item.firstMetadataValue('relationship.type'));
|
||||
expect(itemMetadataRepresentation.itemType).toEqual(item.firstMetadataValue('dspace.entity.type'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ export class ItemMetadataRepresentation extends Item implements MetadataRepresen
|
||||
* The type of item this item can be represented as
|
||||
*/
|
||||
get itemType(): string {
|
||||
return this.firstMetadataValue('relationship.type');
|
||||
return this.firstMetadataValue('dspace.entity.type');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -66,12 +66,12 @@ describe('RelationshipEffects', () => {
|
||||
|
||||
leftItem = Object.assign(new Item(), {
|
||||
uuid: testUUID1,
|
||||
metadata: { 'relationship.type': [leftTypeMD] }
|
||||
metadata: { 'dspace.entity.type': [leftTypeMD] }
|
||||
});
|
||||
|
||||
rightItem = Object.assign(new Item(), {
|
||||
uuid: testUUID2,
|
||||
metadata: { 'relationship.type': [rightTypeMD] }
|
||||
metadata: { 'dspace.entity.type': [rightTypeMD] }
|
||||
});
|
||||
|
||||
relationshipType = Object.assign(new RelationshipType(), {
|
||||
|
@@ -167,8 +167,8 @@ export class RelationshipEffects {
|
||||
}
|
||||
|
||||
private addRelationship(item1: Item, item2: Item, relationshipType: string, submissionId: string, nameVariant?: string) {
|
||||
const type1: string = item1.firstMetadataValue('relationship.type');
|
||||
const type2: string = item2.firstMetadataValue('relationship.type');
|
||||
const type1: string = item1.firstMetadataValue('dspace.entity.type');
|
||||
const type2: string = item2.firstMetadataValue('dspace.entity.type');
|
||||
return this.relationshipTypeService.getRelationshipTypeByLabelAndTypes(relationshipType, type1, type2)
|
||||
.pipe(
|
||||
mergeMap((type: RelationshipType) => {
|
||||
|
@@ -14,7 +14,7 @@ import { ThemeService } from '../theme-support/theme.service';
|
||||
templateUrl: './metadata-representation-loader.component.html'
|
||||
})
|
||||
/**
|
||||
* Component for determining what component to use depending on the item's relationship type (relationship.type), its metadata representation and, optionally, its context
|
||||
* Component for determining what component to use depending on the item's entity type (dspace.entity.type), its metadata representation and, optionally, its context
|
||||
*/
|
||||
export class MetadataRepresentationLoaderComponent implements OnInit {
|
||||
private componentRefInstance: MetadataRepresentationListElementComponent;
|
||||
@@ -64,7 +64,7 @@ export class MetadataRepresentationLoaderComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the component depending on the item's relationship type, metadata representation type and context
|
||||
* Fetch the component depending on the item's entity type, metadata representation type and context
|
||||
* @returns {string}
|
||||
*/
|
||||
private getComponent(): GenericConstructor<MetadataRepresentationListElementComponent> {
|
||||
|
@@ -157,7 +157,7 @@
|
||||
"place": 0
|
||||
}
|
||||
],
|
||||
"relationship.type": [
|
||||
"dspace.entity.type": [
|
||||
{
|
||||
"value": "Publication",
|
||||
"language": null,
|
||||
|
@@ -27,7 +27,7 @@ import { ThemeService } from '../../../theme-support/theme.service';
|
||||
templateUrl: './listable-object-component-loader.component.html'
|
||||
})
|
||||
/**
|
||||
* Component for determining what component to use depending on the item's relationship type (relationship.type)
|
||||
* Component for determining what component to use depending on the item's entity type (dspace.entity.type)
|
||||
*/
|
||||
export class ListableObjectComponentLoaderComponent implements OnInit, OnDestroy {
|
||||
/**
|
||||
@@ -179,7 +179,7 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnDestroy
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the component depending on the item's relationship type, view mode and context
|
||||
* Fetch the component depending on the item's entity type, view mode and context
|
||||
* @returns {GenericConstructor<Component>}
|
||||
*/
|
||||
getComponent(renderTypes: (string | GenericConstructor<ListableObject>)[],
|
||||
|
@@ -57,7 +57,7 @@ const mockItemWithEntityType: Item = Object.assign(new Item(), {
|
||||
value: 'This is just another title'
|
||||
}
|
||||
],
|
||||
'relationship.type': [
|
||||
'dspace.entity.type': [
|
||||
{
|
||||
language: null,
|
||||
value: 'Publication'
|
||||
|
@@ -12,10 +12,10 @@ let fixture: ComponentFixture<TypeBadgeComponent>;
|
||||
|
||||
const type = 'authorOfPublication';
|
||||
|
||||
const mockItemWithRelationshipType = Object.assign(new Item(), {
|
||||
const mockItemWithEntityType = Object.assign(new Item(), {
|
||||
bundles: observableOf({}),
|
||||
metadata: {
|
||||
'relationship.type': [
|
||||
'dspace.entity.type': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: type
|
||||
@@ -24,7 +24,7 @@ const mockItemWithRelationshipType = Object.assign(new Item(), {
|
||||
}
|
||||
});
|
||||
|
||||
const mockItemWithoutRelationshipType = Object.assign(new Item(), {
|
||||
const mockItemWithoutEntityType = Object.assign(new Item(), {
|
||||
bundles: observableOf({}),
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
@@ -52,21 +52,21 @@ describe('ItemTypeBadgeComponent', () => {
|
||||
comp = fixture.componentInstance;
|
||||
}));
|
||||
|
||||
describe('When the item has a relationship type', () => {
|
||||
describe('When the item has an entity type', () => {
|
||||
beforeEach(() => {
|
||||
comp.object = mockItemWithRelationshipType;
|
||||
comp.object = mockItemWithEntityType;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the relationship type badge', () => {
|
||||
it('should show the entity type badge', () => {
|
||||
const badge = fixture.debugElement.query(By.css('span.badge'));
|
||||
expect(badge.nativeElement.textContent).toContain(type.toLowerCase());
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the item has no relationship type', () => {
|
||||
describe('When the item has no entity type', () => {
|
||||
beforeEach(() => {
|
||||
comp.object = mockItemWithoutRelationshipType;
|
||||
comp.object = mockItemWithoutEntityType;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@@ -3180,9 +3180,9 @@
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.save-button": "Save",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -3120,9 +3120,9 @@
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.save-button": "Save",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -2789,9 +2789,9 @@
|
||||
// "item.edit.relationships.save-button": "Save",
|
||||
"item.edit.relationships.save-button": "Speichern",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -1711,7 +1711,7 @@
|
||||
|
||||
"item.edit.relationships.save-button": "Save",
|
||||
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
"item.edit.return": "Back",
|
||||
|
@@ -2861,9 +2861,9 @@
|
||||
// "item.edit.relationships.save-button": "Save",
|
||||
"item.edit.relationships.save-button": "Guardar",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -2625,9 +2625,9 @@
|
||||
// "item.edit.relationships.save-button": "Save",
|
||||
"item.edit.relationships.save-button": "Tallenna",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -2864,9 +2864,9 @@
|
||||
// "item.edit.relationships.save-button": "Save",
|
||||
"item.edit.relationships.save-button": "Sauvegarder",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -2430,8 +2430,8 @@
|
||||
// "item.edit.relationships.save-button": "Save",
|
||||
"item.edit.relationships.save-button": "Mentés",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Adja hozzá a 'relationship.type' metaadatot ezen elem hivatkozásánek engedélyezéséhez",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Adja hozzá a 'dspace.entity.type' metaadatot ezen elem hivatkozásánek engedélyezéséhez",
|
||||
|
||||
|
||||
|
||||
|
@@ -3180,9 +3180,9 @@
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.save-button": "Save",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -2620,9 +2620,9 @@
|
||||
// "item.edit.relationships.save-button": "Save",
|
||||
"item.edit.relationships.save-button": "Saglabāt",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -2860,9 +2860,9 @@
|
||||
// "item.edit.relationships.save-button": "Save",
|
||||
"item.edit.relationships.save-button": "Opslaan",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -3180,9 +3180,9 @@
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.save-button": "Save",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -2818,9 +2818,9 @@
|
||||
// "item.edit.relationships.save-button": "Save",
|
||||
"item.edit.relationships.save-button": "Salvar",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -2818,9 +2818,9 @@
|
||||
// "item.edit.relationships.save-button": "Save",
|
||||
"item.edit.relationships.save-button": "Salvar",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -3180,9 +3180,9 @@
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.save-button": "Save",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
@@ -3180,9 +3180,9 @@
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.save-button": "Save",
|
||||
|
||||
// "item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
// "item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
// TODO New key - Add a translation
|
||||
"item.edit.relationships.no-entity-type": "Add 'relationship.type' metadata to enable relationships for this item",
|
||||
"item.edit.relationships.no-entity-type": "Add 'dspace.entity.type' metadata to enable relationships for this item",
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user