diff --git a/dmp-frontend/src/app/core/model/dataset-profile-definition/auth-type.enum.ts b/dmp-frontend/src/app/core/model/dataset-profile-definition/auth-type.enum.ts new file mode 100644 index 000000000..9f26507c7 --- /dev/null +++ b/dmp-frontend/src/app/core/model/dataset-profile-definition/auth-type.enum.ts @@ -0,0 +1,3 @@ +export enum AuthType { + BEARER = 'Bearer' +} diff --git a/dmp-frontend/src/app/core/model/dataset-profile-definition/html-method.enum.ts b/dmp-frontend/src/app/core/model/dataset-profile-definition/html-method.enum.ts new file mode 100644 index 000000000..ed63f9540 --- /dev/null +++ b/dmp-frontend/src/app/core/model/dataset-profile-definition/html-method.enum.ts @@ -0,0 +1,6 @@ +export enum HtmlMethod { + GET = 'GET', + POST = 'POST', + PUT = 'PUT', + PATCH = 'PATCH' +} diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/auto-complete-auth-field-data.model.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/auto-complete-auth-field-data.model.ts new file mode 100644 index 000000000..9eec7c2a7 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/auto-complete-auth-field-data.model.ts @@ -0,0 +1,33 @@ +import { UntypedFormGroup, Validators } from "@angular/forms"; +import { FieldDataEditorModel } from "./field-data-editor-model"; +import { AuthAutoCompleteData, AutoCompleteSingleData } from "@app/core/model/dataset-profile-definition/field-data/field-data"; + +export class AuthFieldEditorModel extends FieldDataEditorModel { + url: string; + method: string; + body: string; + path: string; + type: string; + + buildForm(disabled: boolean = false, skipDisable: Array = []): UntypedFormGroup { + const formGroup = this.formBuilder.group({ + method: [{ value: this.method, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.method')) }], + url: [{ value: this.url, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.url')) },[Validators.required]], + body: [{ value: this.body, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.body')) }], + path: [{ value: this.path, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.path')) }, [Validators.required]], + type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.type')) }, [Validators.required]] + }); + + return formGroup; + } + + fromModel(item: AuthAutoCompleteData): AuthFieldEditorModel { + this.url = item.url; + this.method = item.method; + this.body = item.body; + this.path = item.path; + this.type = item.type; + return this; + } + +}