mirror of
https://github.com/YMFE/yapi.git
synced 2025-04-06 15:00:26 +08:00
fix: 修复复制接口,query 等参数无法复制bug
This commit is contained in:
parent
b33b77959c
commit
2192b144a2
@ -4,9 +4,11 @@
|
||||
|
||||
* 进入project页面加入loading
|
||||
* 接口list页table中加入分页
|
||||
* 项目添加者自动变成项目组长
|
||||
|
||||
#### Bug Fixed
|
||||
* 修复无权限进入项目bug
|
||||
* 修复复制接口,query 等参数无法复制bug
|
||||
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@ import { Input, Button, message, Icon, Card, Alert, Modal, Switch, Row, Col } fr
|
||||
import { fetchNewsData } from '../../../reducer/modules/news.js';
|
||||
import { changeGroupMsg, fetchGroupList, setCurrGroup, fetchGroupMsg, updateGroupList, deleteGroup } from '../../../reducer/modules/group.js';
|
||||
const { TextArea } = Input;
|
||||
import { trim } from '../../../common.js';
|
||||
import _ from 'underscore';
|
||||
import './GroupSetting.scss';
|
||||
const confirm = Modal.confirm;
|
||||
@ -163,7 +164,7 @@ class GroupSetting extends Component {
|
||||
</div>
|
||||
</div>,
|
||||
onOk() {
|
||||
const groupName = document.getElementById('group_name').value;
|
||||
const groupName = trim(document.getElementById('group_name').value);
|
||||
if (that.props.currGroup.group_name !== groupName) {
|
||||
message.error('分组名称有误')
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -214,7 +214,10 @@ class InterfaceMenu extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
copyInterface = (data) => {
|
||||
copyInterface = async (id) => {
|
||||
|
||||
let interfaceData = await this.props.fetchInterfaceData(id);
|
||||
let data = JSON.parse(JSON.stringify(interfaceData.payload.data.data));
|
||||
data.title = data.title + '_copy';
|
||||
data.path = data.path + '_' + Date.now();
|
||||
axios.post('/api/interface/add', data).then((res) => {
|
||||
@ -365,7 +368,7 @@ class InterfaceMenu extends Component {
|
||||
<Icon type='delete' className="interface-delete-icon" onClick={(e) => { e.stopPropagation(); this.showConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
|
||||
</Tooltip>
|
||||
<Tooltip title="复制接口">
|
||||
<Icon type='copy' className="interface-delete-icon" onClick={(e) => { e.stopPropagation(); this.copyInterface(item) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
|
||||
<Icon type='copy' className="interface-delete-icon" onClick={(e) => { e.stopPropagation(); this.copyInterface(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
|
||||
</Tooltip>
|
||||
</div>
|
||||
{/*<Dropdown overlay={menu(item)} trigger={['click']} onClick={e => e.stopPropagation()}>
|
||||
|
@ -12,7 +12,7 @@ const RadioGroup = Radio.Group;
|
||||
const RadioButton = Radio.Button;
|
||||
import constants from '../../../../constants/variable.js';
|
||||
const confirm = Modal.confirm;
|
||||
import { nameLengthLimit, entries } from '../../../../common';
|
||||
import { nameLengthLimit, entries, trim } from '../../../../common';
|
||||
import '../Setting.scss';
|
||||
// layout
|
||||
const formItemLayout = {
|
||||
@ -31,6 +31,8 @@ const formItemLayout = {
|
||||
|
||||
const Option = Select.Option;
|
||||
|
||||
|
||||
|
||||
@connect(
|
||||
state => {
|
||||
return {
|
||||
@ -83,7 +85,6 @@ class ProjectMessage extends Component {
|
||||
if (!err) {
|
||||
let assignValue = Object.assign(projectMsg, values);
|
||||
values.protocol = this.state.protocol.split(':')[0];
|
||||
console.log('assignValue', assignValue);
|
||||
|
||||
updateProject(assignValue).then((res) => {
|
||||
if (res.payload.data.errcode == 0) {
|
||||
@ -110,7 +111,7 @@ class ProjectMessage extends Component {
|
||||
</div>
|
||||
</div>,
|
||||
onOk() {
|
||||
let groupName = document.getElementById('project_name').value;
|
||||
let groupName = trim(document.getElementById('project_name').value);
|
||||
if (that.props.projectMsg.name !== groupName) {
|
||||
message.error('项目名称有误')
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -120,7 +121,7 @@ class ProjectMessage extends Component {
|
||||
that.props.delProject(that.props.projectId).then((res) => {
|
||||
if (res.payload.data.errcode == 0) {
|
||||
message.success('删除成功!');
|
||||
that.props.history.push('/group');
|
||||
that.props.history.push('/group/' + that.props.projectMsg.group_id);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -159,7 +160,7 @@ class ProjectMessage extends Component {
|
||||
}
|
||||
|
||||
async componentWillMount() {
|
||||
|
||||
|
||||
await this.props.fetchGroupList();
|
||||
// await this.props.getProject(this.props.projectId);
|
||||
const groupMsg = await this.props.fetchGroupMsg(this.props.projectMsg.group_id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user