Skip to content

Commit

Permalink
Fix [Batch Run] change map to dict in parameters types
Browse files Browse the repository at this point in the history
  • Loading branch information
mavdryk committed Dec 20, 2023
1 parent 5ab50a7 commit e31deaf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/components/JobWizard/JobWizard.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import {
parameterTypeFloat,
parameterTypeInt,
parameterTypeList,
parameterTypeMap,
parameterTypeDict,
parameterTypeStr,
parameterTypeValueMap
} from '../../elements/FormParametersTable/formParametersTable.util'
Expand Down Expand Up @@ -719,7 +719,7 @@ export const parseParameterType = (parameterValue, isHyper) => {
!Array.isArray(parameterValue) &&
parameterValue !== null
) {
return parameterTypeMap
return parameterTypeDict
} else if (isFinite(parameterValue)) {
return String(parameterValue).includes('.') ? parameterTypeFloat : parameterTypeInt
} else if (typeof parameterValue === 'boolean') {
Expand Down Expand Up @@ -823,7 +823,7 @@ const convertParameterValue = (value, type) => {
return Number(value)
} else if (type === parameterTypeBool && ['true', 'false'].includes(value.toLowerCase())) {
return value.toLowerCase() === 'true'
} else if ([parameterTypeList, parameterTypeMap].includes(type)) {
} else if ([parameterTypeList, parameterTypeDict].includes(type)) {
try {
return JSON.parse(value)
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { FormRowActions } from 'igz-controls/elements'

import {
parameterTypeList,
parameterTypeMap,
parameterTypeDict,
parametersValueTypeOptions,
parameterTypeBool,
parameterTypeInt,
Expand Down Expand Up @@ -81,11 +81,11 @@ const FormParametersRow = ({
const tableEditingRowClassNames = classnames(tableRowClassNames, 'form-table__row_active')

const getValueValidationRules = parameterType => {
if (parameterType === parameterTypeMap) {
if (parameterType === parameterTypeDict) {
return [
{
name: 'invalidStructure',
label: 'Value is not a valid `map` type',
label: 'Value is not a valid `dict` type',
pattern: newValue => {
try {
const parsedValue = JSON.parse(String(newValue))
Expand Down Expand Up @@ -162,7 +162,7 @@ const FormParametersRow = ({
return typeof valueItem === 'boolean'
case parameterTypeList:
return Array.isArray(valueItem)
case parameterTypeMap:
case parameterTypeDict:
return isPlainObject(valueItem)
default:
return false
Expand All @@ -181,8 +181,8 @@ const FormParametersRow = ({

const getValueTip = parameterType => {
switch (parameterType) {
case parameterTypeMap:
return 'The valid `map` type must be in the JSON format\n e.g. {"hello": "world"}'
case parameterTypeDict:
return 'The valid `dict` type must be in the JSON format\n e.g. {"hello": "world"}'
case parameterTypeList:
return 'The valid `list` type must be in the JSON format\n e.g. ["hello", "world"]'
default:
Expand All @@ -207,7 +207,7 @@ const FormParametersRow = ({
return 'Example: [true, false]'
case parameterTypeList:
return 'Example: [["hello", "world"], [1, 2, 3]]'
case parameterTypeMap:
case parameterTypeDict:
return 'Example: [{"hello": "world"}, {"test": true}]'
default:
return ''
Expand Down
18 changes: 9 additions & 9 deletions src/elements/FormParametersTable/formParametersTable.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const parameterTypeInt = 'int'
export const parameterTypeFloat = 'float'
export const parameterTypeBool = 'bool'
export const parameterTypeList = 'list'
export const parameterTypeMap = 'map'
export const parameterTypeDict = 'dict'

export const parameterOptionRange = 'range'
export const parameterOptionRandomize = 'randomize'
Expand All @@ -35,7 +35,7 @@ export const parameterTypeValueMap = {
[parameterTypeInt]: 'integer',
[parameterTypeFloat]: 'float',
[parameterTypeBool]: 'boolean',
[parameterTypeMap]: 'map',
[parameterTypeDict]: 'dict',
[parameterTypeList]: 'list'
}

Expand All @@ -50,27 +50,27 @@ export const parametersValueOptionsList = [
]
export const parametersValueTypeOptions = [
{
label: 'str',
label: parameterTypeStr,
id: parameterTypeStr
},
{
label: 'int',
label: parameterTypeInt,
id: parameterTypeInt
},
{
label: 'float',
label: parameterTypeFloat,
id: parameterTypeFloat
},
{
label: 'bool',
label: parameterTypeBool,
id: parameterTypeBool
},
{
label: 'list',
label: parameterTypeList,
id: parameterTypeList
},
{
label: 'map',
id: parameterTypeMap
label: parameterTypeDict,
id: parameterTypeDict
}
]

0 comments on commit e31deaf

Please sign in to comment.