import * as React from 'react'; import { Stack, FocusTrapCallout, DefaultButton, FocusZone, PrimaryButton, getTheme, mergeStyleSets, FontWeights } from '@fluentui/react'; import { killJob } from '../../static/function'; import { blocked } from '../buttons/Icon'; const theme = getTheme(); const styles = mergeStyleSets({ buttonArea: { verticalAlign: 'top', display: 'inline-block', textAlign: 'center', height: 32 }, callout: { maxWidth: 300 }, header: { padding: '18px 24px 12px' }, title: [ theme.fonts.xLarge, { margin: 0, color: theme.palette.neutralPrimary, fontWeight: FontWeights.semilight } ], inner: { height: '100%', padding: '0 24px 20px' }, actions: { position: 'relative', marginTop: 20, width: '100%', whiteSpace: 'nowrap' }, buttons: { display: 'flex', justifyContent: 'flex-end', padding: '0 24px 24px' }, subtext: [ theme.fonts.small, { margin: 0, color: theme.palette.neutralPrimary, fontWeight: FontWeights.semilight } ] }); interface KillJobState { isCalloutVisible: boolean; } interface KillJobProps { trial: any; } class KillJob extends React.Component { private menuButtonElement!: HTMLElement | null; constructor(props: KillJobProps) { super(props); this.state = { isCalloutVisible: false }; } onDismiss = (): void => { this.setState(() => ({ isCalloutVisible: false })); }; onKill = (): void => { this.setState({ isCalloutVisible: false }, () => { const { trial } = this.props; killJob(trial.key, trial.id, trial.status); }); }; openPromot = (event: React.SyntheticEvent): void => { event.preventDefault(); event.stopPropagation(); this.setState({ isCalloutVisible: true }); }; render(): React.ReactNode { const { isCalloutVisible } = this.state; const prompString = 'Are you sure to cancel this trial?'; return (
(this.menuButtonElement = menuButton)}> {blocked}
{isCalloutVisible ? (

Kill trial

{prompString}

No Yes
) : null}
); } } export default KillJob;