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:
Tim Donohue
2021-04-02 09:22:53 -05:00
committed by GitHub
33 changed files with 61 additions and 61 deletions

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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(),

View File

@@ -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(

View File

@@ -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);
}

View File

@@ -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>

View File

@@ -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'

View File

@@ -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();
}

View File

@@ -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'));
});
});
}

View File

@@ -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');
}
/**

View File

@@ -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(), {

View File

@@ -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) => {

View File

@@ -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> {

View File

@@ -157,7 +157,7 @@
"place": 0
}
],
"relationship.type": [
"dspace.entity.type": [
{
"value": "Publication",
"language": null,

View File

@@ -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>)[],

View File

@@ -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'

View File

@@ -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();
});

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",