This repository has been archived by the owner on Oct 29, 2019. It is now read-only.
/
application.js
99 lines (98 loc) · 3.11 KB
/
application.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import mockjs from 'mockjs';
export default {
getAllApplication(req, res) {
res.json(mockjs.mock(
{
data: {
'applicationId|20-50': [{ 'key|+1': 3, label: function() { return `app-${this.key}`; } }], // eslint-disable-line
},
}
));
},
getApplication(req, res) {
res.json(mockjs.mock(
{
data: {
'getSlowService|10': [{ 'key|+1': 1, name: '@name', 'avgResponseTime|200-1000': 1 }],
'getServerThroughput|10': [{ 'key|+1': 1, name: '@name', 'callsPerSec|100-10000': 1 }],
getApplicationTopology: () => {
const application = mockjs.mock({
nodes: [
{
id: 1,
name: '@name',
'type|1': ['DUBBO', 'tomcat', 'SPRINGMVC'],
'calls|1000-2000': 1,
'sla|1-100.1-2': 1,
'apdex|0.2': 1,
'numOfServer|1-100': 1,
'numOfServerAlarm|1-100': 1,
'numOfServiceAlarm|1-100': 1,
'isIncomingNode|1': true,
},
],
});
const resources = mockjs.mock({
'nodes|5': [
{
'id|+1': 200,
name: '@name',
'type|1': ['Oracle', 'MYSQL', 'REDIS'],
},
],
});
const nodes = application.nodes.concat(resources.nodes);
const userConnectApplication = mockjs.mock({
calls: [
{
source: 1,
target: 200,
'isAlarm|1': true,
'callType|1': ['rpc', 'http', 'dubbo'],
'callsPerSec|100-2000': 1,
'avgResponseTime|500-5000': 1,
},
{
source: 1,
target: 201,
'isAlarm|1': true,
'callType|1': ['rpc', 'http', 'dubbo'],
'callsPerSec|100-2000': 1,
'avgResponseTime|500-5000': 1,
},
{
source: 1,
target: 202,
'isAlarm|1': true,
'callType|1': ['rpc', 'http', 'dubbo'],
'callsPerSec|100-2000': 1,
'avgResponseTime|500-5000': 1,
},
{
source: 1,
target: 203,
'isAlarm|1': true,
'callType|1': ['rpc', 'http', 'dubbo'],
'callsPerSec|100-2000': 1,
'avgResponseTime|500-5000': 1,
},
{
source: 1,
target: 204,
'isAlarm|1': true,
'callType|1': ['rpc', 'http', 'dubbo'],
'callsPerSec|100-2000': 1,
'avgResponseTime|500-5000': 1,
},
],
});
return {
nodes,
calls: userConnectApplication.calls,
};
},
},
}
));
},
};