forked from hazza/dspace-angular
50434: Metadata Registry read-only
This commit is contained in:
@@ -124,6 +124,38 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"admin": {
|
||||
"registries": {
|
||||
"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.",
|
||||
"schemas": {
|
||||
"table": {
|
||||
"namespace": "Namespace",
|
||||
"name": "Name",
|
||||
"caption": "List of metadata schemas"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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."
|
||||
},
|
||||
"fields": {
|
||||
"head": "Schema metadata fields",
|
||||
"table": {
|
||||
"field": "Field",
|
||||
"scopenote": "Scope Note",
|
||||
"caption": "List of metadata fields"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"loading": {
|
||||
"default": "Loading...",
|
||||
"top-level-communities": "Loading top level communities...",
|
||||
|
13
src/app/+admin-page/admin-page-routing.module.ts
Normal file
13
src/app/+admin-page/admin-page-routing.module.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: 'registries', loadChildren: './admin-registries/admin-registries.module#AdminRegistriesModule' }
|
||||
])
|
||||
]
|
||||
})
|
||||
export class AdminPageRoutingModule {
|
||||
|
||||
}
|
13
src/app/+admin-page/admin-page.module.ts
Normal file
13
src/app/+admin-page/admin-page.module.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { AdminRegistriesModule } from './admin-registries/admin-registries.module';
|
||||
import { AdminPageRoutingModule } from './admin-page-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
AdminRegistriesModule,
|
||||
AdminPageRoutingModule
|
||||
]
|
||||
})
|
||||
export class AdminPageModule {
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: 'metadata', component: MetadataRegistryComponent, data: { title: 'admin.registries.metadata.title' } },
|
||||
{ path: 'metadata/:schemaName', component: MetadataSchemaComponent, data: { title: 'admin.registries.schema.title' } }
|
||||
])
|
||||
]
|
||||
})
|
||||
export class AdminRegistriesRoutingModule {
|
||||
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component';
|
||||
import { AdminRegistriesRoutingModule } from './admin-registries-routing.module';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule,
|
||||
TranslateModule,
|
||||
AdminRegistriesRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
MetadataRegistryComponent,
|
||||
MetadataSchemaComponent
|
||||
]
|
||||
})
|
||||
export class AdminRegistriesModule {
|
||||
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<div class="container">
|
||||
<div class="metadata-registry row">
|
||||
<div class="col-12">
|
||||
|
||||
<h2 class="border-bottom pb-2">{{'admin.registries.metadata.head' | translate}}</h2>
|
||||
|
||||
<p class="pb-2">{{'admin.registries.metadata.description' | translate}}</p>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<caption>{{'admin.registries.metadata.schemas.table.caption' | translate}}</caption>
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th scope="col">{{'admin.registries.metadata.schemas.table.namespace' | translate}}</th>
|
||||
<th scope="col">{{'admin.registries.metadata.schemas.table.name' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="invisible"></tr>
|
||||
<tr *ngFor="let schema of (metadataSchemas | async)?.payload?.page">
|
||||
<td><a [routerLink]="[schema.prefix]">{{schema.namespace}}</a></td>
|
||||
<td><a [routerLink]="[schema.prefix]">{{schema.prefix}}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,20 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { MetadataRegistryService } from '../../../core/metadata/metadataregistry.service';
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-metadata-registry',
|
||||
templateUrl: './metadata-registry.component.html'
|
||||
})
|
||||
export class MetadataRegistryComponent {
|
||||
|
||||
metadataSchemas: Observable<RemoteData<PaginatedList<MetadataSchema>>>;
|
||||
|
||||
constructor(private metadataRegistryService: MetadataRegistryService) {
|
||||
this.metadataSchemas = this.metadataRegistryService.getMetadataSchemas();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<div class="container">
|
||||
<div class="metadata-schema row">
|
||||
<div class="col-12">
|
||||
|
||||
<h2 class="border-bottom pb-2">{{'admin.registries.schema.head' | translate}}: "{{(metadataSchema | async)?.payload?.prefix}}"</h2>
|
||||
|
||||
<p class="pb-2">
|
||||
{{'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>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<caption>{{'admin.registries.schema.fields.table.caption' | translate}}</caption>
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th scope="col">{{'admin.registries.schema.fields.table.field' | translate}}</th>
|
||||
<th scope="col">{{'admin.registries.schema.fields.table.scopenote' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="invisible"></tr>
|
||||
<tr *ngFor="let field of (metadataFields | async)?.payload?.page">
|
||||
<td>{{(metadataSchema | async)?.payload?.prefix}}.{{field.element}}<label *ngIf="field.qualifier">.</label>{{field.qualifier}}</td>
|
||||
<td>{{field.scopenote}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,37 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MetadataRegistryService } from '../../../core/metadata/metadataregistry.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||
import { MetadataField } from '../../../core/metadata/metadatafield.model';
|
||||
import { MetadataSchema } from '../../../core/metadata/metadataschema.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-metadata-schema',
|
||||
templateUrl: './metadata-schema.component.html'
|
||||
})
|
||||
export class MetadataSchemaComponent implements OnInit {
|
||||
|
||||
metadataSchema: Observable<RemoteData<MetadataSchema>>;
|
||||
metadataFields: Observable<RemoteData<PaginatedList<MetadataField>>>;
|
||||
|
||||
constructor(private metadataRegistryService: MetadataRegistryService, private route: ActivatedRoute) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.params.subscribe((params) => {
|
||||
this.initialize(params);
|
||||
});
|
||||
}
|
||||
|
||||
initialize(params) {
|
||||
this.metadataSchema = this.metadataRegistryService.getMetadataSchemaByName(params.schemaName);
|
||||
this.metadataSchema.subscribe((value) => {
|
||||
let schema = value.payload;
|
||||
this.metadataFields = this.metadataRegistryService.getMetadataFieldsBySchema(schema);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@@ -12,6 +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: '**', pathMatch: 'full', component: PageNotFoundComponent },
|
||||
])
|
||||
],
|
||||
|
@@ -32,6 +32,12 @@ export class MetadataRegistryService {
|
||||
return Observable.of(remoteData);
|
||||
}
|
||||
|
||||
public getMetadataSchemaByName(schemaName: string): Observable<RemoteData<MetadataSchema>> {
|
||||
let payload = this.metadataSchemas.filter((value) => value.prefix == schemaName)[0];
|
||||
let remoteData = new RemoteData(false, false, true, undefined, payload);
|
||||
return Observable.of(remoteData);
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.metadataSchemas = [
|
||||
{
|
||||
@@ -64,7 +70,7 @@ export class MetadataRegistryService {
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/10",
|
||||
"element": "contributor",
|
||||
"qualifier": "editor",
|
||||
"scopenote": null,
|
||||
"scopenote": "test scope note",
|
||||
"schema": this.metadataSchemas[0]
|
||||
},
|
||||
{
|
||||
@@ -435,7 +441,7 @@ export class MetadataRegistryService {
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/53",
|
||||
"element": "relation",
|
||||
"qualifier": "isbasedon",
|
||||
"scopenote": null,
|
||||
"scopenote": "a scope note",
|
||||
"schema": this.metadataSchemas[1]
|
||||
},
|
||||
{
|
||||
@@ -449,7 +455,7 @@ export class MetadataRegistryService {
|
||||
"self": "https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/48",
|
||||
"element": "relation",
|
||||
"qualifier": "ispartof",
|
||||
"scopenote": null,
|
||||
"scopenote": "another scope note",
|
||||
"schema": this.metadataSchemas[1]
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user