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

This commit is contained in:
suxiaoxin 2017-08-25 19:04:16 +08:00
commit 7653d07704
6 changed files with 26 additions and 27 deletions

View File

@ -11,8 +11,7 @@
.footer-container{
margin: 0 auto !important;
padding-top: .48rem;
padding-bottom: .48rem;
padding: .48rem .24rem;
max-width: 12.2rem;
.icon {
font-size: .16rem;

View File

@ -69,11 +69,9 @@ class ProjectList extends Component {
e.preventDefault();
form.validateFields((err, values) => {
if (!err) {
values.group_id = values.group.split(':')[0];
values.group_name = values.group.split(':')[1];
values.group_id = values.group;
values.icon = constants.PROJECT_ICON[0];
values.color = pickRandomProperty(constants.PROJECT_COLOR);
delete values.group;
addProject(values).then((res) => {
if (res.payload.data.errcode == 0) {
form.resetFields();
@ -115,13 +113,13 @@ class ProjectList extends Component {
label="所属分组"
>
{getFieldDecorator('group', {
initialValue: this.state.groupList.length > 0? this.state.groupList[0]._id.toString() + ':' + this.state.groupList[0].group_name : null ,
initialValue: this.state.groupList.length > 0? this.state.groupList[0]._id.toString() : null ,
rules: [{
required: true, message: '请选择项目所属的分组!'
}]
})(
<Select>
{this.state.groupList.map((item, index) => <Option value={item._id.toString() + ':' + this.state.groupList[index].group_name} key={index}>{item.group_name}</Option>)}
{this.state.groupList.map((item, index) => <Option value={item._id.toString()} key={index}>{item.group_name}</Option>)}
</Select>
)}
</FormItem>

View File

@ -2,6 +2,7 @@ import React, { Component } from 'react'
import { Table, Card, Badge, Select, Button, Modal, Row, Col, message, Popconfirm } from 'antd';
import PropTypes from 'prop-types';
import { autobind } from 'core-decorators';
import { fetchGroupMsg } from '../../../../reducer/modules/group';
import { connect } from 'react-redux';
import ErrMsg from '../../../../components/ErrMsg/ErrMsg.js';
import { fetchGroupMemberList } from '../../../../reducer/modules/group.js';
@ -33,6 +34,7 @@ const arrayAddKey = (arr) => {
getProjectMemberList,
addMember,
delMember,
fetchGroupMsg,
changeMemberRole
}
)
@ -59,6 +61,7 @@ class ProjectMember extends Component {
changeMemberRole: PropTypes.func,
fetchGroupMemberList: PropTypes.func,
getProjectMsg: PropTypes.func,
fetchGroupMsg: PropTypes.func,
getProjectMemberList: PropTypes.func
}
@autobind
@ -146,11 +149,12 @@ class ProjectMember extends Component {
async componentWillMount() {
const groupMemberList = await this.props.fetchGroupMemberList(this.props.projectMsg.group_id);
const groupMsg = await this.props.fetchGroupMsg(this.props.projectMsg.group_id);
const rojectMsg = await this.props.getProjectMsg(this.props.projectId);
const projectMemberList = await this.props.getProjectMemberList(this.props.projectId);
this.setState({
groupMemberList: groupMemberList.payload.data.data,
groupName: this.props.projectMsg.group_name,
groupName: groupMsg.payload.data.data.group_name,
projectMemberList: arrayAddKey(projectMemberList.payload.data.data),
role: rojectMsg.payload.data.data.role
})

View File

@ -13,7 +13,6 @@ class projectModel extends baseModel {
basepath: {type: String },
desc: String,
group_id: { type: Number, required: true },
group_name: { type: String, required: true },
project_type: {type:String, required: true, enum: ['public', 'private']},
members: [
{uid: Number, role: {type: String, enum:['owner', 'dev']},username: String, email: String}
@ -33,16 +32,16 @@ class projectModel extends baseModel {
return m.save();
}
get(id) {
get(id) {
return this.model.findOne({
_id: id
}).exec();
}
}
getBaseInfo(id){
return this.model.findOne({
_id: id
}).select('_id uid name basepath desc group_id group_name project_type env icon color add_time up_time')
}).select('_id uid name basepath desc group_id project_type env icon color add_time up_time')
.exec()
}

View File

@ -148,7 +148,7 @@ var projectController = function (_baseController) {
}, {
key: 'add',
value: function () {
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
var params, checkRepeat, data, result, colInst, catInst, username;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
@ -320,7 +320,7 @@ var projectController = function (_baseController) {
}, {
key: 'addMember',
value: function () {
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) {
var params, check, userdata, result, username;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
@ -443,7 +443,7 @@ var projectController = function (_baseController) {
}, {
key: 'delMember',
value: function () {
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) {
var _this2 = this;
var params, check, result, username;
@ -541,7 +541,7 @@ var projectController = function (_baseController) {
}, {
key: 'getUserdata',
value: function () {
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(uid, role) {
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(uid, role) {
var userInst, userData;
return _regenerator2.default.wrap(function _callee4$(_context4) {
while (1) {
@ -599,7 +599,7 @@ var projectController = function (_baseController) {
}, {
key: 'getMemberList',
value: function () {
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) {
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) {
var params, project;
return _regenerator2.default.wrap(function _callee5$(_context5) {
while (1) {
@ -661,7 +661,7 @@ var projectController = function (_baseController) {
}, {
key: 'get',
value: function () {
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) {
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) {
var params, result, catInst, cat;
return _regenerator2.default.wrap(function _callee6$(_context6) {
while (1) {
@ -746,7 +746,7 @@ var projectController = function (_baseController) {
}, {
key: 'list',
value: function () {
var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) {
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) {
var group_id, auth, result, follow, uids, _users, users;
return _regenerator2.default.wrap(function _callee7$(_context7) {
@ -846,7 +846,7 @@ var projectController = function (_baseController) {
}, {
key: 'del',
value: function () {
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) {
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) {
var id, interfaceInst, interfaceColInst, interfaceCaseInst, result;
return _regenerator2.default.wrap(function _callee8$(_context8) {
while (1) {
@ -939,7 +939,7 @@ var projectController = function (_baseController) {
}, {
key: 'changeMemberRole',
value: function () {
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(ctx) {
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(ctx) {
var _this3 = this;
var params, projectInst, check, result, username;
@ -1055,7 +1055,7 @@ var projectController = function (_baseController) {
}, {
key: 'upSet',
value: function () {
var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) {
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) {
var _this4 = this;
var id, data, result;
@ -1145,7 +1145,7 @@ var projectController = function (_baseController) {
}, {
key: 'up',
value: function () {
var _ref11 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee11(ctx) {
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx) {
var id, params, projectData, checkRepeat, data, result, username;
return _regenerator2.default.wrap(function _callee11$(_context11) {
while (1) {
@ -1294,7 +1294,7 @@ var projectController = function (_baseController) {
}, {
key: 'search',
value: function () {
var _ref12 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee12(ctx) {
var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(ctx) {
var q, projectList, groupList, projectRules, groupRules, queryList;
return _regenerator2.default.wrap(function _callee12$(_context12) {
while (1) {
@ -1369,7 +1369,7 @@ var projectController = function (_baseController) {
}, {
key: 'download',
value: function () {
var _ref13 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee13(ctx) {
var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(ctx) {
var project_id, interfaceInst, count, arr, fileName, res;
return _regenerator2.default.wrap(function _callee13$(_context13) {
while (1) {

View File

@ -52,7 +52,6 @@ var projectModel = function (_baseModel) {
basepath: { type: String },
desc: String,
group_id: { type: Number, required: true },
group_name: { type: String, required: true },
project_type: { type: String, required: true, enum: ['public', 'private'] },
members: [{ uid: Number, role: { type: String, enum: ['owner', 'dev'] }, username: String, email: String }],
env: [{ name: String, domain: String }],
@ -80,7 +79,7 @@ var projectModel = function (_baseModel) {
value: function getBaseInfo(id) {
return this.model.findOne({
_id: id
}).select('_id uid name basepath desc group_id group_name project_type env icon color add_time up_time').exec();
}).select('_id uid name basepath desc group_id project_type env icon color add_time up_time').exec();
}
}, {
key: 'getByDomain',