|
@@ -22,6 +22,9 @@ const JptWrapper = styled.div`
|
|
const FormItem = Form.Item
|
|
const FormItem = Form.Item
|
|
const { Password } = Input
|
|
const { Password } = Input
|
|
|
|
|
|
|
|
+let timer = ''
|
|
|
|
+let timeout = ''
|
|
|
|
+
|
|
const JptMgmt = () => {
|
|
const JptMgmt = () => {
|
|
const [jptList, setJptList] = useState([])
|
|
const [jptList, setJptList] = useState([])
|
|
const [dataLoading, setDataLoading] = useState(false)
|
|
const [dataLoading, setDataLoading] = useState(false)
|
|
@@ -30,6 +33,7 @@ const JptMgmt = () => {
|
|
const [isCreateJptProgram, setIsCreateJptProgram] = useState(false)
|
|
const [isCreateJptProgram, setIsCreateJptProgram] = useState(false)
|
|
const [isEditJptPsd, setIsEditJptPsd] = useState(false)
|
|
const [isEditJptPsd, setIsEditJptPsd] = useState(false)
|
|
const [currentJpt, setCurrentJpt] = useState(null)
|
|
const [currentJpt, setCurrentJpt] = useState(null)
|
|
|
|
+ const [timerState, setTimerState] = useState(false)
|
|
const [jptForm] = Form.useForm()
|
|
const [jptForm] = Form.useForm()
|
|
const [psdForm] = Form.useForm()
|
|
const [psdForm] = Form.useForm()
|
|
|
|
|
|
@@ -65,16 +69,35 @@ const JptMgmt = () => {
|
|
setDataLoading(false)
|
|
setDataLoading(false)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const getJptState = () => {
|
|
|
|
+ setTimerState(true)
|
|
|
|
+ timeout = setTimeout(() => {
|
|
|
|
+ clearInterval(timer)
|
|
|
|
+ setSwitchLoading(false)
|
|
|
|
+ }, 100000)
|
|
|
|
+ timer = setInterval(() => {
|
|
|
|
+ fetchJptList()
|
|
|
|
+ }, 10000)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ if (timerState && jptList[0].programStatus) {
|
|
|
|
+ clearTimeout(timeout)
|
|
|
|
+ clearInterval(timer)
|
|
|
|
+ message.success('开启成功')
|
|
|
|
+ setSwitchLoading(false)
|
|
|
|
+ }
|
|
|
|
+ }, [timerState, jptList])
|
|
|
|
+
|
|
const startJpt = async programme_id => {
|
|
const startJpt = async programme_id => {
|
|
setSwitchLoading(true)
|
|
setSwitchLoading(true)
|
|
const { data } = await startJupyter({ programme_id })
|
|
const { data } = await startJupyter({ programme_id })
|
|
if (data.code === 200) {
|
|
if (data.code === 200) {
|
|
- message.success('开启成功')
|
|
|
|
- fetchJptList()
|
|
|
|
|
|
+ getJptState()
|
|
} else {
|
|
} else {
|
|
message.error(data.msg)
|
|
message.error(data.msg)
|
|
|
|
+ setSwitchLoading(false)
|
|
}
|
|
}
|
|
- setSwitchLoading(false)
|
|
|
|
}
|
|
}
|
|
const stopJpt = async programme_id => {
|
|
const stopJpt = async programme_id => {
|
|
setSwitchLoading(true)
|
|
setSwitchLoading(true)
|