Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
2f166e98
Unverified
Commit
2f166e98
authored
Apr 22, 2021
by
Lijiaoa
Committed by
GitHub
Apr 22, 2021
Browse files
fix update experiment paramters bug (#3556)
parent
c2c04f6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
52 deletions
+49
-52
ts/webui/src/components/overview/count/EditExperimentParam.tsx
...bui/src/components/overview/count/EditExperimentParam.tsx
+10
-1
ts/webui/src/components/slideNav/TrialConfigPanel.tsx
ts/webui/src/components/slideNav/TrialConfigPanel.tsx
+39
-51
No files found.
ts/webui/src/components/overview/count/EditExperimentParam.tsx
View file @
2f166e98
...
@@ -30,6 +30,7 @@ export const EditExperimentParam = (): any => {
...
@@ -30,6 +30,7 @@ export const EditExperimentParam = (): any => {
const
{
title
,
field
,
editType
,
maxExecDuration
,
maxTrialNum
,
trialConcurrency
,
updateOverviewPage
}
=
useContext
(
const
{
title
,
field
,
editType
,
maxExecDuration
,
maxTrialNum
,
trialConcurrency
,
updateOverviewPage
}
=
useContext
(
EditExpeParamContext
EditExpeParamContext
);
);
const
originMaxDurationStr
=
EXPERIMENT
.
profile
.
params
.
maxExperimentDuration
;
const
{
maxDurationUnit
,
changeMaxDurationUnit
}
=
useContext
(
AppContext
);
const
{
maxDurationUnit
,
changeMaxDurationUnit
}
=
useContext
(
AppContext
);
const
[
unit
,
setUnit
]
=
useState
(
maxDurationUnit
);
const
[
unit
,
setUnit
]
=
useState
(
maxDurationUnit
);
let
defaultVal
=
''
;
let
defaultVal
=
''
;
...
@@ -112,8 +113,10 @@ export const EditExperimentParam = (): any => {
...
@@ -112,8 +113,10 @@ export const EditExperimentParam = (): any => {
params
:
{
update_type
:
editType
}
params
:
{
update_type
:
editType
}
});
});
if
(
res
.
status
===
200
)
{
if
(
res
.
status
===
200
)
{
if
(
isMaxDuration
)
{
changeMaxDurationUnit
(
unit
);
}
showMessageInfo
(
`Successfully updated experiment's
${
field
}
`
,
'
success
'
);
showMessageInfo
(
`Successfully updated experiment's
${
field
}
`
,
'
success
'
);
changeMaxDurationUnit
(
unit
);
updateOverviewPage
();
updateOverviewPage
();
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -127,6 +130,12 @@ export const EditExperimentParam = (): any => {
...
@@ -127,6 +130,12 @@ export const EditExperimentParam = (): any => {
showMessageInfo
(
`Failed to update trial
${
field
}
\nUnknown error`
,
'
error
'
);
showMessageInfo
(
`Failed to update trial
${
field
}
\nUnknown error`
,
'
error
'
);
}
}
setEditValInput
(
defaultVal
);
setEditValInput
(
defaultVal
);
// confirm trial config panel val
if
(
isMaxDuration
)
{
newProfile
.
params
[
field
]
=
originMaxDurationStr
;
}
else
{
newProfile
.
params
[
field
]
=
beforeParam
;
}
}
}
showPencil
();
showPencil
();
}
}
...
...
ts/webui/src/components/slideNav/TrialConfigPanel.tsx
View file @
2f166e98
...
@@ -3,8 +3,7 @@ import { Stack, Panel, PrimaryButton } from '@fluentui/react';
...
@@ -3,8 +3,7 @@ import { Stack, Panel, PrimaryButton } from '@fluentui/react';
import
{
EXPERIMENT
}
from
'
../../static/datamodel
'
;
import
{
EXPERIMENT
}
from
'
../../static/datamodel
'
;
import
MonacoEditor
from
'
react-monaco-editor
'
;
import
MonacoEditor
from
'
react-monaco-editor
'
;
import
{
MONACO
}
from
'
../../static/const
'
;
import
{
MONACO
}
from
'
../../static/const
'
;
import
{
AppContext
}
from
'
../../App
'
;
import
{
convertDuration
,
caclMonacoEditorHeight
}
from
'
../../static/function
'
;
import
{
convertDuration
,
convertTimeAsUnit
,
caclMonacoEditorHeight
}
from
'
../../static/function
'
;
import
{
prettyStringify
}
from
'
../../static/json_util
'
;
import
{
prettyStringify
}
from
'
../../static/json_util
'
;
import
lodash
from
'
lodash
'
;
import
lodash
from
'
lodash
'
;
import
'
../../static/style/logDrawer.scss
'
;
import
'
../../static/style/logDrawer.scss
'
;
...
@@ -69,56 +68,45 @@ class TrialConfigPanel extends React.Component<LogDrawerProps, LogDrawerState> {
...
@@ -69,56 +68,45 @@ class TrialConfigPanel extends React.Component<LogDrawerProps, LogDrawerState> {
const
prettyWidth
=
innerWidth
>
1400
?
100
:
60
;
const
prettyWidth
=
innerWidth
>
1400
?
100
:
60
;
const
showProfile
=
JSON
.
stringify
(
profile
,
filter
,
2
);
return
(
return
(
<
AppContext
.
Consumer
>
<
Stack
>
{
(
value
):
React
.
ReactNode
=>
{
<
Panel
const
unit
=
value
.
maxDurationUnit
;
isOpen
=
{
true
}
profile
.
params
.
maxExperimentDuration
=
`
${
convertTimeAsUnit
(
hasCloseButton
=
{
false
}
unit
,
isFooterAtBottom
=
{
true
}
profile
.
params
.
maxExperimentDuration
isLightDismiss
=
{
true
}
)}${
unit
}
`
;
onLightDismissClick
=
{
hideConfigPanel
}
const
showProfile
=
JSON
.
stringify
(
profile
,
filter
,
2
);
>
return
(
<
div
className
=
'panel'
>
<
Stack
>
{
panelName
===
'
search space
'
?
(
<
Panel
<
div
>
isOpen
=
{
true
}
<
div
className
=
'panelName'
>
Search space
</
div
>
hasCloseButton
=
{
false
}
<
MonacoEditor
isFooterAtBottom
=
{
true
}
height
=
{
monacoEditorHeight
}
isLightDismiss
=
{
true
}
language
=
'json'
onLightDismissClick
=
{
hideConfigPanel
}
theme
=
'vs-light'
>
value
=
{
prettyStringify
(
EXPERIMENT
.
searchSpace
,
prettyWidth
,
2
)
}
<
div
className
=
'panel'
>
options
=
{
MONACO
}
{
panelName
===
'
search space
'
?
(
/>
<
div
>
</
div
>
<
div
className
=
'panelName'
>
Search space
</
div
>
)
:
(
<
MonacoEditor
<
div
className
=
'profile'
>
height
=
{
monacoEditorHeight
}
<
div
className
=
'panelName'
>
Config
</
div
>
language
=
'json'
<
MonacoEditor
theme
=
'vs-light'
width
=
'100%'
value
=
{
prettyStringify
(
EXPERIMENT
.
searchSpace
,
prettyWidth
,
2
)
}
height
=
{
monacoEditorHeight
}
options
=
{
MONACO
}
language
=
'json'
/>
theme
=
'vs-light'
</
div
>
value
=
{
showProfile
}
)
:
(
options
=
{
MONACO
}
<
div
className
=
'profile'
>
/>
<
div
className
=
'panelName'
>
Config
</
div
>
</
div
>
<
MonacoEditor
)
}
width
=
'100%'
<
PrimaryButton
text
=
'Close'
className
=
'configClose'
onClick
=
{
hideConfigPanel
}
/>
height
=
{
monacoEditorHeight
}
</
div
>
language
=
'json'
</
Panel
>
theme
=
'vs-light'
</
Stack
>
value
=
{
showProfile
}
options
=
{
MONACO
}
/>
</
div
>
)
}
<
PrimaryButton
text
=
'Close'
className
=
'configClose'
onClick
=
{
hideConfigPanel
}
/>
</
div
>
</
Panel
>
</
Stack
>
);
}
}
</
AppContext
.
Consumer
>
);
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment