[AAE-15082][AAE-15081] Resolve the options coming from a json variabl… (#8673)

* [AAE-15082][AAE-15081] Resolve the options coming from a json variable for a dropdown

* split method to smaller parts and remove duplications in units

* fix unit tests

* get variables from API call

* [AAE-15082] Add handle form variable

* replace variableId by variableName

* improve code
This commit is contained in:
Tomasz Gnyp
2023-06-29 17:21:14 +02:00
committed by GitHub
parent dabe4ca279
commit e3ea23da37
7 changed files with 379 additions and 20 deletions

View File

@@ -0,0 +1,23 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface VariableConfig {
variableName: string;
optionsPath?: string;
optionsId?: string;
optionsLabel?: string;
}

View File

@@ -27,6 +27,7 @@ import { FormWidgetModel } from './form-widget.model';
import { FormFieldRule } from './form-field-rule';
import { ProcessFormModel } from './process-form-model.interface';
import { isNumberValue } from './form-field-utils';
import { VariableConfig } from './form-field-variable-options';
// Maps to FormFieldRepresentation
export class FormFieldModel extends FormWidgetModel {
@@ -66,7 +67,7 @@ export class FormFieldModel extends FormWidgetModel {
restLabelProperty: string;
hasEmptyValue: boolean;
className: string;
optionType: 'rest' | 'manual' ;
optionType: 'rest' | 'manual' | 'variable';
params: FormFieldMetadata = {};
hyperlinkUrl: string;
displayText: string;
@@ -81,6 +82,7 @@ export class FormFieldModel extends FormWidgetModel {
selectLoggedUser: boolean;
groupsRestriction: string[];
leftLabels: boolean = false;
variableConfig: VariableConfig;
// container model members
numberOfColumns: number = 1;
@@ -194,6 +196,7 @@ export class FormFieldModel extends FormWidgetModel {
this.rule = json.rule;
this.selectLoggedUser = json.selectLoggedUser;
this.groupsRestriction = json.groupsRestriction?.groups;
this.variableConfig = json.variableConfig;
if (json.placeholder && json.placeholder !== '' && json.placeholder !== 'null') {
this.placeholder = json.placeholder;

View File

@@ -46,6 +46,7 @@
"UPLOAD": "UPLOAD",
"REQUIRED": "This is a required field",
"REST_API_FAILED": "The server `{{ hostname }}` is not reachable",
"VARIABLE_DROPDOWN_OPTIONS_FAILED": "There was a problem loading dropdown elements. Please contact administrator.",
"FILE_NAME": "File Name",
"NO_FILE_ATTACHED": "No file attached",
"VALIDATOR": {