fix: 解决冲突

This commit is contained in:
zwjamnsss 2017-10-13 17:37:04 +08:00
commit b913981fcd
21 changed files with 49 additions and 34 deletions

View File

@ -24,7 +24,8 @@ YApi 是<strong>高效</strong>、<strong>易用</strong>、<strong>功能强大
npm install -g yapi-cli --registry https://registry.npm.taobao.org
yapi-cli server
#### 更新
#### 升级
升级项目版本是非常容易的,并且不会影响已有的项目数据,只会同步 vendors 目录下的源码文件。
cd {项目目录}
yapi-cli ls //查看版本号列表
yapi-cli update //更新到最新版本

View File

@ -19,7 +19,7 @@ const alertContent = () => {
const ua = window.navigator.userAgent,
isChrome = ua.indexOf("Chrome") && window.chrome;
if (!isChrome) {
return <Alert style={{zIndex: 99}} message={'YApi 的插件、接口测试等功能仅支持 Chrome 浏览器,请使用 Chrome 浏览器获得完整功能。'} banner closable />
return <Alert style={{zIndex: 99}} message={'YApi 的接口测试等功能仅支持 Chrome 浏览器,请使用 Chrome 浏览器获得完整功能。'} banner closable />
}
}

View File

@ -78,18 +78,19 @@ export default class GroupList extends Component {
async componentWillMount() {
const groupId = !isNaN(this.props.match.params.groupId) ? parseInt(this.props.match.params.groupId) : 0;
await this.props.fetchGroupList();
let currGroup = this.props.groupList[0] || { group_name: '', group_desc: '' };
let currGroup = false;
if (this.props.groupList.length && groupId) {
for (let i = 0; i < this.props.groupList.length; i++) {
if (this.props.groupList[i]._id === groupId) {
currGroup = this.props.groupList[i];
} else {
this.props.history.replace(`${currGroup._id}`);
}
}
} }
} else if (!groupId && this.props.groupList.length) {
this.props.history.push(`/group/${this.props.groupList[0]._id}`);
}
if(!currGroup){
currGroup = this.props.groupList[0] || { group_name: '', group_desc: '' };
this.props.history.replace(`${currGroup._id}`);
}
this.setState({ groupList: this.props.groupList });
this.props.setCurrGroup(currGroup)
}

View File

@ -126,7 +126,7 @@ class ProjectList extends Component {
</Col>
<Col>
{/(admin)|(owner)|(dev)/.test(this.props.currGroup.role) ?
<Button type="primary"><Link to="/add-project">添加项目</Link></Button>:
<Link to="/add-project"><Button type="primary">添加项目</Button></Link>:
<Tooltip title="您没有权限,请联系该分组组长或管理员">
<Button type="primary" disabled >添加项目</Button>
</Tooltip>}

View File

@ -252,6 +252,10 @@ class InterfaceEditForm extends Component {
}
editor.create();
editor.txt.html(this.state.desc)
if(navigator.userAgent.indexOf("Firefox")>0){
document.getElementById('title').focus()
}
}
componentWillUnmount() {
@ -518,7 +522,7 @@ class InterfaceEditForm extends Component {
return requestBodyTpl(item, index)
})
return (
<Form onSubmit={this.handleSubmit}>
<Form onSubmit={this.handleSubmit}>
<h2 className="interface-title" style={{ marginTop: 0 }}>基本设置</h2>
<div className="panel-sub">
@ -531,7 +535,7 @@ class InterfaceEditForm extends Component {
initialValue: this.state.title,
rules: nameLengthLimit('接口')
})(
<Input placeholder="接口名称" />
<Input id="title" placeholder="接口名称" />
)}
</FormItem>

View File

@ -109,6 +109,8 @@ class InterfaceList extends Component {
if (result.data.errcode === 0) {
message.success('修改成功');
this.handleRequest(this.props);
} else {
message.error(result.data.errmsg)
}
}

View File

