import * as React from 'react'; import { Stack, Panel, Pivot, PivotItem, PrimaryButton } from '@fluentui/react'; import { EXPERIMENT } from '../../../static/datamodel'; import MonacoEditor from 'react-monaco-editor'; import { MONACO } from '../../../static/const'; import { convertDuration } from '../../../static/function'; import { prettyStringify } from '../../../static/json_util'; import lodash from 'lodash'; import '../../../static/style/logDrawer.scss'; interface LogDrawerProps { hideConfigPanel: () => void; activeTab?: string; } interface LogDrawerState { panelInnerHeight: number; } class TrialConfigPanel extends React.Component { constructor(props: LogDrawerProps) { super(props); this.state = { panelInnerHeight: window.innerHeight }; } setLogDrawerHeight(): void { this.setState(() => ({ panelInnerHeight: window.innerHeight })); } async componentDidMount(): Promise { window.addEventListener('resize', this.setLogDrawerHeight); } componentWillUnmount(): void { window.removeEventListener('resize', this.setLogDrawerHeight); } render(): React.ReactNode { const { hideConfigPanel, activeTab } = this.props; const { panelInnerHeight } = this.state; // [marginTop 16px] + [Search space 46px] + // button[height: 32px, marginTop: 45px, marginBottom: 25px] + [padding-bottom: 20px] const monacoEditorHeight = panelInnerHeight - 184; const blacklist = [ 'id', 'logDir', 'startTime', 'endTime', 'experimentName', 'searchSpace', 'trainingServicePlatform' ]; const filter = (key: string, val: any): any => { return blacklist.includes(key) ? undefined : val; }; const profile = lodash.cloneDeep(EXPERIMENT.profile); profile.execDuration = convertDuration(profile.execDuration); profile.params.maxExecDuration = convertDuration(profile.params.maxExecDuration); const showProfile = JSON.stringify(profile, filter, 2); return (
); } } export default TrialConfigPanel;