Skip to content

Commit

Permalink
🎨 revert format
Browse files Browse the repository at this point in the history
(cherry picked from commit 3e5524d)
  • Loading branch information
hugo-escire authored and github-actions[bot] committed Sep 8, 2023
1 parent e3ea2cb commit 161d7e0
Showing 1 changed file with 55 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
Component,
EventEmitter,
OnDestroy,
OnInit,
Output,
} from '@angular/core';
import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
import {
DynamicFormControlModel,
DynamicFormGroupModel,
Expand All @@ -21,12 +15,13 @@ import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model'

@Component({
selector: 'ds-metadata-schema-form',
templateUrl: './metadata-schema-form.component.html',
templateUrl: './metadata-schema-form.component.html'
})
/**
* A form used for creating and editing metadata schemas
*/
export class MetadataSchemaFormComponent implements OnInit, OnDestroy {

/**
* A unique id used for ds-form
*/
Expand Down Expand Up @@ -58,14 +53,14 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
formLayout: DynamicFormLayout = {
name: {
grid: {
host: 'col col-sm-6 d-inline-block',
},
host: 'col col-sm-6 d-inline-block'
}
},
namespace: {
grid: {
host: 'col col-sm-6 d-inline-block',
},
},
host: 'col col-sm-6 d-inline-block'
}
}
};

/**
Expand All @@ -78,67 +73,63 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
*/
@Output() submitForm: EventEmitter<any> = new EventEmitter();

constructor(
public registryService: RegistryService,
private formBuilderService: FormBuilderService,
private translateService: TranslateService
) {}
constructor(public registryService: RegistryService, private formBuilderService: FormBuilderService, private translateService: TranslateService) {
}

ngOnInit() {
combineLatest([
this.translateService.get(`${this.messagePrefix}.name`),
this.translateService.get(`${this.messagePrefix}.namespace`),
this.translateService.get(`${this.messagePrefix}.namespace`)
]).subscribe(([name, namespace]) => {
this.name = new DynamicInputModel({
id: 'name',
label: name,
name: 'name',
validators: {
required: null,
pattern: '^[^. ,]*$',
maxLength: 32,
},
required: true,
errorMessages: {
pattern: 'error.validation.metadata.name.invalid-pattern',
maxLength: 'error.validation.metadata.name.max-length',
},
});
id: 'name',
label: name,
name: 'name',
validators: {
required: null,
pattern: '^[^. ,]*$',
maxLength: 32,
},
required: true,
errorMessages: {
pattern: 'error.validation.metadata.name.invalid-pattern',
maxLength: 'error.validation.metadata.name.max-length',
},
});
this.namespace = new DynamicInputModel({
id: 'namespace',
label: namespace,
name: 'namespace',
validators: {
required: null,
maxLength: 256,
},
required: true,
errorMessages: {
maxLength: 'error.validation.metadata.namespace.max-length',
},
});
id: 'namespace',
label: namespace,
name: 'namespace',
validators: {
required: null,
maxLength: 256,
},
required: true,
errorMessages: {
maxLength: 'error.validation.metadata.namespace.max-length',
},
});
this.formModel = [
new DynamicFormGroupModel({
id: 'metadatadataschemagroup',
group: [this.namespace, this.name],
}),
new DynamicFormGroupModel(
{
id: 'metadatadataschemagroup',
group:[this.namespace, this.name]
})
];
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
this.registryService
.getActiveMetadataSchema()
.subscribe((schema: MetadataSchema) => {
if (schema == null) {
this.clearFields();
} else {
this.formGroup.patchValue({
metadatadataschemagroup: {
name: schema.prefix,
namespace: schema.namespace,
},
});
this.name.disabled = true;
}
});
this.registryService.getActiveMetadataSchema().subscribe((schema: MetadataSchema) => {
if (schema == null) {
this.clearFields();
} else {
this.formGroup.patchValue({
metadatadataschemagroup: {
name: schema.prefix,
namespace: schema.namespace,
},
});
this.name.disabled = true;
}
});
});
}

Expand Down

0 comments on commit 161d7e0

Please sign in to comment.