修改bot安装位置等信息,保存按钮添加loading
This commit is contained in:
parent
d3c3b34efc
commit
b166b1a51c
|
|
@ -5,6 +5,7 @@ import { Link } from "react-router-dom";
|
|||
import { getInstallBot, updateInstallBot } from "../../../../softbot/api";
|
||||
import { getImageUrl } from 'educoder';
|
||||
import './index.scss';
|
||||
import '../exploit/index.scss';
|
||||
|
||||
function DispositionDetail(props){
|
||||
const {match:{params:{id}}, current_user, current_user:{login, user_id}} = props;
|
||||
|
|
@ -16,6 +17,8 @@ function DispositionDetail(props){
|
|||
// bot状态
|
||||
const [botState, setBotState] = useState(true);
|
||||
const [error, setError] = useState(false);
|
||||
// 保存按钮loading效果
|
||||
const [saveLoading, setSaveLoading] = useState(false);
|
||||
|
||||
// 获取bot详情
|
||||
useEffect(()=>{
|
||||
|
|
@ -122,6 +125,7 @@ function DispositionDetail(props){
|
|||
repo_owner_map[item.id+""] = login;
|
||||
});
|
||||
}
|
||||
setSaveLoading(true);
|
||||
current_user && updateInstallBot({
|
||||
bot_id: id,
|
||||
password: "",
|
||||
|
|
@ -134,6 +138,7 @@ function DispositionDetail(props){
|
|||
installed_store_list: botDetail.store_id_list
|
||||
}).then(res=>{
|
||||
if(res && res.code === 200){
|
||||
setSaveLoading(false);
|
||||
setSelectValue([]);
|
||||
const repoIds = new Set();
|
||||
options.map(item=>{
|
||||
|
|
@ -143,6 +148,7 @@ function DispositionDetail(props){
|
|||
getInsBotDetail(repoIds);
|
||||
message.success('更改成功');
|
||||
}else{
|
||||
setSaveLoading(false);
|
||||
message.error(res.message);
|
||||
}
|
||||
})
|
||||
|
|
@ -154,7 +160,10 @@ function DispositionDetail(props){
|
|||
{botDetail && <div className="oneLine">
|
||||
<img src={getImageUrl(botDetail.logo)} alt="" className="botImg imgBox"/>
|
||||
<div className="ml40 font-16">
|
||||
<div className="font-22"><a href={`/softbot/${id}`}>{botDetail && botDetail.market_name}</a></div>
|
||||
<div className="font-22">
|
||||
<a href={`/softbot/${id}`}>{botDetail && botDetail.market_name}</a>
|
||||
<span className={`font-12 ml10 statusBot myInstallBotStatus ${botDetail.is_public ? 'public' : 'private'}`}>{botDetail.is_public ? '公开' : '私有'}</span>
|
||||
</div>
|
||||
<a className="mr30 color88" href={`/${botDetail.register_login}`}>{botDetail && botDetail.register_name}</a>
|
||||
<span className="color88">{botDetail && botDetail.create_time}</span>
|
||||
</div>
|
||||
|
|
@ -192,7 +201,7 @@ function DispositionDetail(props){
|
|||
<span className='changeStatusTip'>{botState ? '开始使用该Bot,授予该Bot所需的仓库访问权限' : '暂停停止使用该bot,阻塞该bot拥有的仓库访问权限'}</span>
|
||||
</div>
|
||||
</div>
|
||||
{botDetail && !botDetail.is_public && login !== botDetail.register_login ? <Tooltip title="该bot为私有bot,仅bot开发者有权限更改"><Button type="primary" style={{width: '100px', height: '36px'}} className="mt30" disabled>保存</Button></Tooltip> : <Button type="primary" style={{width: '100px', height: '36px'}} className="mt30" onClick={updateInsBot}>保存</Button>}
|
||||
{botDetail && !botDetail.is_public && login !== botDetail.register_login ? <Tooltip title="该bot为私有bot,仅bot开发者有权限更改"><Button type="primary" style={{width: '100px', height: '36px'}} className="mt30" disabled>保存</Button></Tooltip> : <Button type="primary" style={{width: '100px', height: '36px'}} className="mt30" onClick={updateInsBot} loading={saveLoading}>保存</Button>}
|
||||
</div>
|
||||
</Spin>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@
|
|||
}
|
||||
}
|
||||
.changeStatusTip{color:#99a2af;}
|
||||
.myInstallBotStatus{
|
||||
position: relative;
|
||||
top: -4px;
|
||||
}
|
||||
}
|
||||
.nullBotsBox{
|
||||
border-radius: 4px 4px 0px 0px;
|
||||
|
|
|
|||
Loading…
Reference in New Issue