mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
Merg branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev
This commit is contained in:
commit
6a417b68b1
@ -124,7 +124,7 @@ export default class GroupList extends Component {
|
|||||||
async editGroup() {
|
async editGroup() {
|
||||||
const { currGroupName: group_name, currGroupDesc: group_desc } = this.state;
|
const { currGroupName: group_name, currGroupDesc: group_desc } = this.state;
|
||||||
const id = this.props.currGroup._id;
|
const id = this.props.currGroup._id;
|
||||||
const res = axios.post('/api/group/up', { group_name, group_desc, id });
|
const res = await axios.post('/api/group/up', { group_name, group_desc, id });
|
||||||
if (res.data.errcode) {
|
if (res.data.errcode) {
|
||||||
message.error(res.data.errmsg);
|
message.error(res.data.errmsg);
|
||||||
} else {
|
} else {
|
||||||
|
@ -61,27 +61,27 @@ class InterfaceEdit extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
let domain = location.hostname + (location.port !== "" ? ":" + location.port : "");
|
// let domain = location.hostname + (location.port !== "" ? ":" + location.port : "");
|
||||||
let s = new WebSocket('ws://' + domain + '/api/interface/solve_conflict?id=' + this.props.match.params.actionId);
|
// let s = new WebSocket('ws://' + domain + '/api/interface/solve_conflict?id=' + this.props.match.params.actionId);
|
||||||
s.onopen = () => {
|
// s.onopen = () => {
|
||||||
this.WebSocket = s;
|
// this.WebSocket = s;
|
||||||
}
|
// }
|
||||||
|
|
||||||
s.onmessage = (e) => {
|
// s.onmessage = (e) => {
|
||||||
let result = JSON.parse(e.data);
|
// let result = JSON.parse(e.data);
|
||||||
if (result.errno === 0) {
|
// if (result.errno === 0) {
|
||||||
this.setState({
|
// this.setState({
|
||||||
curdata: result.data,
|
// curdata: result.data,
|
||||||
status: 1
|
// status: 1
|
||||||
})
|
// })
|
||||||
} else {
|
// } else {
|
||||||
this.setState({
|
// this.setState({
|
||||||
curdata: result.data,
|
// curdata: result.data,
|
||||||
status: 2
|
// status: 2
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ class InterfaceEditForm extends Component {
|
|||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.state = Object.assign({
|
this.state = Object.assign({
|
||||||
title: '',
|
title: '',
|
||||||
path: '',
|
path: '',
|
||||||
@ -87,7 +86,6 @@ class InterfaceEditForm extends Component {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.form.validateFields((err, values) => {
|
this.props.form.validateFields((err, values) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
console.log(values)
|
|
||||||
if (values.res_body_type === 'json') values.res_body = this.state.res_body;
|
if (values.res_body_type === 'json') values.res_body = this.state.res_body;
|
||||||
values.req_params = this.state.req_params;
|
values.req_params = this.state.req_params;
|
||||||
values.req_body_other = this.state.req_body_other;
|
values.req_body_other = this.state.req_body_other;
|
||||||
@ -373,7 +371,7 @@ class InterfaceEditForm extends Component {
|
|||||||
label="选择分类"
|
label="选择分类"
|
||||||
>
|
>
|
||||||
{getFieldDecorator('catid', {
|
{getFieldDecorator('catid', {
|
||||||
initialValue: _.find(this.props.cat, item => item._id === this.state.catid).name,
|
initialValue: this.state.catid + "",
|
||||||
rules: [
|
rules: [
|
||||||
{ required: true, message: '请选择一个分类' }
|
{ required: true, message: '请选择一个分类' }
|
||||||
]
|
]
|
||||||
|
@ -341,6 +341,11 @@ class groupController extends baseController {
|
|||||||
* @example ./api/group/up.json
|
* @example ./api/group/up.json
|
||||||
*/
|
*/
|
||||||
async up(ctx) {
|
async up(ctx) {
|
||||||
|
|
||||||
|
let groupInst = yapi.getInst(groupModel);
|
||||||
|
let id = ctx.request.body.id;
|
||||||
|
let data = {};
|
||||||
|
|
||||||
if (await this.checkAuth(id, 'group', 'danger') !== true) {
|
if (await this.checkAuth(id, 'group', 'danger') !== true) {
|
||||||
return ctx.body = yapi.commons.resReturn(null, 405, '没有权限');
|
return ctx.body = yapi.commons.resReturn(null, 405, '没有权限');
|
||||||
}
|
}
|
||||||
@ -350,9 +355,7 @@ class groupController extends baseController {
|
|||||||
group_name: 'string',
|
group_name: 'string',
|
||||||
group_desc: 'string'
|
group_desc: 'string'
|
||||||
});
|
});
|
||||||
let groupInst = yapi.getInst(groupModel);
|
|
||||||
let id = ctx.request.body.id;
|
|
||||||
let data = {};
|
|
||||||
ctx.request.body.group_name && (data.group_name = ctx.request.body.group_name);
|
ctx.request.body.group_name && (data.group_name = ctx.request.body.group_name);
|
||||||
ctx.request.body.group_desc && (data.group_desc = ctx.request.body.group_desc);
|
ctx.request.body.group_desc && (data.group_desc = ctx.request.body.group_desc);
|
||||||
if (Object.keys(data).length === 0) {
|
if (Object.keys(data).length === 0) {
|
||||||
|
@ -88,7 +88,7 @@ var groupController = function (_baseController) {
|
|||||||
(0, _createClass3.default)(groupController, [{
|
(0, _createClass3.default)(groupController, [{
|
||||||
key: 'get',
|
key: 'get',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||||
var params, groupInst, result;
|
var params, groupInst, result;
|
||||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -160,7 +160,7 @@ var groupController = function (_baseController) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'add',
|
key: 'add',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) {
|
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||||
var params, groupUserdata, groupInst, checkRepeat, data, result;
|
var params, groupUserdata, groupInst, checkRepeat, data, result;
|
||||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -272,7 +272,7 @@ var groupController = function (_baseController) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'getUserdata',
|
key: 'getUserdata',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(uid, role) {
|
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(uid, role) {
|
||||||
var userInst, userData;
|
var userInst, userData;
|
||||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -333,7 +333,7 @@ var groupController = function (_baseController) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'addMember',
|
key: 'addMember',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(ctx) {
|
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(ctx) {
|
||||||
var params, groupInst, check, groupUserdata, result;
|
var params, groupInst, check, groupUserdata, result;
|
||||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -446,7 +446,7 @@ var groupController = function (_baseController) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'changeMemberRole',
|
key: 'changeMemberRole',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) {
|
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) {
|
||||||
var params, groupInst, check, result;
|
var params, groupInst, check, result;
|
||||||
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -547,7 +547,7 @@ var groupController = function (_baseController) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'getMemberList',
|
key: 'getMemberList',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) {
|
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) {
|
||||||
var params, groupInst, group;
|
var params, groupInst, group;
|
||||||
return _regenerator2.default.wrap(function _callee6$(_context6) {
|
return _regenerator2.default.wrap(function _callee6$(_context6) {
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -611,7 +611,7 @@ var groupController = function (_baseController) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'delMember',
|
key: 'delMember',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) {
|
var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) {
|
||||||
var params, groupInst, check, result;
|
var params, groupInst, check, result;
|
||||||
return _regenerator2.default.wrap(function _callee7$(_context7) {
|
return _regenerator2.default.wrap(function _callee7$(_context7) {
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -709,7 +709,7 @@ var groupController = function (_baseController) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'list',
|
key: 'list',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) {
|
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) {
|
||||||
var groupInst, result;
|
var groupInst, result;
|
||||||
return _regenerator2.default.wrap(function _callee8$(_context8) {
|
return _regenerator2.default.wrap(function _callee8$(_context8) {
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -762,11 +762,10 @@ var groupController = function (_baseController) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'del',
|
key: 'del',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) {
|
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) {
|
||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var groupInst, projectInst, interfaceInst, interfaceColInst, interfaceCaseInst, _id, projectList, result;
|
var groupInst, projectInst, interfaceInst, interfaceColInst, interfaceCaseInst, id, projectList, result;
|
||||||
|
|
||||||
return _regenerator2.default.wrap(function _callee10$(_context10) {
|
return _regenerator2.default.wrap(function _callee10$(_context10) {
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (_context10.prev = _context10.next) {
|
switch (_context10.prev = _context10.next) {
|
||||||
@ -785,9 +784,9 @@ var groupController = function (_baseController) {
|
|||||||
interfaceInst = _yapi2.default.getInst(_interface2.default);
|
interfaceInst = _yapi2.default.getInst(_interface2.default);
|
||||||
interfaceColInst = _yapi2.default.getInst(_interfaceCol2.default);
|
interfaceColInst = _yapi2.default.getInst(_interfaceCol2.default);
|
||||||
interfaceCaseInst = _yapi2.default.getInst(_interfaceCase2.default);
|
interfaceCaseInst = _yapi2.default.getInst(_interfaceCase2.default);
|
||||||
_id = ctx.request.body.id;
|
id = ctx.request.body.id;
|
||||||
|
|
||||||
if (_id) {
|
if (id) {
|
||||||
_context10.next = 11;
|
_context10.next = 11;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -796,13 +795,13 @@ var groupController = function (_baseController) {
|
|||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
_context10.next = 13;
|
_context10.next = 13;
|
||||||
return projectInst.list(_id, true);
|
return projectInst.list(id, true);
|
||||||
|
|
||||||
case 13:
|
case 13:
|
||||||
projectList = _context10.sent;
|
projectList = _context10.sent;
|
||||||
|
|
||||||
projectList.forEach(function () {
|
projectList.forEach(function () {
|
||||||
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(p) {
|
var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(p) {
|
||||||
return _regenerator2.default.wrap(function _callee9$(_context9) {
|
return _regenerator2.default.wrap(function _callee9$(_context9) {
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (_context9.prev = _context9.next) {
|
switch (_context9.prev = _context9.next) {
|
||||||
@ -831,11 +830,11 @@ var groupController = function (_baseController) {
|
|||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
_context10.next = 17;
|
_context10.next = 17;
|
||||||
return projectInst.delByGroupid(_id);
|
return projectInst.delByGroupid(id);
|
||||||
|
|
||||||
case 17:
|
case 17:
|
||||||
_context10.next = 19;
|
_context10.next = 19;
|
||||||
return groupInst.del(_id);
|
return groupInst.del(id);
|
||||||
|
|
||||||
case 19:
|
case 19:
|
||||||
result = _context10.sent;
|
result = _context10.sent;
|
||||||
@ -881,37 +880,36 @@ var groupController = function (_baseController) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'up',
|
key: 'up',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx) {
|
var _ref11 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee11(ctx) {
|
||||||
var groupInst, _id2, data, result;
|
var groupInst, id, data, result;
|
||||||
|
|
||||||
return _regenerator2.default.wrap(function _callee11$(_context11) {
|
return _regenerator2.default.wrap(function _callee11$(_context11) {
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (_context11.prev = _context11.next) {
|
switch (_context11.prev = _context11.next) {
|
||||||
case 0:
|
case 0:
|
||||||
_context11.next = 2;
|
groupInst = _yapi2.default.getInst(_group2.default);
|
||||||
|
id = ctx.request.body.id;
|
||||||
|
data = {};
|
||||||
|
_context11.next = 5;
|
||||||
return this.checkAuth(id, 'group', 'danger');
|
return this.checkAuth(id, 'group', 'danger');
|
||||||
|
|
||||||
case 2:
|
case 5:
|
||||||
_context11.t0 = _context11.sent;
|
_context11.t0 = _context11.sent;
|
||||||
|
|
||||||
if (!(_context11.t0 !== true)) {
|
if (!(_context11.t0 !== true)) {
|
||||||
_context11.next = 5;
|
_context11.next = 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context11.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 405, '没有权限'));
|
return _context11.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 405, '没有权限'));
|
||||||
|
|
||||||
case 5:
|
case 8:
|
||||||
_context11.prev = 5;
|
_context11.prev = 8;
|
||||||
|
|
||||||
ctx.request.body = _yapi2.default.commons.handleParams(ctx.request.body, {
|
ctx.request.body = _yapi2.default.commons.handleParams(ctx.request.body, {
|
||||||
id: 'number',
|
id: 'number',
|
||||||
group_name: 'string',
|
group_name: 'string',
|
||||||
group_desc: 'string'
|
group_desc: 'string'
|
||||||
});
|
});
|
||||||
groupInst = _yapi2.default.getInst(_group2.default);
|
|
||||||
_id2 = ctx.request.body.id;
|
|
||||||
data = {};
|
|
||||||
|
|
||||||
ctx.request.body.group_name && (data.group_name = ctx.request.body.group_name);
|
ctx.request.body.group_name && (data.group_name = ctx.request.body.group_name);
|
||||||
ctx.request.body.group_desc && (data.group_desc = ctx.request.body.group_desc);
|
ctx.request.body.group_desc && (data.group_desc = ctx.request.body.group_desc);
|
||||||
@ -919,7 +917,7 @@ var groupController = function (_baseController) {
|
|||||||
ctx.body = _yapi2.default.commons.resReturn(null, 404, '分组名和分组描述不能为空');
|
ctx.body = _yapi2.default.commons.resReturn(null, 404, '分组名和分组描述不能为空');
|
||||||
}
|
}
|
||||||
_context11.next = 15;
|
_context11.next = 15;
|
||||||
return groupInst.up(_id2, data);
|
return groupInst.up(id, data);
|
||||||
|
|
||||||
case 15:
|
case 15:
|
||||||
result = _context11.sent;
|
result = _context11.sent;
|
||||||
@ -930,7 +928,7 @@ var groupController = function (_baseController) {
|
|||||||
|
|
||||||
case 19:
|
case 19:
|
||||||
_context11.prev = 19;
|
_context11.prev = 19;
|
||||||
_context11.t1 = _context11['catch'](5);
|
_context11.t1 = _context11['catch'](8);
|
||||||
|
|
||||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context11.t1.message);
|
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context11.t1.message);
|
||||||
|
|
||||||
@ -939,7 +937,7 @@ var groupController = function (_baseController) {
|
|||||||
return _context11.stop();
|
return _context11.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _callee11, this, [[5, 19]]);
|
}, _callee11, this, [[8, 19]]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function up(_x12) {
|
function up(_x12) {
|
||||||
|
Loading…
Reference in New Issue
Block a user