This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[webui] refactor overview page #2924
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
86c8a2e
fisrt commit
d2507f5
Merge branch 'master' of https://github.com/Microsoft/nni into overview
f95b541
fix styles
4dfbb02
fix showMessage info
87a68c9
PR
876bf58
fix update bug and improve trial command model
6020f3e
fix a comment
79c8373
delete unuseful file
1dfd074
add img file back and delete final metric is format because webui sup…
2864845
add global loding
697420b
fix some comments
5a1dd22
fix yuge comments and update loading img style and update yarn.lock
d3b8ac3
fix comments
bab6b92
remove config search space button from overview page to App
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import { COLUMN } from './static/const'; | |
import { EXPERIMENT, TRIALS } from './static/datamodel'; | ||
import NavCon from './components/NavCon'; | ||
import MessageInfo from './components/modals/MessageInfo'; | ||
import { TrialConfigButton } from './components/public-child/config/TrialConfigButton'; | ||
import './App.scss'; | ||
|
||
interface AppState { | ||
|
@@ -30,12 +31,13 @@ export const AppContext = React.createContext({ | |
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars | ||
changeMetricGraphMode: (val: 'max' | 'min') => {}, | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars | ||
changeEntries: (val: string) => {} | ||
changeEntries: (val: string) => {}, | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars | ||
updateOverviewPage: () => {} | ||
}); | ||
|
||
class App extends React.Component<{}, AppState> { | ||
private timerId!: number | undefined; | ||
private dataFormatimer!: number; | ||
private firstLoad: boolean = false; // when click refresh selector options | ||
constructor(props: {}) { | ||
super(props); | ||
|
@@ -60,35 +62,8 @@ class App extends React.Component<{}, AppState> { | |
metricGraphMode: EXPERIMENT.optimizeMode === 'minimize' ? 'min' : 'max' | ||
})); | ||
this.timerId = window.setTimeout(this.refresh, this.state.interval * 100); | ||
// final result is legal | ||
// get a succeed trial,see final result data's format | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
this.dataFormatimer = window.setInterval(this.getFinalDataFormat, this.state.interval * 1000); | ||
} | ||
|
||
getFinalDataFormat = (): void => { | ||
for (let i = 0; this.state.isillegalFinal === false; i++) { | ||
if (TRIALS.succeededTrials()[0] !== undefined && TRIALS.succeededTrials()[0].final !== undefined) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const oneSucceedTrial = JSON.parse(JSON.parse(TRIALS.succeededTrials()[0].final!.data)); | ||
if (typeof oneSucceedTrial === 'number' || oneSucceedTrial.hasOwnProperty('default')) { | ||
window.clearInterval(this.dataFormatimer); | ||
break; | ||
} else { | ||
// illegal final data | ||
this.setState(() => ({ | ||
isillegalFinal: true, | ||
expWarningMessage: | ||
'WebUI support final result as number and dictornary includes default keys, your experiment final result is illegal, please check your data.' | ||
})); | ||
window.clearInterval(this.dataFormatimer); | ||
} | ||
} else { | ||
break; | ||
} | ||
} | ||
}; | ||
|
||
changeInterval = (interval: number): void => { | ||
window.clearTimeout(this.timerId); | ||
if (interval === 0) { | ||
|
@@ -116,6 +91,12 @@ class App extends React.Component<{}, AppState> { | |
this.setState({ bestTrialEntries: entries }); | ||
}; | ||
|
||
updateOverviewPage = (): void => { | ||
this.setState(state => ({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems the parenthesis is not necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually needed. |
||
experimentUpdateBroadcast: state.experimentUpdateBroadcast + 1 | ||
})); | ||
}; | ||
|
||
shouldComponentUpdate(nextProps: any, nextState: AppState): boolean { | ||
if (!(nextState.isUpdate || nextState.isUpdate === undefined)) { | ||
nextState.isUpdate = true; | ||
|
@@ -155,6 +136,8 @@ class App extends React.Component<{}, AppState> { | |
</div> | ||
<Stack className='contentBox'> | ||
<Stack className='content'> | ||
{/* search space & config */} | ||
<TrialConfigButton /> | ||
{/* if api has error field, show error message */} | ||
{errorList.map( | ||
(item, key) => | ||
|
@@ -179,7 +162,8 @@ class App extends React.Component<{}, AppState> { | |
metricGraphMode, | ||
changeMetricGraphMode: this.changeMetricGraphMode, | ||
bestTrialEntries, | ||
changeEntries: this.changeEntries | ||
changeEntries: this.changeEntries, | ||
updateOverviewPage: this.updateOverviewPage | ||
}} | ||
> | ||
{this.props.children} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
(_: string) => {}
will suppress the warning.Why
no-empty-function
is enabled? Doesn't make any sense to me.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense to me. And this rule is discussed result?