Unverified Commit b0bcde86 authored by Lijiaoa's avatar Lijiaoa Committed by GitHub
Browse files

Refine webui (#4548)

parent b4d8aebb
import * as React from 'react'; import * as React from 'react';
import axios from 'axios'; import axios from 'axios';
import { Stack, StackItem, Panel, PrimaryButton, DefaultButton, Pivot, PivotItem } from '@fluentui/react'; import { Stack, StackItem, Panel, PrimaryButton, DefaultButton, Pivot, PivotItem } from '@fluentui/react';
import { infoIcon } from '../buttons/Icon'; import { DOWNLOAD_IP } from '@static/const';
import { DOWNLOAD_IP } from '../../static/const'; import { downFile } from '@static/function';
import { downFile } from '../../static/function'; import { infoIcon } from '@components/fluent/Icon';
import MonacoHTML from '../public-child/MonacoEditor'; import MonacoHTML from '@components/common/MonacoEditor';
import '../../static/style/logDrawer.scss'; import '@style/logPanel.scss';
interface LogDrawerProps { interface LogPanelProps {
closeDrawer: () => void; closePanel: () => void;
activeTab?: string; activeTab?: string;
} }
interface LogDrawerState { interface LogPanelState {
nniManagerLogStr: string | null; nniManagerLogStr: string | null;
dispatcherLogStr: string | null; dispatcherLogStr: string | null;
isLoading: boolean; isLoading: boolean;
logDrawerHeight: number; logPanelHeight: number;
} }
class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> { class LogPanel extends React.Component<LogPanelProps, LogPanelState> {
private timerId: number | undefined; private timerId: number | undefined;
constructor(props: LogDrawerProps) { constructor(props: LogPanelProps) {
super(props); super(props);
this.state = { this.state = {
nniManagerLogStr: null, nniManagerLogStr: null,
dispatcherLogStr: null, dispatcherLogStr: null,
isLoading: true, isLoading: true,
logDrawerHeight: window.innerHeight logPanelHeight: window.innerHeight
}; };
} }
...@@ -63,25 +63,25 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> { ...@@ -63,25 +63,25 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> {
</div> </div>
); );
setLogDrawerHeight = (): void => { setLogPanelHeight = (): void => {
this.setState(() => ({ logDrawerHeight: window.innerHeight })); this.setState(() => ({ logPanelHeight: window.innerHeight }));
}; };
async componentDidMount(): Promise<void> { async componentDidMount(): Promise<void> {
this.refresh(); this.refresh();
window.addEventListener('resize', this.setLogDrawerHeight); window.addEventListener('resize', this.setLogPanelHeight);
} }
componentWillUnmount(): void { componentWillUnmount(): void {
window.clearTimeout(this.timerId); window.clearTimeout(this.timerId);
window.removeEventListener('resize', this.setLogDrawerHeight); window.removeEventListener('resize', this.setLogPanelHeight);
} }
render(): React.ReactNode { render(): React.ReactNode {
const { closeDrawer, activeTab } = this.props; const { closePanel, activeTab } = this.props;
const { nniManagerLogStr, dispatcherLogStr, isLoading, logDrawerHeight } = this.state; const { nniManagerLogStr, dispatcherLogStr, isLoading, logPanelHeight } = this.state;
// tab[height: 56] + tab[margin-bottom: 20] + button[32] + button[margin-top: 45, -bottom: 7] + fluent-panel own paddingBottom[20] + title-border[2] // tab[height: 56] + tab[margin-bottom: 20] + button[32] + button[margin-top: 45, -bottom: 7] + fluent-panel own paddingBottom[20] + title-border[2]
const monacoHeight = logDrawerHeight - 182; const monacoHeight = logPanelHeight - 182;
return ( return (
<Stack> <Stack>
<Panel <Panel
...@@ -89,7 +89,7 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> { ...@@ -89,7 +89,7 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> {
hasCloseButton={false} hasCloseButton={false}
isFooterAtBottom={true} isFooterAtBottom={true}
isLightDismiss={true} isLightDismiss={true}
onLightDismissClick={closeDrawer} onLightDismissClick={closePanel}
className='logPanel' className='logPanel'
> >
<Pivot selectedKey={activeTab} style={{ minHeight: 190 }}> <Pivot selectedKey={activeTab} style={{ minHeight: 190 }}>
...@@ -105,7 +105,7 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> { ...@@ -105,7 +105,7 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> {
<PrimaryButton text='Download' onClick={this.downloadDispatcher} /> <PrimaryButton text='Download' onClick={this.downloadDispatcher} />
</StackItem> </StackItem>
<StackItem grow={12} className='close'> <StackItem grow={12} className='close'>
<DefaultButton text='Close' onClick={closeDrawer} /> <DefaultButton text='Close' onClick={closePanel} />
</StackItem> </StackItem>
</Stack> </Stack>
</div> </div>
...@@ -122,7 +122,7 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> { ...@@ -122,7 +122,7 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> {
<PrimaryButton text='Download' onClick={this.downloadNNImanager} /> <PrimaryButton text='Download' onClick={this.downloadNNImanager} />
</StackItem> </StackItem>
<StackItem grow={12} className='close'> <StackItem grow={12} className='close'>
<DefaultButton text='Close' onClick={closeDrawer} /> <DefaultButton text='Close' onClick={closePanel} />
</StackItem> </StackItem>
</Stack> </Stack>
</div> </div>
...@@ -159,4 +159,4 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> { ...@@ -159,4 +159,4 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> {
}; };
} }
export default LogDrawer; export default LogPanel;
import * as React from 'react'; import * as React from 'react';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { getPrefix } from '../../static/function'; import { getPrefix } from '@static/function';
const OVERVIEWTABS = ( const OVERVIEWTABS = (
<NavLink to='/oview' activeClassName='selected' className='common-tabs'> <NavLink to='/oview' activeClassName='selected' className='common-tabs'>
......
...@@ -2,10 +2,14 @@ import React, { useState, useCallback } from 'react'; ...@@ -2,10 +2,14 @@ import React, { useState, useCallback } from 'react';
import { Stack, DefaultButton, Icon } from '@fluentui/react'; import { Stack, DefaultButton, Icon } from '@fluentui/react';
import MediaQuery from 'react-responsive'; import MediaQuery from 'react-responsive';
import TrialConfigPanel from './TrialConfigPanel'; import TrialConfigPanel from './TrialConfigPanel';
import LogPanel from '../modals/LogPanel'; import LogPanel from './LogPanel';
import IconButtonTemplate from './IconButtonTemplet'; import IconButtonTemplate from './IconButtonTemplet';
import '../../static/style/overview/panel.scss'; import '@style/nav/slideNavBtns.scss';
/***
* this file is the container of [config, search space, dispatcher/nnimanager log]
* these three button is in the right of page
*/
export const SlideNavBtns = (): any => { export const SlideNavBtns = (): any => {
const [isShowConfigPanel, setShowConfigPanle] = useState(false); const [isShowConfigPanel, setShowConfigPanle] = useState(false);
const [isShowLogPanel, setShowLogPanel] = useState(false); const [isShowLogPanel, setShowLogPanel] = useState(false);
...@@ -57,7 +61,7 @@ export const SlideNavBtns = (): any => { ...@@ -57,7 +61,7 @@ export const SlideNavBtns = (): any => {
</Stack> </Stack>
{isShowConfigPanel && <TrialConfigPanel panelName={panelName} hideConfigPanel={hideConfigPanel} />} {isShowConfigPanel && <TrialConfigPanel panelName={panelName} hideConfigPanel={hideConfigPanel} />}
{/* the panel for dispatcher & nnimanager log message */} {/* the panel for dispatcher & nnimanager log message */}
{isShowLogPanel && <LogPanel closeDrawer={hideLogPanel} />} {isShowLogPanel && <LogPanel closePanel={hideLogPanel} />}
</React.Fragment> </React.Fragment>
); );
}; };
import * as React from 'react'; import * as React from 'react';
import { Stack, Panel, PrimaryButton } from '@fluentui/react'; import { Stack, Panel, PrimaryButton } from '@fluentui/react';
import { EXPERIMENT } from '../../static/datamodel';
import MonacoEditor from 'react-monaco-editor';
import { MONACO } from '../../static/const';
import { convertDuration, caclMonacoEditorHeight } from '../../static/function';
import { prettyStringify } from '../../static/json_util';
import lodash from 'lodash'; import lodash from 'lodash';
import '../../static/style/logDrawer.scss'; import MonacoEditor from 'react-monaco-editor';
import { EXPERIMENT } from '@static/datamodel';
import { MONACO } from '@static/const';
import { convertDuration, caclMonacoEditorHeight } from '@static/function';
import { prettyStringify } from '@static/jsonutil';
import '@static/style/logPanel.scss';
interface LogDrawerProps { interface LogDrawerProps {
hideConfigPanel: () => void; hideConfigPanel: () => void;
......
import * as React from 'react';
import { TRIALS } from '../../static/datamodel';
interface IntermediateValProps {
trialId: string;
}
class IntermediateVal extends React.Component<IntermediateValProps, {}> {
constructor(props: IntermediateValProps) {
super(props);
}
render(): React.ReactNode {
return <div>{TRIALS.getTrial(this.props.trialId).formatLatestAccuracy()}</div>;
}
}
export default IntermediateVal;
...@@ -3,11 +3,11 @@ import ReactDOM from 'react-dom'; ...@@ -3,11 +3,11 @@ import ReactDOM from 'react-dom';
import App from './App'; import App from './App';
import { getPrefix } from './static/function'; import { getPrefix } from './static/function';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
const Overview = lazy(() => import('./components/Overview')); const Overview = lazy(() => import('./components/experiment/overview/Overview'));
const TrialsDetail = lazy(() => import('./components/TrialsDetail')); const TrialsDetail = lazy(() => import('./components/experiment/trialdetail/TrialsDetail'));
const Experiment = lazy(() => import('./components/managementExp/ExperimentManager')); const ExperimentManagerIndex = lazy(() => import('./components/experimentManagement/ExperimentManagerIndex'));
import './index.css'; import '@style/index.css';
import './static/style/loading.scss'; import '@style/loading.scss';
import * as serviceWorker from './serviceWorker'; import * as serviceWorker from './serviceWorker';
const path = getPrefix(); const path = getPrefix();
...@@ -21,7 +21,7 @@ ReactDOM.render( ...@@ -21,7 +21,7 @@ ReactDOM.render(
</div> </div>
} }
> >
<Route path='/experiment' component={Experiment} exact /> <Route path='/experiment' component={ExperimentManagerIndex} exact />
<Switch> <Switch>
<App> <App>
<Route path='/' component={Overview} exact /> <Route path='/' component={Overview} exact />
......
...@@ -36,6 +36,7 @@ $error: #a4262c; ...@@ -36,6 +36,7 @@ $error: #a4262c;
} }
} }
/* set color for experiment best-metric value in overview page */
.bestMetric { .bestMetric {
.DONE, .DONE,
.STOPPED, .STOPPED,
......
/* all table status font-color */ /* all trial status font-color in the table */
.RUNNING, .RUNNING,
.USER_CANCELED { .USER_CANCELED {
color: #0071bc; color: #0071bc;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment