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
09bcb454b6
@ -3,11 +3,10 @@ import PropTypes from 'prop-types'
|
||||
import Mock from 'mockjs'
|
||||
import { Button, Input, Select, Card, Alert, Spin, Icon, Collapse, Radio, Tooltip, message } from 'antd'
|
||||
import { autobind } from 'core-decorators';
|
||||
import crossRequest from 'cross-request';
|
||||
import mockEditor from '../../containers/Project/Interface/InterfaceList/mockEditor'
|
||||
import URL from 'url';
|
||||
const MockExtra = require('common/mock-extra.js')
|
||||
import './Postman.scss'
|
||||
import './Postman.scss';
|
||||
|
||||
const { TextArea } = Input;
|
||||
const InputGroup = Input.Group;
|
||||
@ -38,7 +37,8 @@ export default class Run extends Component {
|
||||
bodyType: '',
|
||||
bodyOther: '',
|
||||
loading: false,
|
||||
validRes: null
|
||||
validRes: null,
|
||||
hasPlugin: true
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
@ -46,9 +46,30 @@ export default class Run extends Component {
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
let startTime = 0;
|
||||
this.interval = setInterval(()=>{
|
||||
startTime += 500;
|
||||
if(startTime > 5000){
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
if(window.crossRequest){
|
||||
clearInterval(this.interval);
|
||||
this.setState({
|
||||
hasPlugin: true
|
||||
})
|
||||
}else{
|
||||
this.setState({
|
||||
hasPlugin: false
|
||||
})
|
||||
}
|
||||
}, 500)
|
||||
this.getInterfaceState()
|
||||
}
|
||||
|
||||
componentWillUnmount(){
|
||||
clearInterval(this.interval)
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.data._id !== this.props.data._id) {
|
||||
this.getInterfaceState(nextProps)
|
||||
@ -139,7 +160,7 @@ export default class Run extends Component {
|
||||
|
||||
this.setState({ loading: true })
|
||||
|
||||
crossRequest({
|
||||
window.crossRequest({
|
||||
url: href,
|
||||
method,
|
||||
headers: this.getHeadersObj(headers),
|
||||
@ -359,10 +380,10 @@ export default class Run extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
hasCrossRequestPlugin() {
|
||||
const dom = document.getElementById('y-request');
|
||||
return dom.getAttribute('key') === 'yapi';
|
||||
}
|
||||
// hasCrossRequestPlugin() {
|
||||
// const dom = document.getElementById('y-request');
|
||||
// return dom.getAttribute('key') === 'yapi';
|
||||
// }
|
||||
|
||||
objToArr(obj, key, value) {
|
||||
const keyName = key || 'name';
|
||||
@ -451,7 +472,7 @@ export default class Run extends Component {
|
||||
render () {
|
||||
|
||||
const { method, domains, pathParam, pathname, query, headers, bodyForm, caseEnv, bodyType, resHeader, loading, validRes } = this.state;
|
||||
const hasPlugin = this.hasCrossRequestPlugin();
|
||||
const hasPlugin = this.state.hasPlugin;
|
||||
const isResJson = resHeader && resHeader['content-type'] && resHeader['content-type'].indexOf('application/json') !== -1
|
||||
let path = pathname;
|
||||
pathParam.forEach(item => {
|
||||
|
@ -26,7 +26,6 @@ class AddInterfaceForm extends Component {
|
||||
e.preventDefault();
|
||||
this.props.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
values.catid = this.props.catid
|
||||
this.props.onSubmit(values)
|
||||
}
|
||||
});
|
||||
|
10
npm-shrinkwrap.json
generated
10
npm-shrinkwrap.json
generated
@ -2726,11 +2726,6 @@
|
||||
"object-assign": "4.1.1"
|
||||
}
|
||||
},
|
||||
"cross-request": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://repo.corp.qunar.com/artifactory/api/npm/npm-qunar/cross-request/-/cross-request-1.0.4.tgz",
|
||||
"integrity": "sha1-kgc6xR0EZv0yA1EjmJ0XNMC+Qr4="
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://repo.corp.qunar.com/artifactory/api/npm/npm-qunar/cross-spawn/-/cross-spawn-3.0.1.tgz",
|
||||
@ -15285,11 +15280,6 @@
|
||||
"resolved": "https://repo.corp.qunar.com/artifactory/api/npm/npm-qunar/yallist/-/yallist-2.1.2.tgz",
|
||||
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
|
||||
},
|
||||
"yapi-plugin-qsso": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "http://registry.npm.taobao.org/yapi-plugin-qsso/download/yapi-plugin-qsso-1.0.2.tgz",
|
||||
"integrity": "sha1-blrUEMXZAJg9DfYONIbrjYvtWxk="
|
||||
},
|
||||
"yargs": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://repo.corp.qunar.com/artifactory/api/npm/npm-qunar/yargs/-/yargs-7.1.0.tgz",
|
||||
|
@ -37,7 +37,6 @@
|
||||
"clipboard": "^1.7.1",
|
||||
"copy-webpack-plugin": "^4.0.1",
|
||||
"core-decorators": "^0.17.0",
|
||||
"cross-request": "^1.0.1",
|
||||
"css-loader": "^0.28.4",
|
||||
"eslint": "^3.19.0",
|
||||
"eslint-loader": "^1.9.0",
|
||||
@ -99,7 +98,6 @@
|
||||
"validate-commit-msg": "^2.12.2",
|
||||
"webpack": "^3.5.5",
|
||||
"webpack-dev-middleware": "^1.12.0",
|
||||
"yapi-plugin-qsso": "^1.0.2",
|
||||
"ykit-config-antd": "^0.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
18926
prd/index.css
18926
prd/index.css
File diff suppressed because it is too large
Load Diff
5336
prd/index.js
5336
prd/index.js
File diff suppressed because one or more lines are too long
3019
prd/lib.js
3019
prd/lib.js
File diff suppressed because one or more lines are too long
48
prd/lib2.js
48
prd/lib2.js
File diff suppressed because one or more lines are too long
@ -1,94 +0,0 @@
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // install a JSONP callback for chunk loading
|
||||
/******/ var parentJsonpFunction = window["webpackJsonp"];
|
||||
/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
|
||||
/******/ // add "moreModules" to the modules object,
|
||||
/******/ // then flag all "chunkIds" as loaded and fire callback
|
||||
/******/ var moduleId, chunkId, i = 0, callbacks = [];
|
||||
/******/ for(;i < chunkIds.length; i++) {
|
||||
/******/ chunkId = chunkIds[i];
|
||||
/******/ if(installedChunks[chunkId])
|
||||
/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]);
|
||||
/******/ installedChunks[chunkId] = 0;
|
||||
/******/ }
|
||||
/******/ for(moduleId in moreModules) {
|
||||
/******/ modules[moduleId] = moreModules[moduleId];
|
||||
/******/ }
|
||||
/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
|
||||
/******/ while(callbacks.length)
|
||||
/******/ callbacks.shift().call(null, __webpack_require__);
|
||||
/******/ if(moreModules[0]) {
|
||||
/******/ installedModules[0] = 0;
|
||||
/******/ return __webpack_require__(0);
|
||||
/******/ }
|
||||
/******/ };
|
||||
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
|
||||
/******/ // object to store loaded and loading chunks
|
||||
/******/ // "0" means "already loaded"
|
||||
/******/ // Array means "loading", array contains callbacks
|
||||
/******/ var installedChunks = {
|
||||
/******/ 3:0
|
||||
/******/ };
|
||||
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId])
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ exports: {},
|
||||
/******/ id: moduleId,
|
||||
/******/ loaded: false
|
||||
/******/ };
|
||||
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.loaded = true;
|
||||
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
|
||||
/******/ // This file contains only the entry chunk.
|
||||
/******/ // The chunk loading function for additional chunks
|
||||
/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) {
|
||||
/******/ // "0" is the signal for "already loaded"
|
||||
/******/ if(installedChunks[chunkId] === 0)
|
||||
/******/ return callback.call(null, __webpack_require__);
|
||||
|
||||
/******/ // an array means "currently loading".
|
||||
/******/ if(installedChunks[chunkId] !== undefined) {
|
||||
/******/ installedChunks[chunkId].push(callback);
|
||||
/******/ } else {
|
||||
/******/ // start chunk loading
|
||||
/******/ installedChunks[chunkId] = [callback];
|
||||
/******/ var head = document.getElementsByTagName('head')[0];
|
||||
/******/ var script = document.createElement('script');
|
||||
/******/ script.type = 'text/javascript';
|
||||
/******/ script.charset = 'utf-8';
|
||||
/******/ script.async = true;
|
||||
|
||||
/******/ script.src = __webpack_require__.p + "" + chunkId + ".chunk.js";
|
||||
/******/ head.appendChild(script);
|
||||
/******/ }
|
||||
/******/ };
|
||||
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([]);
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta id="cross-request-sign" charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>YAPI-高效、易用、功能强大的api管理平台</title>
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/image/favicon.png">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta id="cross-request-sign" charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>YAPI-高效、易用、功能强大的api管理平台</title>
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/image/favicon.png">
|
||||
@ -9,9 +9,6 @@
|
||||
document.write('<script src="/prd/assets.js?v=' + Math.random() + '"><\/script>');
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
document.write('<link rel="stylesheet" href="/prd/' + window.WEBPACK_ASSETS['index.js'].css + '" />');
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user