You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.4 KiB
TypeScript
71 lines
2.4 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
import { takeUntil } from 'rxjs/operators';
|
|
import { ValidationErrorModel } from '../../../../../common/forms/validation/error-model/validation-error-model';
|
|
import { DatasetProfileCriteria } from '../../../../../core/query/dataset-profile/dataset-profile-criteria';
|
|
import { DatasetProfileService } from '../../../../../core/services/dataset-profile/dataset-profile.service';
|
|
import { BaseCriteriaComponent } from '../../../../misc/criteria/base-criteria.component';
|
|
import { DialodConfirmationUploadDatasetProfiles } from './dialog-confirmation-upload-profile/dialog-confirmation-upload-profiles.component';
|
|
|
|
@Component({
|
|
selector: 'app-dataset-profile-criteria-component',
|
|
templateUrl: './dataset-profile.component.html',
|
|
styleUrls: ['./dataset-profile.component.scss'],
|
|
})
|
|
export class DatasetProfileCriteriaComponent extends BaseCriteriaComponent implements OnInit {
|
|
|
|
public criteria: DatasetProfileCriteria = new DatasetProfileCriteria();
|
|
|
|
constructor(
|
|
private datasetService: DatasetProfileService,
|
|
private dialog: MatDialog,
|
|
private language: TranslateService,
|
|
) {
|
|
super(new ValidationErrorModel());
|
|
}
|
|
|
|
ngOnInit() {
|
|
super.ngOnInit();
|
|
if (this.criteria == null) { this.criteria = new DatasetProfileCriteria(); }
|
|
}
|
|
|
|
setCriteria(criteria: DatasetProfileCriteria): void {
|
|
this.criteria = criteria;
|
|
}
|
|
|
|
onCallbackError(error: any) {
|
|
this.setErrorModel(error.error);
|
|
}
|
|
|
|
controlModified(): void {
|
|
this.clearErrorModel();
|
|
if (this.refreshCallback != null &&
|
|
(this.criteria.like == null || this.criteria.like.length === 0 || this.criteria.like.length > 2)
|
|
) {
|
|
this.refreshCallback();
|
|
}
|
|
}
|
|
|
|
openDialog(): void {
|
|
const dialogRef = this.dialog.open(DialodConfirmationUploadDatasetProfiles, {
|
|
data: {
|
|
message: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML-FILE-TITLE'),
|
|
confirmButton: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML'),
|
|
cancelButton: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML-FILE-CANCEL'),
|
|
name: "",
|
|
file: FileList,
|
|
sucsess: false
|
|
}
|
|
});
|
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => {
|
|
if (data && data.sucsess && data.name != null && data.file != null) {
|
|
this.datasetService.uploadFile(data.file, data.name)
|
|
.pipe(takeUntil(this._destroyed))
|
|
.subscribe();
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|