Skip to content

Commit

Permalink
add serve alive
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Oct 8, 2019
1 parent 1f88a66 commit 5fb65d1
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import React, { useContext } from 'react';
import React, { useContext, useEffect, useState } from 'react';
import { Result, Button } from 'antd';
import Context from '../UIApiContext';
import styles from './ResultPanel.module.less';

export default ({ name, url, onFinish }: { name: string; url: string; onFinish: () => void }) => {
const { api } = useContext(Context);
const [alive, setAlive] = useState<boolean>(false);
const isMini = api.isMini();
useEffect(() => {
(async () => {
const msg = (await api.callRemote({
type: 'tasks/is_dev_server_alive',
})) as {
alive: boolean;
};
setAlive(msg.alive);
})();
}, []);
return (
<div className={styles.result}>
<Result
status="success"
title={`${name} 安装成功!`}
subTitle="代码已插入页面。编译完成后页面将会自动刷新。"
extra={
isMini
isMini || !alive
? [
<Button type="primary" key="preview" onClick={() => onFinish()}>
完成
Expand Down

0 comments on commit 5fb65d1

Please sign in to comment.