Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev

This commit is contained in:
wenbo.dong 2017-08-30 12:18:58 +08:00
commit f03755c2d9
9 changed files with 86 additions and 71 deletions

View File

@ -76,5 +76,6 @@ export default {
'fork',
'android-o',
'apple-o'
]
],
HTTP_REQUEST_HEADER: ["Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language", "Accept-Datetime", "Authorization", "Cache-Control", "Connection", "Cookie", "Content-Disposition", "Content-Length", "Content-MD5", "Content-Type", "Date", "Expect", "From", "Host", "If-Match", "If-Modified-Since", "If-None-Match", "If-Range", "If-Unmodified-Since", "Max-Forwards", "Origin", "Pragma", "Proxy-Authorization", "Range", "Referer", "TE", "User-Agent", "Upgrade", "Via", "Warning", "X-Requested-With", "DNT", "X-Forwarded-For", "X-Forwarded-Host", "X-Forwarded-Proto", "Front-End-Https", "X-Http-Method-Override", "X-ATT-DeviceId", "X-Wap-Profile", "Proxy-Connection", "X-UIDH", "X-Csrf-Token"]
}

View File

@ -8,6 +8,9 @@
.case-delete-icon{
display: none;
}
i:before{
line-height: 17px;
}
}
.menu-title:hover {
.case-delete-icon {

View File

@ -11,4 +11,7 @@
margin-left: 5px;
cursor: pointer
}
.ant-select-selection__rendered{
line-height: 34px;
}
}

View File

