mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
50434: Feedback 2018/03/16
This commit is contained in:
@@ -129,28 +129,23 @@
|
||||
"metadata": {
|
||||
"title": "DSpace Angular :: 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": {
|
||||
"table": {
|
||||
"namespace": "Namespace",
|
||||
"name": "Name",
|
||||
"caption": "List of metadata schemas"
|
||||
"name": "Name"
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"title": "DSpace Angular :: Metadata Schema",
|
||||
"head": "Metadata Schema",
|
||||
"description": {
|
||||
"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."
|
||||
},
|
||||
"description": "This is the metadata schema for \"{{namespace}}\".",
|
||||
"fields": {
|
||||
"head": "Schema metadata fields",
|
||||
"table": {
|
||||
"field": "Field",
|
||||
"scopenote": "Scope Note",
|
||||
"caption": "List of metadata fields"
|
||||
"scopenote": "Scope Note"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="metadata-schemas" class="table table-striped table-hover">
|
||||
<caption>{{'admin.registries.metadata.schemas.table.caption' | translate}}</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{'admin.registries.metadata.schemas.table.namespace' | translate}}</th>
|
@@ -15,14 +15,14 @@ describe('MetadataRegistryComponent', () => {
|
||||
let metadataRegistryService: MetadataRegistryService;
|
||||
const mockSchemasList = [
|
||||
{
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1",
|
||||
"prefix": "dc",
|
||||
"namespace": "http://dublincore.org/documents/dcmi-terms/"
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
||||
prefix: 'dc',
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||
},
|
||||
{
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2",
|
||||
"prefix": "mock",
|
||||
"namespace": "http://dspace.org/mockschema"
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
||||
prefix: 'mock',
|
||||
namespace: 'http://dspace.org/mockschema'
|
||||
}
|
||||
];
|
||||
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', () => {
|
||||
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);
|
||||
});
|
||||
|
||||
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');
|
||||
|
||||
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');
|
||||
});
|
||||
|
@@ -4,15 +4,11 @@
|
||||
|
||||
<h2 id="header" class="border-bottom pb-2">{{'admin.registries.schema.head' | translate}}: "{{(metadataSchema | async)?.payload?.prefix}}"</h2>
|
||||
|
||||
<p id="description" class="pb-2">
|
||||
{{'admin.registries.schema.description.part1' | translate}} "{{(metadataSchema | async)?.payload?.namespace}}".
|
||||
{{'admin.registries.schema.description.part2' | translate}}
|
||||
</p>
|
||||
<p id="description" class="pb-2">{{'admin.registries.schema.description' | translate:namespace }}</p>
|
||||
|
||||
<h3>{{'admin.registries.schema.fields.head' | translate}}</h3>
|
||||
<div class="table-responsive">
|
||||
<table id="metadata-fields" class="table table-striped table-hover">
|
||||
<caption>{{'admin.registries.schema.fields.table.caption' | translate}}</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<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 { PaginatedList } from '../../../core/data/paginated-list';
|
||||
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 { ActivatedRoute } from '@angular/router';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MockTranslateLoader } from '../../../shared/testing/mock-translate-loader';
|
||||
|
||||
describe('MetadataSchemaComponent', () => {
|
||||
let comp: MetadataSchemaComponent;
|
||||
@@ -16,51 +17,51 @@ describe('MetadataSchemaComponent', () => {
|
||||
let metadataRegistryService: MetadataRegistryService;
|
||||
const mockSchemasList = [
|
||||
{
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1",
|
||||
"prefix": "dc",
|
||||
"namespace": "http://dublincore.org/documents/dcmi-terms/"
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
||||
prefix: 'dc',
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||
},
|
||||
{
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2",
|
||||
"prefix": "mock",
|
||||
"namespace": "http://dspace.org/mockschema"
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
||||
prefix: 'mock',
|
||||
namespace: 'http://dspace.org/mockschema'
|
||||
}
|
||||
];
|
||||
const mockFieldsList = [
|
||||
{
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/8",
|
||||
"element": "contributor",
|
||||
"qualifier": "advisor",
|
||||
"scopenote": null,
|
||||
"schema": mockSchemasList[0]
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/8',
|
||||
element: 'contributor',
|
||||
qualifier: 'advisor',
|
||||
scopenote: null,
|
||||
schema: mockSchemasList[0]
|
||||
},
|
||||
{
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/9",
|
||||
"element": "contributor",
|
||||
"qualifier": "author",
|
||||
"scopenote": null,
|
||||
"schema": mockSchemasList[0]
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/9',
|
||||
element: 'contributor',
|
||||
qualifier: 'author',
|
||||
scopenote: null,
|
||||
schema: mockSchemasList[0]
|
||||
},
|
||||
{
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/10",
|
||||
"element": "contributor",
|
||||
"qualifier": "editor",
|
||||
"scopenote": "test scope note",
|
||||
"schema": mockSchemasList[1]
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/10',
|
||||
element: 'contributor',
|
||||
qualifier: 'editor',
|
||||
scopenote: 'test scope note',
|
||||
schema: mockSchemasList[1]
|
||||
},
|
||||
{
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/11",
|
||||
"element": "contributor",
|
||||
"qualifier": "illustrator",
|
||||
"scopenote": null,
|
||||
"schema": mockSchemasList[1]
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/11',
|
||||
element: 'contributor',
|
||||
qualifier: 'illustrator',
|
||||
scopenote: null,
|
||||
schema: mockSchemasList[1]
|
||||
}
|
||||
];
|
||||
const mockSchemas = Observable.of(new RemoteData(false, false, true, undefined, new PaginatedList(null, mockSchemasList)));
|
||||
const metadataRegistryServiceStub = {
|
||||
getMetadataSchemas: () => mockSchemas,
|
||||
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]))
|
||||
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]))
|
||||
};
|
||||
const schemaNameParam = 'mock';
|
||||
const activatedRouteStub = {
|
||||
@@ -88,25 +89,20 @@ describe('MetadataSchemaComponent', () => {
|
||||
});
|
||||
|
||||
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');
|
||||
});
|
||||
|
||||
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', () => {
|
||||
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);
|
||||
});
|
||||
|
||||
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');
|
||||
|
||||
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');
|
||||
});
|
||||
});
|
@@ -13,6 +13,8 @@ import { MetadataSchema } from '../../../core/metadata/metadataschema.model';
|
||||
})
|
||||
export class MetadataSchemaComponent implements OnInit {
|
||||
|
||||
namespace;
|
||||
|
||||
metadataSchema: Observable<RemoteData<MetadataSchema>>;
|
||||
metadataFields: Observable<RemoteData<PaginatedList<MetadataField>>>;
|
||||
|
||||
@@ -29,8 +31,9 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
initialize(params) {
|
||||
this.metadataSchema = this.metadataRegistryService.getMetadataSchemaByName(params.schemaName);
|
||||
this.metadataSchema.subscribe((value) => {
|
||||
let schema = value.payload;
|
||||
const schema = value.payload;
|
||||
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 { AdminRegistriesModule } from './admin-registries/admin-registries.module';
|
||||
import { AdminPageRoutingModule } from './admin-page-routing.module';
|
||||
import { AdminRoutingModule } from './admin-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
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: 'items', loadChildren: './+item-page/item-page.module#ItemPageModule' },
|
||||
{ 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 },
|
||||
])
|
||||
],
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user