Commit f6ca9768 authored by Alicia.DeDiosFuente's avatar Alicia.DeDiosFuente Committed by Florent POITTEVIN
Browse files

fix: fix validation metadata type

parent c1f67c9a
......@@ -10,7 +10,6 @@
[solidifyValidation]="errors"
autofocus
[solidifyFocusFirstElement]="true"
(blur)="checkAvailable(formDefinition.name, fd)"
[formControl]="fd"
[required]="formValidationHelper.hasRequiredField(fd)"
>
......@@ -118,14 +117,13 @@
></code>
</ng-container>
</ng-container>
<div class="submit-button">
<button *ngIf="!readonly"
mat-flat-button
color="primary"
type="submit"
(keydown.enter)="onSubmit()"
[disabled]="!form.valid || !form.dirty"
[disabled]="!(this.uploadedOrChangedFile && form.valid || this.isEditAction && form.valid && form.dirty) && !(this.uploadedOrChangedFile && !this.isEditAction && form.valid )"
>
{{'admin.metadataType.form.submit' | translate }}
</button>
......
......@@ -3,6 +3,7 @@ import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Input,
Output,
} from "@angular/core";
import {
......@@ -38,12 +39,16 @@ export class AdminMetadataTypeFormPresentational extends SharedAbstractFormPrese
readonly filesAccepted: string[] = [".xml", ".json", ".xsd", ".txt"];
readonly maxSizeFile: number = 25000000;
@Input()
isEditAction: boolean = false;
metadataFormatEnum: KeyValue[] = MetadataTypeFormatEnumHelper.getListKeyValue();
private readonly _fileUploadBS: BehaviorSubject<File | undefined> = new BehaviorSubject<File | undefined>(undefined);
@Output("fileUploadChange")
readonly fileUploadObs: Observable<File | undefined> = ObservableUtil.asObservable(this._fileUploadBS);
constructor(protected readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _notificationService: NotificationService,
private readonly _fb: FormBuilder) {
......@@ -95,6 +100,7 @@ export class AdminMetadataTypeFormPresentational extends SharedAbstractFormPrese
this._notificationService.showInformation(TRANSLATE("admin.metadataType.readUploadedFileSuccessfully"));
};
fileReader.readAsText(file);
this.uploadedOrChangedFile = true;
}
onTestFileUpload(event: Event & any): void {
......
......@@ -18,5 +18,4 @@
(dirtyChange)="updateCanDeactivate($event)"
></dlcm-admin-metadata-type-form>
</div>
</div>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment