mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-30 13:20:24 +08:00
Merge branch 'dev' of http://gitlab.corp.qunar.com/mfe/yapi into dev
This commit is contained in:
commit
5ca8623040
@ -49,7 +49,8 @@ class ProjectMessage extends Component {
|
||||
super(props);
|
||||
this.state = {
|
||||
protocol: 'http:\/\/',
|
||||
projectMsg: {}
|
||||
projectMsg: {},
|
||||
showDangerOptions: false
|
||||
}
|
||||
}
|
||||
static propTypes = {
|
||||
@ -139,6 +140,14 @@ class ProjectMessage extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
// 点击“查看危险操作”按钮
|
||||
toggleDangerOptions = () => {
|
||||
// console.log(this.state.showDangerOptions);
|
||||
this.setState({
|
||||
showDangerOptions: !this.state.showDangerOptions
|
||||
});
|
||||
}
|
||||
|
||||
async componentWillMount() {
|
||||
await this.props.getProjectMsg(this.props.projectId);
|
||||
const groupMsg = await this.props.fetchGroupMsg(this.props.projectMsg.group_id);
|
||||
@ -288,19 +297,20 @@ class ProjectMessage extends Component {
|
||||
|
||||
{/* 只有组长和管理员有权限删除项目 */}
|
||||
{projectMsg.role === 'owner' || projectMsg.role === 'admin' ?
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="危险操作"
|
||||
className="danger-container"
|
||||
>
|
||||
<Card noHovering={true} className="card-danger">
|
||||
<div className="danger-container">
|
||||
<div className="title">
|
||||
<h2 className="content"><Icon type="exclamation-circle-o" /> 危险操作</h2>
|
||||
<Button onClick={this.toggleDangerOptions}>查 看<Icon type={this.state.showDangerOptions ? 'up' : 'down'} /></Button>
|
||||
</div>
|
||||
{this.state.showDangerOptions ? <Card noHovering={true} className="card-danger">
|
||||
<div className="card-danger-content">
|
||||
<h3>删除项目</h3>
|
||||
<p>项目一旦删除,将无法恢复数据,请慎重操作!</p>
|
||||
<p>只有组长和管理员有权限删除项目。</p>
|
||||
</div>
|
||||
<Button type="danger" ghost className="card-danger-btn" onClick={this.showConfirm}>删除</Button>
|
||||
</Card>
|
||||
</FormItem> : null}
|
||||
</Card> : null}
|
||||
</div> : null}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
@ -193,9 +193,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 环境配置中首个item的删除按钮定位调整
|
||||
.env-first-row {
|
||||
.ant-col-2 {
|
||||
position: relative;
|
||||
bottom: .16rem;
|
||||
}
|
||||
}
|
||||
|
||||
// 危险操作
|
||||
.danger-container {
|
||||
.title {
|
||||
margin-bottom: .48rem;
|
||||
text-align: center;
|
||||
.content {
|
||||
color: rgba(39, 56, 72, 0.65);
|
||||
margin-bottom: .16rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,15 +49,17 @@ function emitHook(name, ...args) {
|
||||
let hook = hooks[name];
|
||||
if (hook.mulit === true && hook.type === 'listener') {
|
||||
if (Array.isArray(hook.listener)) {
|
||||
let promiseAll = [];
|
||||
hook.listener.forEach(item => {
|
||||
if (typeof item === 'function') {
|
||||
item.call(pluginModule, ...args)
|
||||
promiseAll.push(Promise.resolve(item.call(pluginModule, ...args)))
|
||||
}
|
||||
})
|
||||
return Promise.all(promiseAll);
|
||||
}
|
||||
} else if (hook.mulit === false && hook.type === 'listener') {
|
||||
if (typeof hook.listener === 'function') {
|
||||
hook.listener.call(pluginModule, ...args);
|
||||
return Promise.resolve(hook.listener.call(pluginModule, ...args));
|
||||
}
|
||||
} else if (hook.type === 'component') {
|
||||
return hook.listener;
|
||||
|
@ -168,9 +168,9 @@ em {
|
||||
}
|
||||
|
||||
// 页面级底部固定 需要添加padding以保证页面底部不被覆盖
|
||||
.has-affix-footer {
|
||||
padding-bottom: .92rem;
|
||||
}
|
||||
// .has-affix-footer {
|
||||
// padding-bottom: .92rem;
|
||||
// }
|
||||
|
||||
.popover-index {
|
||||
max-width: 3.2rem;
|
||||
|
@ -21,18 +21,16 @@ class advMockController extends baseController{
|
||||
let params = ctx.request.body;
|
||||
try{
|
||||
if(!params.interface_id){
|
||||
return yapi.commons.resReturn(null, 408, '缺少interface_id');
|
||||
return ctx.body =yapi.commons.resReturn(null, 408, '缺少interface_id');
|
||||
}
|
||||
if(!params.project_id){
|
||||
return yapi.commons.resReturn(null, 408, '缺少project_id');
|
||||
}
|
||||
if(!params.mock_script){
|
||||
return yapi.commons.resReturn(null, 408, '缺少mock_script');
|
||||
return ctx.body =yapi.commons.resReturn(null, 408, '缺少project_id');
|
||||
}
|
||||
|
||||
|
||||
let data = {
|
||||
interface_id: params.interface_id,
|
||||
mock_script: params.mock_script,
|
||||
mock_script: params.mock_script || '',
|
||||
project_id: params.project_id,
|
||||
uid: this.getUid(),
|
||||
enable: params.enable === true ? true : false
|
||||
|
@ -494,9 +494,9 @@ class userController extends baseController {
|
||||
email: data.email || userData.email
|
||||
}
|
||||
let groupInst = yapi.getInst(groupModel);
|
||||
groupInst.updateMember(member)
|
||||
await groupInst.updateMember(member)
|
||||
let projectInst = yapi.getInst(projectModel);
|
||||
projectInst.updateMember(member)
|
||||
await projectInst.updateMember(member)
|
||||
|
||||
let result = await userInst.update(id, data);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
|
@ -121,18 +121,25 @@ function bindHook(name, listener) {
|
||||
|
||||
}
|
||||
|
||||
async function emitHook(name) {
|
||||
/**
|
||||
*
|
||||
* @param {*} hookname
|
||||
* @return promise
|
||||
*/
|
||||
function emitHook(name) {
|
||||
if (hooks[name] && typeof hooks[name] === 'object') {
|
||||
let args = Array.prototype.slice.call(arguments, 1);
|
||||
if (hooks[name].type === 'single' && typeof hooks[name].listener === 'function') {
|
||||
return await hooks[name].listener.apply(yapi, args);
|
||||
return Promise.resolve(hooks[name].listener.apply(yapi, args));
|
||||
}
|
||||
let promiseAll = [];
|
||||
if (Array.isArray(hooks[name].listener)) {
|
||||
let listenerList = hooks[name].listener;
|
||||
for(let i=0, l = listenerList.length; i< l; i++){
|
||||
await listenerList[i].apply(yapi, args);
|
||||
promiseAll.push(Promise.resolve(listenerList[i].apply(yapi, args)));
|
||||
}
|
||||
}
|
||||
return Promise.all(promiseAll);
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,7 +160,7 @@ function emitHookSync(name) {
|
||||
|
||||
yapi.bindHook = bindHook;
|
||||
yapi.emitHook = emitHook;
|
||||
yapi.emitHookSync = emitHookSync;
|
||||
yapi.emitHookSync = emitHook;
|
||||
|
||||
|
||||
|
||||
|
@ -433,6 +433,7 @@ for(let ctrl in routerConfig){
|
||||
} )
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} routerController controller
|
||||
|
@ -1 +1 @@
|
||||
window.WEBPACK_ASSETS = {"index.js":{"js":"index@32a0dc2682847e4e52b8.js","css":"index@32a0dc2682847e4e52b8.css"},"lib":{"js":"lib@cd09b17af3008fec401c.js"},"lib2":{"js":"lib2@fda61e2b7f61e65a452d.js"},"manifest":{"js":"manifest@b67af9f8b578904e66c5.js"}}
|
||||
window.WEBPACK_ASSETS = {"index.js":{"js":"index@69ac3d9b2a64776501a0.js","css":"index@69ac3d9b2a64776501a0.css"},"lib":{"js":"lib@f88ed246a871afd46f3e.js"},"lib2":{"js":"lib2@34c977588e1eeac462a0.js"},"manifest":{"js":"manifest@b67af9f8b578904e66c5.js"}}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
1
static/prd/index@69ac3d9b2a64776501a0.css
Normal file
1
static/prd/index@69ac3d9b2a64776501a0.css
Normal file
File diff suppressed because one or more lines are too long
BIN
static/prd/index@69ac3d9b2a64776501a0.css.gz
Normal file
BIN
static/prd/index@69ac3d9b2a64776501a0.css.gz
Normal file
Binary file not shown.
1
static/prd/index@69ac3d9b2a64776501a0.js
Normal file
1
static/prd/index@69ac3d9b2a64776501a0.js
Normal file
File diff suppressed because one or more lines are too long
BIN
static/prd/index@69ac3d9b2a64776501a0.js.gz
Normal file
BIN
static/prd/index@69ac3d9b2a64776501a0.js.gz
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
static/prd/lib2@34c977588e1eeac462a0.js.gz
Normal file
BIN
static/prd/lib2@34c977588e1eeac462a0.js.gz
Normal file
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
1
static/prd/lib@f88ed246a871afd46f3e.js
Normal file
1
static/prd/lib@f88ed246a871afd46f3e.js
Normal file
File diff suppressed because one or more lines are too long
BIN
static/prd/lib@f88ed246a871afd46f3e.js.gz
Normal file
BIN
static/prd/lib@f88ed246a871afd46f3e.js.gz
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user