@ -258,7 +258,7 @@ class View extends Component {
title: '参数名称',
dataIndex: 'name',
key: 'name',
width: '100px'
width: '200px'
}, {
title: '参数值',
dataIndex: 'value',

View File

@ -11,7 +11,10 @@ function mock(mockJSON, context) {
return parse(mockJSON);
function parse(p, c) {
c = c || {};
if(!c){
c = Array.isArray(p) ? [] : {}
}
for (var i in p) {
if (!p.hasOwnProperty(i)) {
continue;

View File

@ -100,12 +100,17 @@ function improtData(importDataModule){
function handleResponse(api){
let res_body = '';
if(!api || !Array.isArray(api)){
if(!api || typeof api !== 'object'){
return res_body;
}
_.each(api, (res, code)=>{
if(code == 200 || code === 'default'){
res_body = handleSchema(res.schema);
if(code == 200){
if(res && typeof res === 'object'){
res_body = handleSchema(res.schema);
}else{
res_body = '';
}
}
})
return res_body;
@ -118,7 +123,8 @@ function improtData(importDataModule){
}
try{
data.definitions = SwaggerData.definitions;
return JSON.stringify(jsf(data), null, 2);
let jsfData = JSON.stringify(jsf(data), null, 2);
return jsfData;
}catch(e){
return '';
}

7
plugin.json Normal file
View File

@ -0,0 +1,7 @@
[
{
"title": "yapi-plugin-qsso",
"url": "https://github.com/ymfe/yapi-plugin-qsso",
"desc": "qunar 专用 sso 第三方登录"
}
]

View File

@ -89,7 +89,7 @@ class interfaceColController extends baseController{
});
let username = this.getUsername();
yapi.commons.saveLog({
content: `用户 "${username}" 添加了接口集 "${params.name}"`,
content: `<a href="/user/profile/${this.getUid()}">${username}</a> 添加了接口集 <a href="/project/${params.project_id}/interface/col/${result._id}">${params.name}</a>`,
type: 'project',
uid: this.getUid(),
username: username,
@ -220,7 +220,7 @@ class interfaceColController extends baseController{
this.colModel.get(params.col_id).then((col)=>{
yapi.commons.saveLog({
content: `用户 "${username}" 在接口集 "${col.name}" 下添加了接口用例 "${params.casename}"`,
content: `<a href="/user/profile/${this.getUid()}">${username}</a> 在接口集 <a href="/project/${params.project_id}/interface/col/${params.col_id}">${col.name}</a> 下添加了接口用例 <a href="/project/${params.project_id}/interface/case/${result._id}">${params.casename}</a>`,
type: 'project',
uid: this.getUid(),
username: username,
@ -278,7 +278,7 @@ class interfaceColController extends baseController{
let username = this.getUsername();
this.colModel.get(params.col_id).then((col)=>{
yapi.commons.saveLog({
content: `用户 "${username}" 在接口集 "${col.name}" 下导入了接口 ${data.casename}`,
content: `<a href="/user/profile/${this.getUid()}">${username}</a> 在接口集 <a href="/project/${params.project_id}/interface/col/${params.col_id}">${col.name}</a> 下导入了接口 <a href="/project/${params.project_id}/interface/case/${data.interface_id}">${data.casename}</a>`,
type: 'project',
uid: this.getUid(),
username: username,
@ -348,7 +348,7 @@ class interfaceColController extends baseController{
let username = this.getUsername();
this.colModel.get(caseData.col_id).then((col)=>{
yapi.commons.saveLog({
content: `用户 "${username}" 在接口集 "${col.name}" 更新了接口用例 "${params.casename || caseData.casename}"`,
content:`<a href="/user/profile/${this.getUid()}">${username}</a> 在接口集 <a href="/project/${caseData.project_id}/interface/col/${caseData.col_id}">${col.name}</a> 更新了接口用例 <a href="/project/${caseData.project_id}/interface/case/${params.id}">${params.casename || caseData.casename}</a>`,
type: 'project',
uid: this.getUid(),
username: username,
@ -453,7 +453,7 @@ class interfaceColController extends baseController{
});
let username = this.getUsername();
yapi.commons.saveLog({
content: `用户 "${username}" 更新了接口集 "${params.name}" 的信息`,
contnet: `<a href="/user/profile/${this.getUid()}">${username}</a> 更新了接口集 <a href="/project/${colData.project_id}/interface/col/${params.col_id}">${params.name}</a> 的信息`,
type: 'project',
uid: this.getUid(),
username: username,
@ -527,7 +527,7 @@ class interfaceColController extends baseController{
await this.caseModel.delByCol(id);
let username = this.getUsername();
yapi.commons.saveLog({
content: `用户 "${username}" 删除了接口集 "${colData.name}" 及其下面的接口`,
content: `<a href="/user/profile/${this.getUid()}">${username}</a> 删除了接口集 <a href="/project/${colData.project_id}/interface/col/${id}">${colData.name}</a> 及其下面的接口`,
type: 'project',
uid: this.getUid(),
username: username,
@ -564,7 +564,7 @@ class interfaceColController extends baseController{
let username = this.getUsername();
this.colModel.get(caseData.col_id).then((col)=>{
yapi.commons.saveLog({
content: `用户 "${username}" 删除了接口集 "${col.name}" 下的接口 "${caseData.casename}"`,
content: `<a href="/user/profile/${this.getUid()}">${username}</a> 删除了接口集 <a href="/project/${caseData.project_id}/interface/col/${caseData.col_id}">${col.name}</a> 下的接口 <a href="/project/${caseData.project_id}/interface/case/${caseid}">${caseData.casename}</a>`,
type: 'project',
uid: this.getUid(),
username: username,

View File

@ -609,7 +609,7 @@ class projectController extends baseController {
let result = await this.Model.up(id, data);
let username = this.getUsername();
yapi.commons.saveLog({
content: `<a href="/user/profile/${this.getUid()}">${username}</a> 更新了项目 <a href="/user/profile/${id}}">${projectData.name}</a> ""`,
content: `<a href="/user/profile/${this.getUid()}">${username}</a> 更新了项目 <a href="/user/profile/${id}}">${projectData.name}</a>`,
type: 'project',
uid: this.getUid(),
username: username,
@ -660,7 +660,7 @@ class projectController extends baseController {
let result = await this.Model.up(id, data);
let username = this.getUsername();
yapi.commons.saveLog({
content: `<a href="/user/profile/${this.getUid()}">${username}</a> 更新了项目 <a href="/user/profile/${id}">${projectData.name}"</a> 环境`,
content: `<a href="/user/profile/${this.getUid()}">${username}</a> 更新了项目 <a href="/user/profile/${id}">${projectData.name}</a> 环境`,
type: 'project',
uid: this.getUid(),
username: username,

View File

@ -1,5 +0,0 @@
<<<<<<< HEAD
window.WEBPACK_ASSETS = {"index.js":{"js":"index@8a3568400b8e3dea6f1e.js","css":"index@8a3568400b8e3dea6f1e.css"},"lib":{"js":"lib@92e2c3937254a8f33f8a.js"},"lib2":{"js":"lib2@2e084b54b8a92fdaf766.js"},"manifest":{"js":"manifest@b67af9f8b578904e66c5.js"}}
=======
window.WEBPACK_ASSETS = {"index.js":{"js":"index@d40cbb31e3ed41d757d9.js","css":"index@d40cbb31e3ed41d757d9.css"},"lib":{"js":"lib@3d6790748483412d111e.js"},"lib2":{"js":"lib2@34c977588e1eeac462a0.js"},"manifest":{"js":"manifest@b67af9f8b578904e66c5.js"}}
>>>>>>> e27b666f67edebac832ca9a3c751d0d764680284

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
!function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n=window.webpackJsonp;window.webpackJsonp=function(s,o){for(var u,f,l=0,c=[];l<s.length;l++)f=s[l],i[f]&&c.push.apply(c,i[f]),i[f]=0;for(u in o)e[u]=o[u];for(n&&n(s,o);c.length;)c.shift().call(null,t);if(o[0])return r[0]=0,t(0)};var r={},i={3:0};t.e=function(e,n){if(0===i[e])return n.call(null,t);if(void 0!==i[e])i[e].push(n);else{i[e]=[n];var r=document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.async=!0,s.src=t.p+""+e+".chunk.min.js",r.appendChild(s)}},t.m=e,t.c=r,t.p=""}([])