Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Transformerlab App
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
TransformerLab
Transformerlab App
Commits
277f6617
Commit
277f6617
authored
1 month ago
by
deep1401
Browse files
Options
Downloads
Patches
Plain Diff
Read multiple value from ui:options if not defined directly. Default is always true
parent
5cd7ee50
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/renderer/components/Experiment/DynamicPluginForm.tsx
+20
-13
20 additions, 13 deletions
src/renderer/components/Experiment/DynamicPluginForm.tsx
with
20 additions
and
13 deletions
src/renderer/components/Experiment/DynamicPluginForm.tsx
+
20
−
13
View file @
277f6617
...
@@ -402,14 +402,21 @@ function CustomAutocompleteWidget<T = any, S extends StrictRJSFSchema = RJSFSche
...
@@ -402,14 +402,21 @@ function CustomAutocompleteWidget<T = any, S extends StrictRJSFSchema = RJSFSche
schema
,
schema
,
multiple
,
multiple
,
}
=
props
;
}
=
props
;
console
.
log
(
"
OPTIONS
"
,
options
);
const
{
enumOptions
}
=
options
;
const
{
enumOptions
}
=
options
;
console
.
log
(
"
ENUM OPTIONS
"
,
enumOptions
);
// Default multiple is true.
// Default multiple is true.
const
_multiple
=
typeof
multiple
===
'
undefined
'
?
true
:
!!
multiple
;
// const _multiple = typeof multiple === 'undefined' ? true : !!multiple;
// Check both multiple and options.multiple; default is true.
// console.log("OPTIONS", options);
const
_multiple
=
typeof
multiple
!==
'
undefined
'
?
Boolean
(
multiple
)
:
typeof
options
.
multiple
!==
'
undefined
'
?
Boolean
(
options
.
multiple
)
:
true
;
// console.log("multiple", _multiple);
// Determine default value.
// Determine default value.
const
defaultValue
=
_multiple
?
[]
:
''
;
const
defaultValue
=
_multiple
?
[]
:
''
;
// Use the provided value or fallback to default.
// Use the provided value or fallback to default.
...
@@ -525,15 +532,15 @@ export default function DynamicPluginForm({
...
@@ -525,15 +532,15 @@ export default function DynamicPluginForm({
parsedData
.
parameters
&&
parsedData
.
parameters
&&
key
in
parsedData
.
parameters
key
in
parsedData
.
parameters
)
{
)
{
if
(
parsedData
.
parameters
[
key
].
enum
)
{
//
if (parsedData.parameters[key].enum) {
// Set the enum array such that config[key] is the first element
//
// Set the enum array such that config[key] is the first element
const
enumArray
=
parsedData
.
parameters
[
key
].
enum
;
//
const enumArray = parsedData.parameters[key].enum;
let
index
=
enumArray
.
indexOf
(
config
[
key
]);
//
let index = enumArray.indexOf(config[key]);
if
(
index
>
0
)
{
//
if (index > 0) {
enumArray
.
unshift
(
enumArray
.
splice
(
index
,
1
)[
0
]);
//
enumArray.unshift(enumArray.splice(index, 1)[0]);
}
//
}
parsedData
.
parameters
[
key
].
enum
=
enumArray
;
//
parsedData.parameters[key].enum = enumArray;
}
//
}
parsedData
.
parameters
[
key
].
default
=
config
[
key
];
parsedData
.
parameters
[
key
].
default
=
config
[
key
];
}
}
});
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment