Create a commit message for these git differences "diff… · The Chat ArchiveCreate a commit message for these git differences "diff --git a/frontend/.prettierrc…
Download ▾
Create a commit message for these git differences "diff --git a/frontend/.prettierrc b/frontend/.prettierrc
index 7dbd9a4..b1872c6 100644
--- a/frontend/.prettierrc
+++ b/frontend/.prettierrc
@@ -6,5 +6,6 @@
"parser": "angular"
}
}
}
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 3e53edd..9b31414 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -27,6 +27,7 @@
"jsonlines": "^0.1.1",
"ngx-json-viewer": "^3.2.1",
"ngx-mask": "^18.0.0",
-
"prettier-plugin-organize-attributes": "^1.0.0",
"rxjs": "7.8.0",
"tslib": "2.3.0",
"zone.js": "0.14.3"
@@ -11535,7 +11536,6 @@
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
"integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==",
@@ -11546,6 +11546,18 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
-
"node_modules/prettier-plugin-organize-attributes": {
-
"version": "1.0.0",
-
"resolved": "https://registry.npmjs.org/prettier-plugin-organize-attributes/-/prettier-plugin-organize-attributes-1.0.0.tgz",
-
"integrity": "sha512-+NmameaLxbCcylEXsKPmawtzla5EE6ECqvGkpfQz4KM847fXDifB1gFnPQEpoADAq6IXg+cMI8Z0ISJEXa6fhg==",
-
"license": "MIT",
-
"engines": {
-
"node": ">=14.0.0"
-
},
-
"peerDependencies": {
-
"prettier": "^3.0.0"
-
}
-
},
"node_modules/proc-log": {
"version": "4.2.0",
Assistant
Add 'prettier-plugin-organize-attributes', enhance form field hints
- Added
prettier-plugin-organize-attributes to the project and updated .prettierrc to include the plugin.
- Reformatted HTML templates by running Prettier, which reorganized HTML attributes for consistency.
- Enhanced user guidance in form fields by adding
mat-hint elements and placeholders in component templates.
- Updated component TypeScript files to improve form control defaults and validations.
- Adjusted default values in form controls for better initial state.
- Improved validators and validation logic for more robust form handling.
"prettier": {
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
-
"integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A=="
-
},
-
"prettier-plugin-organize-attributes": {
-
"version": "1.0.0",
-
"resolved": "https://registry.npmjs.org/prettier-plugin-organize-attributes/-/prettier-plugin-organize-attributes-1.0.0.tgz",
-
"integrity": "sha512-+NmameaLxbCcylEXsKPmawtzla5EE6ECqvGkpfQz4KM847fXDifB1gFnPQEpoADAq6IXg+cMI8Z0ISJEXa6fhg==",
-
"requires": {}
},
"proc-log": {
"version": "4.2.0",
diff --git a/frontend/package.json b/frontend/package.json
index 855b9ff..60ec529 100644
--- a/frontend/package.json
+++ b/frontend/package.json
"jsonlines": "^0.1.1",
"ngx-json-viewer": "^3.2.1",
"ngx-mask": "^18.0.0",
diff --git a/frontend/src/app/schema-config/boolean-field/boolean-field.component.html b/frontend/src/app/schema-config/boolean-field/boolean-field.component.html
index 33838f3..dd60dfc 100644
--- a/frontend/src/app/schema-config/boolean-field/boolean-field.component.html
+++ b/frontend/src/app/schema-config/boolean-field/boolean-field.component.html
-<form [formGroup]="fieldForm" class="row">
+<form class="row" [formGroup]="fieldForm">
<mat-form-field class="w-100">
<mat-label>Generator</mat-label>
}}</mat-option>
}
</mat-select>
@if (fieldForm.get("values")) {
-
<input
-
matInput
-
formControlName="values"
-
placeholder="e.g., true, false, true"
-
/>
-
<mat-hint>Enter boolean values separated by commas</mat-hint>
</mat-form-field>
}
@if (fieldForm.get("weights")) {
-
<input
-
[readonly]="autoRenew()"
-
matInput
-
formControlName="weights"
-
placeholder="e.g., 0.3, 0.3, 0.4"
-
/>
-
<mat-hint>
-
Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.
-
</mat-hint>
-
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
-
<mat-icon>{{ autoRenew() ? "autorenew" : "pause" }}</mat-icon>
-
</button>
</mat-form-field>
}
diff --git a/frontend/src/app/schema-config/boolean-field/boolean-field.component.ts b/frontend/src/app/schema-config/boolean-field/boolean-field.component.ts
index 11142c9..68bf841 100644
--- a/frontend/src/app/schema-config/boolean-field/boolean-field.component.ts
+++ b/frontend/src/app/schema-config/boolean-field/boolean-field.component.ts
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -24,6 +25,8 @@ import { MatSelectModule } from '@angular/material/select';
import { MatInputModule } from '@angular/material/input';
import { MatTooltipModule } from '@angular/material/tooltip';
import { weightsSumToOneValidator } from '../../shared/validators/weights-sum-to-one-validator.validator';
+import { MatIconModule } from '@angular/material/icon';
+import { MatButtonModule } from '@angular/material/button';
type BooleanFieldGenerator =
| { type: GeneratorType.Uniform }
@@ -45,6 +48,8 @@ interface BooleanFieldForm {
MatSelectModule,
MatInputModule,
MatTooltipModule,
-
MatIconModule,
-
MatButtonModule,
templateUrl: './boolean-field.component.html',
styleUrl: './boolean-field.component.scss',
@@ -53,6 +58,8 @@ interface BooleanFieldForm {
export class BooleanFieldComponent implements OnInit {
private readonly destroyRef = inject(DestroyRef);
input.required<typeof fieldGeneratorMap.boolean_col>();
public changeField = output();
@@ -102,7 +109,7 @@ export class BooleanFieldComponent implements OnInit {
this.values.valueChanges
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(() => {
@@ -124,9 +131,7 @@ export class BooleanFieldComponent implements OnInit {
this.fieldForm.addControl('values', this.values);
this.fieldForm.addControl('weights', this.weights);
@@ -168,4 +173,43 @@ export class BooleanFieldComponent implements OnInit {
-
private calculateWeights(values: string): string {
-
const valueArray = values
-
.split(',')
-
.map((v) => v.trim())
-
.filter((v) => v !== '');
-
if (valueArray.length === 0) return '';
-
const weight = (1 / valueArray.length).toFixed(2);
-
return Array(valueArray.length).fill(weight).join(', ');
-
}
-
private updateValuesAndWeightsValidation(): void {
-
if (this.autoRenew()) {
-
this.values.removeValidators(matchingArrayLengthsValidator(['weights']));
-
this.weights.removeValidators(matchingArrayLengthsValidator(['values']));
-
} else {
-
this.values.addValidators(matchingArrayLengthsValidator(['weights']));
-
this.weights.addValidators(matchingArrayLengthsValidator(['values']));
-
}
-
this.values.updateValueAndValidity({ emitEvent: false });
-
this.weights.updateValueAndValidity({ emitEvent: false });
-
}
-
private updateWeights(): void {
-
const calculatedWeights = this.calculateWeights(this.values.value || '');
-
this.weights.setValue(calculatedWeights, { emitEvent: true });
-
}
-
public onToggleAutorenew(): void {
-
this.autoRenew.update((value) => !value);
-
this.updateValuesAndWeightsValidation();
-
if (this.autoRenew()) this.updateWeights();
-
}
diff --git a/frontend/src/app/schema-config/date-field/date-field.component.html b/frontend/src/app/schema-config/date-field/date-field.component.html
index 5a3ddb8..574c495 100644
--- a/frontend/src/app/schema-config/date-field/date-field.component.html
+++ b/frontend/src/app/schema-config/date-field/date-field.component.html
-<form [formGroup]="fieldForm" class="row">
+<form class="row" [formGroup]="fieldForm">
<mat-form-field class="w-100">
<mat-label>Generator</mat-label>
-
<mat-select [formControl]="type">
@for (generator of generatorTypes(); track generator) {
<mat-option [value]="generator.value">{{
generator.viewValue
}}</mat-option>
}
</mat-select>
-
<mat-hint>Choose how to generate values for this field</mat-hint>
- @for (controlName of formControlNames; track controlName) {
-
<mat-label>Date Format Pattern</mat-label>
-
<input
-
formControlName="pattern"
-
matInput
-
placeholder="e.g., yyyy-MM-dd"
-
/>
-
<mat-hint>Specify the date format pattern (e.g., yyyy-MM-dd)</mat-hint>
</mat-form-field>
}
@if (fieldForm.get("duration")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>Duration</mat-label>
-
<input matInput formControlName="duration" />
-
<mat-hint>e.g., 2 days or -5 days</mat-hint>
-
<mat-label>Duration Offset</mat-label>
-
<input
-
matInput
-
formControlName="duration"
-
placeholder="e.g., 2 days or -5 days"
-
/>
-
<mat-hint
-
>Enter the duration offset (e.g., "2 days" or "-5 days")</mat-hint
-
>
</mat-form-field>
}
@if (fieldForm.get("start")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>Start</mat-label>
-
<input matInput [matDatepicker]="picker" formControlName="start" />
-
<mat-hint>YYYY/MM/DD</mat-hint>
-
<mat-datepicker-toggle matIconSuffix [for]="picker" />
-
<mat-datepicker #picker />
-
<mat-label>Start Date</mat-label>
-
<input
-
[matDatepicker]="startPicker"
-
matInput
-
formControlName="start"
-
placeholder="YYYY-MM-DD"
-
/>
-
<mat-hint>Select the start date (YYYY-MM-DD)</mat-hint>
-
<mat-datepicker-toggle [for]="startPicker" matIconSuffix />
-
<mat-datepicker #startPicker />
</mat-form-field>
}
@if (fieldForm.get("end")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>End</mat-label>
-
<input matInput [matDatepicker]="picker" formControlName="end" />
-
<mat-hint>YYYY/MM/DD</mat-hint>
-
<mat-datepicker-toggle matIconSuffix [for]="picker" />
-
<mat-datepicker #picker />
-
<mat-label>End Date</mat-label>
-
<input
-
[matDatepicker]="endPicker"
-
matInput
-
formControlName="end"
-
placeholder="YYYY-MM-DD"
-
/>
-
<mat-hint>Select the end date (YYYY-MM-DD)</mat-hint>
-
<mat-datepicker-toggle [for]="endPicker" matIconSuffix />
-
<mat-datepicker #endPicker />
</mat-form-field>
}
@if (fieldForm.get("values")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>Date Values</mat-label>
<input
repeatMask
dataMask="0000-00-00"
matInput
formControlName="values"
-
placeholder="e.g., 2023-10-11, 2023-10-12"
/>
-
<mat-hint
-
>Enter dates in YYYY-MM-DD format, separated by commas</mat-hint
-
>
</mat-form-field>
}
<mat-label>Weights</mat-label>
<input
[readonly]="autoRenew()"
-
placeholder="e.g., 0.3, 0.3, 0.4"
/>
-
<mat-hint>
-
Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.
-
</mat-hint>
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
<mat-icon>
{{ autoRenew() ? "autorenew" : "pause" }}
diff --git a/frontend/src/app/schema-config/date-field/date-field.component.ts b/frontend/src/app/schema-config/date-field/date-field.component.ts
index 7526beb..29e70ec 100644
--- a/frontend/src/app/schema-config/date-field/date-field.component.ts
+++ b/frontend/src/app/schema-config/date-field/date-field.component.ts
@@ -275,16 +275,4 @@ export class DateFieldComponent implements OnInit {
if (this.autoRenew()) this.updateWeights();
diff --git a/frontend/src/app/schema-config/date-time-field/date-time-field.component.html b/frontend/src/app/schema-config/date-time-field/date-time-field.component.html
index ae393d8..0286b7e 100644
--- a/frontend/src/app/schema-config/date-time-field/date-time-field.component.html
+++ b/frontend/src/app/schema-config/date-time-field/date-time-field.component.html
-<form [formGroup]="fieldForm" class="row">
+<form class="row" [formGroup]="fieldForm">
<mat-form-field class="w-100">
<mat-label>Generator</mat-label>
-
<mat-select [formControl]="type">
@for (generator of generatorTypes(); track generator) {
<mat-option [value]="generator.value">{{
generator.viewValue
}}</mat-option>
}
</mat-select>
-
<mat-hint>Choose how to generate values for this field</mat-hint>
- @for (controlName of formControlNames; track controlName) {
-
<mat-label>Date-Time Format Pattern</mat-label>
-
<input
-
formControlName="pattern"
-
matInput
-
placeholder="e.g., yyyy-MM-dd'T'HH:mm:ss"
-
/>
-
<mat-hint
-
>Specify the date-time format pattern (e.g.,
-
yyyy-MM-dd'T'HH:mm:ss)</mat-hint
-
>
</mat-form-field>
}
@if (fieldForm.get("start")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>Start Date-Time</mat-label>
-
<input
-
readonly
-
matInput
-
formControlName="start"
-
placeholder="yyyy-MM-ddTHH:mm:ss"
-
/>
-
<mat-hint>Select the start date and time</mat-hint>
<button
(click)="onDateTimePickerOpen('start')"
matIconSuffix
@if (fieldForm.get("end")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>End Date-Time</mat-label>
-
<input
-
readonly
-
matInput
-
formControlName="end"
-
placeholder="yyyy-MM-ddTHH:mm:ss"
-
/>
-
<mat-hint>Select the end date and time</mat-hint>
<button
(click)="onDateTimePickerOpen('end')"
matIconSuffix
-
@if (fieldForm.get("duration")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Duration Offset</mat-label>
-
<input
-
formControlName="duration"
-
matInput
-
placeholder="e.g., 2 days 3 hours or -5 hours 30 minutes"
-
/>
-
<mat-hint
-
>Enter the duration offset (e.g., "2 days" or "-5 days")</mat-hint
-
>
-
</mat-form-field>
-
-
}
@if (fieldForm.get("values")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>Date-Time Values</mat-label>
<input
repeatMask
dataMask="0000-00-00T00:00:00"
matInput
formControlName="values"
-
placeholder="e.g., 2023-10-11T14:30:00, 2023-10-12T09:15:00"
/>
-
<mat-hint
-
>Enter date-time values in yyyy-MM-dd'T'HH:mm:ss format, separated by
-
commas</mat-hint
-
>
</mat-form-field>
}
<mat-label>Weights</mat-label>
<input
[readonly]="autoRenew()"
-
placeholder="e.g., 0.3, 0.3, 0.4"
/>
-
<mat-hint>
-
Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.
-
</mat-hint>
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
<mat-icon>
{{ autoRenew() ? "autorenew" : "pause" }}
diff --git a/frontend/src/app/schema-config/date-time-field/date-time-field.component.ts b/frontend/src/app/schema-config/date-time-field/date-time-field.component.ts
index 8f8fccd..9fa80f2 100644
--- a/frontend/src/app/schema-config/date-time-field/date-time-field.component.ts
+++ b/frontend/src/app/schema-config/date-time-field/date-time-field.component.ts
@@ -98,14 +98,8 @@ export class DateTimeFieldComponent implements OnInit {
public pattern = this.schemaFormFieldGeneratorSvc.getDatePatternField(
-
public start = new FormControl('', {
-
nonNullable: true,
-
validators: [Validators.required],
-
});
-
public end = new FormControl('', {
-
nonNullable: true,
-
validators: [Validators.required],
-
});
-
public start = this.schemaFormFieldGeneratorSvc.getStartDateTimeField();
-
public end = this.schemaFormFieldGeneratorSvc.getEndDateTimeField();
public values = this.schemaFormFieldGeneratorSvc.getValuesField([
dateTimeCommaSeparatedValidator,
]);
diff --git a/frontend/src/app/schema-config/decimal-field/decimal-field.component.html b/frontend/src/app/schema-config/decimal-field/decimal-field.component.html
index 48492d4..705ab40 100644
--- a/frontend/src/app/schema-config/decimal-field/decimal-field.component.html
+++ b/frontend/src/app/schema-config/decimal-field/decimal-field.component.html
-<form [formGroup]="fieldForm">
-
-
-
<mat-form-field class="w-100">
-
<mat-label>Generator</mat-label>
-
<mat-select [formControl]="type">
-
@for (generator of generatorTypes(); track generator) {
-
<mat-option [value]="generator.value">{{
-
generator.viewValue
-
}}</mat-option>
-
}
-
</mat-select>
-
</mat-form-field>
-
-
@for (controlName of formControlNames; track controlName) {
-
<div class="col-12">
-
<mat-form-field class="w-100">
-
<mat-label>{{ controlName | titlecase }}</mat-label>
-
<input matInput [formControlName]="controlName" />
-
</mat-form-field>
-
</div>
-
}
-
@if (fieldForm.get("weights")) {
-
<div class="col-12">
-
<mat-form-field class="w-100">
-
<mat-label>Weights</mat-label>
-
<input
-
[readonly]="autoRenew()"
-
repeatMask
-
dataMask="0.00"
-
matInput
-
formControlName="weights"
-
/>
-
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
-
<mat-icon>
-
{{ autoRenew() ? "autorenew" : "pause" }}
-
</mat-icon>
-
</button>
-
</mat-form-field>
-
</div>
-
}
+<form class="row" [formGroup]="fieldForm">
-
-
-
<mat-label>Generator</mat-label>
-
<mat-select [formControl]="type">
-
@for (generator of generatorTypes(); track generator) {
-
<mat-option [value]="generator.value">{{
-
generator.viewValue
-
}}</mat-option>
-
}
-
</mat-select>
-
<mat-hint>Choose how to generate values for this field</mat-hint>
-
-
@if (fieldForm.get("scale")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Scale</mat-label>
-
<input matInput formControlName="scale" placeholder="e.g., 2" />
-
<mat-hint
-
>Enter the number of decimal places (e.g., 2 for 10.20)</mat-hint
-
>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("mean")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Mean</mat-label>
-
<input matInput formControlName="mean" placeholder="e.g., 50" />
-
<mat-hint
-
>Enter the average value (mean) for the normal distribution</mat-hint
-
>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("stdDev")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Standard Deviation</mat-label>
-
<input matInput formControlName="stdDev" placeholder="e.g., 5" />
-
<mat-hint
-
>Enter the standard deviation for the normal distribution</mat-hint
-
>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("min")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Minimum Value</mat-label>
-
<input matInput formControlName="min" placeholder="e.g., 1" />
-
<mat-hint>Enter the minimum value of the range</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("max")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Maximum Value</mat-label>
-
<input matInput formControlName="max" placeholder="e.g., 100" />
-
<mat-hint>Enter the maximum value of the range</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("values")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Values</mat-label>
-
<input
-
matInput
-
formControlName="values"
-
placeholder="e.g., 10, 20, 30"
-
/>
-
<mat-hint>Enter numeric values separated by commas</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("weights")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Weights</mat-label>
-
<input
-
matInput
-
formControlName="weights"
-
placeholder="e.g., 0.3, 0.3, 0.4"
-
/>
-
<mat-hint>
-
Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.
-
</mat-hint>
-
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
-
<mat-icon>{{ autoRenew() ? "autorenew" : "pause" }}</mat-icon>
-
</button>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("start")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Start Value</mat-label>
-
<input matInput formControlName="start" placeholder="e.g., 0" />
-
<mat-hint>Enter the starting value of the sequence</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("step")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Step</mat-label>
-
<input placeholder="e.g., 1" matInput formControlName="step" />
-
<mat-hint
-
>Enter the step size to increment or decrement the value</mat-hint
-
>
-
</mat-form-field>
-
-
}
diff --git a/frontend/src/app/schema-config/decimal-field/decimal-field.component.ts b/frontend/src/app/schema-config/decimal-field/decimal-field.component.ts
index 4d6d498..c383a18 100644
--- a/frontend/src/app/schema-config/decimal-field/decimal-field.component.ts
+++ b/frontend/src/app/schema-config/decimal-field/decimal-field.component.ts
@@ -25,7 +25,6 @@ import { TitleCasePipe } from '@angular/common';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import { MatInputModule } from '@angular/material/input';
-import { weightsSumToOneValidator } from '../../shared/validators/weights-sum-to-one-validator.validator';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { RepeatMaskDirective } from '../../shared/directives/repeat-mask.directive';
@@ -114,7 +113,7 @@ export class DecimalFieldComponent implements OnInit {
public weights = this.schemaFormFieldGeneratorSvc.getWeightsField();
public start = this.schemaFormFieldGeneratorSvc.getStartField();
public step = this.schemaFormFieldGeneratorSvc.getStepField();
- public scale = this.schemaFormFieldGeneratorSvc.getScaleField();
diff --git a/frontend/src/app/schema-config/double-field/double-field.component.html b/frontend/src/app/schema-config/double-field/double-field.component.html
index d33ada2..8008330 100644
--- a/frontend/src/app/schema-config/double-field/double-field.component.html
+++ b/frontend/src/app/schema-config/double-field/double-field.component.html
-<form [formGroup]="fieldForm" class="row">
+<form class="row" [formGroup]="fieldForm">
<mat-form-field class="w-100">
<mat-label>Generator</mat-label>
-
<mat-select [formControl]="type">
@for (generator of generatorTypes(); track generator) {
<mat-option [value]="generator.value">{{
generator.viewValue
}}</mat-option>
}
</mat-select>
-
<mat-hint>Choose how to generate values for this field</mat-hint>
- @for (controlName of formControlNames; track controlName) {
-
@if (fieldForm.get("min")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Minimum Value</mat-label>
-
<input matInput formControlName="min" placeholder="e.g., 1" />
-
<mat-hint>Enter the minimum value of the range</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("max")) {
<mat-form-field class="w-100">
-
<mat-label>Maximum Value</mat-label>
-
<input matInput formControlName="max" placeholder="e.g., 100" />
-
<mat-hint>Enter the maximum value of the range</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("values")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Values</mat-label>
-
<input
-
placeholder="e.g., 10, 20, 30"
-
matInput
-
formControlName="values"
-
/>
-
<mat-hint>Enter numeric values separated by commas</mat-hint>
</mat-form-field>
}
<mat-label>Weights</mat-label>
<input
[readonly]="autoRenew()"
-
repeatMask
-
dataMask="0.00"
-
placeholder="e.g., 0.3, 0.3, 0.4"
matInput
formControlName="weights"
/>
-
<mat-hint>
-
Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.
-
</mat-hint>
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
-
<mat-icon>{{ autoRenew() ? "autorenew" : "pause" }}</mat-icon>
</button>
</mat-form-field>
}
-
@if (fieldForm.get("start")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Start</mat-label>
-
<input placeholder="e.g., 0" matInput formControlName="start" />
-
<mat-hint>Enter the starting value of the sequence</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("step")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Step</mat-label>
-
<input placeholder="e.g., 1" matInput formControlName="step" />
-
<mat-hint
-
>Enter the step size to increment or decrement the value</mat-hint
-
>
-
</mat-form-field>
-
-
}
diff --git a/frontend/src/app/schema-config/double-field/double-field.component.ts b/frontend/src/app/schema-config/double-field/double-field.component.ts
index 81a7b2d..22ba08c 100644
--- a/frontend/src/app/schema-config/double-field/double-field.component.ts
+++ b/frontend/src/app/schema-config/double-field/double-field.component.ts
@@ -25,7 +25,6 @@ import { numbersCommaSeparatedValidator } from '../../shared/validators/numbers-
import { startWith } from 'rxjs';
import { matchingArrayLengthsValidator } from '../../shared/validators/matching-array-lenghts-validator.validator';
import { TitleCasePipe } from '@angular/common';
-import { weightsSumToOneValidator } from '../../shared/validators/weights-sum-to-one-validator.validator';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { RepeatMaskDirective } from '../../shared/directives/repeat-mask.directive';
@@ -291,10 +290,4 @@ export class DoubleFieldComponent implements OnInit {
if (this.autoRenew()) this.updateWeights();
-
public get formControlNames(): string[] {
-
return Object.keys(this.fieldForm.controls).filter(
-
(key) => key !== 'type' && key !== 'weights',
-
);
-
}
diff --git a/frontend/src/app/schema-config/int-field/int-field.component.html b/frontend/src/app/schema-config/int-field/int-field.component.html
index 335903f..8008330 100644
--- a/frontend/src/app/schema-config/int-field/int-field.component.html
+++ b/frontend/src/app/schema-config/int-field/int-field.component.html
-<form [formGroup]="fieldForm" class="row">
+<form class="row" [formGroup]="fieldForm">
<mat-form-field class="w-100">
<mat-label>Generator</mat-label>
}}</mat-option>
}
</mat-select>
- @for (controlName of formControlNames; track controlName) {
-
<mat-label>Minimum Value</mat-label>
-
<input matInput formControlName="min" placeholder="e.g., 1" />
-
<mat-hint>Enter the minimum value of the range</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("max")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Maximum Value</mat-label>
-
<input matInput formControlName="max" placeholder="e.g., 100" />
-
<mat-hint>Enter the maximum value of the range</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("values")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Values</mat-label>
-
<input
-
placeholder="e.g., 10, 20, 30"
-
matInput
-
formControlName="values"
-
/>
-
<mat-hint>Enter numeric values separated by commas</mat-hint>
</mat-form-field>
}
<mat-label>Weights</mat-label>
<input
[readonly]="autoRenew()"
-
repeatMask
-
dataMask="0.00"
-
placeholder="e.g., 0.3, 0.3, 0.4"
matInput
formControlName="weights"
/>
-
<mat-hint>
-
Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.
-
</mat-hint>
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
-
<mat-icon>{{ autoRenew() ? "autorenew" : "pause" }}</mat-icon>
</button>
</mat-form-field>
}
-
@if (fieldForm.get("start")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Start</mat-label>
-
<input placeholder="e.g., 0" matInput formControlName="start" />
-
<mat-hint>Enter the starting value of the sequence</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("step")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Step</mat-label>
-
<input placeholder="e.g., 1" matInput formControlName="step" />
-
<mat-hint
-
>Enter the step size to increment or decrement the value</mat-hint
-
>
-
</mat-form-field>
-
-
}
diff --git a/frontend/src/app/schema-config/int-field/int-field.component.ts b/frontend/src/app/schema-config/int-field/int-field.component.ts
index 00aa7d2..79dca55 100644
--- a/frontend/src/app/schema-config/int-field/int-field.component.ts
+++ b/frontend/src/app/schema-config/int-field/int-field.component.ts
@@ -276,10 +276,4 @@ export class IntFieldComponent implements OnInit {
if (this.autoRenew()) this.updateWeights();
-
public get formControlNames(): string[] {
-
return Object.keys(this.fieldForm.controls).filter(
-
(key) => key !== 'type' && key !== 'weights',
-
);
-
}
diff --git a/frontend/src/app/schema-config/long-field/long-field.component.html b/frontend/src/app/schema-config/long-field/long-field.component.html
index 88da3ce..8008330 100644
--- a/frontend/src/app/schema-config/long-field/long-field.component.html
+++ b/frontend/src/app/schema-config/long-field/long-field.component.html
-<form [formGroup]="fieldForm" class="row">
+<form class="row" [formGroup]="fieldForm">
<mat-form-field class="w-100">
<mat-label>Generator</mat-label>
-
<mat-select [formControl]="type">
@for (generator of generatorTypes(); track generator) {
<mat-option [value]="generator.value">{{
generator.viewValue
}}</mat-option>
}
</mat-select>
-
<mat-hint>Choose how to generate values for this field</mat-hint>
@if (fieldForm.get("min")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>Minimum Value</mat-label>
-
<input matInput formControlName="min" placeholder="e.g., 1" />
-
<mat-hint>Enter the minimum value of the range</mat-hint>
</mat-form-field>
}
@if (fieldForm.get("max")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>Maximum Value</mat-label>
-
<input matInput formControlName="max" placeholder="e.g., 100" />
-
<mat-hint>Enter the maximum value of the range</mat-hint>
</mat-form-field>
}
<div class="col-12">
<mat-form-field class="w-100">
<mat-label>Values</mat-label>
-
<input
-
placeholder="e.g., 10, 20, 30"
-
matInput
-
formControlName="values"
-
/>
-
<mat-hint>Enter numeric values separated by commas</mat-hint>
</mat-form-field>
}
<mat-label>Weights</mat-label>
<input
[readonly]="autoRenew()"
-
repeatMask
-
dataMask="0.00"
-
placeholder="e.g., 0.3, 0.3, 0.4"
matInput
formControlName="weights"
/>
-
<mat-hint>
-
Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.
-
</mat-hint>
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
<div class="col-12">
<mat-form-field class="w-100">
<mat-label>Start</mat-label>
-
<input placeholder="e.g., 0" matInput formControlName="start" />
-
<mat-hint>Enter the starting value of the sequence</mat-hint>
</mat-form-field>
}
<div class="col-12">
<mat-form-field class="w-100">
<mat-label>Step</mat-label>
-
<input placeholder="e.g., 1" matInput formControlName="step" />
-
<mat-hint
-
>Enter the step size to increment or decrement the value</mat-hint
-
>
</mat-form-field>
}
diff --git a/frontend/src/app/schema-config/modal-date-time-picker/modal-date-time-picker.component.html b/frontend/src/app/schema-config/modal-date-time-picker/modal-date-time-picker.component.html
index 2890e57..d35c7b7 100644
--- a/frontend/src/app/schema-config/modal-date-time-picker/modal-date-time-picker.component.html
+++ b/frontend/src/app/schema-config/modal-date-time-picker/modal-date-time-picker.component.html
<mat-calendar [(selected)]="date" />
<mat-label>Time</mat-label>
- <input [mask]="mask" matInput [formControl]="this.time" />
-
<input
-
[mask]="mask"
-
[formControl]="this.time"
-
[placeholder]="
-
dataField === 'date-time' ? 'e.g., 14:30:00' : 'e.g., 14:30:00.500'
-
"
-
matInput
-
/>
-
@if (dataField === "date-time") {
-
<mat-hint>Enter the time in HH:mm:ss format</mat-hint>
-
} @else {
-
<mat-hint>Enter the time in HH:mm:ss.SSS format</mat-hint>
-
}
<button (click)="onCancel()" mat-button>Cancel</button>
diff --git a/frontend/src/app/schema-config/string-field/string-field.component.html b/frontend/src/app/schema-config/string-field/string-field.component.html
index d33ada2..0abcca8 100644
--- a/frontend/src/app/schema-config/string-field/string-field.component.html
+++ b/frontend/src/app/schema-config/string-field/string-field.component.html
-<form [formGroup]="fieldForm" class="row">
+<form class="row" [formGroup]="fieldForm">
<mat-form-field class="w-100">
<mat-label>Generator</mat-label>
-
<mat-select [formControl]="type">
@for (generator of generatorTypes(); track generator) {
<mat-option [value]="generator.value">{{
generator.viewValue
}}</mat-option>
}
</mat-select>
-
<mat-hint>Choose how to generate values for this field</mat-hint>
- @for (controlName of formControlNames; track controlName) {
-
@if (fieldForm.get("minChars")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Minimum Characters</mat-label>
-
<input matInput formControlName="minChars" placeholder="e.g., 5" />
-
<mat-hint
-
>Enter the minimum number of characters for the generated
-
strings</mat-hint
-
>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("maxChars")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Maximum Characters</mat-label>
-
<input matInput formControlName="maxChars" placeholder="e.g., 15" />
-
<mat-hint
-
>Enter the maximum number of characters for the generated
-
strings</mat-hint
-
>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("description")) {
<mat-form-field class="w-100">
-
<mat-label>Description</mat-label>
-
<input
-
matInput
-
formControlName="description"
-
placeholder="e.g., Car Names"
-
/>
-
<mat-hint>
-
Provide a description to guide value generation (e.g., "Car Names",
-
"Fruit Names")
-
</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("values")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Values</mat-label>
-
<input
-
matInput
-
formControlName="values"
-
placeholder="e.g., Red, Blue, Green"
-
/>
-
<mat-hint
-
>Enter comma-separated strings to use as possible values</mat-hint
-
>
</mat-form-field>
}
<mat-label>Weights</mat-label>
<input
[readonly]="autoRenew()"
-
placeholder="e.g., 0.3, 0.5, 0.2"
/>
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
-
<mat-icon>{{ autoRenew() ? "autorenew" : "pause" }}</mat-icon>
</button>
-
<mat-hint>
-
Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.
-
</mat-hint>
</mat-form-field>
}
diff --git a/frontend/src/app/schema-config/string-field/string-field.component.ts b/frontend/src/app/schema-config/string-field/string-field.component.ts
index ff3c406..bdf9757 100644
--- a/frontend/src/app/schema-config/string-field/string-field.component.ts
+++ b/frontend/src/app/schema-config/string-field/string-field.component.ts
@@ -16,13 +16,11 @@ import { MatSelectModule } from '@angular/material/select';
import { MatInputModule } from '@angular/material/input';
import { SchemaFormFieldGeneratorService } from '../../shared/services/schema-form-field-generator.service';
import { compareToOtherFieldValidator } from '../../shared/validators/compare-to-other-field-validator.validator';
-import { startWith, tap } from 'rxjs';
+import { startWith } from 'rxjs';
import { matchingArrayLengthsValidator } from '../../shared/validators/matching-array-lenghts-validator.validator';
import { TitleCasePipe } from '@angular/common';
-import { numbersCommaSeparatedValidator } from '../../shared/validators/numbers-comma-separate-validator.validator';
-import { weightsSumToOneValidator } from '../../shared/validators/weights-sum-to-one-validator.validator';
import { RepeatMaskDirective } from '../../shared/directives/repeat-mask.directive';
-import { MatButtonModule, MatIconButton } from '@angular/material/button';
+import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
type StringFieldGenerator =
@@ -70,52 +68,51 @@ export class StringFieldComponent implements OnInit {
public readonly autoRenew = signal(true);
-
public readonly type = this.schemaFormFieldGeneratorSvc.getTypeField(
-
GeneratorType.Enum,
-
);
-
public readonly minChars = this.schemaFormFieldGeneratorSvc.getMinField([
compareToOtherFieldValidator(
'maxChars',
(min: number, max: number) => min < max,
'minGreaterThanMax',
),
]);
- public maxChars = this.schemaFormFieldGeneratorSvc.getMaxField([
-
public readonly maxChars = this.schemaFormFieldGeneratorSvc.getMaxField([
compareToOtherFieldValidator(
'minchars',
(max: number, min: number) => min < max,
'MaxSmallerThanMin',
),
]);
-
public values = this.schemaFormFieldGeneratorSvc.getValuesField([]);
-
public weights = this.schemaFormFieldGeneratorSvc.getWeightsField();
-
public description = this.schemaFormFieldGeneratorSvc.getDescriptionField([]);
-
public fieldForm = new FormGroup({
-
public readonly values = this.schemaFormFieldGeneratorSvc.getValuesField([]);
-
public readonly weights = this.schemaFormFieldGeneratorSvc.getWeightsField();
-
public readonly description =
-
this.schemaFormFieldGeneratorSvc.getDescriptionField([]);
-
public readonly fieldForm = new FormGroup({
type: this.type,
});
public ngOnInit(): void {
this.type.valueChanges
-
.pipe(
-
startWith(this.type.value),
-
takeUntilDestroyed(this.destroyRef),
-
tap((type) => {
-
this.updateFormControls(type);
-
}),
-
)
-
.subscribe();
-
.pipe(startWith(this.type.value), takeUntilDestroyed(this.destroyRef))
-
.subscribe((type) => {
-
this.updateFormControls(type);
-
});
this.fieldForm.valueChanges
.pipe(
startWith(this.fieldForm.value),
takeUntilDestroyed(this.destroyRef),
-
.subscribe(() => {
-
const schema = this.getTypedFormValue();
-
if (schema) this.changeField.emit(schema);
-
});
this.minChars.valueChanges
.pipe(takeUntilDestroyed(this.destroyRef))
@@ -187,8 +184,7 @@ export class StringFieldComponent implements OnInit {
this.fieldForm.addControl('values', this.values);
this.fieldForm.addControl('weights', this.weights);
@@ -279,10 +275,4 @@ export class StringFieldComponent implements OnInit {
if (this.autoRenew()) this.updateWeights();
-
public get formControlNames(): string[] {
-
return Object.keys(this.fieldForm.controls).filter(
-
(key) => key !== 'type' && key !== 'weights',
-
);
-
}
diff --git a/frontend/src/app/schema-config/time-field/time-field.component.html b/frontend/src/app/schema-config/time-field/time-field.component.html
index 067ca48..f118af7 100644
--- a/frontend/src/app/schema-config/time-field/time-field.component.html
+++ b/frontend/src/app/schema-config/time-field/time-field.component.html
-<form [formGroup]="fieldForm" class="row">
+<form class="row" [formGroup]="fieldForm">
<mat-form-field class="w-100">
<mat-label>Generator</mat-label>
}}</mat-option>
}
</mat-select>
- @for (controlName of formControlNames; track controlName) {
-
@if (fieldForm.get("pattern")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Time Format Pattern</mat-label>
-
<input
-
matInput
-
formControlName="pattern"
-
placeholder="e.g., HH:mm:ss"
-
/>
-
<mat-hint>Specify the time format pattern (e.g., HH:mm:ss)</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("start")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Start Time</mat-label>
-
<input
-
[repeat]="false"
-
matInput
-
repeatMask
-
dataMask="00:00:00"
-
formControlName="start"
-
placeholder="HH:mm:ss"
-
/>
-
<mat-hint>Enter the start time in HH:mm:ss format</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("end")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>End Time</mat-label>
-
<input
-
[repeat]="false"
-
matInput
-
formControlName="end"
-
repeatMask
-
dataMask="00:00:00"
-
placeholder="HH:mm:ss"
-
/>
-
<mat-hint>Enter the end time in HH:mm:ss format</mat-hint>
-
</mat-form-field>
-
-
}
-
@if (fieldForm.get("duration")) {
<mat-form-field class="w-100">
-
<mat-label>Duration</mat-label>
-
<input
-
matInput
-
formControlName="duration"
-
placeholder="e.g., 2 hours or -30 minutes"
-
/>
-
<mat-hint
-
>Enter the duration (e.g., "2 hours" or "-30 minutes")</mat-hint
-
>
</mat-form-field>
}
@if (fieldForm.get("values")) {
<div class="col-12">
<mat-form-field class="w-100">
-
<mat-label>Time Values</mat-label>
<input
repeatMask
dataMask="00:00:00"
matInput
formControlName="values"
-
placeholder="e.g., 09:00:00, 12:30:00, 18:45:00"
/>
-
<mat-hint>Enter times in HH:mm:ss format, separated by commas</mat-hint>
</mat-form-field>
}
<mat-label>Weights</mat-label>
<input
[readonly]="autoRenew()"
-
placeholder="e.g., 0.3, 0.3, 0.4"
/>
-
<mat-hint>
-
Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.
-
</mat-hint>
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
<mat-icon>
{{ autoRenew() ? "autorenew" : "pause" }}
diff --git a/frontend/src/app/schema-config/time-field/time-field.component.ts b/frontend/src/app/schema-config/time-field/time-field.component.ts
index 4883471..d70233a 100644
--- a/frontend/src/app/schema-config/time-field/time-field.component.ts
+++ b/frontend/src/app/schema-config/time-field/time-field.component.ts
@@ -19,7 +19,6 @@ import { MatSelectModule } from '@angular/material/select';
import { SchemaFormFieldGeneratorService } from '../../shared/services/schema-form-field-generator.service';
import { startWith, tap } from 'rxjs';
import { matchingArrayLengthsValidator } from '../../shared/validators/matching-array-lenghts-validator.validator';
-import { numbersCommaSeparatedValidator } from '../../shared/validators/numbers-comma-separate-validator.validator';
import { TitleCasePipe } from '@angular/common';
import { RepeatMaskDirective } from '../../shared/directives/repeat-mask.directive';
import { timeValuesCommaSeparatedValidator } from '../../shared/validators/time-values-comma-separate-validator.validator';
@@ -77,6 +76,7 @@ interface TimeFieldForm {
templateUrl: './time-field.component.html',
styleUrl: './time-field.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
export class TimeFieldComponent implements OnInit {
@@ -98,7 +98,8 @@ export class TimeFieldComponent implements OnInit {
timeValuesCommaSeparatedValidator,
public weights = this.schemaFormFieldGeneratorSvc.getWeightsField();
- public duration = this.schemaFormFieldGeneratorSvc.getDurationField();
public fieldForm = new FormGroup({
type: this.type,
pattern: this.pattern,
diff --git a/frontend/src/app/schema-config/timestamp-field/timestamp-field.component.html b/frontend/src/app/schema-config/timestamp-field/timestamp-field.component.html
index c07a1bb..b0864ca 100644
--- a/frontend/src/app/schema-config/timestamp-field/timestamp-field.component.html
+++ b/frontend/src/app/schema-config/timestamp-field/timestamp-field.component.html
-<form [formGroup]="fieldForm" class="row">
+<form class="row" [formGroup]="fieldForm">
<mat-form-field class="w-100">
<mat-label>Generator</mat-label>
}}</mat-option>
}
</mat-select>
- @for (controlName of formControlNames; track controlName) {
-
<mat-label>Pattern</mat-label>
-
<input
-
matInput
-
formControlName="pattern"
-
placeholder="e.g., yyyy-MM-dd'T'HH:mm:ss.SSSZ"
-
/>
-
<mat-hint
-
>Specify the timestamp format pattern (e.g.,
-
yyyy-MM-dd'T'HH:mm:ss.SSSZ)</mat-hint
-
>
</mat-form-field>
}
<div class="col-12">
<mat-form-field class="w-100">
<mat-label>Start</mat-label>
<div class="col-12">
<mat-form-field class="w-100">
<mat-label>End</mat-label>
-
@if (fieldForm.get("duration")) {
-
-
<mat-form-field class="w-100">
-
<mat-label>Duration</mat-label>
-
<input
-
matInput
-
formControlName="duration"
-
placeholder="e.g., 2 days 3 hours or -5 hours 30 minutes"
-
/>
-
<mat-hint
-
>Enter the duration offset (e.g., "2 days" or "-5 days")</mat-hint
-
>
-
</mat-form-field>
-
-
}
@if (fieldForm.get("values")) {
<div class="col-12">
<mat-form-field class="w-100">
dataMask="0000-00-00T00:00:00.000Z"
matInput
formControlName="values"
-
placeholder="e.g., 2023-10-11T14:30:00.000Z, 2023-10-12T09:15:00.000Z"
/>
-
<mat-hint
-
>Enter timestamp values in yyyy-MM-dd'T'HH:mm:ss.SSSZ format,
-
separated by commas</mat-hint
-
>
</mat-form-field>
}
<mat-label>Weights</mat-label>
<input
[readonly]="autoRenew()"
-
placeholder="e.g., 0.3, 0.3, 0.4"
/>
-
<mat-hint
-
>Enter decimal weights between 0 and 1, separated by commas. The
-
weights should sum to 1.</mat-hint
-
>
<button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button>
<mat-icon>
{{ autoRenew() ? "autorenew" : "pause" }}
diff --git a/frontend/src/app/schema-config/timestamp-field/timestamp-field.component.ts b/frontend/src/app/schema-config/timestamp-field/timestamp-field.component.ts
index db9c141..99f7d02 100644
--- a/frontend/src/app/schema-config/timestamp-field/timestamp-field.component.ts
+++ b/frontend/src/app/schema-config/timestamp-field/timestamp-field.component.ts
@@ -96,14 +96,8 @@ export class TimestampFieldComponent implements OnInit {
public pattern = this.schemaFormFieldGeneratorSvc.getDatePatternField(
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
-
public start = new FormControl('', {
-
nonNullable: true,
-
validators: [Validators.required],
-
});
-
public end = new FormControl('', {
-
nonNullable: true,
-
validators: [Validators.required],
-
});
-
public start = this.schemaFormFieldGeneratorSvc.getStartTimeStampField();
-
public end = this.schemaFormFieldGeneratorSvc.getEndTimestampField();
public values = this.schemaFormFieldGeneratorSvc.getValuesField([
dateTimeCommaSeparatedValidator,
]);
diff --git a/frontend/src/app/shared/directives/repeat-mask.directive.ts b/frontend/src/app/shared/directives/repeat-mask.directive.ts
index 3b73d38..69d6d9d 100644
--- a/frontend/src/app/shared/directives/repeat-mask.directive.ts
+++ b/frontend/src/app/shared/directives/repeat-mask.directive.ts
@@ -25,6 +25,7 @@ export class RepeatMaskDirective implements ControlValueAccessor {
private readonly element = inject(ElementRef);
readonly dataMask = input.required();
-
readonly repeat = input(true);
private onChange: (value: string) => void = () => {};
private onTouched: () => void = () => {};
@@ -56,14 +57,18 @@ export class RepeatMaskDirective implements ControlValueAccessor {
const mask = this.dataMask();
const digits = value.replace(/\D/g, '');
let result = '';
-
if (this.repeat()) {
-
let digitIndex = 0;
-
while (digitIndex < digits.length) {
-
if (result.length > 0) {
-
result += ', ';
-
}
-
result += this.applySingleMask(digits.slice(digitIndex), mask);
-
digitIndex += this.countDigitsInMask(mask);
}
-
result += this.applySingleMask(digits.slice(digitIndex), mask);
-
digitIndex += this.countDigitsInMask(mask);
diff --git a/frontend/src/app/shared/services/schema-form-field-generator.service.ts b/frontend/src/app/shared/services/schema-form-field-generator.service.ts
index 6d2dc6f..8b3b674 100644
--- a/frontend/src/app/shared/services/schema-form-field-generator.service.ts
+++ b/frontend/src/app/shared/services/schema-form-field-generator.service.ts
@@ -21,8 +21,11 @@ import { numbersCommaSeparatedValidator } from '../validators/numbers-comma-sepa
export class SchemaFormFieldGeneratorService {
-
public getScaleField(
-
scale: number = 1,
-
validators?: ValidatorFn[],
-
): FormControl {
-
return new FormControl(scale, {
nonNullable: true,
validators: [
Validators.required,
@@ -32,8 +35,11 @@ export class SchemaFormFieldGeneratorService {
-
public getTypeField(
-
generatorType: GeneratorType = GeneratorType.Uniform,
-
validators?: ValidatorFn[],
-
) {
-
return new FormControl(generatorType, {
nonNullable: true,
validators: [Validators.required, ...(validators || [])],
});
@@ -54,7 +60,7 @@ export class SchemaFormFieldGeneratorService {
public getMeanField(validators?: ValidatorFn[]): FormControl {
- return new FormControl(1, {
@@ -111,22 +117,14 @@ export class SchemaFormFieldGeneratorService {
public getStartTimeField(validators?: ValidatorFn[]) {
return new FormControl<string>('00:00:00', {
nonNullable: true,
-
validators: [Validators.required, ...(validators || [])],
});
}
public getEndTimeField(validators?: ValidatorFn[]) {
return new FormControl('23:59:59', {
nonNullable: true,
@@ -147,6 +145,48 @@ export class SchemaFormFieldGeneratorService {
-
public getStartDateTimeField(validators?: ValidatorFn[]) {
-
const now = new Date();
-
const startDateTime = this.formatLocalDateTime(now);
-
return new FormControl(startDateTime, {
-
nonNullable: true,
-
validators: [Validators.required, ...(validators || [])],
-
});
-
}
-
public getEndDateTimeField(validators?: ValidatorFn[]) {
-
const endDate = new Date();
-
endDate.setDate(endDate.getDate() + 7);
-
const endDateTime = this.formatLocalDateTime(endDate);
-
return new FormControl(endDateTime, {
-
nonNullable: true,
-
validators: [Validators.required, ...(validators || [])],
-
});
-
}
-
public getStartTimeStampField(validators?: ValidatorFn[]) {
-
const now = new Date();
-
const startTimestamp = now.toISOString();
-
return new FormControl(startTimestamp, {
-
nonNullable: true,
-
validators: [Validators.required, ...(validators || [])],
-
});
-
}
-
public getEndTimestampField(validators?: ValidatorFn[]) {
-
const endDate = new Date();
-
endDate.setDate(endDate.getDate() + 7);
-
const endTimestamp = endDate.toISOString();
-
return new FormControl(endTimestamp, {
-
nonNullable: true,
-
validators: [Validators.required, ...(validators || [])],
-
});
-
}
public getStepField(validators?: ValidatorFn[]): FormControl {
return new FormControl<number>(1, {
nonNullable: true,
@@ -158,8 +198,11 @@ export class SchemaFormFieldGeneratorService {
-
public getDurationField(
-
duration: string = '1 days',
-
validators?: ValidatorFn[],
-
): FormControl {
-
return new FormControl(duration, {
nonNullable: true,
validators: [Validators.required, ...(validators || [])],
});
@@ -211,4 +254,16 @@ export class SchemaFormFieldGeneratorService {
-
private formatLocalDateTime(date: Date): string {
-
const pad = (n: number) => (n < 10 ? '0' + n : n.toString());
-
const year = date.getFullYear();
-
const month = pad(date.getMonth() + 1);
-
const day = pad(date.getDate());
-
const hours = pad(date.getHours());
-
const minutes = pad(date.getMinutes());
-
const seconds = pad(date.getSeconds());
-
return ${year}-${month}-${day}T${hours}:${minutes}:${seconds};
-
}
Not yet included in a published release.