mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
e3ea2cb2b0
commit
161d7e069b
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
Output,
|
||||
} from '@angular/core';
|
||||
import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
|
||||
import {
|
||||
DynamicFormControlModel,
|
||||
DynamicFormGroupModel,
|
||||
@@ -21,12 +15,13 @@ import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model'
|
||||
|
||||
@Component({
|
||||
selector: 'ds-metadata-schema-form',
|
||||
templateUrl: './metadata-schema-form.component.html',
|
||||
templateUrl: './metadata-schema-form.component.html'
|
||||
})
|
||||
/**
|
||||
* A form used for creating and editing metadata schemas
|
||||
*/
|
||||
export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
||||
|
||||
/**
|
||||
* A unique id used for ds-form
|
||||
*/
|
||||
@@ -58,14 +53,14 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
||||
formLayout: DynamicFormLayout = {
|
||||
name: {
|
||||
grid: {
|
||||
host: 'col col-sm-6 d-inline-block',
|
||||
},
|
||||
host: 'col col-sm-6 d-inline-block'
|
||||
}
|
||||
},
|
||||
namespace: {
|
||||
grid: {
|
||||
host: 'col col-sm-6 d-inline-block',
|
||||
},
|
||||
},
|
||||
host: 'col col-sm-6 d-inline-block'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -78,16 +73,13 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
@Output() submitForm: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
constructor(
|
||||
public registryService: RegistryService,
|
||||
private formBuilderService: FormBuilderService,
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
constructor(public registryService: RegistryService, private formBuilderService: FormBuilderService, private translateService: TranslateService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
combineLatest([
|
||||
this.translateService.get(`${this.messagePrefix}.name`),
|
||||
this.translateService.get(`${this.messagePrefix}.namespace`),
|
||||
this.translateService.get(`${this.messagePrefix}.namespace`)
|
||||
]).subscribe(([name, namespace]) => {
|
||||
this.name = new DynamicInputModel({
|
||||
id: 'name',
|
||||
@@ -118,15 +110,14 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
||||
},
|
||||
});
|
||||
this.formModel = [
|
||||
new DynamicFormGroupModel({
|
||||
new DynamicFormGroupModel(
|
||||
{
|
||||
id: 'metadatadataschemagroup',
|
||||
group: [this.namespace, this.name],
|
||||
}),
|
||||
group:[this.namespace, this.name]
|
||||
})
|
||||
];
|
||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||
this.registryService
|
||||
.getActiveMetadataSchema()
|
||||
.subscribe((schema: MetadataSchema) => {
|
||||
this.registryService.getActiveMetadataSchema().subscribe((schema: MetadataSchema) => {
|
||||
if (schema == null) {
|
||||
this.clearFields();
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user