mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
50434: Feedback 2018/03/16
This commit is contained in:
@@ -129,28 +129,23 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"title": "DSpace Angular :: Metadata Registry",
|
"title": "DSpace Angular :: Metadata Registry",
|
||||||
"head": "Metadata Registry",
|
"head": "Metadata Registry",
|
||||||
"description": "The metadata registry maintains a list of all metadata fields available in the repository. These fields may be divided amongst multiple schemas. However, DSpace requires the qualified Dublin Core schema. You may extend the Dublin Core schema with additional fields or add new schemas to the registry.",
|
"description": "The metadata registry maintains a list of all metadata fields available in the repository. These fields may be divided amongst multiple schemas. However, DSpace requires the qualified Dublin Core schema.",
|
||||||
"schemas": {
|
"schemas": {
|
||||||
"table": {
|
"table": {
|
||||||
"namespace": "Namespace",
|
"namespace": "Namespace",
|
||||||
"name": "Name",
|
"name": "Name"
|
||||||
"caption": "List of metadata schemas"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
"title": "DSpace Angular :: Metadata Schema",
|
"title": "DSpace Angular :: Metadata Schema",
|
||||||
"head": "Metadata Schema",
|
"head": "Metadata Schema",
|
||||||
"description": {
|
"description": "This is the metadata schema for \"{{namespace}}\".",
|
||||||
"part1": "This is the metadata schema for",
|
|
||||||
"part2": "You may add new or update existing metadata fields to this schema. Fields may also be selected for deletion or be moved to another schema."
|
|
||||||
},
|
|
||||||
"fields": {
|
"fields": {
|
||||||
"head": "Schema metadata fields",
|
"head": "Schema metadata fields",
|
||||||
"table": {
|
"table": {
|
||||||
"field": "Field",
|
"field": "Field",
|
||||||
"scopenote": "Scope Note",
|
"scopenote": "Scope Note"
|
||||||
"caption": "List of metadata fields"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="metadata-schemas" class="table table-striped table-hover">
|
<table id="metadata-schemas" class="table table-striped table-hover">
|
||||||
<caption>{{'admin.registries.metadata.schemas.table.caption' | translate}}</caption>
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{{'admin.registries.metadata.schemas.table.namespace' | translate}}</th>
|
<th scope="col">{{'admin.registries.metadata.schemas.table.namespace' | translate}}</th>
|
@@ -15,14 +15,14 @@ describe('MetadataRegistryComponent', () => {
|
|||||||
let metadataRegistryService: MetadataRegistryService;
|
let metadataRegistryService: MetadataRegistryService;
|
||||||
const mockSchemasList = [
|
const mockSchemasList = [
|
||||||
{
|
{
|
||||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1",
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
||||||
"prefix": "dc",
|
prefix: 'dc',
|
||||||
"namespace": "http://dublincore.org/documents/dcmi-terms/"
|
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2",
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
||||||
"prefix": "mock",
|
prefix: 'mock',
|
||||||
"namespace": "http://dspace.org/mockschema"
|
namespace: 'http://dspace.org/mockschema'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const mockSchemas = Observable.of(new RemoteData(false, false, true, undefined, new PaginatedList(null, mockSchemasList)));
|
const mockSchemas = Observable.of(new RemoteData(false, false, true, undefined, new PaginatedList(null, mockSchemasList)));
|
||||||
@@ -48,15 +48,15 @@ describe('MetadataRegistryComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should contain two schemas', () => {
|
it('should contain two schemas', () => {
|
||||||
let tbody: HTMLElement = fixture.debugElement.query(By.css('#metadata-schemas>tbody')).nativeElement;
|
const tbody: HTMLElement = fixture.debugElement.query(By.css('#metadata-schemas>tbody')).nativeElement;
|
||||||
expect(tbody.children.length).toBe(2);
|
expect(tbody.children.length).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should contain the correct schemas', () => {
|
it('should contain the correct schemas', () => {
|
||||||
let dcName: HTMLElement = fixture.debugElement.query(By.css('#metadata-schemas tr:nth-child(1) td:nth-child(2)')).nativeElement;
|
const dcName: HTMLElement = fixture.debugElement.query(By.css('#metadata-schemas tr:nth-child(1) td:nth-child(2)')).nativeElement;
|
||||||
expect(dcName.textContent).toBe('dc');
|
expect(dcName.textContent).toBe('dc');
|
||||||
|
|
||||||
let mockName: HTMLElement = fixture.debugElement.query(By.css('#metadata-schemas tr:nth-child(2) td:nth-child(2)')).nativeElement;
|
const mockName: HTMLElement = fixture.debugElement.query(By.css('#metadata-schemas tr:nth-child(2) td:nth-child(2)')).nativeElement;
|
||||||
expect(mockName.textContent).toBe('mock');
|
expect(mockName.textContent).toBe('mock');
|
||||||
});
|
});
|
||||||
|
|
@@ -4,15 +4,11 @@
|
|||||||
|
|
||||||
<h2 id="header" class="border-bottom pb-2">{{'admin.registries.schema.head' | translate}}: "{{(metadataSchema | async)?.payload?.prefix}}"</h2>
|
<h2 id="header" class="border-bottom pb-2">{{'admin.registries.schema.head' | translate}}: "{{(metadataSchema | async)?.payload?.prefix}}"</h2>
|
||||||
|
|
||||||
<p id="description" class="pb-2">
|
<p id="description" class="pb-2">{{'admin.registries.schema.description' | translate:namespace }}</p>
|
||||||
{{'admin.registries.schema.description.part1' | translate}} "{{(metadataSchema | async)?.payload?.namespace}}".
|
|
||||||
{{'admin.registries.schema.description.part2' | translate}}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h3>{{'admin.registries.schema.fields.head' | translate}}</h3>
|
<h3>{{'admin.registries.schema.fields.head' | translate}}</h3>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="metadata-fields" class="table table-striped table-hover">
|
<table id="metadata-fields" class="table table-striped table-hover">
|
||||||
<caption>{{'admin.registries.schema.fields.table.caption' | translate}}</caption>
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{{'admin.registries.schema.fields.table.field' | translate}}</th>
|
<th scope="col">{{'admin.registries.schema.fields.table.field' | translate}}</th>
|
@@ -5,10 +5,11 @@ import { Observable } from 'rxjs/Observable';
|
|||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||||
import { MetadataSchema } from '../../../core/metadata/metadataschema.model';
|
import { MetadataSchema } from '../../../core/metadata/metadataschema.model';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { MockTranslateLoader } from '../../../shared/testing/mock-translate-loader';
|
||||||
|
|
||||||
describe('MetadataSchemaComponent', () => {
|
describe('MetadataSchemaComponent', () => {
|
||||||
let comp: MetadataSchemaComponent;
|
let comp: MetadataSchemaComponent;
|
||||||
@@ -16,51 +17,51 @@ describe('MetadataSchemaComponent', () => {
|
|||||||
let metadataRegistryService: MetadataRegistryService;
|
let metadataRegistryService: MetadataRegistryService;
|
||||||
const mockSchemasList = [
|
const mockSchemasList = [
|
||||||
{
|
{
|
||||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1",
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
||||||
"prefix": "dc",
|
prefix: 'dc',
|
||||||
"namespace": "http://dublincore.org/documents/dcmi-terms/"
|
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2",
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
||||||
"prefix": "mock",
|
prefix: 'mock',
|
||||||
"namespace": "http://dspace.org/mockschema"
|
namespace: 'http://dspace.org/mockschema'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const mockFieldsList = [
|
const mockFieldsList = [
|
||||||
{
|
{
|
||||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/8",
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/8',
|
||||||
"element": "contributor",
|
element: 'contributor',
|
||||||
"qualifier": "advisor",
|
qualifier: 'advisor',
|
||||||
"scopenote": null,
|
scopenote: null,
|
||||||
"schema": mockSchemasList[0]
|
schema: mockSchemasList[0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/9",
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/9',
|
||||||
"element": "contributor",
|
element: 'contributor',
|
||||||
"qualifier": "author",
|
qualifier: 'author',
|
||||||
"scopenote": null,
|
scopenote: null,
|
||||||
"schema": mockSchemasList[0]
|
schema: mockSchemasList[0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/10",
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/10',
|
||||||
"element": "contributor",
|
element: 'contributor',
|
||||||
"qualifier": "editor",
|
qualifier: 'editor',
|
||||||
"scopenote": "test scope note",
|
scopenote: 'test scope note',
|
||||||
"schema": mockSchemasList[1]
|
schema: mockSchemasList[1]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/11",
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/11',
|
||||||
"element": "contributor",
|
element: 'contributor',
|
||||||
"qualifier": "illustrator",
|
qualifier: 'illustrator',
|
||||||
"scopenote": null,
|
scopenote: null,
|
||||||
"schema": mockSchemasList[1]
|
schema: mockSchemasList[1]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const mockSchemas = Observable.of(new RemoteData(false, false, true, undefined, new PaginatedList(null, mockSchemasList)));
|
const mockSchemas = Observable.of(new RemoteData(false, false, true, undefined, new PaginatedList(null, mockSchemasList)));
|
||||||
const metadataRegistryServiceStub = {
|
const metadataRegistryServiceStub = {
|
||||||
getMetadataSchemas: () => mockSchemas,
|
getMetadataSchemas: () => mockSchemas,
|
||||||
getMetadataFieldsBySchema: (schema: MetadataSchema) => Observable.of(new RemoteData(false, false, true, undefined, new PaginatedList(null, mockFieldsList.filter((value) => value.schema == schema)))),
|
getMetadataFieldsBySchema: (schema: MetadataSchema) => Observable.of(new RemoteData(false, false, true, undefined, new PaginatedList(null, mockFieldsList.filter((value) => value.schema === schema)))),
|
||||||
getMetadataSchemaByName: (schemaName: string) => Observable.of(new RemoteData(false, false, true, undefined, mockSchemasList.filter((value) => value.prefix == schemaName)[0]))
|
getMetadataSchemaByName: (schemaName: string) => Observable.of(new RemoteData(false, false, true, undefined, mockSchemasList.filter((value) => value.prefix === schemaName)[0]))
|
||||||
};
|
};
|
||||||
const schemaNameParam = 'mock';
|
const schemaNameParam = 'mock';
|
||||||
const activatedRouteStub = {
|
const activatedRouteStub = {
|
||||||
@@ -88,25 +89,20 @@ describe('MetadataSchemaComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should contain the schema prefix in the header', () => {
|
it('should contain the schema prefix in the header', () => {
|
||||||
let header: HTMLElement = fixture.debugElement.query(By.css('.metadata-schema #header')).nativeElement;
|
const header: HTMLElement = fixture.debugElement.query(By.css('.metadata-schema #header')).nativeElement;
|
||||||
expect(header.textContent).toContain('mock');
|
expect(header.textContent).toContain('mock');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should contain the schema namespace in the description', () => {
|
|
||||||
let description: HTMLElement = fixture.debugElement.query(By.css('.metadata-schema #description')).nativeElement;
|
|
||||||
expect(description.textContent).toContain('http://dspace.org/mockschema');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should contain two fields', () => {
|
it('should contain two fields', () => {
|
||||||
let tbody: HTMLElement = fixture.debugElement.query(By.css('#metadata-fields>tbody')).nativeElement;
|
const tbody: HTMLElement = fixture.debugElement.query(By.css('#metadata-fields>tbody')).nativeElement;
|
||||||
expect(tbody.children.length).toBe(2);
|
expect(tbody.children.length).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should contain the correct fields', () => {
|
it('should contain the correct fields', () => {
|
||||||
let editorField: HTMLElement = fixture.debugElement.query(By.css('#metadata-fields tr:nth-child(1) td:nth-child(1)')).nativeElement;
|
const editorField: HTMLElement = fixture.debugElement.query(By.css('#metadata-fields tr:nth-child(1) td:nth-child(1)')).nativeElement;
|
||||||
expect(editorField.textContent).toBe('mock.contributor.editor');
|
expect(editorField.textContent).toBe('mock.contributor.editor');
|
||||||
|
|
||||||
let illustratorField: HTMLElement = fixture.debugElement.query(By.css('#metadata-fields tr:nth-child(2) td:nth-child(1)')).nativeElement;
|
const illustratorField: HTMLElement = fixture.debugElement.query(By.css('#metadata-fields tr:nth-child(2) td:nth-child(1)')).nativeElement;
|
||||||
expect(illustratorField.textContent).toBe('mock.contributor.illustrator');
|
expect(illustratorField.textContent).toBe('mock.contributor.illustrator');
|
||||||
});
|
});
|
||||||
});
|
});
|
@@ -13,6 +13,8 @@ import { MetadataSchema } from '../../../core/metadata/metadataschema.model';
|
|||||||
})
|
})
|
||||||
export class MetadataSchemaComponent implements OnInit {
|
export class MetadataSchemaComponent implements OnInit {
|
||||||
|
|
||||||
|
namespace;
|
||||||
|
|
||||||
metadataSchema: Observable<RemoteData<MetadataSchema>>;
|
metadataSchema: Observable<RemoteData<MetadataSchema>>;
|
||||||
metadataFields: Observable<RemoteData<PaginatedList<MetadataField>>>;
|
metadataFields: Observable<RemoteData<PaginatedList<MetadataField>>>;
|
||||||
|
|
||||||
@@ -29,8 +31,9 @@ export class MetadataSchemaComponent implements OnInit {
|
|||||||
initialize(params) {
|
initialize(params) {
|
||||||
this.metadataSchema = this.metadataRegistryService.getMetadataSchemaByName(params.schemaName);
|
this.metadataSchema = this.metadataRegistryService.getMetadataSchemaByName(params.schemaName);
|
||||||
this.metadataSchema.subscribe((value) => {
|
this.metadataSchema.subscribe((value) => {
|
||||||
let schema = value.payload;
|
const schema = value.payload;
|
||||||
this.metadataFields = this.metadataRegistryService.getMetadataFieldsBySchema(schema);
|
this.metadataFields = this.metadataRegistryService.getMetadataFieldsBySchema(schema);
|
||||||
|
this.namespace = { namespace: value.payload.namespace };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@@ -8,6 +8,6 @@ import { NgModule } from '@angular/core';
|
|||||||
])
|
])
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminPageRoutingModule {
|
export class AdminRoutingModule {
|
||||||
|
|
||||||
}
|
}
|
@@ -1,13 +1,13 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { AdminRegistriesModule } from './admin-registries/admin-registries.module';
|
import { AdminRegistriesModule } from './admin-registries/admin-registries.module';
|
||||||
import { AdminPageRoutingModule } from './admin-page-routing.module';
|
import { AdminRoutingModule } from './admin-routing.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
AdminRegistriesModule,
|
AdminRegistriesModule,
|
||||||
AdminPageRoutingModule
|
AdminRoutingModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminPageModule {
|
export class AdminModule {
|
||||||
|
|
||||||
}
|
}
|
@@ -12,7 +12,7 @@ import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
|
|||||||
{ path: 'collections', loadChildren: './+collection-page/collection-page.module#CollectionPageModule' },
|
{ path: 'collections', loadChildren: './+collection-page/collection-page.module#CollectionPageModule' },
|
||||||
{ path: 'items', loadChildren: './+item-page/item-page.module#ItemPageModule' },
|
{ path: 'items', loadChildren: './+item-page/item-page.module#ItemPageModule' },
|
||||||
{ path: 'search', loadChildren: './+search-page/search-page.module#SearchPageModule' },
|
{ path: 'search', loadChildren: './+search-page/search-page.module#SearchPageModule' },
|
||||||
{ path: 'admin', loadChildren: './+admin-page/admin-page.module#AdminPageModule' },
|
{ path: 'admin', loadChildren: './+admin/admin.module#AdminModule' },
|
||||||
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
|
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user