|
|
@ -1,6 +1,10 @@ |
|
|
|
|
|
|
|
import { Assignment as AssignmentIcon } from '@mui/icons-material'; |
|
|
|
import { Grid } from '@mui/material'; |
|
|
|
import { Grid } from '@mui/material'; |
|
|
|
import { FC, useCallback, useMemo, useRef, useState } from 'react'; |
|
|
|
import { FC, useCallback, useMemo, useRef, useState } from 'react'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import API_BASE_URL from '../lib/consts/API_BASE_URL'; |
|
|
|
|
|
|
|
import { BLACK } from '../lib/consts/DEFAULT_THEME'; |
|
|
|
|
|
|
|
|
|
|
|
import api from '../lib/api'; |
|
|
|
import api from '../lib/api'; |
|
|
|
import ConfirmDialog from './ConfirmDialog'; |
|
|
|
import ConfirmDialog from './ConfirmDialog'; |
|
|
|
import ContainedButton from './ContainedButton'; |
|
|
|
import ContainedButton from './ContainedButton'; |
|
|
@ -10,6 +14,12 @@ import GeneralInitForm, { |
|
|
|
GeneralInitFormValues, |
|
|
|
GeneralInitFormValues, |
|
|
|
} from './GeneralInitForm'; |
|
|
|
} from './GeneralInitForm'; |
|
|
|
import handleAPIError from '../lib/handleAPIError'; |
|
|
|
import handleAPIError from '../lib/handleAPIError'; |
|
|
|
|
|
|
|
import IconButton from './IconButton'; |
|
|
|
|
|
|
|
import IconWithIndicator, { |
|
|
|
|
|
|
|
IconWithIndicatorForwardedRefContent, |
|
|
|
|
|
|
|
} from './IconWithIndicator'; |
|
|
|
|
|
|
|
import JobSummary, { JobSummaryForwardedRefContent } from './JobSummary'; |
|
|
|
|
|
|
|
import Link from './Link'; |
|
|
|
import MessageBox, { Message } from './MessageBox'; |
|
|
|
import MessageBox, { Message } from './MessageBox'; |
|
|
|
import NetworkInitForm, { |
|
|
|
import NetworkInitForm, { |
|
|
|
NetworkInitFormForwardedRefContent, |
|
|
|
NetworkInitFormForwardedRefContent, |
|
|
@ -35,6 +45,9 @@ const StrikerInitForm: FC = () => { |
|
|
|
const generalInitFormRef = useRef<GeneralInitFormForwardedRefContent>({}); |
|
|
|
const generalInitFormRef = useRef<GeneralInitFormForwardedRefContent>({}); |
|
|
|
const networkInitFormRef = useRef<NetworkInitFormForwardedRefContent>({}); |
|
|
|
const networkInitFormRef = useRef<NetworkInitFormForwardedRefContent>({}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const jobIconRef = useRef<IconWithIndicatorForwardedRefContent>({}); |
|
|
|
|
|
|
|
const jobSummaryRef = useRef<JobSummaryForwardedRefContent>({}); |
|
|
|
|
|
|
|
|
|
|
|
const buildSubmitSection = useMemo( |
|
|
|
const buildSubmitSection = useMemo( |
|
|
|
() => |
|
|
|
() => |
|
|
|
isSubmittingForm ? ( |
|
|
|
isSubmittingForm ? ( |
|
|
@ -70,6 +83,15 @@ const StrikerInitForm: FC = () => { |
|
|
|
<Panel> |
|
|
|
<Panel> |
|
|
|
<PanelHeader> |
|
|
|
<PanelHeader> |
|
|
|
<HeaderText text="Initialize striker" /> |
|
|
|
<HeaderText text="Initialize striker" /> |
|
|
|
|
|
|
|
<IconButton |
|
|
|
|
|
|
|
onClick={({ currentTarget }) => { |
|
|
|
|
|
|
|
jobSummaryRef.current.setAnchor?.call(null, currentTarget); |
|
|
|
|
|
|
|
jobSummaryRef.current.setOpen?.call(null, true); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
variant="normal" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<IconWithIndicator icon={AssignmentIcon} ref={jobIconRef} /> |
|
|
|
|
|
|
|
</IconButton> |
|
|
|
</PanelHeader> |
|
|
|
</PanelHeader> |
|
|
|
<FlexBox> |
|
|
|
<FlexBox> |
|
|
|
<GeneralInitForm |
|
|
|
<GeneralInitForm |
|
|
@ -223,6 +245,23 @@ const StrikerInitForm: FC = () => { |
|
|
|
.put('/init', requestBody) |
|
|
|
.put('/init', requestBody) |
|
|
|
.then(() => { |
|
|
|
.then(() => { |
|
|
|
setIsSubmittingForm(false); |
|
|
|
setIsSubmittingForm(false); |
|
|
|
|
|
|
|
setSubmitMessage({ |
|
|
|
|
|
|
|
children: ( |
|
|
|
|
|
|
|
<> |
|
|
|
|
|
|
|
Successfully registered the configuration job! You can check |
|
|
|
|
|
|
|
the progress at the top right icon. Once the job completes, |
|
|
|
|
|
|
|
you can access the{' '} |
|
|
|
|
|
|
|
<Link |
|
|
|
|
|
|
|
href="/login" |
|
|
|
|
|
|
|
sx={{ color: BLACK, display: 'inline-flex' }} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
login page |
|
|
|
|
|
|
|
</Link> |
|
|
|
|
|
|
|
. |
|
|
|
|
|
|
|
</> |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
type: 'info', |
|
|
|
|
|
|
|
}); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((error) => { |
|
|
|
.catch((error) => { |
|
|
|
const errorMessage = handleAPIError(error); |
|
|
|
const errorMessage = handleAPIError(error); |
|
|
@ -233,6 +272,13 @@ const StrikerInitForm: FC = () => { |
|
|
|
}} |
|
|
|
}} |
|
|
|
titleText="Confirm striker initialization" |
|
|
|
titleText="Confirm striker initialization" |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
<JobSummary |
|
|
|
|
|
|
|
getJobUrl={(epoch) => `${API_BASE_URL}/init/job?start=${epoch}`} |
|
|
|
|
|
|
|
onFetchSuccessAppend={(jobs) => { |
|
|
|
|
|
|
|
jobIconRef.current.indicate?.call(null, Object.keys(jobs).length > 0); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
ref={jobSummaryRef} |
|
|
|
|
|
|
|
/> |
|
|
|
</> |
|
|
|
</> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|