@ -408,7 +408,7 @@ class InterfaceEditForm extends Component {
{getFieldDecorator('path', {
initialValue: this.state.path,
rules: [{
required: true, message: '输入接口路径!'
required: true, message: '输入接口路径!'
}]
})(
<Input onBlur={this.handlePath} placeholder="/path" style={{ width: '60%' }} />

View File

@ -43,6 +43,10 @@ class View extends Component {
dataIndex: 'name',
key: 'name'
}, {
title: '参数类型',
dataIndex: 'type',
key: 'type'
},{
title: '是否必须',
dataIndex: 'required',
key: 'required'
@ -60,7 +64,8 @@ class View extends Component {
key: i,
name: item.name,
value: item.desc,
required: item.required?"必须":"非必须"
required: item.required?"必须":"非必须",
type: item.type === "text"?"文本":"文件"
})
})
}
@ -224,8 +229,14 @@ class View extends Component {
done: "完成"
}
let statusColor = {
undone: "rgb(255, 85, 0)",
done: "#cfefdf"
undone: {
bac: "rgb(255, 85, 0)",
color: "white"
},
done:{
bac: "rgb(135, 208, 104)",
color: "white"
}
}
let methodColor = {
post: {
@ -236,28 +247,29 @@ class View extends Component {
bac: "#cfefdf",
color: "#00a854"
},
input: {
bac: "#57cf27",
color: "#9c82a2"
put: {
bac: "#fff3cf",
color: "#ffbf00"
},
delete: {
bac: "#57cf27",
color: "#57cf27"
bac: "#fcdbd9",
color: "#f04134"
},
head: {
bac: "#d4d5f7",
color: "#0b47ef"
bac: "#fff3cf",
color: "#ffbf00"
},
patch: {
bac: "#f9f4e1",
color: "#fac200"
bac: "#fff3cf",
color: "#ffbf00"
},
options: {
bac: "#f7cdf5",
color: "#fa00f2"
bac: "#fff3cf",
color: "#ffbf00"
}
}
methodColor = methodColor[this.props.curData.method?this.props.curData.method.toLowerCase():"get"];
statusColor = statusColor[this.props.curData.status?this.props.curData.status.toLowerCase():"undone"]
if(!methodColor) methodColor = "get";
let res = <div className="caseContainer">
<div className="colName">
@ -266,7 +278,7 @@ class View extends Component {
</div>
<div className="colMethod">
<span className="colKey">请求方法</span>
<span style={{color:methodColor,backgroundColor:methodColor.bac}} className="colValue">{this.props.curData.method}</span>
<span style={{color:methodColor.color,backgroundColor:methodColor.bac}} className="colValue">{this.props.curData.method}</span>
</div>
<div className="colPath">
<span className="colKey">接口路径</span>
@ -274,7 +286,7 @@ class View extends Component {
</div>
<div className="colstatus">
<span className="colKey">状态</span>
<span style={{backgroundColor:statusColor[this.props.curData.status]}} className="colValue">{status[this.props.curData.status]}</span>
<span style={{backgroundColor:statusColor.bac,color: statusColor.color}} className="colValue">{status[this.props.curData.status]}</span>
</div>
<div className="colAddTime">
<span className="colKey">创建时间</span>

View File

@ -307,28 +307,28 @@ class interfaceController extends baseController {
up_time: yapi.commons.time()
};
if (params.path) {
if (!_.isUndefined(params.path)) {
data.path = params.path;
}
if (params.title) {
if (!_.isUndefined(params.title)) {
data.title = params.title;
}
if (params.desc) {
if (!_.isUndefined(params.desc)) {
data.desc = params.desc;
}
if (params.method) {
if (!_.isUndefined(params.method)) {
data.method = params.method;
}
if (params.catid) {
if (!_.isUndefined(params.catid)) {
data.catid = params.catid;
}
if (params.req_headers) {
if (!_.isUndefined(params.req_headers)) {
data.req_headers = params.req_headers;
}
if (params.req_body_form) {
if (!_.isUndefined(params.req_body_form)) {
data.req_body_form = params.req_body_form;
}
if (params.req_params && Array.isArray(params.req_params) && params.req_params.length > 0) {
@ -338,25 +338,25 @@ class interfaceController extends baseController {
data.type = 'static'
}
if (params.req_query) {
if (!_.isUndefined(params.req_query)) {
data.req_query = params.req_query;
}
if (params.req_body_other) {
if (!_.isUndefined(params.req_body_other)) {
data.req_body_other = params.req_body_other;
}
if (params.req_body_type) {
if (!_.isUndefined(params.req_body_type)) {
data.req_body_type = params.req_body_type;
}
if (params.res_body_type) {
if (!_.isUndefined(params.res_body_type)) {
data.res_body_type = params.res_body_type;
}
if (params.res_body) {
if (!_.isUndefined(params.res_body)) {
data.res_body = params.res_body;
}
if (params.status) {
if (!_.isUndefined(params.status)) {
data.status = params.status;
}

View File

@ -560,14 +560,12 @@ class projectController extends baseController {
data.project_type = params.project_type
}
if (params.name) data.name = params.name;
if (params.desc) data.desc = params.desc;
if (params.basepath) {
data.basepath = params.basepath;
}
if (params.env) data.env = params.env;
if (params.color) data.color = params.color;
if (params.icon) data.icon = params.icon;
if (!_.isUndefined(params.name)) data.name = params.name;
if (!_.isUndefined(params.desc)) data.desc = params.desc;
data.basepath = params.basepath;
if (!_.isUndefined(params.env)) data.env = params.env;
if (!_.isUndefined(params.color)) data.color = params.color;
if (!_.isUndefined(params.icon)) data.icon = params.icon;
let result = await this.Model.up(id, data);
let username = this.getUsername();
yapi.commons.saveLog({

View File

@ -114,7 +114,7 @@ var interfaceController = function (_baseController) {
(0, _createClass3.default)(interfaceController, [{
key: 'add',
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 _this2 = this;
var params, auth, checkRepeat, data, paths, name, i, result;
@ -300,7 +300,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'get',
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, result;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
@ -362,7 +362,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'list',
value: function () {
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) {
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
var project_id, result;
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
@ -412,7 +412,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'listByCat',
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 catid, result;
return _regenerator2.default.wrap(function _callee4$(_context4) {
while (1) {
@ -462,7 +462,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'listByMenu',
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 project_id, result, newResult, i, item, list, j;
return _regenerator2.default.wrap(function _callee5$(_context5) {
while (1) {
@ -567,7 +567,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'up',
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 _this3 = this;
var params, id, interfaceData, auth, checkRepeat, data, result, username, cateid;
@ -649,28 +649,28 @@ var interfaceController = function (_baseController) {
};
if (params.path) {
if (!_underscore2.default.isUndefined(params.path)) {
data.path = params.path;
}
if (params.title) {
if (!_underscore2.default.isUndefined(params.title)) {
data.title = params.title;
}
if (params.desc) {
if (!_underscore2.default.isUndefined(params.desc)) {
data.desc = params.desc;
}
if (params.method) {
if (!_underscore2.default.isUndefined(params.method)) {
data.method = params.method;
}
if (params.catid) {
if (!_underscore2.default.isUndefined(params.catid)) {
data.catid = params.catid;
}
if (params.req_headers) {
if (!_underscore2.default.isUndefined(params.req_headers)) {
data.req_headers = params.req_headers;
}
if (params.req_body_form) {
if (!_underscore2.default.isUndefined(params.req_body_form)) {
data.req_body_form = params.req_body_form;
}
if (params.req_params && Array.isArray(params.req_params) && params.req_params.length > 0) {
@ -680,25 +680,25 @@ var interfaceController = function (_baseController) {
data.type = 'static';
}
if (params.req_query) {
if (!_underscore2.default.isUndefined(params.req_query)) {
data.req_query = params.req_query;
}
if (params.req_body_other) {
if (!_underscore2.default.isUndefined(params.req_body_other)) {
data.req_body_other = params.req_body_other;
}
if (params.req_body_type) {
if (!_underscore2.default.isUndefined(params.req_body_type)) {
data.req_body_type = params.req_body_type;
}
if (params.res_body_type) {
if (!_underscore2.default.isUndefined(params.res_body_type)) {
data.res_body_type = params.res_body_type;
}
if (params.res_body) {
if (!_underscore2.default.isUndefined(params.res_body)) {
data.res_body = params.res_body;
}
if (params.status) {
if (!_underscore2.default.isUndefined(params.status)) {
data.status = params.status;
}
@ -773,7 +773,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'del',
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 _this4 = this;
var id, data, auth, inter, result, username;
@ -870,7 +870,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'solveConflict',
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 _this5 = this;
var id, result, userInst, userinfo, data;
@ -953,7 +953,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'addCat',
value: function () {
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(ctx) {
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(ctx) {
var params, auth, result, username;
return _regenerator2.default.wrap(function _callee9$(_context9) {
while (1) {
@ -1048,7 +1048,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'upCat',
value: function () {
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) {
var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) {
var params, result, username, cate, auth;
return _regenerator2.default.wrap(function _callee10$(_context10) {
while (1) {
@ -1120,7 +1120,7 @@ var interfaceController = function (_baseController) {
}, {
key: 'delCat',
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 id, catData, auth, username, result, r;
return _regenerator2.default.wrap(function _callee11$(_context11) {
while (1) {

View File

@ -1285,14 +1285,12 @@ var projectController = function (_baseController) {
data.project_type = params.project_type;
}
if (params.name) data.name = params.name;
if (params.desc) data.desc = params.desc;
if (params.basepath) {
data.basepath = params.basepath;
}
if (params.env) data.env = params.env;
if (params.color) data.color = params.color;
if (params.icon) data.icon = params.icon;
if (!_underscore2.default.isUndefined(params.name)) data.name = params.name;
if (!_underscore2.default.isUndefined(params.desc)) data.desc = params.desc;
data.basepath = params.basepath;
if (!_underscore2.default.isUndefined(params.env)) data.env = params.env;
if (!_underscore2.default.isUndefined(params.color)) data.color = params.color;
if (!_underscore2.default.isUndefined(params.icon)) data.icon = params.icon;
_context12.next = 34;
return this.Model.up(id, data);