36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { Component, Inject, OnInit } from '@angular/core';
|
|
import { FormGroup } from '@angular/forms';
|
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
|
import { takeUntil } from 'rxjs/operators';
|
|
import { BaseComponent } from '../../../../../../core/common/base/base.component';
|
|
import { ExternalRegistryService } from '../../../../../../core/services/external-sources/registry/external-registry.service';
|
|
import { ExternalRegistryEditorModel } from '../../../dataset-wizard-editor.model';
|
|
|
|
@Component({
|
|
templateUrl: 'dataset-external-registry-dialog-editor.component.html',
|
|
styleUrls: ['./dataset-external-registry-dialog-editor.component.scss']
|
|
})
|
|
export class DatasetExternalRegistryDialogEditorComponent extends BaseComponent implements OnInit {
|
|
public formGroup: FormGroup;
|
|
|
|
constructor(
|
|
private externalRegistryService: ExternalRegistryService,
|
|
public dialogRef: MatDialogRef<DatasetExternalRegistryDialogEditorComponent>,
|
|
@Inject(MAT_DIALOG_DATA) public data: any
|
|
) { super(); }
|
|
|
|
ngOnInit(): void {
|
|
const registryModel = new ExternalRegistryEditorModel();
|
|
this.formGroup = registryModel.buildForm();
|
|
}
|
|
|
|
|
|
send(value: any) {
|
|
this.externalRegistryService.create(this.formGroup.value)
|
|
.pipe(takeUntil(this._destroyed))
|
|
.subscribe(
|
|
(item) => this.dialogRef.close(item)
|
|
);
|
|
}
|
|
}
|