softbot issue
This commit is contained in:
parent
db36358a63
commit
05e42d4ddc
|
|
@ -119,8 +119,8 @@ function Index(props){
|
|||
</ul>
|
||||
<ul className="securityUl">
|
||||
<li>Bot开发</li>
|
||||
<li className={pathname.indexOf("/settings/exploitBot")>-1 ?"active":""}><Link to={`/settings/exploitBot`}><i className="iconfont icon-kaifabot mr5 font-18"></i><span className="text-shodow-bold">开发Bot</span></Link></li>
|
||||
<li className={pathname.indexOf("/settings/dispositionBot")>-1 ?"active":""}><Link to={`/settings/dispositionBot`}><i className="iconfont icon-BOTpeizhi mr5 font-17"></i><span className="text-shodow-bold">Bot配置</span></Link></li>
|
||||
<li className={pathname.indexOf("/settings/exploitBot")>-1 ?"active":""}><Link to={`/settings/exploitBot`}><i className="iconfont icon-kaifabot mr5 font-18"></i><span className="text-shodow-bold">我的Bot</span></Link></li>
|
||||
<li className={pathname.indexOf("/settings/dispositionBot")>-1 ?"active":""}><Link to={`/settings/dispositionBot`}><i className="iconfont icon-BOTpeizhi mr5 font-17"></i><span className="text-shodow-bold">Bot安装</span></Link></li>
|
||||
</ul>
|
||||
</div>
|
||||
<LongWidth>
|
||||
|
|
|
|||
|
|
@ -143,7 +143,11 @@ function DispositionDetail(props){
|
|||
>
|
||||
{filterOption.map(item=>(<Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>))}
|
||||
</Select>}
|
||||
{checkValue === 1 && selectValue.map((item, index)=>{return <div key={index} className="selectValueBox font-14"><i className="iconfont icon-daimakuicon1 font-14 mr5"></i><span className="selectValue">{item.name}</span><i className="iconfont icon-guanbi font-12 close ml30" onClick={()=>{deleteSelect(item)}}></i></div>})}
|
||||
{checkValue === 1 && selectValue.map((item, index)=>{return <div key={index} className="selectValueBox font-14">
|
||||
<i className="iconfont icon-daimakuicon1 font-14 mr5"></i>
|
||||
<Link className="selectValue" to={`/${item.author && item.author.login}/${item.identifier}`}>{`${item.author && item.author.name}/${item.name}`}</Link>
|
||||
<i className="iconfont icon-guanbi font-12 close ml30" onClick={()=>{deleteSelect(item)}}></i>
|
||||
</div>})}
|
||||
</div>
|
||||
<div className="detailTil font-16 mt30 mb10">更改Bot状态</div>
|
||||
{/* {botDetail && botDetail.state === 1 && <div className="disBotItem">
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ function DispositionBot(props){
|
|||
const [reload, setReload] = useState(undefined);
|
||||
|
||||
useEffect(()=>{
|
||||
document.title='Bot配置';
|
||||
document.title='Bot安装';
|
||||
}, [])
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -44,7 +44,7 @@ function DispositionBot(props){
|
|||
}
|
||||
|
||||
return <div>
|
||||
<div className="dispositionHead font-18">Bot配置</div>
|
||||
<div className="dispositionHead font-18">Bot安装</div>
|
||||
{/* bot列表显示区域 */}
|
||||
{botList && (botList.length > 0 ? <div className="setBotListBox">
|
||||
{botList.map((item, index)=>{return <div className="disBotItem" key={index}>
|
||||
|
|
@ -61,7 +61,7 @@ function DispositionBot(props){
|
|||
</div> : <div className="nullBotsBox mt80">
|
||||
<img src={nullBot} alt="" width={62}/>
|
||||
<p className="font-18 showBigTip">您当前暂未安装任何Bot</p>
|
||||
<div className="showTip font-14">Bot可以帮助项目贡献者处理繁杂的项目任务,比如关闭疑修、合并请求等,以节约时间精力提升开发效率。快去市场中挑选一个适合您项目的Bot吧!</div>
|
||||
<div className="showTip font-14">您可以将Bot配置到仓库来处理一些繁杂的项目任务,比如自动化关闭疑修、合并请求等,以节约时间精力提升开发效率。快去<Link to="/softbot"> Bot市场 </Link>中挑选一个适合您项目的Bot吧!</div>
|
||||
<div className="borTip"></div>
|
||||
<Button type="primary" style={{width: '112px', height: '36px', padding: 0}}><Link to={'/softbot'}>去Bot市场逛逛</Link></Button>
|
||||
</div>)}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ function AdvancedInformation(props){
|
|||
|
||||
// 选择用户
|
||||
function selectInputUser(e, option){
|
||||
setNewId(option.props.value);
|
||||
setNewId(option.props);
|
||||
setSearchKey(option.props.name);
|
||||
};
|
||||
|
||||
|
|
@ -92,12 +92,13 @@ function AdvancedInformation(props){
|
|||
function makeOver(){
|
||||
setMakeOverErrortTip(undefined);
|
||||
if(newId){
|
||||
const {value, login} = newId
|
||||
transferBot({
|
||||
login: current_user && current_user.login,
|
||||
user_id: current_user && current_user.user_id,
|
||||
user_name: current_user && current_user.username,
|
||||
bot_id: parseInt(id),
|
||||
transfer_to_user_id: parseInt(newId)
|
||||
transfer_to_user_id: parseInt(value),
|
||||
to_logn: login
|
||||
}).then(res=>{
|
||||
if(res && res.code === 200){
|
||||
message.success('操作成功');
|
||||
|
|
@ -169,7 +170,7 @@ function AdvancedInformation(props){
|
|||
return <div className="advancedInformationBox">
|
||||
<div className="informationHead pb15">高级选项</div>
|
||||
{/* 提示:转让中状态 */}
|
||||
{botDetail && botDetail.is_transfer_success === 2 && <div className="transferBotStatus mt15"><i className="iconfont icon-yuyue-lishi-shijian font-18 mr5 ml10"></i>此Bot正在等待转移至<a href={`/${botDetail.transfer_to_login}`}>{botDetail.transfer_to_name +' (' + botDetail.transfer_to_login +')'}</a>(用户账号)</div>}
|
||||
{botDetail && botDetail.is_transfer_success === 2 && <div className="transferBotStatus mt15"><i className="iconfont icon-yuyue-lishi-shijian font-18 mr5 ml10"></i>此Bot正在等待转移至<a href={`/${botDetail.transfer_to_login}`}>{botDetail.transfer_to_name +' (' + botDetail.transfer_to_login +')'}</a></div>}
|
||||
<div className="disFlex itemBox">
|
||||
<div className="font-15">
|
||||
转让该Bot的所有权至其他用户
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ function BasicInformation(props){
|
|||
if(res && res.code === 200){
|
||||
message.success("更改成功");
|
||||
setReload(Math.random());
|
||||
}else{
|
||||
message.error(res.message);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
@ -100,7 +102,7 @@ function BasicInformation(props){
|
|||
return <Box>
|
||||
{botDetail && <div className="basicInformationBox">
|
||||
<p className="informationHead pb15 mb10">注册信息</p>
|
||||
<div className="labelBox"><span className="label">Bot所有者</span>{current_user.username}</div>
|
||||
<div className="labelBox"><span className="label">Bot所有者</span><Link to={`/${current_user.login}`}>{current_user.username}</Link></div>
|
||||
<div className="labelBox"><span className="label">Bot ID</span>{id}</div>
|
||||
<div className="labelBox"><span className="label">客户端ID</span>{botDetail.client_id}</div>
|
||||
<div className="labelBox"><span className="label">主页URL</span><Link to={`/softbot/${id}`} className="blueSpan">{window.location.origin + `/softbot/${id}`}</Link></div>
|
||||
|
|
@ -128,7 +130,7 @@ function BasicInformation(props){
|
|||
rules:[{required:true,message:"请输入Bot名称"}],
|
||||
initialValue: botDetail.bot_name
|
||||
})(
|
||||
<Input.TextArea placeholder="请输入Bot名称" maxLength={200} className="height36" autoSize={true}/>
|
||||
<Input.TextArea placeholder="请输入Bot名称" maxLength={50} className="height36" autoSize={true}/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item label="详细介绍" className="botItem introduce">
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ function Putaway(props){
|
|||
is_receive_ag1: disabled ? 1 : 0,
|
||||
is_receive_ag2: 0,
|
||||
logo: logo,
|
||||
market_time: moment().format(),
|
||||
market_time: "",
|
||||
}).then(res=>{
|
||||
if(res && res.code === -1){
|
||||
message.error(res.data);
|
||||
|
|
@ -128,7 +128,7 @@ function Putaway(props){
|
|||
rules:[{required:true,message:"请输入上架Bot市场名称"}],
|
||||
initialValue: detail.market_name
|
||||
})(
|
||||
<Input.TextArea placeholder="请输入上架Bot市场名称" maxLength={200} className="height36" autoSize={true}/>
|
||||
<Input.TextArea placeholder="请输入上架Bot市场名称" maxLength={50} className="height36" autoSize={true}/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item label="简要介绍" className="oneItem">
|
||||
|
|
@ -185,7 +185,7 @@ function Putaway(props){
|
|||
)}
|
||||
</Form.Item>
|
||||
{!isEdit && <Form.Item>
|
||||
<Checkbox onChange={onChange}>我接受GitLink Bot市场开发者协议</Checkbox>
|
||||
<Checkbox onChange={onChange}>我已阅读并接受<a className="login-form-forgot" href="https://forum.trustie.net/forums/5029/detail" target="_blank">《GitLink服务协议条款》</a></Checkbox>
|
||||
</Form.Item>}
|
||||
<Form.Item><Button style={{width:"129px", height: '36px'}} type="primary" htmlType="submit" disabled={!disabled} className="putawayBut mt20">{isEdit ? '保存修改' : '申请上架'}</Button></Form.Item>
|
||||
</Form>}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ function ConfigurateBot(props){
|
|||
|
||||
return <div className="configurateBotBox">
|
||||
<div className="configurateBotHead mb30">
|
||||
<span className="font-18 configurateBotTitle">Bot配置</span>
|
||||
<span className="font-18 configurateBotTitle">Bot开发者配置</span>
|
||||
<Button style={{width: '53px', padding: '0'}} className="grayBorBut"><Link to={`/settings/exploitBot/configuration`}>返回</Link></Button>
|
||||
</div>
|
||||
<Box>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ function ExploitBot(props){
|
|||
const [reload, setReload] = useState(undefined);
|
||||
|
||||
useEffect(()=>{
|
||||
document.title='开发Bot';
|
||||
document.title='我的Bot';
|
||||
}, [])
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -73,7 +73,7 @@ function ExploitBot(props){
|
|||
|
||||
return <div>
|
||||
<div className="exploitHead font-18">
|
||||
<span>Bot开发者配置</span>
|
||||
<span>我的Bot</span>
|
||||
<Button type="primary" style={{width: '100px', height: '36px'}}><Link to={`/settings/exploitBot/new`}>Bot注册</Link></Button>
|
||||
</div>
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ function ExploitBot(props){
|
|||
</div> : <div className="nullBotsBox mt80">
|
||||
<img src={nullBot} alt="" width={62}/>
|
||||
<p className="font-18 showBigTip">您当前暂未注册任何Bot</p>
|
||||
<div className="showTip font-14">欢迎使用Bot! Bot可以帮助项目贡献者处理繁杂的项目任务,比如关闭疑修、合并请求。在使用之前,请先注册一个Bot!</div>
|
||||
<div className="showTip font-14">Bot可以帮助您自动化处理一些繁杂的项目任务,欢迎您<Link to="/settings/exploitBot/new"> 注册一个Bot </Link>基于GitLink API进行开发。<br/>此外您还可以在<Link to="/softbot"> Bot市场 </Link>中共享或安装他人的Bot</div>
|
||||
</div>)}
|
||||
|
||||
<Modal
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import DivertModal from '../Divert/DivertModal';
|
|||
import { Link } from 'react-router-dom';
|
||||
import axios from "axios";
|
||||
import "./setting.scss";
|
||||
import { unInstallMarketBot } from "../../softbot/api";
|
||||
const { TextArea } = Input;
|
||||
const { Option } = Select;
|
||||
|
||||
|
|
@ -194,17 +195,25 @@ class Setting extends Component {
|
|||
deleteProject = () => {
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const { projectName } = this.state;
|
||||
const {current_user:{login, user_id}, projectDetail:{project_id}} = this.props;
|
||||
this.props.confirm({
|
||||
content: <span style={{display:"block",textAlign:"left"}}>该操作无法撤销!且将会一并删除相关的疑修、合并请求、工作流、里程碑、动态等数据。<br/>是否确认删除 <span style={{fontWeight:"bold"}}>{owner}/{projectName}({projectsId})</span>?</span>,
|
||||
onOk: () => {
|
||||
const url = `/${owner}/${projectsId}.json`;
|
||||
axios.delete(url).then((result) => {
|
||||
this.props.showNotification("仓库删除成功!");
|
||||
this.props.history.push(`/${owner}`);
|
||||
// 卸载bot(判断bot是否安装后端做了判断)
|
||||
unInstallMarketBot({
|
||||
login,
|
||||
user_id,
|
||||
store_id: project_id,
|
||||
store_identifier: projectsId
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
this.props.showNotification("仓库删除成功!");
|
||||
this.props.history.push(`/${owner}`);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -214,4 +214,13 @@ export function cancelTransferBot(data) {
|
|||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 仓库删除时取消安装bot
|
||||
export function unInstallMarketBot(data){
|
||||
return fetch({
|
||||
url: '/uninstallMarketBot',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 657 KiB |
|
|
@ -58,7 +58,7 @@ function SoftBotDEtail(props){
|
|||
}).then(res=>{
|
||||
if(res && res.code === 200){
|
||||
const {is_public, developer_id, bot_name} = res.data;
|
||||
document.title=bot_name;
|
||||
document.title=`SoftBot-${bot_name}`;
|
||||
const {user_id, login} = current_user
|
||||
if((login && !is_public && developer_id !== user_id) || (!login && !is_public)){
|
||||
message.error("私有bot,无权限访问");
|
||||
|
|
@ -151,7 +151,7 @@ function SoftBotDEtail(props){
|
|||
<div className="botImgBg"><img src={getImageUrl(detail.logo)} alt="" className="botImg"></img></div>
|
||||
<div className="centerBox">
|
||||
<p className="font-24">{detail.bot_name}</p>
|
||||
<div className="userBox font-16">{detail.first_func && <span className="typeBox font-15 mr15">{detail.first_func}</span>}<a href={`/${detail.developer_login}`}>{detail.developer_name}</a></div>
|
||||
<div className="userBox font-16">{detail.first_func && <span className="typeBox font-15 mr15">{detail.first_func}</span>}{detail.second_func && <span className="typeBox font-15 mr15">{detail.second_func}</span>}<a href={`/${detail.developer_login}`}>{detail.developer_name}</a></div>
|
||||
<div>{detail.market_desc}</div>
|
||||
</div>
|
||||
{((current_user && !current_user.login) || detail.is_public || (!detail.is_public && detail.developer_id === current_user.user_id))&&<Button type="primary" style={{width: '114px', height: '40px'}} className="font-15" onClick={click}>{isInstall ? '查看详情' : '安装此Bot'}</Button>}
|
||||
|
|
@ -188,7 +188,11 @@ function SoftBotDEtail(props){
|
|||
>
|
||||
{filterOption.map(item=>(<Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>))}
|
||||
</Select>}
|
||||
{checkValue === 1 && selectValue.map((item, index)=>{return <div key={index} className="selectValueBox font-14"><i className="iconfont icon-daimakuicon1 font-14 mr5"></i><span className="selectValue">{item.name}</span><i className="iconfont icon-guanbi font-12 close ml30" onClick={()=>{deleteSelect(item)}}></i></div>})}
|
||||
{checkValue === 1 && selectValue.map((item, index)=>{return <div key={index} className="selectValueBox font-14">
|
||||
<i className="iconfont icon-daimakuicon1 font-14 mr5"></i>
|
||||
<span className="selectValue">{`${item.author && item.author.name}/${item.name}`}</span>
|
||||
<i className="iconfont icon-guanbi font-12 close ml30" onClick={()=>{deleteSelect(item)}}></i>
|
||||
</div>})}
|
||||
<div className="installTil font-18 mt20 mb10">权限信息</div>
|
||||
{detail && <div className="mb10 font-16 greenCol"><i className={`mr8 iconfont ${detail.limit_and_events.juris_diction_code !== 2 ? 'icon-wanchenggouxuan' : 'icon-tishi1 font-16'}`}></i>代码库{detail.limit_and_events.juris_diction_code === 2 ? '无' : detail.limit_and_events.juris_diction_code === 1 ? '读写' : '只读'}权限</div>}
|
||||
{detail && <div className="mb20 font-16 greenCol"><i className={`mr8 iconfont ${detail.limit_and_events.juris_diction_pr !== 2 ? 'icon-wanchenggouxuan' : 'icon-tishi1 font-16'}`}></i>合并请求(PR){detail.limit_and_events.juris_diction_pr === 2 ? '无' : detail.limit_and_events.juris_diction_pr === 1 ? '读写' : '只读'}权限</div>}
|
||||
|
|
|
|||
Loading…
Reference in New Issue