This commit is contained in:
Michele Artini 2024-01-15 12:14:13 +01:00
parent 0816c578eb
commit a04a9ec55a
5 changed files with 36 additions and 12 deletions

View File

@ -7,7 +7,8 @@
{
"name":"mode",
"description":"Collection Mode",
"defaultValue":"REFRESH"
"defaultValue":"REFRESH",
"validTerms": ["REFRESH" , "INCREMENTAL"]
},
{
"name":"overrideFromDate",

View File

@ -46,6 +46,8 @@ import { OaiComponent } from './oai/oai.component';
import { SwaggerUiComponent } from './swagger/swagger-ui.component';
import { WfTemplateDialog, WfConfDialog } from './wf-confs/wf-common.component';
import { MatMenuModule } from '@angular/material/menu';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
@NgModule({
declarations: [
@ -123,7 +125,9 @@ import { MatMenuModule } from '@angular/material/menu';
MatStepperModule,
MatButtonModule,
MatIconModule,
MatMenuModule
MatMenuModule,
MatDatepickerModule,
MatNativeDateModule,
],
providers: [{
provide: HTTP_INTERCEPTORS,

View File

@ -226,7 +226,8 @@ export interface WfParam {
description?: string,
type?: string,
defaultValue?: any,
required: boolean
required: boolean,
validTerms: string[]
}
export interface WfHistoryEntry {

View File

@ -181,16 +181,15 @@ export class WfConfDialog implements OnInit {
if (p.required) { validations.push(Validators.required); }
if (p.type == 'number') { validations.push(Validators.pattern('^[0-9]*$')); }
if (this.data.userParams[p.name]) {
this.wfConfFormStep3.addControl(p.name, new FormControl(this.data.userParams[p.name], validations));
} else if (this.data.systemParams[p.name]) {
this.wfConfFormStep3.addControl(p.name, new FormControl({ value: this.data.systemParams[p.name], disabled: true }, validations));
} else if (p.defaultValue) {
this.wfConfFormStep3.addControl(p.name, new FormControl(p.defaultValue, validations));
} else {
this.wfConfFormStep3.addControl(p.name, new FormControl('', validations));
}
})
});

View File

@ -63,13 +63,32 @@
<form [formGroup]="wfConfFormStep3">
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;" *ngFor="let p of wfParameters">
<mat-label>{{p.name}}</mat-label>
<input matInput [formControlName]="p.name" *ngIf="p.type != 'boolean'" />
<mat-select matInput [formControlName]="p.name" *ngIf="p.type == 'boolean'">
<mat-option></mat-option>
<mat-option value="true">true</mat-option>
<mat-option value="false">false</mat-option>
</mat-select>
<div [ngSwitch]="p.type">
<input matInput type="number" [formControlName]="p.name" *ngSwitchCase="'NUMBER'" />
<mat-select matInput [formControlName]="p.name" *ngSwitchCase="'BOOLEAN'">
<mat-option></mat-option>
<mat-option value="true">true</mat-option>
<mat-option value="false">false</mat-option>
</mat-select>
<div *ngSwitchCase="'DATE'">
<input matInput [matDatepicker]="datepicker">
<mat-datepicker-toggle matIconSuffix [for]="datepicker"></mat-datepicker-toggle>
<mat-datepicker #datepicker />
</div>
<div *ngSwitchDefault>
<input matInput type="text" [formControlName]="p.name" *ngIf="p.validTerms.length == 0" />
<mat-select matInput [formControlName]="p.name" *ngIf="p.validTerms.length > 0">
<mat-option></mat-option>
<mat-option value="{{t}}" *ngFor="let t of p.validTerms">{{t}}</mat-option>
</mat-select>
</div>
</div>
<mat-error *ngIf="wfConfFormStep3.get(p.name)?.invalid">Invalid value</mat-error>
</mat-form-field>