Skip to content

Commit 43db360

Browse files
committed
feat: add mock data
1 parent 5cafc4e commit 43db360

File tree

9 files changed

+75
-11
lines changed

9 files changed

+75
-11
lines changed

.eslintrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ module.exports = {
2424
"react/no-direct-mutation-state": 2,
2525
"react/no-unknown-property": 1,
2626
"react/prefer-es6-class": 1,
27-
"react/react-in-jsx-scope": 2
27+
"react/react-in-jsx-scope": 2,
28+
"comma-dangle": 0,
29+
"jsx-quotes": 0,
2830
},
2931
"env": {
3032
"es6": true,

antd-sample/app.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import ReactDom from 'react-dom';
66

77
import 'antd/dist/antd.css';
88

9+
import './app.less';
10+
911
import fetch from './common/fetch';
1012

1113
import {
@@ -48,8 +50,6 @@ function onChange (pagination, filters, sorter) {
4850
console.log('params', pagination, filters, sorter);
4951
}
5052

51-
import './app.less';
52-
5353
const Header = Layout.Header;
5454
const Footer = Layout.Footer;
5555
const Content = Layout.Content;
@@ -66,8 +66,7 @@ class App extends React.Component {
6666
}
6767

6868
componentWillMount () {
69-
return;
70-
fetch('/api/getListData', 'GET', null)
69+
fetch('/api/antd-sample/getListData', 'GET', null)
7170
.then(res => {
7271
if (res.success) {
7372
this.setState({
@@ -94,7 +93,7 @@ class App extends React.Component {
9493
return (
9594
<Layout>
9695
<Header className="header"></Header>
97-
<Content style={{padding: 30}}>
96+
<Content style={{ padding: 30 }}>
9897
<Select className="test-list" defaultValue="lucy" style={{ width: 120 }}>
9998
<Option value="jack">Jack</Option>
10099
<Option value="lucy">Lucy</Option>

data/antd-sample.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"projectName": "antd-sample",
3+
"description": "antd sample",
4+
"globalProxy": null,
5+
"uniqId": "23db2d5a-d9fe-4d5c-bf80-73eb8282f0fc"
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"protocol": "http",
3+
"pathname": "api/antd-sample/getListData",
4+
"method": "ALL",
5+
"projectUniqId": "23db2d5a-d9fe-4d5c-bf80-73eb8282f0fc",
6+
"description": "get list data",
7+
"currentScene": "error",
8+
"proxyConfig": {},
9+
"contextConfig": {},
10+
"uniqId": "debf0525-6188-483d-8ff8-ac62b5f6da8e"
11+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"sceneName": "default",
3+
"data": {
4+
"success": true,
5+
"data": [
6+
{
7+
"key": "1",
8+
"name": "John Brown",
9+
"age": 32,
10+
"address": "New York No. 1 Lake Park"
11+
},
12+
{
13+
"key": "2",
14+
"name": "Jim Green",
15+
"age": 42,
16+
"address": "London No. 1 Lake Park"
17+
},
18+
{
19+
"key": "3",
20+
"name": "Joe Black",
21+
"age": 32,
22+
"address": "Sidney No. 1 Lake Park"
23+
},
24+
{
25+
"key": "4",
26+
"name": "Jim Red",
27+
"age": 32,
28+
"address": "London No. 2 Lake Park"
29+
}
30+
]
31+
},
32+
"interfaceUniqId": "debf0525-6188-483d-8ff8-ac62b5f6da8e",
33+
"uniqId": "5e573d2a-385f-4540-a0d2-27f6de8c95f9"
34+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"sceneName": "error",
3+
"data": {
4+
"success": false,
5+
"errorMessage": "error message from datahub"
6+
},
7+
"interfaceUniqId": "debf0525-6188-483d-8ff8-ac62b5f6da8e",
8+
"uniqId": "f922a5a6-e53f-4605-8f7c-6915fc306215"
9+
}

data/awesome.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"projectName": "awesome",
33
"description": "sample description",
4+
"globalProxy": null,
45
"uniqId": "85475c30-a506-463a-aeab-5a9651185022"
56
}

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"prepublish": "npm run build",
2121
"serve": "npm run dev:test &",
2222
"test": "macaca run -d ./test --verbose",
23+
"test:antd": "macaca run -d ./test/antd-sample --verbose",
2324
"ci": "./ci.sh",
2425
"reliable": "reliable report -c ./macaca-reliable.config.js",
2526
"contributor": "git-contributor"
@@ -41,7 +42,7 @@
4142
"classnames": "^2.2.5",
4243
"cross-env": "^5.1.1",
4344
"css-loader": "^0.28.8",
44-
"datahub-proxy-middleware": "^1.0.9",
45+
"datahub-proxy-middleware": "^2.0.2",
4546
"eslint": "^4.10.0",
4647
"eslint-config-standard": "^11.0.0-beta.0",
4748
"eslint-loader": "^2.0.0",
@@ -92,10 +93,8 @@
9293
"webpack": "^4.10.0",
9394
"webpack-cli": "^3.0.1",
9495
"webpack-dev-server": "^3.1.4",
96+
"whatwg-fetch": "^2.0.4",
9597
"xutil": "1"
9698
},
97-
"licenses": "MIT",
98-
"dependencies": {
99-
"whatwg-fetch": "^2.0.4"
100-
}
99+
"licenses": "MIT"
101100
}

webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ const datahubConfig = {
1010
hostname: '127.0.0.1',
1111
store: path.join(__dirname, 'data'),
1212
proxy: {
13+
'^/api/antd-sample': {
14+
hub: 'antd-sample',
15+
},
1316
'^/api': {
1417
hub: 'awesome',
1518
},

0 commit comments

Comments
 (0)