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

This commit is contained in:
zwjamnsss 2017-08-30 14:28:11 +08:00
commit 0fb6f7bbe1
13 changed files with 199 additions and 176 deletions

View File

@ -40,7 +40,8 @@ class UsernameAutoComplete extends Component {
this.state = {
dataSource: [],
uid: 0,
username: ''
username: '',
changeName: ''
}
}
@ -48,39 +49,63 @@ class UsernameAutoComplete extends Component {
callbackState: PropTypes.func
}
// 改变本组件 state并回调给父组件
changeState = (uid, username) => {
// 设置本组件 state
this.setState({ uid, username });
// 回调 将当前选中的uid和username回调给父组件
this.props.callbackState({ uid, username });
}
// 输入框中的值改变时
onChange = (userName) => {
this.setState({
changeName: userName
});
}
// 选中候选词时
onSelect = (userName) => {
this.state.dataSource.forEach((item) => {
if (item.username === userName) {
// 设置本组件 state
this.setState({
uid: item.id,
username: item.username
});
// 回调 将当前选中的uid和username回调给父组件
this.props.callbackState({
uid: item.id,
username: item.username
})
this.changeState(item.id, item.username);
}
});
}
// 搜索回调
handleSearch = (value) => {
const params = { q: value}
axios.get('/api/user/search', { params })
.then(data => {
const userList = []
data = data.data.data
const userList = [];
data = data.data.data;
if (data) {
data.forEach( v => userList.push({
username: v.username,
id: v.uid
}));
// 取回搜索值后,设置 dataSource
this.setState({
dataSource: userList
})
});
if (userList.length) {
userList.forEach((item) => {
if (item.username === this.state.changeName) {
// 每次取回搜索值后,没选择时默认选择第一位
this.changeState(userList[0].id, userList[0].username);
} else {
// 有候选词但没有对应输入框中的字符串,此时应清空候选 uid 和 username
this.changeState(-1, '');
}
});
} else {
// 如果没有搜索结果,则清空候选 uid 和 username
this.changeState(-1, '');
}
}
})
});
}
render () {
@ -88,6 +113,7 @@ class UsernameAutoComplete extends Component {
<AutoComplete
dataSource={this.state.dataSource.map(i => i.username)}
style={{ width: '100%' }}
onChange={this.onChange}
onSelect={this.onSelect}
onSearch={this.handleSearch}
placeholder="请输入用户名"

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

@ -2,7 +2,7 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux';
import InterfaceEditForm from './InterfaceEditForm.js'
import { updateInterfaceData } from '../../../../reducer/modules/interface.js';
import { updateInterfaceData,fetchInterfaceList } from '../../../../reducer/modules/interface.js';
import axios from 'axios'
import { message } from 'antd'
import './Edit.scss'
@ -15,7 +15,8 @@ import { withRouter, Link } from 'react-router-dom';
currProject: state.project.currProject
}
}, {
updateInterfaceData
updateInterfaceData,
fetchInterfaceList
}
)
@ -24,6 +25,7 @@ class InterfaceEdit extends Component {
curdata: PropTypes.object,
currProject: PropTypes.object,
updateInterfaceData: PropTypes.func,
fetchInterfaceList: PropTypes.func,
match: PropTypes.object,
switchToView: PropTypes.func
}
@ -41,6 +43,7 @@ class InterfaceEdit extends Component {
onSubmit = async (params) => {
params.id = this.props.match.params.actionId;
let result = await axios.post('/api/interface/up', params);
this.props.fetchInterfaceList(this.props.currProject._id).then();
if (result.data.errcode === 0) {
this.props.updateInterfaceData(params);
message.success('保存成功');

View File

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

View File

@ -85,10 +85,8 @@ class InterfaceEditForm extends Component {
handleSubmit = (e) => {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
if (values.res_body_type === 'json') values.res_body = this.state.res_body;
values.req_params = this.state.req_params;
// values.req_body_other = this.state.req_body_other;
if (!err) {
if (values.res_body_type === 'json') values.res_body = this.state.res_body;
values.method = this.state.method;
let isfile = false, isHavaContentType = false;
if (values.req_body_type === 'form') {
@ -130,7 +128,7 @@ class InterfaceEditForm extends Component {
values.req_query = values.req_query ? values.req_query.filter(item => item.name !== '') : []
if (HTTP_METHOD[values.method].request_body !== true) {
values.req_params = []
values.req_body_form = []
}
this.props.onSubmit(values)
}
@ -410,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

@ -95,8 +95,6 @@ class ProjectMessage extends Component {
this.props.getProjectMsg(this.props.projectId);
message.success('修改成功! ');
// this.props.history.push('/group');
} else {
message.error(res.payload.data.errmsg);
}
}).catch(() => {
});

View File

@ -1,55 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
.test {
width: 400px;
position: relative;
min-height: 240px;
background-color: #2395f1;
overflow: hidden;
}
.test:before, .test:after {
content: "";
position: absolute;
left: 50%;
min-width: 800px;
min-height: 800px;
background-color: #fff;
animation-name: rotate;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
.test:before {
bottom: 180px;
border-radius: 45%;
animation-duration: 10s;
}
.test:after {
top: 180px;
opacity: .5;
border-radius: 47%;
animation-duration: 10s;
}
@keyframes rotate {
0% {
transform: translate(-50%, 0) rotateZ(0deg);
}
50% {
transform: translate(-50%, -2%) rotateZ(180deg);
}
100% {
transform: translate(-50%, 0%) rotateZ(360deg);
}
}
</style>
</head>
<body>
<div class="test">
</div>
</body>
</html>

View File

@ -2,6 +2,7 @@ import interfaceModel from '../models/interface.js';
import interfaceCatModel from '../models/interfaceCat.js';
import interfaceCaseModel from '../models/interfaceCase.js'
import _ from 'underscore';
import baseController from './base.js';
import yapi from '../yapi.js';
import userModel from '../models/user.js';
@ -61,6 +62,7 @@ class interfaceController extends baseController {
}
params.method = params.method || 'GET';
params.method = params.method.toUpperCase();
params.req_params = params.req_params || [];
params.res_body_type = params.res_body_type ? params.res_body_type.toLowerCase() : 'json';
if (!params.project_id) {
@ -105,7 +107,23 @@ class interfaceController extends baseController {
if (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) {
if (params.path.indexOf(":") > 0) {
let paths = params.path.split("/"), name, i;
for (i = 1; i < paths.length; i++) {
if (paths[i][0] === ':') {
name = paths[i].substr(1);
if (!_.find(params.req_params, { name: name })) {
params.req_params.push({
name: name,
desc: ''
})
}
}
}
}
if ( params.req_params.length > 0) {
data.type = 'var'
data.req_params = params.req_params;
} else {
@ -116,9 +134,9 @@ class interfaceController extends baseController {
}
let result = await this.Model.save(data);
// let project = await this.projectModel.get(params.project_id);
this.catModel.get(params.catid).then((cate)=>{
this.catModel.get(params.catid).then((cate) => {
let username = this.getUsername();
yapi.commons.saveLog({
content: `用户 "${username}" 为分类 "${cate.name}" 添加了接口 "${data.title}"`,
@ -128,7 +146,7 @@ class interfaceController extends baseController {
typeid: params.project_id
});
});
ctx.body = yapi.commons.resReturn(result);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
@ -251,7 +269,6 @@ class interfaceController extends baseController {
async up(ctx) {
let params = ctx.request.body;
params = yapi.commons.handleParams(params, {
title: 'string',
path: 'string',
@ -279,7 +296,7 @@ class interfaceController extends baseController {
return ctx.body = yapi.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/');
}
if (params.path && params.path !== interfaceData.path && params.method !== interfaceData.method) {
if (params.path && (params.path !== interfaceData.path || params.method !== interfaceData.method)) {
let checkRepeat = await this.Model.checkRepeat(interfaceData.project_id, params.path, params.method);
if (checkRepeat > 0) {
return ctx.body = yapi.commons.resReturn(null, 401, '已存在的接口:' + params.path + '[' + params.method + ']');
@ -290,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) {
@ -321,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;
}
@ -347,7 +364,7 @@ class interfaceController extends baseController {
let result = await this.Model.up(id, data);
let username = this.getUsername();
if (params.catid) {
this.catModel.get(+params.catid).then((cate)=>{
this.catModel.get(+params.catid).then((cate) => {
yapi.commons.saveLog({
content: `用户 "${username}" 更新了分类 "${cate.name}" 下的接口 "${data.title}"`,
type: 'project',
@ -358,7 +375,7 @@ class interfaceController extends baseController {
});
} else {
let cateid = interfaceData.catid;
this.catModel.get(cateid).then((cate)=>{
this.catModel.get(cateid).then((cate) => {
yapi.commons.saveLog({
content: `用户 "${username}" 更新了分类 "${cate.name}" 下的接口 "${data.title}"`,
type: 'project',
@ -369,7 +386,7 @@ class interfaceController extends baseController {
});
}
ctx.body = yapi.commons.resReturn(result);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
@ -409,7 +426,7 @@ class interfaceController extends baseController {
let result = await this.Model.del(id);
await this.caseModel.delByInterfaceId(id);
let username = this.getUsername();
this.catModel.get(inter.catid).then((cate)=>{
this.catModel.get(inter.catid).then((cate) => {
yapi.commons.saveLog({
content: `用户 "${username}" 删除了分类 "${cate.name}" 下的接口 "${inter.title}"`,
type: 'project',
@ -418,7 +435,7 @@ class interfaceController extends baseController {
typeid: cate.project_id
});
})
ctx.body = yapi.commons.resReturn(result);
} catch (err) {
@ -508,7 +525,7 @@ class interfaceController extends baseController {
name: params.name,
desc: params.desc,
up_time: yapi.commons.time()
});
});
let username = this.getUsername();
let cate = await this.catModel.get(params.catid);

View File

@ -344,7 +344,7 @@ class projectController extends baseController {
for(let index=0, item, r = 1; index< result.length; index++){
item = result[index].toObject();
if(item.project_type === 'private' && auth === false){
r = await this.Model.checkMemberRepeat(this.getUid());
r = await this.Model.checkMemberRepeat(item._id, this.getUid());
if(r === 0){
continue;
}
@ -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

@ -44,6 +44,10 @@ var _interfaceCase = require('../models/interfaceCase.js');
var _interfaceCase2 = _interopRequireDefault(_interfaceCase);
var _underscore = require('underscore');
var _underscore2 = _interopRequireDefault(_underscore);
var _base = require('./base.js');
var _base2 = _interopRequireDefault(_base);
@ -113,7 +117,7 @@ var interfaceController = function (_baseController) {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
var _this2 = this;
var params, auth, checkRepeat, data, result;
var params, auth, checkRepeat, data, paths, name, i, result;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
@ -145,47 +149,48 @@ var interfaceController = function (_baseController) {
case 7:
params.method = params.method || 'GET';
params.method = params.method.toUpperCase();
params.req_params = params.req_params || [];
params.res_body_type = params.res_body_type ? params.res_body_type.toLowerCase() : 'json';
if (params.project_id) {
_context.next = 12;
_context.next = 13;
break;
}
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目id不能为空'));
case 12:
case 13:
if (params.path) {
_context.next = 14;
_context.next = 15;
break;
}
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '接口请求路径不能为空'));
case 14:
case 15:
if (_yapi2.default.commons.verifyPath(params.path)) {
_context.next = 16;
_context.next = 17;
break;
}
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/'));
case 16:
_context.next = 18;
case 17:
_context.next = 19;
return this.Model.checkRepeat(params.project_id, params.path, params.method);
case 18:
case 19:
checkRepeat = _context.sent;
if (!(checkRepeat > 0)) {
_context.next = 21;
_context.next = 22;
break;
}
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在的接口:' + params.path + '[' + params.method + ']'));
case 21:
_context.prev = 21;
case 22:
_context.prev = 22;
data = {
project_id: params.project_id,
catid: params.catid,
@ -210,7 +215,24 @@ var interfaceController = function (_baseController) {
if (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) {
if (params.path.indexOf(":") > 0) {
paths = params.path.split("/"), name = void 0, i = void 0;
for (i = 1; i < paths.length; i++) {
if (paths[i][0] === ':') {
name = paths[i].substr(1);
if (!_underscore2.default.find(params.req_params, { name: name })) {
params.req_params.push({
name: name,
desc: ''
});
}
}
}
}
if (params.req_params.length > 0) {
data.type = 'var';
data.req_params = params.req_params;
} else {
@ -220,10 +242,10 @@ var interfaceController = function (_baseController) {
data.req_body_other = params.req_body_other;
}
_context.next = 29;
_context.next = 31;
return this.Model.save(data);
case 29:
case 31:
result = _context.sent;
@ -240,21 +262,21 @@ var interfaceController = function (_baseController) {
});
ctx.body = _yapi2.default.commons.resReturn(result);
_context.next = 37;
_context.next = 39;
break;
case 34:
_context.prev = 34;
_context.t0 = _context['catch'](21);
case 36:
_context.prev = 36;
_context.t0 = _context['catch'](22);
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
case 37:
case 39:
case 'end':
return _context.stop();
}
}
}, _callee, this, [[21, 34]]);
}, _callee, this, [[22, 36]]);
}));
function add(_x) {
@ -555,7 +577,6 @@ var interfaceController = function (_baseController) {
case 0:
params = ctx.request.body;
params = _yapi2.default.commons.handleParams(params, {
title: 'string',
path: 'string',
@ -604,7 +625,7 @@ var interfaceController = function (_baseController) {
return _context6.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/'));
case 17:
if (!(params.path && params.path !== interfaceData.path && params.method !== interfaceData.method)) {
if (!(params.path && (params.path !== interfaceData.path || params.method !== interfaceData.method))) {
_context6.next = 23;
break;
}
@ -628,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) {
@ -659,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;
}

View File

@ -795,7 +795,7 @@ var projectController = function (_baseController) {
}
_context7.next = 4;
return _this3.Model.checkMemberRepeat(_this3.getUid());
return _this3.Model.checkMemberRepeat(_item._id, _this3.getUid());
case 4:
_r = _context7.sent;
@ -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);