funboost 48.0__py3-none-any.whl → 48.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of funboost might be problematic. Click here for more details.
- funboost/__init__.py +1 -1
- funboost/constant.py +7 -0
- funboost/consumers/base_consumer.py +137 -68
- funboost/core/active_cousumer_info_getter.py +80 -0
- funboost/core/function_result_status_saver.py +1 -1
- funboost/function_result_web/__pycache__/functions.cpython-37.pyc +0 -0
- funboost/function_result_web/__pycache__/functions.cpython-39.pyc +0 -0
- funboost/function_result_web/app.py +104 -7
- funboost/function_result_web/functions.py +17 -4
- funboost/function_result_web/static/css/content_page_style.css +39 -0
- funboost/function_result_web/static/images/favicon.ico +0 -0
- funboost/function_result_web/static/js/bootstrap-datetimepicker.min.js +2 -0
- funboost/function_result_web/static/js/echarts.min.js +32478 -0
- funboost/function_result_web/static/js/moment-with-locales.min.js +1 -0
- funboost/function_result_web/static/js/select2.min.js +2 -0
- funboost/function_result_web/templates/about.html +67 -0
- funboost/function_result_web/templates/conusme_speed.html +217 -0
- funboost/function_result_web/templates/fun_result_table.html +433 -0
- funboost/function_result_web/templates/index.html +194 -423
- funboost/function_result_web/templates/index_backup.html +475 -0
- funboost/function_result_web/templates/index_/321/204/342/225/225/320/235/321/205/320/237/320/277/321/206/320/232/320/250/321/205/320/237/320/260.html +153 -0
- funboost/function_result_web/templates/queue_op.html +501 -0
- funboost/function_result_web/templates/running_consumer_by_ip.html +219 -0
- funboost/function_result_web/templates/running_consumer_by_queue_name.html +220 -0
- funboost/timing_job/timing_push.py +24 -24
- funboost/utils/dependency_packages_in_pythonpath/aioredis/readme.md +0 -6
- funboost/utils/dependency_packages_in_pythonpath/readme.md +0 -6
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/METADATA +78 -76
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/RECORD +33 -18
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/WHEEL +1 -1
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/LICENSE +0 -0
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/entry_points.txt +0 -0
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>pytho万能分布式函数调度框架</title>
|
|
8
|
+
<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
|
|
9
|
+
<link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
|
10
|
+
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css">
|
|
11
|
+
<link rel="stylesheet" href="{{ url_for('static',filename='assets/css/jquery.mCustomScrollbar.min.css') }}">
|
|
12
|
+
<link rel="stylesheet" href="{{ url_for('static',filename='assets/css/custom.css') }}">
|
|
13
|
+
|
|
14
|
+
<!-- 在其他 link 标签后添加 -->
|
|
15
|
+
<link href="https://cdn.bootcdn.net/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet">
|
|
16
|
+
<script src="{{ url_for('static',filename='js/jquery-1.11.0.min.js') }}" type="text/javascript"></script>
|
|
17
|
+
<!-- <script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.11.0/jquery.min.js"></script> -->
|
|
18
|
+
<!-- 在其他 script 标签后添加 -->
|
|
19
|
+
<script src="https://cdn.bootcdn.net/ajax/libs/select2/4.0.13/js/select2.min.js"></script>
|
|
20
|
+
<style>
|
|
21
|
+
.marginLeft20 {
|
|
22
|
+
margin-left: 20px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.liActive {
|
|
26
|
+
background: #FFFF66;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
</style>
|
|
30
|
+
</head>
|
|
31
|
+
<body>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
<!-- <li><a href="{{url_for('logout')}}">退出</a></li> -->
|
|
38
|
+
|
|
39
|
+
<!-- 添加固定导航栏 -->
|
|
40
|
+
<nav class="navbar navbar-default navbar-fixed-top" style="min-height: 40px;">
|
|
41
|
+
<div class="container-fluid">
|
|
42
|
+
<div class="navbar-header pull-right">
|
|
43
|
+
<a href="{{url_for('logout')}}" class="btn btn-danger" style="margin: 4px 15px;">
|
|
44
|
+
<i class="fa fa-sign-out"></i> 退出
|
|
45
|
+
</a>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</nav>
|
|
49
|
+
|
|
50
|
+
<!-- 删除原来的退出按钮 -->
|
|
51
|
+
<!-- 调整主容器的上边距 -->
|
|
52
|
+
<div class="container-fluid" style="margin-top: 10px;">
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
<div style="margin-top: 70px;">
|
|
59
|
+
{# <h1 style="text-align:center;">Pro sidebar template</h1>#}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
<form class="form-inline" role="form" style="float: left">
|
|
63
|
+
<div class="form-group marginLeft20">
|
|
64
|
+
<label for="col_name_search">队列名称:</label>
|
|
65
|
+
<select class="form-control" id="col_name_search">
|
|
66
|
+
<option value="">请选择队列...</option>
|
|
67
|
+
</select>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="form-group marginLeft20">
|
|
70
|
+
<label for="start_time">起始时间:</label>
|
|
71
|
+
<input type="text" class="form-control" id="start_time">
|
|
72
|
+
</div>
|
|
73
|
+
<div class="form-group marginLeft20">
|
|
74
|
+
<label for="end_time">截止时间:</label>
|
|
75
|
+
<input type="text" class="form-control" id="end_time">
|
|
76
|
+
</div>
|
|
77
|
+
<label for="sucess_status" class="marginLeft20">函数运行状态:</label>
|
|
78
|
+
<select class="form-control" id="sucess_status">
|
|
79
|
+
<option value="1">全部</option>
|
|
80
|
+
<option value="2">成功</option>
|
|
81
|
+
<option value="3">失败</option>
|
|
82
|
+
|
|
83
|
+
</select>
|
|
84
|
+
<div class="form-group marginLeft20">
|
|
85
|
+
<label for="params">函数参数:</label>
|
|
86
|
+
<input type="text" class="form-control" id="params" placeholder="请输入参数。。">
|
|
87
|
+
</div>
|
|
88
|
+
<button type="button" class="btn btn-default marginLeft20" onclick="document.getElementById('table').style.display = 'block';$('#echartsArea').css('display','none');startRun();queryResult(currentColName,0,true)">查询</button>
|
|
89
|
+
</form>
|
|
90
|
+
|
|
91
|
+
<button id="statistic" type="button" class="btn btn-info btn-sm marginLeft20" onclick="statistic()">生成统计表</button>
|
|
92
|
+
|
|
93
|
+
<button id="autoFresh" type="button" class="btn btn-success btn-sm marginLeft20" style="float2: right" onclick="startOrStop()">自动刷新中</button>
|
|
94
|
+
<!-- <p id="echartsInfoTex" style="clear: both;margin-top: 30px;background-color:yellowgreen ;width:600px;color: white;text-shadow: 0 0 10px black;font-size: 16px;display: none"></p>
|
|
95
|
+
<p id="Last1minInfoTex" style="clear: both;margin-top: 10px;background-color:#00ccff;width:600px;color: white;text-shadow: 0 0 10px black;font-size: 16px;"></p>
|
|
96
|
+
<p id="resultInfoTex" style="clear: both;margin-top: 10px;background-color:green;width:600px;color: white;text-shadow: 0 0 10px black;font-size: 16px;"></p>
|
|
97
|
+
-->
|
|
98
|
+
<p id="echartsInfoTex" style="clear: both;margin-top: 30px;background-color:yellowgreen ;width:600px;color: white;text-shadow: 0 0 10px black;font-size: 16px;display: none"></p>
|
|
99
|
+
<div style="display: flex; gap: 20px; margin-top: 10px;">
|
|
100
|
+
<p id="Last1minInfoTex" style="margin: 0; background-color:#00ccff;width:600px;color: white;text-shadow: 0 0 10px black;font-size: 16px;"></p>
|
|
101
|
+
<p id="resultInfoTex" style="margin: 0; background-color:green;width:600px;color: white;text-shadow: 0 0 10px black;font-size: 16px;"></p>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<div id = echartsArea style="display: None">
|
|
105
|
+
<div id="st4" style="width: 100%;height:600px;margin-top:60px;"></div>
|
|
106
|
+
<div id="st3" style="width: 100%;height:600px;margin-top:60px;"></div>
|
|
107
|
+
<div id="st2" style="width: 100%;height:600px;margin-top:60px;"></div>
|
|
108
|
+
<div id="st1" style="width: 100%;height:600px;margin-top:60px;"></div>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="table-responsive">
|
|
111
|
+
<table id="table" class="table table-striped">
|
|
112
|
+
|
|
113
|
+
</table>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
<script src="http://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
<script src="https://cdn.bootcss.com/moment.js/2.24.0/moment-with-locales.js"></script>
|
|
124
|
+
<script src="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
|
|
125
|
+
<script type="text/javascript" src="https://cdn.bootcss.com/echarts/3.3.0/echarts.js"></script>
|
|
126
|
+
|
|
127
|
+
<script src="{{ url_for('static',filename='assets/js/jquery.mCustomScrollbar.concat.min.js') }}"></script>
|
|
128
|
+
<script src="{{ url_for('static',filename='assets/js/custom.js') }}"></script>
|
|
129
|
+
|
|
130
|
+
<script>
|
|
131
|
+
|
|
132
|
+
// 在现有的变量声明后添加
|
|
133
|
+
var allQueues = []; // 存储所有队列数据
|
|
134
|
+
var currentColName;
|
|
135
|
+
|
|
136
|
+
// 页面加载完成后立即获取所有队列
|
|
137
|
+
$(document).ready(function() {
|
|
138
|
+
$.ajax({
|
|
139
|
+
url: "{{ url_for('query_cols_view')}}",
|
|
140
|
+
data: {col_name_search: ''},
|
|
141
|
+
async: true,
|
|
142
|
+
success: function (result) {
|
|
143
|
+
allQueues = result;
|
|
144
|
+
var html = '<option value="">请选择队列...</option>';
|
|
145
|
+
for (var item of result) {
|
|
146
|
+
html += '<option value="' + item.collection_name + '">' +
|
|
147
|
+
item.collection_name + ' (' + item.count + ')</option>';
|
|
148
|
+
}
|
|
149
|
+
$("#col_name_search").html(html);
|
|
150
|
+
|
|
151
|
+
// 初始化选择框的搜索功能
|
|
152
|
+
$("#col_name_search").select2({
|
|
153
|
+
placeholder: "请输入队列名称搜索...",
|
|
154
|
+
allowClear: true,
|
|
155
|
+
width: '300px'
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// 监听选择变化
|
|
159
|
+
$("#col_name_search").on('change', function() {
|
|
160
|
+
var selectedQueue = $(this).val();
|
|
161
|
+
console.log("Selected queue:", selectedQueue);
|
|
162
|
+
currentColName = selectedQueue;
|
|
163
|
+
// if(selectedQueue) {
|
|
164
|
+
// queryResult(selectedQueue, 0, true);
|
|
165
|
+
// }
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
String.prototype.format = function () {
|
|
173
|
+
var values = arguments;
|
|
174
|
+
return this.replace(/\{(\d+)\}/g, function (match, index) {
|
|
175
|
+
if (values.length > index) {
|
|
176
|
+
return values[index];
|
|
177
|
+
} else {
|
|
178
|
+
return "";
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
function dateToString(date) {
|
|
184
|
+
const year = date.getFullYear();
|
|
185
|
+
let month = date.getMonth() + 1;
|
|
186
|
+
let day = date.getDate();
|
|
187
|
+
let hour = date.getHours();
|
|
188
|
+
let minute = date.getMinutes();
|
|
189
|
+
let second = date.getSeconds();
|
|
190
|
+
month = month > 9 ? month : ('0' + month);
|
|
191
|
+
day = day > 9 ? day : ('0' + day);
|
|
192
|
+
hour = hour > 9 ? hour : ('0' + hour);
|
|
193
|
+
minute = minute > 9 ? minute : ('0' + minute);
|
|
194
|
+
second = second > 9 ? second : ('0' + second);
|
|
195
|
+
return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
//昨天的时间
|
|
200
|
+
var day1 = new Date();
|
|
201
|
+
day1.setDate(day1.getDate() - 2);
|
|
202
|
+
|
|
203
|
+
//明天的时间
|
|
204
|
+
var day2 = new Date();
|
|
205
|
+
day2.setDate(day2.getDate() + 1);
|
|
206
|
+
|
|
207
|
+
$("#start_time").val(dateToString(day1));
|
|
208
|
+
$("#end_time").val(dateToString(day2));
|
|
209
|
+
useAsync = false;
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
//searchCols();
|
|
213
|
+
useAsync = true;
|
|
214
|
+
|
|
215
|
+
function queryResult(col_name, page, manualOperate) {
|
|
216
|
+
$('#echartsArea').css('display','none');
|
|
217
|
+
currentColName = col_name;
|
|
218
|
+
if (manualOperate === true){
|
|
219
|
+
document.getElementById('table').style.display = 'block';
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
$.ajax({
|
|
223
|
+
url: "{{ url_for('query_result_view')}}", data: {
|
|
224
|
+
col_name: col_name, start_time: $("#start_time").val(),
|
|
225
|
+
end_time: $("#end_time").val(), is_success: $("#sucess_status").val(), function_params: $("#params").val(), page: page
|
|
226
|
+
}, async: useAsync, success: function (result, status) {
|
|
227
|
+
// console.info(result);
|
|
228
|
+
|
|
229
|
+
var html = ' <thead>\n' +
|
|
230
|
+
' <tr>\n' +
|
|
231
|
+
' <th>执行机器-进程-脚本</th>\n' +
|
|
232
|
+
|
|
233
|
+
' <th>函数名称</th>\n' +
|
|
234
|
+
' <th>函数入参</th>\n' +
|
|
235
|
+
' <th>函数结果</th>\n' +
|
|
236
|
+
' <th>消息发布时间</th>\n' +
|
|
237
|
+
' <th>开始执行时间</th>\n' +
|
|
238
|
+
' <th>消耗时间(秒)</th>\n' +
|
|
239
|
+
' <th>执行次数(重试)</th>\n' +
|
|
240
|
+
' <th>运行状态</th>\n' +
|
|
241
|
+
' <th>是否成功</th>\n' +
|
|
242
|
+
' <th>错误原因</th>\n' +
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
' <th>线程(协程)数</th>\n' +
|
|
246
|
+
' </tr>\n' +
|
|
247
|
+
' </thead>' +
|
|
248
|
+
'<tbody>';
|
|
249
|
+
for (var item of result) {
|
|
250
|
+
// console.info(item);
|
|
251
|
+
var displayLevel = "success";
|
|
252
|
+
if (item.run_times > 1) {
|
|
253
|
+
displayLevel = "warning";
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (item.success === false) {
|
|
257
|
+
displayLevel = "danger";
|
|
258
|
+
}
|
|
259
|
+
var tr = ' <tr class="{0}">\n' +
|
|
260
|
+
|
|
261
|
+
' <td>{1}</td>\n' +
|
|
262
|
+
' <td>{2}</td>\n' +
|
|
263
|
+
' <td>{3}</td>\n' +
|
|
264
|
+
' <td>{4}</td>\n' +
|
|
265
|
+
' <td>{5}</td>\n' +
|
|
266
|
+
' <td>{6}</td>\n' +
|
|
267
|
+
' <td>{7}</td>\n' +
|
|
268
|
+
' <td>{8}</td>\n' +
|
|
269
|
+
' <td>{9}</td>\n' +
|
|
270
|
+
' <td>{10}</td>\n' +
|
|
271
|
+
' <td>{11}</td>\n' +
|
|
272
|
+
' <td>{12}</td>\n' +
|
|
273
|
+
|
|
274
|
+
' </tr>';
|
|
275
|
+
var successText = item.success === true ? "成功" : "失败";
|
|
276
|
+
<!-- console.info(item.run_status);-->
|
|
277
|
+
var run_status_text = item.run_status;
|
|
278
|
+
if (item.run_status==="running"){
|
|
279
|
+
successText = "未完成";
|
|
280
|
+
displayLevel = "info";
|
|
281
|
+
if ( Date.now() /1000 - item.time_start > 600) {
|
|
282
|
+
run_status_text = "running?";
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
var time_start_obj = new Date(item.time_start * 1000);
|
|
287
|
+
var time_start_str = dateToString(time_start_obj);
|
|
288
|
+
|
|
289
|
+
tr = tr.format(displayLevel, item.host_process + ' - ' + item.script_name, item.function, item.params_str, item.result,item.publish_time_str,
|
|
290
|
+
time_start_str,item.time_cost, item.run_times, run_status_text,successText, item.exception, item.total_thread);
|
|
291
|
+
html += tr;
|
|
292
|
+
}
|
|
293
|
+
html += '</tbody>';
|
|
294
|
+
$("#table").html(html);
|
|
295
|
+
|
|
296
|
+
// document.getElementById('echartsArea').style.display = 'none';
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
if (manualOperate === true) {
|
|
302
|
+
updateQueryText()
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function updateQueryText() {
|
|
307
|
+
|
|
308
|
+
$.ajax({
|
|
309
|
+
url: "{{ url_for('speed_stats')}}", data: {
|
|
310
|
+
col_name: currentColName, start_time: $("#start_time").val(),
|
|
311
|
+
end_time: $("#end_time").val()
|
|
312
|
+
}, async: useAsync, success: function (result, status) {
|
|
313
|
+
var msg = '{0}队列,所选查询时间范围内运行成功了{1}次,失败了{2}次'.format(currentColName,result.success_num, result.fail_num);
|
|
314
|
+
console.info(msg);
|
|
315
|
+
$('#resultInfoTex').html(msg);
|
|
316
|
+
}
|
|
317
|
+
})
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// queryResult(currentColName, 0, true);
|
|
321
|
+
setInterval(updateQueryText, 30000);
|
|
322
|
+
|
|
323
|
+
function updateTopText() {
|
|
324
|
+
if (currentColName===undefined) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
var t1 = new Date(new Date().getTime() - 60000);
|
|
328
|
+
var t2 = new Date();
|
|
329
|
+
$.ajax({
|
|
330
|
+
url: "{{ url_for('speed_stats')}}", data: {
|
|
331
|
+
col_name: currentColName, start_time: dateToString(t1), end_time: dateToString(t2)
|
|
332
|
+
}, async: useAsync, success: function (result, status) {
|
|
333
|
+
var msg = '{0}队列,最近一分钟内运行成功了{1}次,失败了{2}次'.format(currentColName, result.success_num, result.fail_num);
|
|
334
|
+
console.info(msg);
|
|
335
|
+
$('#Last1minInfoTex').text(msg);
|
|
336
|
+
}
|
|
337
|
+
})
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
updateTopText();
|
|
341
|
+
|
|
342
|
+
setInterval(updateTopText, 30000);
|
|
343
|
+
|
|
344
|
+
function autoFreshResult() {
|
|
345
|
+
if (currentColName===undefined) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
queryResult(currentColName, 0, false);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// setInterval(autoFreshResult, 30000);
|
|
352
|
+
|
|
353
|
+
iid = setInterval(autoFreshResult, 5000);
|
|
354
|
+
runStatus = 1;
|
|
355
|
+
|
|
356
|
+
function startRun() {
|
|
357
|
+
$("#autoFresh").text("自动刷新中");
|
|
358
|
+
$("#autoFresh").removeClass("btn-danger");
|
|
359
|
+
$("#autoFresh").addClass("btn-success");
|
|
360
|
+
iid = setInterval(autoFreshResult, 5000);
|
|
361
|
+
runStatus = 1;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function stopRun() {
|
|
365
|
+
$("#autoFresh").text("暂停刷新了");
|
|
366
|
+
$("#autoFresh").removeClass("btn-success");
|
|
367
|
+
$("#autoFresh").addClass("btn-danger");
|
|
368
|
+
clearInterval(iid);
|
|
369
|
+
runStatus = 0;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function startOrStop() {
|
|
373
|
+
if (runStatus === 1) {
|
|
374
|
+
stopRun();
|
|
375
|
+
} else {
|
|
376
|
+
startRun();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
class Person {//定义了一个名字为Person的类
|
|
381
|
+
constructor(name, age) {//constructor是一个构造方法,用来接收参数
|
|
382
|
+
this.name = name;//this代表的是实例对象
|
|
383
|
+
this.age = age;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
say() {//这是一个类的方法,注意千万不要加上function
|
|
387
|
+
return "我的名字叫" + this.name + "今年" + this.age + "岁了";
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
var obj = new Person("laotie", 88);
|
|
392
|
+
console.log(obj.say());//我的名字叫laotie今年88岁了
|
|
393
|
+
|
|
394
|
+
function statistic() {
|
|
395
|
+
$('#echartsInfoTex').html('生成统计表中,需要一段时间。。。。');
|
|
396
|
+
$("#echartsInfoTex").css('display','block');
|
|
397
|
+
$("#echartsArea").css('display','block');
|
|
398
|
+
stopRun();
|
|
399
|
+
document.getElementById('table').style.display = "none";
|
|
400
|
+
$.ajax({
|
|
401
|
+
url: "{{ url_for('speed_statistic_for_echarts')}}", data: {
|
|
402
|
+
col_name: currentColName
|
|
403
|
+
}, async: useAsync, success: function (result, status) {
|
|
404
|
+
// var msg = '{0}队列,最近一分钟内运行成功了{1}次,失败了{2}次'.format(currentColName, result.success_num, result.fail_num);
|
|
405
|
+
console.info(result);
|
|
406
|
+
_buildOneChart('st1', '最近10天的消费情况', '运行次数', result['recent_10_days']['time_arr'], result['recent_10_days']['count_arr']);
|
|
407
|
+
_buildOneChart('st2', '最近24小时的消费情况', '运行次数', result['recent_24_hours']['time_arr'], result['recent_24_hours']['count_arr']);
|
|
408
|
+
_buildOneChart('st3', '最近60分钟的消费情况', '运行次数', result['recent_60_minutes']['time_arr'], result['recent_60_minutes']['count_arr']);
|
|
409
|
+
_buildOneChart('st4', '最近60秒的消费情况', '运行次数', result['recent_60_seconds']['time_arr'], result['recent_60_seconds']['count_arr']);
|
|
410
|
+
$("#echartsInfoTex").css('display','none');
|
|
411
|
+
|
|
412
|
+
// $('#top_text').text(msg);
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function _buildOneChart(elementId, titelText, legendData, xData, yData) {
|
|
420
|
+
|
|
421
|
+
var myChart = echarts.init(document.getElementById(elementId));
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
// 指定图表的配置项和数据
|
|
426
|
+
var option = {
|
|
427
|
+
title: {
|
|
428
|
+
text: titelText
|
|
429
|
+
},
|
|
430
|
+
tooltip: {},
|
|
431
|
+
legend: {
|
|
432
|
+
data: [legendData]
|
|
433
|
+
},
|
|
434
|
+
|
|
435
|
+
xAxis: {
|
|
436
|
+
type: 'category',
|
|
437
|
+
data: xData,
|
|
438
|
+
axisLabel: {
|
|
439
|
+
rotate: 90,
|
|
440
|
+
|
|
441
|
+
interval: 0,
|
|
442
|
+
|
|
443
|
+
// formatter: function (value) {
|
|
444
|
+
//
|
|
445
|
+
// console.info(value);
|
|
446
|
+
// var v = value.split("").join("\n");
|
|
447
|
+
// console.info(v);
|
|
448
|
+
// return v;
|
|
449
|
+
// },
|
|
450
|
+
|
|
451
|
+
// show: true, interval: 'auto', inside: false, rotate: 90, margin: 8, formatter: null, showMinLabel: null, showMaxLabel: null,
|
|
452
|
+
|
|
453
|
+
},
|
|
454
|
+
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
yAxis: {},
|
|
458
|
+
series: [{
|
|
459
|
+
name: legendData,
|
|
460
|
+
type: 'bar',
|
|
461
|
+
data: yData
|
|
462
|
+
}]
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// 使用刚指定的配置项和数据显示图表。
|
|
466
|
+
myChart.setOption(option);
|
|
467
|
+
console.info(elementId);
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
</script>
|
|
474
|
+
</body>
|
|
475
|
+
</html>
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<!-- 引入 Bootstrap CSS -->
|
|
8
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
9
|
+
<!-- 引入 jQuery -->
|
|
10
|
+
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
|
|
11
|
+
<!-- 引入 Bootstrap JS -->
|
|
12
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
13
|
+
<title>Left Navbar with Dynamic Content</title>
|
|
14
|
+
<style>
|
|
15
|
+
body {
|
|
16
|
+
overflow-x: hidden;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sidebar {
|
|
20
|
+
position: fixed;
|
|
21
|
+
top: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
width: 150px;
|
|
25
|
+
background-color: #296074;
|
|
26
|
+
padding-top: 20px;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.sidebar .nav-link {
|
|
31
|
+
color: white;
|
|
32
|
+
background-color: #296074; /* 导航栏链接默认灰色背景 */
|
|
33
|
+
margin-bottom: 5px;
|
|
34
|
+
border-radius: 5px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.sidebar .nav-link.active {
|
|
38
|
+
background-color: #0BBAF8; /* 激活状态蓝色背景 */
|
|
39
|
+
color: white;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.main-content {
|
|
43
|
+
margin-left: 150px;
|
|
44
|
+
/* padding: 20px; */
|
|
45
|
+
height: 100vh; /* 设置为视窗高度 */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.main-content iframe {
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: calc(100vh - 40px); /* 视窗高度减去padding */
|
|
51
|
+
padding: 20px;
|
|
52
|
+
border: none;
|
|
53
|
+
overflow: auto;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.sidebar .nav-item {
|
|
57
|
+
padding: 5px 10px;
|
|
58
|
+
position: relative;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.sidebar .nav-item:not(:last-child)::after {
|
|
62
|
+
content: '';
|
|
63
|
+
position: absolute;
|
|
64
|
+
bottom: -2px;
|
|
65
|
+
left: 10%;
|
|
66
|
+
width: 80%;
|
|
67
|
+
height: 2px;
|
|
68
|
+
background: linear-gradient(to right, transparent, #ffffff80, transparent);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.sidebar .nav-link {
|
|
72
|
+
padding: 8px 15px;
|
|
73
|
+
transition: all 0.3s ease;
|
|
74
|
+
font-weight: 500;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.sidebar .nav-link:hover {
|
|
78
|
+
transform: translateX(5px);
|
|
79
|
+
background-color: #1e4d61;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
</style>
|
|
83
|
+
</head>
|
|
84
|
+
|
|
85
|
+
<body>
|
|
86
|
+
<!-- 左侧导航栏 -->
|
|
87
|
+
<div class="sidebar">
|
|
88
|
+
<ul class="nav flex-column">
|
|
89
|
+
<li class="nav-item">
|
|
90
|
+
<a class="nav-link active" href="#" data-target="/tpl/fun_result_table.html">函数结果</a>
|
|
91
|
+
</li>
|
|
92
|
+
<li class="nav-item">
|
|
93
|
+
<a class="nav-link" href="#" data-target="/tpl/conusme_speed.html">消费速率</a>
|
|
94
|
+
</li>
|
|
95
|
+
<li class="nav-item">
|
|
96
|
+
<a class="nav-link" href="#" data-target="/tpl/running_consumer_by_ip.html">运行中消费者(by ip)</a>
|
|
97
|
+
</li>
|
|
98
|
+
<li class="nav-item">
|
|
99
|
+
<a class="nav-link" href="#" data-target="/tpl/running_consumer_by_queue_name.html">运行中消费者(by queue)</a>
|
|
100
|
+
</li>
|
|
101
|
+
<li class="nav-item">
|
|
102
|
+
<a class="nav-link" href="#" data-target="/tpl/about.html">说明</a>
|
|
103
|
+
</li>
|
|
104
|
+
</ul>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<!-- 右侧内容区域 -->
|
|
108
|
+
<div class="main-content" id="content000">
|
|
109
|
+
<!-- 初始加载 Home 页面内容 -->
|
|
110
|
+
<!-- 右侧内容区域 -->
|
|
111
|
+
<iframe id="content" frameborder="0">
|
|
112
|
+
<!-- 初始加载 Home 页面内容 -->
|
|
113
|
+
</iframe >
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
<script>
|
|
119
|
+
$(document).ready(function () {
|
|
120
|
+
// 初始加载 Home 页面
|
|
121
|
+
loadPage('/tpl/fun_result_table.html');
|
|
122
|
+
|
|
123
|
+
// 导航栏点击事件
|
|
124
|
+
$('.sidebar .nav-link').click(function (e) {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
// 移除所有导航项的 active 类
|
|
127
|
+
$('.sidebar .nav-link').removeClass('active');
|
|
128
|
+
// 为当前点击的导航项添加 active 类
|
|
129
|
+
$(this).addClass('active');
|
|
130
|
+
// 获取要加载的页面文件名
|
|
131
|
+
const targetPage = $(this).data('target');
|
|
132
|
+
// 加载页面内容
|
|
133
|
+
loadPage(targetPage);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// 加载页面内容的函数
|
|
137
|
+
function loadPage(page) {
|
|
138
|
+
$.ajax({
|
|
139
|
+
url: page,
|
|
140
|
+
method: 'GET',
|
|
141
|
+
success: function (data) {
|
|
142
|
+
$('#content').attr('src', page);
|
|
143
|
+
},
|
|
144
|
+
error: function () {
|
|
145
|
+
$('#content').html('<p>Error loading page.</p>');
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
</script>
|
|
151
|
+
</body>
|
|
152
|
+
|
|
153
|
+
</html>
|