diff --git a/client/containers/Interface/Interface.js b/client/containers/Interface/Interface.js index 0a96066a..0cbb54df 100644 --- a/client/containers/Interface/Interface.js +++ b/client/containers/Interface/Interface.js @@ -8,7 +8,7 @@ import InterfaceTable from './InterfaceTable/InterfaceTable.js' import InterfaceMode from './InterfaceMode/InterfaceMode.js' import moment from 'moment' import { - fetchInterfaceData, + fetchInterfaceData, projectMember, closeProjectMember } from '../../actions/interfaceAction.js' diff --git a/client/containers/Interface/Interface.scss b/client/containers/Interface/Interface.scss index 7e451f49..892a521d 100644 --- a/client/containers/Interface/Interface.scss +++ b/client/containers/Interface/Interface.scss @@ -1,48 +1,19 @@ /* .interface-box.css */ .interface-box { max-width: 11rem; - display: -webkit-box; - -webkit-box-flex: 1; margin: 24px auto; border-radius: 4px; box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20); - font-size: 0.14rem; background: #FFF; - - .interface-list { - width: 216px; - line-height: 45px; - background: #f9fafe; - - li { - padding: 0 0 0 30px; - color: #344562; - cursor: pointer; - - &:hover { - color: #29f; - } - - a { - color: #344562; - &:hover { - color: #29f; - } - } - } + overflow: hidden; + .interface-btngroup { + margin: .24rem .24rem 0; + } + .interface-btn { + margin-right: .16rem; } - .interface-table { - -webkit-box-flex: 1; - margin: 0 20px; - min-height: 740px; - .ant-table-wrapper table { - font-size: .14rem; - - button { - margin: 0 10px 0 0; - } - } + margin: .24rem; } } diff --git a/client/containers/Interface/InterfaceList/InterfaceList.js b/client/containers/Interface/InterfaceList/InterfaceList.js index b0720f50..8d278db9 100644 --- a/client/containers/Interface/InterfaceList/InterfaceList.js +++ b/client/containers/Interface/InterfaceList/InterfaceList.js @@ -1,6 +1,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import { Link } from 'react-router-dom' +import { Button } from 'antd' class InterfaceList extends Component { static propTypes = { @@ -23,10 +24,10 @@ class InterfaceList extends Component { const getInterfaceId = this.getInterfaceId() console.log(`/AddInterface/${getInterfaceId}`) return ( - +
+ + +
) } } diff --git a/client/containers/Interface/InterfaceTable/InterfaceTable.js b/client/containers/Interface/InterfaceTable/InterfaceTable.js index def13166..a65ca614 100644 --- a/client/containers/Interface/InterfaceTable/InterfaceTable.js +++ b/client/containers/Interface/InterfaceTable/InterfaceTable.js @@ -85,7 +85,7 @@ class InterfaceTable extends Component { return (
- +
) } diff --git a/client/containers/ProjectGroups/ProjectList/UpDateModal.js b/client/containers/ProjectGroups/ProjectList/UpDateModal.js index 7e122b09..81ca8bb7 100644 --- a/client/containers/ProjectGroups/ProjectList/UpDateModal.js +++ b/client/containers/ProjectGroups/ProjectList/UpDateModal.js @@ -252,7 +252,7 @@ class UpDateModal extends Component { })( - {envs.length > 0 ? ( + {/* 新增的项中,只有最后一项有删除按钮 */} + { (envs.length > 0 && k._id) || (envs.length == index + 1) ? ( this.remove(k._id ? k._id : k)} + onClick={() => { + return this.remove(k._id ? k._id : k); + }} /> ) : null} diff --git a/server/middleware/mockServer.js b/server/middleware/mockServer.js index 9bc59b50..461874a4 100644 --- a/server/middleware/mockServer.js +++ b/server/middleware/mockServer.js @@ -4,13 +4,14 @@ import interfaceModel from '../models/interface.js' import Mock from 'mockjs' module.exports = async (ctx, next) => { - yapi.commons.log('mock Server running...') + yapi.commons.log('Server Recevie Request...') let hostname = ctx.hostname; let config = yapi.WEBCONFIG; if(ctx.hostname === config.webhost){ if(next) await next(); return true; } + yapi.commons.log('MockServer Running...') let projectInst = yapi.getInst(projectModel), projects; try{ projects = await projectInst.getByDomain(hostname); @@ -18,10 +19,12 @@ module.exports = async (ctx, next) => { return ctx.body = yapi.commons.resReturn(null, 403, e.message); } - let matchProject = false, maxBasepath = 0; + let matchProject = [], maxBasepath = 0; + for(let i=0, l = projects.length; i< l; i++){ let project = projects[i]; - if(ctx.path && ctx.path.indexOf(project.basepath) === 0 && project.basepath[project.basepath.length -1] === '/'){ + + if(ctx.path && ctx.path.indexOf(project.basepath) === 0){ matchProject.push(project); if(project.basepath.length > maxBasepath){ maxBasepath = project.basepath.length; diff --git a/server_dist/middleware/mockServer.js b/server_dist/middleware/mockServer.js index 7732d55c..d9d66655 100644 --- a/server_dist/middleware/mockServer.js +++ b/server_dist/middleware/mockServer.js @@ -34,7 +34,7 @@ module.exports = function () { while (1) { switch (_context.prev = _context.next) { case 0: - _yapi2.default.commons.log('mock Server running...'); + _yapi2.default.commons.log('Server Recevie Request...'); hostname = ctx.hostname; config = _yapi2.default.WEBCONFIG; @@ -55,28 +55,31 @@ module.exports = function () { return _context.abrupt('return', true); case 8: + _yapi2.default.commons.log('MockServer Running...'); projectInst = _yapi2.default.getInst(_project3.default), projects = void 0; - _context.prev = 9; - _context.next = 12; + _context.prev = 10; + _context.next = 13; return projectInst.getByDomain(hostname); - case 12: + case 13: projects = _context.sent; - _context.next = 18; + _context.next = 19; break; - case 15: - _context.prev = 15; - _context.t0 = _context['catch'](9); + case 16: + _context.prev = 16; + _context.t0 = _context['catch'](10); return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 403, _context.t0.message)); - case 18: - matchProject = false, maxBasepath = 0; + case 19: + matchProject = [], maxBasepath = 0; + for (i = 0, l = projects.length; i < l; i++) { _project = projects[i]; - if (ctx.path && ctx.path.indexOf(_project.basepath) === 0 && _project.basepath[_project.basepath.length - 1] === '/') { + + if (ctx.path && ctx.path.indexOf(_project.basepath) === 0) { matchProject.push(_project); if (_project.basepath.length > maxBasepath) { maxBasepath = _project.basepath.length; @@ -86,62 +89,62 @@ module.exports = function () { } if (!(matchProject === false)) { - _context.next = 22; + _context.next = 23; break; } return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '不存在的domain')); - case 22: + case 23: project = matchProject, interfaceData = void 0; interfaceInst = _yapi2.default.getInst(_interface2.default); - _context.prev = 24; - _context.next = 27; + _context.prev = 25; + _context.next = 28; return interfaceInst.getByPath(project._id, ctx.path.substr(project.basepath.length)); - case 27: + case 28: interfaceData = _context.sent; if (!(!interfaceData || interfaceData.length === 0)) { - _context.next = 30; + _context.next = 31; break; } return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 404, '不存在的api')); - case 30: + case 31: if (!(interfaceData.length > 1)) { - _context.next = 32; + _context.next = 33; break; } return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 405, '存在多个api,请检查数据库')); - case 32: + case 33: interfaceData = interfaceData[0]; if (!(interfaceData.res_body_type === 'json')) { - _context.next = 35; + _context.next = 36; break; } return _context.abrupt('return', ctx.body = _mockjs2.default.mock(_yapi2.default.commons.json_parse(interfaceData.res_body))); - case 35: + case 36: return _context.abrupt('return', ctx.body = interfaceData.res_body); - case 38: - _context.prev = 38; - _context.t1 = _context['catch'](24); + case 39: + _context.prev = 39; + _context.t1 = _context['catch'](25); return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 409, _context.t1.message)); - case 41: + case 42: case 'end': return _context.stop(); } } - }, _callee, undefined, [[9, 15], [24, 38]]); + }, _callee, undefined, [[10, 16], [25, 39]]); })); return function (_x, _x2) {