mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 23:13:04 +00:00
58789: Preventing submit from firing multiple times + some code cleanup
This commit is contained in:
@@ -5,7 +5,7 @@ import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||
import { MetadataSchema } from '../../../core/metadata/metadataschema.model';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import { RestResponse } from '../../../core/cache/response.models';
|
||||
import { zip } from 'rxjs/internal/observable/zip';
|
||||
@@ -70,7 +70,7 @@ export class MetadataRegistryComponent {
|
||||
}
|
||||
|
||||
deleteSchemas() {
|
||||
this.registryService.getSelectedMetadataSchemas().subscribe(
|
||||
this.registryService.getSelectedMetadataSchemas().pipe(take(1)).subscribe(
|
||||
(schemas) => {
|
||||
const tasks$ = [];
|
||||
for (const schema of schemas) {
|
||||
|
@@ -8,9 +8,6 @@ import {
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { RegistryService } from '../../../../core/registry/registry.service';
|
||||
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||
import { FormService } from '../../../../shared/form/form.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppState } from '../../../../app.reducer';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { MetadataSchema } from '../../../../core/metadata/metadataschema.model';
|
||||
|
||||
@@ -73,11 +70,10 @@ export class MetadataSchemaFormComponent implements OnInit {
|
||||
|
||||
@Output() submitForm: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
constructor(private registryService: RegistryService, private formBuilderService: FormBuilderService, private formService: FormService, private store: Store<AppState>) {
|
||||
constructor(private registryService: RegistryService, private formBuilderService: FormBuilderService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||
this.registryService.getActiveMetadataSchema().subscribe((schema) => {
|
||||
this.formGroup.patchValue({
|
||||
@@ -95,7 +91,7 @@ export class MetadataSchemaFormComponent implements OnInit {
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.registryService.getActiveMetadataSchema().subscribe(
|
||||
this.registryService.getActiveMetadataSchema().pipe(take(1)).subscribe(
|
||||
(schema) => {
|
||||
const values = {
|
||||
prefix: this.name.value,
|
||||
|
Reference in New Issue
Block a user